Produced by Araxis Merge on 4/2/2019 1:06:53 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | C:\AraxisMergeCompare\Pri_un\ARS_Backend\ars_app\src\main\java\gov\va\med\ars\configuration\hibernate | EreposPersistenceConfig.java | Wed Mar 27 19:22:44 2019 UTC |
2 | C:\AraxisMergeCompare\Pri_re\ARS_Backend\ars_app\src\main\java\gov\va\med\ars\configuration\hibernate | EreposPersistenceConfig.java | Thu Mar 28 17:50:38 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 244 |
Changed | 1 | 2 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | /** | |
2 | * | |
3 | */ | |
4 | package go v.va.med.a rs.configu ration.hib ernate; | |
5 | ||
6 | import jav a.util.Has hMap; | |
7 | ||
8 | import jav ax.persist ence.Entit yManagerFa ctory; | |
9 | import jav ax.sql.Dat aSource; | |
10 | ||
11 | import org .apache.co mmons.lang .StringUti ls; | |
12 | import org .springfra mework.bea ns.factory .annotatio n.Autowire d; | |
13 | import org .springfra mework.bea ns.factory .annotatio n.Value; | |
14 | import org .springfra mework.con text.annot ation.Bean ; | |
15 | import org .springfra mework.con text.annot ation.Conf iguration; | |
16 | import org .springfra mework.cor e.env.Envi ronment; | |
17 | import org .springfra mework.dat a.jpa.repo sitory.con fig.Enable JpaReposit ories; | |
18 | import org .springfra mework.jdb c.datasour ce.DriverM anagerData Source; | |
19 | import org .springfra mework.orm .hibernate 5.Hibernat eException Translator ; | |
20 | import org .springfra mework.orm .jpa.JpaTr ansactionM anager; | |
21 | import org .springfra mework.orm .jpa.Local ContainerE ntityManag erFactoryB ean; | |
22 | import org .springfra mework.orm .jpa.vendo r.Hibernat eJpaVendor Adapter; | |
23 | import org .springfra mework.tra nsaction.P latformTra nsactionMa nager; | |
24 | import org .springfra mework.tra nsaction.a nnotation. EnableTran sactionMan agement; | |
25 | ||
26 | /** | |
27 | * @author
|
|
28 | * | |
29 | */ | |
30 | @Configura tion | |
31 | @EnableTra nsactionMa nagement | |
32 | @EnableJpa Repositori es(basePac kages = "g ov.va.med. ars.dao.er epos", ent ityManager FactoryRef = "eRepos EntityMana ger", tran sactionMan agerRef = "eReposTra nsactionMa nager") | |
33 | public cla ss EreposP ersistence Config { | |
34 | ||
35 | @A utowired | |
36 | Da taSource a rsDataSour ce; | |
37 | ||
38 | @A utowired | |
39 | pr ivate Envi ronment en v; | |
40 | ||
41 | @V alue("$(in it-db:fals e)") | |
42 | pr ivate Stri ng initDat abase; | |
43 | ||
44 | @B ean(name = "eReposEn tityManage r") | |
45 | pu blic Local ContainerE ntityManag erFactoryB ean eRepos EntityMana ger() { | |
46 | fina l LocalCon tainerEnti tyManagerF actoryBean em = new LocalConta inerEntity ManagerFac toryBean() ; | |
47 | em.s etDataSour ce(eReposD ataSource( )); | |
48 | em.s etPackages ToScan( "g ov.va.med. domain.ere posModel" ); | |
49 | ||
50 | fina l Hibernat eJpaVendor Adapter ve ndorAdapte r = new Hi bernateJpa VendorAdap ter(); | |
51 | em.s etJpaVendo rAdapter(v endorAdapt er); | |
52 | fina l HashMap< String, Ob ject> prop erties = n ew HashMap <String, O bject>(); | |
53 | prop erties.put ("hibernat e.hbm2ddl. auto", env .getProper ty("hibern ate.hbm2dd l.auto")); | |
54 | prop erties.put ("hibernat e.dialect" , env.getP roperty("h ibernate.d ialect")); | |
55 | em.s etJpaPrope rtyMap(pro perties); | |
56 | ||
57 | retu rn em; | |
58 | } | |
59 | ||
60 | @B ean(name = "ereposDa taSource") | |
61 | pu blic DataS ource eRep osDataSour ce() { | |
62 | ||
63 | Stri ng ereposU rl = env.g etProperty ("jdbc.ere pos.url"); | |
64 | Stri ng arsUrl = env.getP roperty("j dbc.ars.ur l"); | |
65 | Stri ng ereposU sername = env.getPro perty("jdb c.erepos.u sername"); | |
66 | Stri ng arsUser name = env .getProper ty("jdbc.a rs.usernam e"); | |
67 | ||
68 | ||
69 | if ( StringUtil s.isBlank( ereposUrl) ) { | |
70 | erepos Url = arsU rl; | |
71 | } | |
72 | if ( StringUtil s.isBlank( ereposUser name)) { | |
73 | erepos Username = arsUserna me; | |
74 | } | |
75 | /* | |
76 | * a rsUrl = | arsUserna me = | Re sult | |
77 | * e reposUrl | ereposUse rname | | |
78 | * - ---------- ---------- ---------- ---- | |
79 | * T rue | True | ar sDatasourc e | |
80 | * T rue | False | er eposDataso urce | |
81 | * F alse | True | er eposDataso urce | |
82 | * F alse | False | er eposDataso urce | |
83 | * | |
84 | */ | |
85 | ||
86 | if ( arsUrl.equ alsIgnoreC ase(erepos Url) && ar sUsername. equalsIgno reCase(ere posUsernam e)) { | |
87 | ||
88 | return arsDataSo urce; | |
89 | ||
90 | } el se { | |
91 | ||
92 | final DriverMana gerDataSou rce dataSo urce = new DriverMan agerDataSo urce(); | |
93 | ||
94 | dataSo urce.setDr iverClassN ame(env.ge tProperty( "jdbc.ars. driverClas sName")); | |
95 | dataSo urce.setUr l(ereposUr l); | |
96 | dataSo urce.setUs ername(ere posUsernam e); | |
97 | if (St ringUtils. isNotBlank (env.getPr operty("jd bc.erepos. password") )) { | |
98 | ||
99 | dataSour ce.setPass word(env.g etProperty ("jdbc.ere pos.passwo rd")); | |
100 | ||
101 | } else { | |
102 | ||
103 | dataSour ce.setPass word(env.g etProperty ("jdbc.ars .password" )); | |
104 | ||
105 | } | |
106 | return dataSourc e; | |
107 | ||
108 | } | |
109 | } | |
110 | ||
111 | @B ean | |
112 | pu blic Hiber nateExcept ionTransla tor hibern ateExcepti onTranslat or() { | |
113 | retu rn new Hib ernateExce ptionTrans lator(); | |
114 | } | |
115 | ||
116 | @B ean(name = "eReposTr ansactionM anager") | |
117 | pu blic Platf ormTransac tionManage r eReposTr ansactionM anager() { | |
118 | Enti tyManagerF actory fac tory = eRe posEntityM anager().g etObject() ; | |
119 | ||
120 | retu rn new Jpa Transactio nManager(f actory); | |
121 | } | |
122 | ||
123 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.