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 | EWVPersistenceConfig.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 | EWVPersistenceConfig.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 | ||
31 | @Configura tion | |
32 | @EnableTra nsactionMa nagement | |
33 | @EnableJpa Repositori es(basePac kages = "g ov.va.med. ars.dao.ew v", entity ManagerFac toryRef = "ewvEntity Manager", transactio nManagerRe f = "ewvTr ansactionM anager") | |
34 | public cla ss EWVPers istenceCon fig { | |
35 | ||
36 | @A utowired | |
37 | Da taSource a rsDataSour ce; | |
38 | ||
39 | @A utowired | |
40 | pr ivate Envi ronment en v; | |
41 | ||
42 | @V alue("$(in it-db:fals e)") | |
43 | pr ivate Stri ng initDat abase; | |
44 | ||
45 | @B ean(name = "ewvEntit yManager") | |
46 | pu blic Local ContainerE ntityManag erFactoryB ean ewvEnt ityManager () { | |
47 | fina l LocalCon tainerEnti tyManagerF actoryBean em = new LocalConta inerEntity ManagerFac toryBean() ; | |
48 | em.s etDataSour ce(ewvData Source()); | |
49 | em.s etPackages ToScan( "g ov.va.med. domain.ewv " ); | |
50 | ||
51 | fina l Hibernat eJpaVendor Adapter ve ndorAdapte r = new Hi bernateJpa VendorAdap ter(); | |
52 | em.s etJpaVendo rAdapter(v endorAdapt er); | |
53 | fina l HashMap< String, Ob ject> prop erties = n ew HashMap <String, O bject>(); | |
54 | prop erties.put ("hibernat e.hbm2ddl. auto", env .getProper ty("hibern ate.hbm2dd l.auto")); | |
55 | prop erties.put ("hibernat e.dialect" , env.getP roperty("h ibernate.d ialect")); | |
56 | em.s etJpaPrope rtyMap(pro perties); | |
57 | ||
58 | retu rn em; | |
59 | } | |
60 | ||
61 | @B ean(name = "ewvDataS ource") | |
62 | pu blic DataS ource ewvD ataSource( ) { | |
63 | ||
64 | Stri ng ewvUrl = env.getP roperty("j dbc.ewv.ur l"); | |
65 | Stri ng arsUrl = env.getP roperty("j dbc.ars.ur l"); | |
66 | Stri ng ewvUser name = env .getProper ty("jdbc.e wv.usernam e"); | |
67 | Stri ng arsUser name = env .getProper ty("jdbc.a rs.usernam e"); | |
68 | ||
69 | if ( StringUtil s.isBlank( ewvUrl)) { | |
70 | ewvUrl = arsUrl; | |
71 | } | |
72 | if ( StringUtil s.isBlank( ewvUsernam e)) { | |
73 | ewvUse rname = ar sUsername; | |
74 | } | |
75 | /* | |
76 | * a rsUrl = | arsUserna me = | Re sult | |
77 | * e wvUrl | ewvUserna me | | |
78 | * - ---------- ---------- ---------- ---- | |
79 | * T rue | True | ar sDatasourc e | |
80 | * T rue | False | ew vDatasourc e | |
81 | * F alse | True | ew vDatasourc e | |
82 | * F alse | False | ew vDatasourc e | |
83 | * | |
84 | */ | |
85 | if ( arsUrl.equ alsIgnoreC ase(ewvUrl ) && arsUs ername.equ alsIgnoreC ase(ewvUse rname)) { | |
86 | ||
87 | return arsDataSo urce; | |
88 | ||
89 | } el se { | |
90 | ||
91 | final DriverMana gerDataSou rce dataSo urce = new DriverMan agerDataSo urce(); | |
92 | ||
93 | dataSo urce.setDr iverClassN ame(env.ge tProperty( "jdbc.ars. driverClas sName")); | |
94 | dataSo urce.setUr l(ewvUrl); | |
95 | dataSo urce.setUs ername(ewv Username); | |
96 | if (St ringUtils. isNotBlank (env.getPr operty("jd bc.ewv.pas sword"))) { | |
97 | ||
98 | dataSour ce.setPass word(env.g etProperty ("jdbc.ewv .password" )); | |
99 | ||
100 | } else { | |
101 | ||
102 | dataSour ce.setPass word(env.g etProperty ("jdbc.ars .password" )); | |
103 | ||
104 | } | |
105 | return dataSourc e; | |
106 | ||
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 = "ewvTrans actionMana ger") | |
117 | pu blic Platf ormTransac tionManage r ewvTrans actionMana ger() { | |
118 | Enti tyManagerF actory fac tory = ewv EntityMana ger().getO bject(); | |
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.