Produced by Araxis Merge on 10/5/2018 9:05:31 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 | MHEDP3_VAOS_VATS_SM_Sept2018.zip\SM 2.4.0\scheduling-manager-resources-2.4.0.zip\SchedulingManagerMDWSLib\src\main\java\com\agilex\healthcare\schedulingmanager\mdws\connection | QueryConnection.java | Thu Jul 19 20:06:36 2018 UTC |
| 2 | MHEDP3_VAOS_VATS_SM_Sept2018.zip\SM 2.4.0\scheduling-manager-resources-2.4.0.zip\SchedulingManagerMDWSLib\src\main\java\com\agilex\healthcare\schedulingmanager\mdws\connection | QueryConnection.java | Fri Oct 5 16:53:37 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 392 |
| 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 jav a.io.Seria lizable; | |
| 5 | import jav a.net.URL; | |
| 6 | import jav a.util.Dat e; | |
| 7 | import jav a.util.UUI D; | |
| 8 | ||
| 9 | import jav ax.xml.nam espace.QNa me; | |
| 10 | import jav ax.xml.ws. BindingPro vider; | |
| 11 | ||
| 12 | import com .agilex.he althcare.s chedulingm anager.mdw s.generate dwsdl.quer yservice.Q uerySvcSoa p; | |
| 13 | import com .agilex.he althcare.s chedulingm anager.uti l.UriUtils ; | |
| 14 | import org .apache.cx f.endpoint .Client; | |
| 15 | import org .apache.cx f.frontend .ClientPro xy; | |
| 16 | import org .apache.cx f.transpor t.http.HTT PConduit; | |
| 17 | import org .apache.cx f.transpor ts.http.co nfiguratio n.HTTPClie ntPolicy; | |
| 18 | import org .springfra mework.sec urity.core .context.S ecurityCon text; | |
| 19 | import org .springfra mework.sec urity.core .context.S ecurityCon textHolder ; | |
| 20 | ||
| 21 | import com .agilex.he althcare.m obilehealt hplatform. domain.Mhp User; | |
| 22 | import com .agilex.he althcare.m obilehealt hplatform. security.A ppUser; | |
| 23 | import com .agilex.he althcare.s chedulingm anager.mdw s.MdwsResp onseExcept ion; | |
| 24 | import com .agilex.he althcare.s chedulingm anager.mdw s.generate dwsdl.quer yservice.Q uerySvc; | |
| 25 | import com .agilex.he althcare.s chedulingm anager.mdw s.generate dwsdl.quer yservice.D ataSourceA rray; | |
| 26 | ||
| 27 | public cla ss QueryCo nnection i mplements Serializab le { | |
| 28 | // private st atic final org.apach e.commons. logging.Lo g logger = org.apach e.commons. logging.Lo gFactory.g etLog(Sche dulingConn ection.cla ss); | |
| 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 QuerySvc Soap port; | |
| 34 | privat e Date ref reshedTime stamp; | |
| 35 | //priv ate VistaS ite site; | |
| 36 | ||
| 37 | public QueryConn ection() { | |
| 38 | th is.id = UU ID.randomU UID().toSt ring(); | |
| 39 | } | |
| 40 | ||
| 41 | public QueryConn ection(Que rySvcSoap port) { | |
| 42 | th is.id = UU ID.randomU UID().toSt ring(); | |
| 43 | th is.port = port; | |
| 44 | } | |
| 45 | ||
| 46 | ||
| 47 | public QueryConn ection(Mdw sConfigura tion confi guration, String sit eCode, boo lean authe nticateFla g) { | |
| 48 | th is.id = UU ID.randomU UID().toSt ring(); | |
| 49 | th is.configu ration = c onfigurati on; | |
| 50 | th is.port = establishC onnection( configurat ion, siteC ode, authe nticateFla g); | |
| 51 | th is.refresh edTimestam p = new Da te(); | |
| 52 | } | |
| 53 | ||
| 54 | privat e QuerySvc Soap estab lishConnec tion(MdwsC onfigurati on configu ration, St ring siteC ode, boole an authent icated) { | |
| 55 | St ring baseU rl = ""; | |
| 56 | Mh pUser mhpU ser = null ; | |
| 57 | ||
| 58 | if (authenti cated) { | |
| 59 | mhpUser = getMhpUs er(); | |
| 60 | baseUrl = mhpUser. getMdwsInf o().getBas eUrl(); | |
| 61 | } else { | |
| 62 | baseUrl = configur ation.getE ndPointBas eUrl(); | |
| 63 | } | |
| 64 | ||
| 65 | co nfiguratio n.setEndPo intBaseUrl (baseUrl); | |
| 66 | ||
| 67 | St ring url = UriUtils. addPath(ba seUrl, con figuration .getEndPoi ntUrl()).t oString(); | |
| 68 | ||
| 69 | UR L wsdlLoca tion = con structWsdl Url(url); | |
| 70 | Qu erySvc que rySvc = nu ll; | |
| 71 | tr y { | |
| 72 | querySvc = new Query Svc(wsdlLo cation, ne w QName("h ttp:// DNS /QuerySvc" , "QuerySv c")); | |
| 73 | } catch (Thr owable t) { | |
| 74 | throw new MdwsRe sponseExce ption(Mdws ResponseEx ception.Us erMessages .CONNECTIO N_ERROR, t .getMessag e()); | |
| 75 | } | |
| 76 | Qu erySvcSoap port; | |
| 77 | try { | |
| 78 | port = querySvc. getQuerySv cSoap(); | |
| 79 | } ca tch (Throw able t) { | |
| 80 | throw ne w MdwsResp onseExcept ion(MdwsRe sponseExce ption.User Messages.C ONNECTION_ ERROR, t.g etMessage( )); | |
| 81 | } | |
| 82 | ||
| 83 | (( BindingPro vider)port ).getReque stContext( ).put(Bind ingProvide r.SESSION_ MAINTAIN_P ROPERTY, t rue); | |
| 84 | (( BindingPro vider)port ).getReque stContext( ).put(Bind ingProvide r.ENDPOINT _ADDRESS_P ROPERTY, u rl); | |
| 85 | (( BindingPro vider)port ).getReque stContext( ).put("jav ax.xml.ws. client.con nectionTim eout", con figuration .getWsConn ectTimeout ()); | |
| 86 | (( BindingPro vider)port ).getReque stContext( ).put("jav ax.xml.ws. client.rec eiveTimeou t", config uration.ge tWsRequest Timeout()) ; | |
| 87 | ||
| 88 | // if(authent icated) { | |
| 89 | // this.s ite = conf iguration. getVistaSi te(siteCod e); | |
| 90 | // valida teVistaAcc ount(this. site, site Code); | |
| 91 | // } | |
| 92 | ||
| 93 | if (authentic ated) { | |
| 94 | setSes sionOnPort (port, mhp User.getMd wsInfo().g etSessionI d()); | |
| 95 | } | |
| 96 | el se { | |
| 97 | DataSour ceArray ds a = null; | |
| 98 | try { | |
| 99 | dsa = port.con nect(siteC ode); | |
| 100 | } catch (Throwable t) { | |
| 101 | thro w new Mdws ResponseEx ception(Md wsResponse Exception. UserMessag es.CONNECT ION_ERROR, t.getMess age()); | |
| 102 | } | |
| 103 | if (dsa. getFault() != null) | |
| 104 | thro w new Mdws ResponseEx ception(Md wsResponse Exception. UserMessag es.CONNECT ION_ERROR, dsa.getFa ult()); | |
| 105 | ||
| 106 | // if(aut henticated ) { | |
| 107 | // Us erTO resul t = port.l ogin(site. getAccessC ode(), sit e.getVerif yCode(), " "); | |
| 108 | // if (result.g etFault() != null) { | |
| 109 | // try {por t.disconne ct();} cat ch (Throwa ble t) { l ogger.info ("Problem trying to dispose co nnection: " + t.getM essage()); } | |
| 110 | // throw ne w MdwsResp onseExcept ion(MdwsRe sponseExce ption.User Messages.I NVALID_ACC ESS_VERIFY , result.g etFault()) ; | |
| 111 | // } | |
| 112 | // } | |
| 113 | } | |
| 114 | ||
| 115 | re turn port; | |
| 116 | } | |
| 117 | ||
| 118 | pr ivate Mhp User getMh pUser(){ | |
| 119 | Se curityCont ext ctx = SecurityCo ntextHolde r.getConte xt(); | |
| 120 | ||
| 121 | Ap pUser appU ser = (App User) ctx. getAuthent ication(). getPrincip al(); | |
| 122 | Mh pUser mhpU ser = appU ser.getMhp User(); | |
| 123 | mhpU ser.setUse rName(appU ser.getUse rname()); | |
| 124 | ||
| 125 | re turn mhpUs er; | |
| 126 | } | |
| 127 | ||
| 128 | pr ivate void setSessio nOnPort(Qu erySvcSoap port, Str ing sessio nId) { | |
| 129 | Clie nt client = ClientPr oxy.getCli ent(port); | |
| 130 | ||
| 131 | HTTP ClientPoli cy policy = new HTTP ClientPoli cy(); | |
| 132 | HTTP Conduit ht tpConduit = (HTTPCon duit)clien t.getCondu it(); | |
| 133 | ||
| 134 | poli cy.setCook ie("ASP.NE T_SessionI d=" + sess ionId); | |
| 135 | po licy.setAl lowChunkin g(false); | |
| 136 | ||
| 137 | http Conduit.se tClient(po licy); | |
| 138 | } | |
| 139 | ||
| 140 | ||
| 141 | privat e URL cons tructWsdlU rl(String endPointUr l){ | |
| 142 | St ring wsdlL ocation = endPointUr l + "?WSDL "; | |
| 143 | UR L wsdlLoca tionURL = null; | |
| 144 | tr y { | |
| 145 | wsdlLoca tionURL = new URL(ws dlLocation ); | |
| 146 | } catch (Exc eption e) { | |
| 147 | thro w new Mdws ResponseEx ception(Md wsResponse Exception. UserMessag es.INVALID _WSDL, e.g etMessage( )); | |
| 148 | } | |
| 149 | ||
| 150 | re turn wsdlL ocationURL ; | |
| 151 | } | |
| 152 | ||
| 153 | public Date getR efreshedTi mestamp() { | |
| 154 | re turn refre shedTimest amp; | |
| 155 | } | |
| 156 | ||
| 157 | public void refr eshTimesta mp() { | |
| 158 | th is.refresh edTimestam p = new Da te(); | |
| 159 | } | |
| 160 | ||
| 161 | public String ge tId() { | |
| 162 | re turn id; | |
| 163 | } | |
| 164 | ||
| 165 | public QuerySvcS oap getPor t() { | |
| 166 | re turn port; | |
| 167 | } | |
| 168 | ||
| 169 | public MdwsConfi guration g etConfigur ation() { | |
| 170 | re turn this. configurat ion; | |
| 171 | } | |
| 172 | ||
| 173 | @Overr ide | |
| 174 | public int hashC ode() { | |
| 175 | fi nal int pr ime = 31; | |
| 176 | in t result = 1; | |
| 177 | re sult = pri me * resul t + ((id = = null) ? 0 : id.has hCode()); | |
| 178 | re turn resul t; | |
| 179 | } | |
| 180 | ||
| 181 | @Overr ide | |
| 182 | public boolean e quals(Obje ct obj) { | |
| 183 | if (this == obj) | |
| 184 | return t rue; | |
| 185 | if (obj == n ull) | |
| 186 | return f alse; | |
| 187 | if (getClass () != obj. getClass() ) | |
| 188 | return f alse; | |
| 189 | Qu eryConnect ion other = (QueryCo nnection) obj; | |
| 190 | if (id == nu ll) { | |
| 191 | if (othe r.id != nu ll) | |
| 192 | retu rn false; | |
| 193 | } else if (! id.equals( other.id)) | |
| 194 | return f alse; | |
| 195 | re turn true; | |
| 196 | } | |
| 197 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.