Produced by Araxis Merge on 5/10/2018 8:39:44 AM 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 | MHED_APPS_CIF.zip\SM v2.2.5\scheduling-manager-resources-2.2.5@e7f57981138.zip\SchedulingManagerMDWSLib\src\main\java\com\agilex\healthcare\schedulingmanager\mdws\connection | SchedulingConnection.java | Sat Apr 7 11:28:50 2018 UTC |
2 | MHED_APPS_CIF.zip\SM v2.2.5\scheduling-manager-resources-2.2.5@e7f57981138.zip\SchedulingManagerMDWSLib\src\main\java\com\agilex\healthcare\schedulingmanager\mdws\connection | SchedulingConnection.java | Thu May 3 12:52:22 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 364 |
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 | package co m.agilex.h ealthcare. scheduling manager.md ws.connect ion; | |
2 | ||
3 | ||
4 | import com .agilex.he althcare.m obilehealt hplatform. domain.Mhp User; | |
5 | import com .agilex.he althcare.m obilehealt hplatform. security.A ppUser; | |
6 | import com .agilex.he althcare.s chedulingm anager.mdw s.MdwsResp onseExcept ion; | |
7 | import com .agilex.he althcare.s chedulingm anager.mdw s.generate dwsdl.sche dulingserv ice.DataSo urceArray; | |
8 | import com .agilex.he althcare.s chedulingm anager.mdw s.generate dwsdl.sche dulingserv ice.Schedu lingSvc; | |
9 | import com .agilex.he althcare.s chedulingm anager.mdw s.generate dwsdl.sche dulingserv ice.Schedu lingSvcSoa p; | |
10 | ||
11 | import com .agilex.he althcare.s chedulingm anager.uti l.UriUtils ; | |
12 | import org .apache.cx f.endpoint .Client; | |
13 | import org .apache.cx f.frontend .ClientPro xy; | |
14 | import org .apache.cx f.transpor t.http.HTT PConduit; | |
15 | import org .apache.cx f.transpor ts.http.co nfiguratio n.HTTPClie ntPolicy; | |
16 | import org .springfra mework.sec urity.core .context.S ecurityCon text; | |
17 | import org .springfra mework.sec urity.core .context.S ecurityCon textHolder ; | |
18 | ||
19 | import jav ax.xml.nam espace.QNa me; | |
20 | import jav ax.xml.ws. BindingPro vider; | |
21 | ||
22 | import jav a.io.Seria lizable; | |
23 | import jav a.net.URL; | |
24 | import jav a.util.Dat e; | |
25 | import jav a.util.UUI D; | |
26 | ||
27 | public cla ss Schedul ingConnect ion implem ents Seria lizable { | |
28 | //priv ate static final org .apache.co mmons.logg ing.Log lo gger = org .apache.co mmons.logg ing.LogFac tory.getLo g(Scheduli ngConnecti on.class); | |
29 | privat e static f inal long serialVers ionUID = - 9785071598 75320587L; | |
30 | ||
31 | privat e String i d; | |
32 | privat e MdwsConf iguration configurat ion; | |
33 | privat e Scheduli ngSvcSoap port; | |
34 | privat e Date ref reshedTime stamp; | |
35 | //priv ate VistaS ite site; | |
36 | ||
37 | public Schedulin gConnectio n() { | |
38 | th is.id = UU ID.randomU UID().toSt ring(); | |
39 | } | |
40 | ||
41 | public Schedulin gConnectio n(Scheduli ngSvcSoap port) { | |
42 | th is.id = UU ID.randomU UID().toSt ring(); | |
43 | th is.port = port; | |
44 | } | |
45 | ||
46 | ||
47 | /** | |
48 | * Cal ls the MDW S service Scheduling Svc.connec t if the a uthenticat edFlag is false - it will usua lly be tru e | |
49 | * sin ce most ap ps will lo gin to a s ite with A uthorizati onServices and that connection is used f rom that p oint on. | |
50 | */ | |
51 | public Schedulin gConnectio n(MdwsConf iguration configurat ion, Strin g siteCode , boolean authentica teFlag) { | |
52 | th is.id = UU ID.randomU UID().toSt ring(); | |
53 | th is.configu ration = c onfigurati on; | |
54 | th is.port = establishC onnection( configurat ion, siteC ode, authe nticateFla g); | |
55 | th is.refresh edTimestam p = new Da te(); | |
56 | } | |
57 | ||
58 | privat e Scheduli ngSvcSoap establishC onnection( MdwsConfig uration co nfiguratio n, String siteCode, boolean au thenticate d) { | |
59 | St ring baseU rl = ""; | |
60 | Mh pUser mhpU ser = null ; | |
61 | ||
62 | if (authenti cated) { | |
63 | mhpUser = getMhpUs er(); | |
64 | baseUrl = mhpUser. getMdwsInf o().getBas eUrl(); | |
65 | } else { | |
66 | baseUrl = configur ation.getE ndPointBas eUrl(); | |
67 | } | |
68 | ||
69 | co nfiguratio n.setEndPo intBaseUrl (baseUrl); | |
70 | ||
71 | St ring url = UriUtils. addPath(ba seUrl, con figuration .getEndPoi ntUrl()).t oString(); | |
72 | ||
73 | UR L wsdlLoca tion = con structWsdl Url(url); | |
74 | Sc hedulingSv c scheduli ngSvc = nu ll; | |
75 | tr y { | |
76 | scheduling Svc = new Scheduling Svc(wsdlLo cation, ne w QName("h ttp:// DNS /Schedulin gSvc", "Sc hedulingSv c")); | |
77 | } catch (Thr owable t) { | |
78 | throw ne w MdwsResp onseExcept ion(MdwsRe sponseExce ption.User Messages.C ONNECTION_ ERROR, t.g etMessage( )); | |
79 | } | |
80 | Sc hedulingSv cSoap port = schedul ingSvc.get Scheduling SvcSoap(); | |
81 | ||
82 | (( BindingPro vider) por t).getRequ estContext ().put(Bin dingProvid er.SESSION _MAINTAIN_ PROPERTY, true); | |
83 | (( BindingPro vider) por t).getRequ estContext ().put(Bin dingProvid er.ENDPOIN T_ADDRESS_ PROPERTY, url); | |
84 | (( BindingPro vider) por t).getRequ estContext ().put("ja vax.xml.ws .client.co nnectionTi meout", co nfiguratio n.getWsCon nectTimeou t()); | |
85 | (( BindingPro vider) por t).getRequ estContext ().put("ja vax.xml.ws .client.re ceiveTimeo ut", confi guration.g etWsReques tTimeout() ); | |
86 | ||
87 | if (authenti cated) { | |
88 | setSessi onOnPort(p ort, mhpUs er.getMdws Info().get SessionId( )); | |
89 | } else { | |
90 | DataSour ceArray ds a = null; | |
91 | try { | |
92 | dsa = port.con nect(siteC ode); | |
93 | } catch (Throwable t) { | |
94 | thro w new Mdws ResponseEx ception(Md wsResponse Exception. UserMessag es.CONNECT ION_ERROR, t.getMess age()); | |
95 | } | |
96 | if (dsa. getFault() != null) | |
97 | thro w new Mdws ResponseEx ception(Md wsResponse Exception. UserMessag es.CONNECT ION_ERROR, dsa.getFa ult()); | |
98 | ||
99 | } | |
100 | ||
101 | re turn port; | |
102 | } | |
103 | ||
104 | privat e MhpUser getMhpUser () { | |
105 | Se curityCont ext ctx = SecurityCo ntextHolde r.getConte xt(); | |
106 | ||
107 | Ap pUser appU ser = (App User) ctx. getAuthent ication(). getPrincip al(); | |
108 | Mh pUser mhpU ser = appU ser.getMhp User(); | |
109 | mh pUser.setU serName(ap pUser.getU sername()) ; | |
110 | ||
111 | re turn mhpUs er; | |
112 | } | |
113 | ||
114 | privat e void set SessionOnP ort(Schedu lingSvcSoa p port, St ring sessi onId) { | |
115 | Cl ient clien t = Client Proxy.getC lient(port ); | |
116 | ||
117 | HT TPClientPo licy polic y = new HT TPClientPo licy(); | |
118 | HT TPConduit httpCondui t = (HTTPC onduit) cl ient.getCo nduit(); | |
119 | ||
120 | po licy.setCo okie("ASP. NET_Sessio nId=" + se ssionId); | |
121 | po licy.setAl lowChunkin g(false); | |
122 | ||
123 | ht tpConduit. setClient( policy); | |
124 | } | |
125 | ||
126 | ||
127 | privat e URL cons tructWsdlU rl(String endPointUr l) { | |
128 | St ring wsdlL ocation = endPointUr l + "?WSDL "; | |
129 | UR L wsdlLoca tionURL = null; | |
130 | tr y { | |
131 | wsdlLoca tionURL = new URL(ws dlLocation ); | |
132 | } catch (Exc eption e) { | |
133 | throw ne w MdwsResp onseExcept ion(MdwsRe sponseExce ption.User Messages.I NVALID_WSD L, e.getMe ssage()); | |
134 | } | |
135 | ||
136 | re turn wsdlL ocationURL ; | |
137 | } | |
138 | ||
139 | public Date getR efreshedTi mestamp() { | |
140 | re turn refre shedTimest amp; | |
141 | } | |
142 | ||
143 | public void refr eshTimesta mp() { | |
144 | th is.refresh edTimestam p = new Da te(); | |
145 | } | |
146 | ||
147 | public String ge tId() { | |
148 | re turn id; | |
149 | } | |
150 | ||
151 | public Schedulin gSvcSoap g etPort() { | |
152 | re turn port; | |
153 | } | |
154 | ||
155 | public MdwsConfi guration g etConfigur ation() { | |
156 | re turn this. configurat ion; | |
157 | } | |
158 | ||
159 | @Overr ide | |
160 | public int hashC ode() { | |
161 | fi nal int pr ime = 31; | |
162 | in t result = 1; | |
163 | re sult = pri me * resul t + ((id = = null) ? 0 : id.has hCode()); | |
164 | re turn resul t; | |
165 | } | |
166 | ||
167 | @Overr ide | |
168 | public boolean e quals(Obje ct obj) { | |
169 | if (this == obj) | |
170 | return t rue; | |
171 | if (obj == n ull) | |
172 | return f alse; | |
173 | if (getClass () != obj. getClass() ) | |
174 | return f alse; | |
175 | Sc hedulingCo nnection o ther = (Sc hedulingCo nnection) obj; | |
176 | if (id == nu ll) { | |
177 | if (othe r.id != nu ll) | |
178 | retu rn false; | |
179 | } else if (! id.equals( other.id)) | |
180 | return f alse; | |
181 | re turn true; | |
182 | } | |
183 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.