Produced by Araxis Merge on 4/5/2017 4:21:47 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:\working_scrub\Unredacted\eHX Code Base\eHX_Bld2_Source Code_CIF_2017-02-14\NHIN_adapter\AdapterLIB\src\main\java\gov\va\med\nhin\adapter\datamanager\adapters | MVI1309DataAdapter.java | Fri Feb 10 15:41:44 2017 UTC |
| 2 | eHX-CIF.zip\eHX-CIF\eHX Code Base\eHX_Bld2_Source Code_CIF_2017-02-14\NHIN_adapter\AdapterLIB\src\main\java\gov\va\med\nhin\adapter\datamanager\adapters | MVI1309DataAdapter.java | Mon Apr 3 14:25:19 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 402 |
| 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 go v.va.med.n hin.adapte r.datamana ger.adapte rs; | |
| 2 | ||
| 3 | import com .sun.xml.w s.client.B indingProv iderProper ties; | |
| 4 | import gov .hhs.fha.n hinc.commo n.nhinccom mon.Assert ionType; | |
| 5 | import gov .va.med.nh in.adapter .datamanag er.DataAda pter; | |
| 6 | import gov .va.med.nh in.adapter .datamanag er.DataQue ry; | |
| 7 | import gov .va.oit.oe d.vaww.VAI dMPort; | |
| 8 | ||
| 9 | import jav a.util.Arr ayList; | |
| 10 | import jav a.util.Lis t; | |
| 11 | import jav a.util.Map ; | |
| 12 | ||
| 13 | import jav ax.xml.bin d.JAXBElem ent; | |
| 14 | import jav ax.xml.ws. BindingPro vider; | |
| 15 | import jav ax.xml.ws. WebService Exception; | |
| 16 | import jav ax.xml.ws. soap.SOAPF aultExcept ion; | |
| 17 | ||
| 18 | import org .hl7.v3.Ac tClassCont rolAct; | |
| 19 | import org .hl7.v3.CS ; | |
| 20 | import org .hl7.v3.II ; | |
| 21 | import org .hl7.v3.Ob jectFactor y; | |
| 22 | import org .hl7.v3.PR PAIN201309 UV02; | |
| 23 | import org .hl7.v3.PR PAIN201309 UV02QUQIMT 021001UV01 ControlAct Process; | |
| 24 | import org .hl7.v3.PR PAIN201310 UV02; | |
| 25 | import org .hl7.v3.PR PAMT201307 UV02Parame terList; | |
| 26 | import org .hl7.v3.PR PAMT201307 UV02Patien tIdentifie r; | |
| 27 | import org .hl7.v3.PR PAMT201307 UV02QueryB yParameter ; | |
| 28 | import org .hl7.v3.ST ; | |
| 29 | import org .hl7.v3.XA ctMoodInte ntEvent; | |
| 30 | import org .slf4j.Log ger; | |
| 31 | import org .slf4j.Log gerFactory ; | |
| 32 | ||
| 33 | /** | |
| 34 | * | |
| 35 | * @author DNS RAYD1 | |
| 36 | */ | |
| 37 | public cla ss MVI1309 DataAdapte r extends MVIDataAda pter imple ments Data Adapter | |
| 38 | { | |
| 39 | privat e static f inal Logge r logger = LoggerFac tory.getLo gger(MVI13 09DataAdap ter.class. getName()) ; | |
| 40 | ||
| 41 | @Overr ide | |
| 42 | public List getD ata(DataQu ery dataQu ery) | |
| 43 | { | |
| 44 | in itializePr operties(d ataQuery); | |
| 45 | ||
| 46 | Ar rayList re t = new Ar rayList(); | |
| 47 | PR PAIN201310 UV02 respo nse1310 = null; | |
| 48 | ||
| 49 | St ring icn = (String) dataQuery. getParamet er("icn"); | |
| 50 | As sertionTyp e assertio n = (Asser tionType) dataQuery. getParamet er("assert ion"); | |
| 51 | St ring sendi ngFacility OID = (Str ing) dataQ uery.getPa rameter("s endingFaci lityOID"); | |
| 52 | St ring sendi ngFacility Number = ( String) da taQuery.ge tParameter ("sendingF acilityNum ber"); | |
| 53 | ||
| 54 | // Implement a require ment to re try the op eration on failure, up to a | |
| 55 | // retry lim it | |
| 56 | in t retriesR emaining = mviRetryL imit; | |
| 57 | wh ile (true) { | |
| 58 | try { | |
| 59 | PRPA IN201309UV 02 request 1309 = bui ldRequest1 309(icn, a ssertion, sendingFac ilityOID, sendingFac ilityNumbe r); | |
| 60 | logg er.debug(" 1309 Reque st: {} ", request130 9); | |
| 61 | VAId MPort port = getVAId MPort(wsdl URL); | |
| 62 | Map< String, Ob ject> requ estContext = ((Bindi ngProvider ) port).ge tRequestCo ntext(); | |
| 63 | requ estContext .put(Bindi ngProvider Properties .REQUEST_T IMEOUT, mv iRequestTi meout); | |
| 64 | requ estContext .put(Bindi ngProvider Properties .CONNECT_T IMEOUT, mv iConnectTi meout); | |
| 65 | resp onse1310 = (PRPAIN20 1310UV02) port.prpaI N201309UV0 2(request1 309); | |
| 66 | ||
| 67 | logg er.debug(" 1310 Respo nse: {} ", response1 310); | |
| 68 | ||
| 69 | brea k; | |
| 70 | } catch (SOAPFault Exception sfe) { | |
| 71 | Stri ng msg = s fe.getMess age(); | |
| 72 | Stri ng sfStr = sfe.getFa ult().getF aultString (); | |
| 73 | Stri ng sfCode = sfe.getF ault().get FaultCode( ); | |
| 74 | logg er.debug(" SOAPFaultE xception: Message { } '" + msg + "'; Fau ltString { } '" + sfS tr + "'; F aultCode { } '" + sfC ode + "'") ; | |
| 75 | thro w sfe; | |
| 76 | } catch (WebServic eException ste) { | |
| 77 | logg er.error(" WebService Exception connecting to MVI. Message={} ", ste.get Message()) ; | |
| 78 | // o nly execut e retries on timeout | |
| 79 | if ( ste.getCau se() insta nceof java .net.Socke tTimeoutEx ception) { | |
| 80 | if (--retr iesRemaini ng == 0) { | |
| 81 | throw ste; | |
| 82 | } else { | |
| 83 | logger .error("Re trying con nection to MVI due t o SocketTi meoutExcep tion. {} r etries rem aining.", retriesRem aining); | |
| 84 | } | |
| 85 | } el se { | |
| 86 | throw ste; | |
| 87 | } | |
| 88 | } // CCR 179231 | |
| 89 | catch (E xception e ) { | |
| 90 | // C CR 177986 | |
| 91 | logg er.error(" There was an error g etting dat a from MVI {} ", e); | |
| 92 | thro w new Data AdapterExc eption("Th ere was an error get ting data from MVI", e); | |
| 93 | } | |
| 94 | } | |
| 95 | ||
| 96 | re t.add(resp onse1310); | |
| 97 | ||
| 98 | re turn ret; | |
| 99 | } | |
| 100 | ||
| 101 | /* | |
| 102 | * Build 130 9 request | |
| 103 | * | |
| 104 | * @param St ring icn | |
| 105 | * | |
| 106 | * @param As sertionTyp e assertio n | |
| 107 | */ | |
| 108 | privat e PRPAIN20 1309UV02 b uildReques t1309(Stri ng icn, As sertionTyp e assertio n, String sendingFac ilityOID, String sen dingFacili tyNumber) | |
| 109 | { | |
| 110 | ||
| 111 | Ob jectFactor y objFacto ry = new O bjectFacto ry(); | |
| 112 | PR PAIN201309 UV02 reque st1309 = o bjFactory. createPRPA IN201309UV 02(); | |
| 113 | ||
| 114 | // Set up me ssage head er fields | |
| 115 | re quest1309. setITSVers ion(reques t1309.getI TSVersion( )); // "XM L_1.0" | |
| 116 | ||
| 117 | re quest1309. setId(crea teMessageI d(request1 309.getId( ))); | |
| 118 | ||
| 119 | // Set Creat ion Time | |
| 120 | re quest1309. setCreatio nTime(crea teCreation Time()); | |
| 121 | ||
| 122 | // Set Inter actionId | |
| 123 | II interacti onId = new II(); | |
| 124 | in teractionI d.setRoot( "2.16.840. 1.113883.1 .6"); // H L7Constant s.INTERACT ION_ID_ROO T | |
| 125 | in teractionI d.setExten sion("PRPA _IN201309U V02"); | |
| 126 | re quest1309. setInterac tionId(int eractionId ); | |
| 127 | ||
| 128 | // Set Proce ssing Code | |
| 129 | CS processin gCode = ne w CS(); | |
| 130 | pr ocessingCo de.setCode (processin gCodeStr); | |
| 131 | re quest1309. setProcess ingCode(pr ocessingCo de); | |
| 132 | ||
| 133 | // Set Proce sing Mode | |
| 134 | CS processin gModeCode = new CS() ; | |
| 135 | pr ocessingMo deCode.set Code("T"); | |
| 136 | re quest1309. setProcess ingModeCod e(processi ngModeCode ); | |
| 137 | ||
| 138 | // Set Ackno wlegment C ode | |
| 139 | CS acceptAck Code = new CS(); | |
| 140 | ac ceptAckCod e.setCode( "AL"); | |
| 141 | re quest1309. setAcceptA ckCode(acc eptAckCode ); | |
| 142 | ||
| 143 | // Set Recei ver | |
| 144 | re quest1309. getReceive r().add(cr eateReceiv er()); | |
| 145 | ||
| 146 | // Set Sende r | |
| 147 | re quest1309. setSender( createSend er(mviSite Key1309, s endingFaci lityOID, s endingFaci lityNumber )); | |
| 148 | ||
| 149 | // Create Co ntrolActPr ocess | |
| 150 | PR PAIN201309 UV02QUQIMT 021001UV01 ControlAct Process co ntrolActPr ocess = ob jFactory.c reatePRPAI N201309UV0 2QUQIMT021 001UV01Con trolActPro cess(); | |
| 151 | co ntrolActPr ocess.setM oodCode(XA ctMoodInte ntEvent.EV N); | |
| 152 | co ntrolActPr ocess.setC lassCode(A ctClassCon trolAct.CA CT); | |
| 153 | ||
| 154 | // Set DataE nterer | |
| 155 | co ntrolActPr ocess.getD ataEnterer ().add(cre ateDataEnt erer2(asse rtion)); | |
| 156 | ||
| 157 | // Query By Parameter | |
| 158 | PR PAMT201307 UV02QueryB yParameter queryByPa rameter = new PRPAMT 201307UV02 QueryByPar ameter(); | |
| 159 | JA XBElement< PRPAMT2013 07UV02Quer yByParamet er> queryB yParameter JAXB = obj Factory.cr eatePRPAIN 201309UV02 QUQIMT0210 01UV01Cont rolActProc essQueryBy Parameter( queryByPar ameter); | |
| 160 | ||
| 161 | II queryId = new II(); | |
| 162 | qu eryId.setR oot(VA_OID ); // take n from MVI _Service_D escription .PDF doc | |
| 163 | qu eryId.setE xtension(" 33452"); / / taken fr om MVI_Ser vice_Descr iption.PDF | |
| 164 | // doc | |
| 165 | qu eryByParam eter.setQu eryId(quer yId); | |
| 166 | ||
| 167 | CS queryPrio rityCode = new CS(); | |
| 168 | qu eryPriorit yCode.setC ode("I"); | |
| 169 | qu eryByParam eter.setRe sponsePrio rityCode(q ueryPriori tyCode); | |
| 170 | ||
| 171 | CS queryStat usCode = n ew CS(); | |
| 172 | qu eryStatusC ode.setCod e("new"); | |
| 173 | qu eryByParam eter.setSt atusCode(q ueryStatus Code); | |
| 174 | ||
| 175 | // Parameter List | |
| 176 | PR PAMT201307 UV02Parame terList pa rameterLis t = new PR PAMT201307 UV02Parame terList(); | |
| 177 | ||
| 178 | PR PAMT201307 UV02Patien tIdentifie r patientI dentifier = new PRPA MT201307UV 02PatientI dentifier( ); | |
| 179 | ||
| 180 | ST semantics Text = new ST(); | |
| 181 | se manticsTex t.setValue ("Patient. Id"); | |
| 182 | pa tientIdent ifier.setS emanticsTe xt(semanti csText); | |
| 183 | ||
| 184 | II patientId = new II( ); | |
| 185 | pa tientId.se tRoot(VA_O ID); // ta ken from t he MVI_Ser vice_Descr iption.PDF | |
| 186 | // doc | |
| 187 | pa tientId.se tExtension (icn + "^N I"); // IC N + "^NI" | |
| 188 | pa tientIdent ifier.getV alue().add (patientId ); | |
| 189 | ||
| 190 | pa rameterLis t.getPatie ntIdentifi er().add(p atientIden tifier); | |
| 191 | qu eryByParam eter.setPa rameterLis t(paramete rList); | |
| 192 | ||
| 193 | co ntrolActPr ocess.setQ ueryByPara meter(quer yByParamet erJAXB); | |
| 194 | ||
| 195 | re quest1309. setControl ActProcess (controlAc tProcess); | |
| 196 | ||
| 197 | // CCR 17798 6-logging update | |
| 198 | lo gger.debug ("1309 req uest {} ", request13 09); | |
| 199 | ||
| 200 | re turn reque st1309; | |
| 201 | } | |
| 202 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.