Produced by Araxis Merge on 6/9/2017 3:45:53 PM Eastern 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 | eHealth_Exch (eHealth Exchange Enhancements) Build 3 docs & code_May_2017.zip\eHXE_Build3_2017-05-04.zip\NHIN_adapter\AdapterLIB\src\main\java\gov\va\med\nhin\adapter\datamanager\adapters | ESRDataAdapter.java | Wed May 3 15:58:46 2017 UTC |
| 2 | eHealth_Exch (eHealth Exchange Enhancements) Build 3 docs & code_May_2017.zip\eHXE_Build3_2017-05-04.zip\NHIN_adapter\AdapterLIB\src\main\java\gov\va\med\nhin\adapter\datamanager\adapters | ESRDataAdapter.java | Thu Jun 1 21:51:36 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 432 |
| Changed | 2 | 4 |
| 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 go v.va.med.n hin.adapte r.datamana ger.adapte rs; | |
| 2 | ||
| 3 | import jav a.net.URL; | |
| 4 | import jav a.util.Arr ayList; | |
| 5 | import jav a.util.Lis t; | |
| 6 | import jav a.util.Pro perties; | |
| 7 | import jav a.util.Set ; | |
| 8 | ||
| 9 | import jav ax.xml.nam espace.QNa me; | |
| 10 | import jav ax.xml.soa p.SOAPElem ent; | |
| 11 | import jav ax.xml.soa p.SOAPEnve lope; | |
| 12 | import jav ax.xml.soa p.SOAPHead er; | |
| 13 | import jav ax.xml.ws. handler.Ha ndler; | |
| 14 | import jav ax.xml.ws. handler.Ha ndlerResol ver; | |
| 15 | import jav ax.xml.ws. handler.Me ssageConte xt; | |
| 16 | import jav ax.xml.ws. handler.Po rtInfo; | |
| 17 | import jav ax.xml.ws. handler.so ap.SOAPHan dler; | |
| 18 | import jav ax.xml.ws. handler.so ap.SOAPMes sageContex t; | |
| 19 | import jav ax.xml.ws. soap.SOAPF aultExcept ion; | |
| 20 | import jav ax.xml.soa p.SOAPExce ption; | |
| 21 | import org .w3c.dom.D OMExceptio n; | |
| 22 | ||
| 23 | import org .slf4j.Log ger; | |
| 24 | import org .slf4j.Log gerFactory ; | |
| 25 | ||
| 26 | import gov .va.med.es r.webservi ces.jaxws. schemas.De mographicI nfo; | |
| 27 | import gov .va.med.es r.webservi ces.jaxws. schemas.Ee Summary; | |
| 28 | import gov .va.med.es r.webservi ces.jaxws. schemas.Ee SummaryPor t; | |
| 29 | import gov .va.med.es r.webservi ces.jaxws. schemas.Ee SummaryPor tService; | |
| 30 | import gov .va.med.es r.webservi ces.jaxws. schemas.Ge tEESummary Request; | |
| 31 | import gov .va.med.es r.webservi ces.jaxws. schemas.Ge tEESummary Response; | |
| 32 | import gov .va.med.nh in.adapter .datamanag er.DataAda pter; | |
| 33 | import gov .va.med.nh in.adapter .datamanag er.DataQue ry; | |
| 34 | import gov .va.med.nh in.adapter .logging.L ogConstant s; | |
| 35 | import gov .va.med.nh in.adapter .utils.Nul lChecker; | |
| 36 | import gov .va.med.nh in.adapter .utils.Pro pertiesCol lectionFac tory; | |
| 37 | import gov .va.med.nh in.adapter .utils.soa p.handler. SOAPLoggin gHandler; | |
| 38 | import org .slf4j.MDC ; | |
| 39 | ||
| 40 | /** | |
| 41 | * | |
| 42 | * @author
|
|
| 43 | */ | |
| 44 | public cla ss ESRData Adapter im plements D ataAdapter <GetEESumm aryRespons e> | |
| 45 | { | |
| 46 | privat e static f inal Logge r logger = LoggerFac tory.getLo gger(ESRDa taAdapter. class); | |
| 47 | ||
| 48 | privat e class He aderHandle rResolver implements HandlerRe solver | |
| 49 | { | |
| 50 | pr ivate fina l String u sername; | |
| 51 | pr ivate fina l String p assword; | |
| 52 | ||
| 53 | pu blic Heade rHandlerRe solver(Str ing userna me, String password) | |
| 54 | { | |
| 55 | this.use rname = us ername; | |
| 56 | this.pas sword = pa ssword; | |
| 57 | } | |
| 58 | ||
| 59 | @O verride | |
| 60 | pu blic List< Handler> g etHandlerC hain(PortI nfo portIn fo) | |
| 61 | { | |
| 62 | List<Han dler> ret = new Arra yList<>(); | |
| 63 | ret.add( new Header Handler(us ername, pa ssword)); | |
| 64 | ret.add( new SOAPL oggingHand ler( Strin g.class.ca st( MDC.ge t( LogCons tants.CORR ELATION_MD CKEY ) ) ) ); | |
| 65 | return r et; | |
| 66 | } | |
| 67 | } | |
| 68 | ||
| 69 | privat e class He aderHandle r implemen ts SOAPHan dler<SOAPM essageCont ext> | |
| 70 | { | |
| 71 | pr ivate fina l String u n; | |
| 72 | pr ivate fina l String p w; | |
| 73 | ||
| 74 | pu blic Heade rHandler(S tring user name, Stri ng passwor d) | |
| 75 | { | |
| 76 | this.un = username ; | |
| 77 | this.pw = password ; | |
| 78 | } | |
| 79 | ||
| 80 | @O verride | |
| 81 | pu blic Set<Q Name> getH eaders() | |
| 82 | { | |
| 83 | return n ull; | |
| 84 | } | |
| 85 | ||
| 86 | @O verride | |
| 87 | pu blic void close(Mess ageContext context) | |
| 88 | { | |
| 89 | } | |
| 90 | ||
| 91 | @O verride | |
| 92 | pu blic boole an handleF ault(SOAPM essageCont ext contex t) | |
| 93 | { | |
| 94 | return t rue; | |
| 95 | } | |
| 96 | ||
| 97 | @O verride | |
| 98 | pu blic boole an handleM essage(SOA PMessageCo ntext smc) | |
| 99 | { | |
| 100 | Boolean outboundPr operty = ( Boolean) s mc.get(Mes sageContex t.MESSAGE_ OUTBOUND_P ROPERTY); | |
| 101 | ||
| 102 | if (outb oundProper ty) { | |
| 103 | try { | |
| 104 | SOAPEnvelo pe envelop e = smc.ge tMessage() .getSOAPPa rt().getEn velope(); | |
| 105 | SOAPHeader header = envelope.g etHeader() ; | |
| 106 | ||
| 107 | if (header == null) { | |
| 108 | header = envelop e.addHeade r(); | |
| 109 | } | |
| 110 | ||
| 111 | SOAPElemen t security = header. addChildEl ement("Sec urity", "w sse", "htt p://docs.o asis-open. org/wss/20 04/01/oasi s-200401-w ss-wssecur ity-secext -1.0.xsd") ; | |
| 112 | ||
| 113 | SOAPElemen t username Token = se curity.add ChildEleme nt("Userna meToken", "wsse"); | |
| 114 | usernameTo ken.addAtt ribute(new QName("xm lns:wsu"), "http://d ocs.oasis- open.org/w ss/2004/01 /oasis-200 401-wss-ws security-u tility-1.0 .xsd"); | |
| 115 | ||
| 116 | SOAPElemen t username = usernam eToken.add ChildEleme nt("Userna me", "wsse "); | |
| 117 | username.a ddTextNode (un); | |
| 118 | ||
| 119 | SOAPElemen t password = usernam eToken.add ChildEleme nt("Passwo rd", "wsse "); | |
| 120 | password.s etAttribut e("Type", "http://do cs.oasis-o pen.org/ws s/2004/01/ oasis-2004 01-wss-use rname-toke n-profile- 1.0#Passwo rdText"); | |
| 121 | password.a ddTextNode (pw); | |
| 122 | } | |
| 123 | // C CR 179231 -Exception handling | |
| 124 | catc h (SOAPExc eption | D OMExceptio n e) { | |
| 125 | // CCR 179 231 | |
| 126 | throw new DataAdapte rException ("Exceptio n occurred while try ing to pro cess SOAP message.", e); | |
| 127 | } | |
| 128 | } | |
| 129 | ||
| 130 | return t rue; | |
| 131 | } | |
| 132 | } | |
| 133 | ||
| 134 | privat e EeSummar yPortServi ce eeSumma ryService = null; | |
| 135 | ||
| 136 | @Overr ide | |
| 137 | public List<GetE ESummaryRe sponse> ge tData(Data Query data Query) | |
| 138 | { | |
| 139 | Ar rayList<Ge tEESummary Response> ret = new ArrayList< >(); | |
| 140 | St ring icn = (String) dataQuery. getParamet er("icn"); | |
| 141 | St ring conne ctionFilen ame = data Query.getP roperty("c onnectionF ilename"); | |
| 142 | St ring conne ction = da taQuery.ge tProperty( "connectio n"); | |
| 143 | ||
| 144 | Ge tEESummary Request ee SummaryReq uest = new GetEESumm aryRequest (); | |
| 145 | ee SummaryReq uest.setKe y(icn); | |
| 146 | ee SummaryReq uest.setKe yType("VPI D"); | |
| 147 | ee SummaryReq uest.setRe questName( "preferred Facility") ; | |
| 148 | ||
| 149 | Ge tEESummary Response e eSummaryRe sponse; | |
| 150 | tr y { | |
| 151 | Properti es propert iesCollect ion = Prop ertiesColl ectionFact ory.getPro pertiesCol lection(co nnectionFi lename); | |
| 152 | Properti es connect ionPropert ies = (Pro perties) p ropertiesC ollection. get(connec tion); | |
| 153 | String w sdlURL = c onnectionP roperties. getPropert y("wsdlURL "); | |
| 154 | String u sername = connection Properties .getProper ty("userna me"); | |
| 155 | String p assword = connection Properties .getProper ty("passwo rd"); | |
| 156 | ||
| 157 | eeSummar yResponse = getEESum maryPort(w sdlURL, us ername, pa ssword).ge tEESummary (eeSummary Request); | |
| 158 | if (eeSu mmaryRespo nse.getSum mary() == null || ee SummaryRes ponse.getS ummary().g etDemograp hics() == null || Nu llChecker. isNullOrEm pty(eeSumm aryRespons e.getSumma ry().getDe mographics ().getPref erredFacil ity())) { | |
| 159 | eeSu mmaryRespo nse = crea teDefaultR esponse("< UNKNOWN>", "<UNKNOWN >"); | |
| 160 | } | |
| 161 | } | |
| 162 | ca tch (SOAPF aultExcept ion sfe) { | |
| 163 | if (sfe. getMessage ().equals( "PERSON_NO T_FOUND")) { | |
| 164 | logg er.warn("E SR reports PERSON_NO T_FOUND"); | |
| 165 | eeSu mmaryRespo nse = crea teDefaultR esponse("< UNKNOWN>", "<UNKNOWN >"); | |
| 166 | } | |
| 167 | else { | |
| 168 | logg er.warn("E SR respond ed with an unexpetec ed error: ", sfe); | |
| 169 | eeSu mmaryRespo nse = crea teDefaultR esponse("< UNAVAILABL E>", "<UNA VAILABLE>" ); | |
| 170 | } | |
| 171 | } | |
| 172 | // CCR 17798 6- improve d log rela ted code | |
| 173 | ca tch (Excep tion e) { | |
| 174 | logger.e rror("Ther e was an e rror getti ng data fr om ESR. M essage = { }", e); | |
| 175 | eeSummar yResponse = createDe faultRespo nse("<UNAV AILABLE>", "<UNAVAIL ABLE>"); | |
| 176 | } | |
| 177 | ||
| 178 | re t.add(eeSu mmaryRespo nse); | |
| 179 | ||
| 180 | re turn ret; | |
| 181 | } | |
| 182 | ||
| 183 | privat e synchron ized EeSum maryPort g etEESummar yPort(Stri ng eeSumma ryServiceW SDL, Strin g username , String p assword) | |
| 184 | { | |
| 185 | if (eeSummar yService = = null) { | |
| 186 | try { | |
| 187 | eeSummaryS ervice = n ew EeSumma ryPortServ ice(new UR L(eeSummar yServiceWS DL), new Q Name("http :// URL . DNS ", "eeSumm aryPortSer vice")); | |
| 188 | ||
| 189 | if ( !NullCheck er.isNullO rEmpty(use rname) && !NullCheck er.isNullO rEmpty(pas sword)) { | |
| 190 | eeSummaryS ervice.set HandlerRes olver(new HeaderHand lerResolve r(username , password )); | |
| 191 | } | |
| 192 | } | |
| 193 | catch (T hrowable t ) { | |
| 194 | thro w new Runt imeExcepti on("Error getting EE SummaryPor t.", t); | |
| 195 | } | |
| 196 | } | |
| 197 | re turn eeSum maryServic e.getEeSum maryPortSo ap11(); | |
| 198 | } | |
| 199 | ||
| 200 | privat e GetEESum maryRespon se createD efaultResp onse(Strin g facility Number, St ring facil ityName) | |
| 201 | { | |
| 202 | Ge tEESummary Response e eSummaryRe sponse = n ew GetEESu mmaryRespo nse(); | |
| 203 | ||
| 204 | Ee Summary ee Summary = new EeSumm ary(); | |
| 205 | ee SummaryRes ponse.setS ummary(eeS ummary); | |
| 206 | ||
| 207 | De mographicI nfo demogr aphicInfo = new Demo graphicInf o(); | |
| 208 | ee Summary.se tDemograph ics(demogr aphicInfo) ; | |
| 209 | ||
| 210 | // CCR 17798 6-logging updates | |
| 211 | lo gger.debug ("facility Number: {} ", facilit yNumber); | |
| 212 | lo gger.debug ("facility Name: {}", facilityN ame); | |
| 213 | ||
| 214 | de mographicI nfo.setPre ferredFaci lity(facil ityNumber + " - " + facilityNa me); | |
| 215 | ||
| 216 | re turn eeSum maryRespon se; | |
| 217 | } | |
| 218 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.