Produced by Araxis Merge on 4/5/2017 4:21:46 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 | MVI1305ICNDataAdapter.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 | MVI1305ICNDataAdapter.java | Mon Apr 3 14:25:19 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 394 |
| 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 | ||
| 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.med.nh in.adapter .mvi.hl7pa rsers.HL7P arser20130 6; | |
| 8 | import gov .va.oit.oe d.vaww.VAI dMPort; | |
| 9 | import jav a.math.Big Integer; | |
| 10 | import jav a.util.Arr ayList; | |
| 11 | import jav a.util.Lis t; | |
| 12 | import jav a.util.Map ; | |
| 13 | ||
| 14 | import jav ax.xml.bin d.JAXBElem ent; | |
| 15 | import jav ax.xml.ws. BindingPro vider; | |
| 16 | import jav ax.xml.ws. WebService Exception; | |
| 17 | import jav ax.xml.ws. soap.SOAPF aultExcept ion; | |
| 18 | ||
| 19 | import org .hl7.v3.CS ; | |
| 20 | import org .hl7.v3.II ; | |
| 21 | import org .hl7.v3.IN T; | |
| 22 | import org .hl7.v3.MC CIMT000300 UV01Acknow ledgement; | |
| 23 | import org .hl7.v3.MF MIMT700711 UV01QueryA ck; | |
| 24 | import org .hl7.v3.Ob jectFactor y; | |
| 25 | import org .hl7.v3.PR PAIN201305 UV02; | |
| 26 | import org .hl7.v3.PR PAIN201305 UV02QUQIMT 021001UV01 ControlAct Process; | |
| 27 | import org .hl7.v3.PR PAIN201306 UV02; | |
| 28 | import org .hl7.v3.PR PAMT201306 UV02Parame terList; | |
| 29 | import org .hl7.v3.PR PAMT201306 UV02QueryB yParameter ; | |
| 30 | import org .slf4j.Log ger; | |
| 31 | import org .slf4j.Log gerFactory ; | |
| 32 | ||
| 33 | /** | |
| 34 | * | |
| 35 | * @author DN S VAZQUD | |
| 36 | */ | |
| 37 | public cla ss MVI1305 ICNDataAda pter exten ds MVIData Adapter im plements D ataAdapter | |
| 38 | { | |
| 39 | pr ivate stat ic final L ogger logg er = Logge rFactory.g etLogger(M VI1305ICND ataAdapter .class.get Name()); | |
| 40 | ||
| 41 | pu blic List getData(Da taQuery da taQuery) | |
| 42 | { | |
| 43 | init ializeProp erties(dat aQuery); | |
| 44 | ||
| 45 | Arra yList ret = new Arra yList(); | |
| 46 | ||
| 47 | Stri ng icn = ( String) da taQuery.ge tParameter ("icn"); | |
| 48 | ||
| 49 | icn = this.get WellFormed ICN(icn); | |
| 50 | ||
| 51 | int retriesRem aining = m viRetryLim it; | |
| 52 | whil e(true) | |
| 53 | { | |
| 54 | try | |
| 55 | { | |
| 56 | PRPAIN20 1305UV02 r equest1305 = createA dapters130 5Request(i cn); | |
| 57 | VAIdMPor t port = g etVAIdMPor t(wsdlURL) ; | |
| 58 | Map<Stri ng, Object > requestC ontext = ( (BindingPr ovider) po rt).getReq uestContex t(); | |
| 59 | requestC ontext.put (BindingPr oviderProp erties.REQ UEST_TIMEO UT, mviReq uestTimeou t); | |
| 60 | requestC ontext.put (BindingPr oviderProp erties.CON NECT_TIMEO UT, mviCon nectTimeou t); | |
| 61 | PRPAIN20 1306UV02 r esponse130 6 = (PRPAI N201306UV0 2) port.pr paIN201305 UV02(reque st1305); | |
| 62 | ||
| 63 | MCCIMT00 0300UV01Ac knowledgem ent ack = response13 06.getAckn owledgemen t().get(0) ; | |
| 64 | MFMIMT70 0711UV01Qu eryAck que ryAck = re sponse1306 .getContro lActProces s().getQue ryAck(); | |
| 65 | logger.i nfo("ack.g etTypeCode ().getCode ():" + ack .getTypeCo de().getCo de()); | |
| 66 | logger.i nfo("query Ack.getQue ryResponse Code().get Code():" + queryAck. getQueryRe sponseCode ().getCode ()); | |
| 67 | ||
| 68 | if(ack.g etTypeCode ().getCode ().equalsI gnoreCase( "AA") && q ueryAck.ge tQueryResp onseCode() .getCode() .equalsIgn oreCase("O K")) | |
| 69 | { | |
| 70 | Map map130 6 = this.b uild1306Re sultsMap(r esponse130 6); | |
| 71 | ret.add(ma p1306); | |
| 72 | } | |
| 73 | else | |
| 74 | { | |
| 75 | // MVI ret urned with error cod e. | |
| 76 | String mvi AckText = (String) a ck.getAckn owledgemen tDetail(). get(0).get Text().get Content(). get(0); | |
| 77 | // fix for fortify i ssue - Pri vacy Viola tion: RTC ticket # | |
| 78 | // 162993 | |
| 79 | logger.war n("MVI que ry for ICN returned error. {} Details: ", mviAckT ext); | |
| 80 | } | |
| 81 | break; | |
| 82 | } | |
| 83 | catch( SOAPFaultE xception s fe) | |
| 84 | { | |
| 85 | String m sg = sfe.g etMessage( ); | |
| 86 | String s fStr = sfe .getFault( ).getFault String(); | |
| 87 | String s fCode = sf e.getFault ().getFaul tCode(); | |
| 88 | throw ne w DataAdap terExcepti on("SOAPFa ultExcepti on occurre d :" + "Me ssage: " + msg + "; " + "Fault String: " + sfStr + ";" + "Fau ltCode: " + sfCode, sfe); | |
| 89 | } | |
| 90 | catch( WebService Exception ste) | |
| 91 | { | |
| 92 | logger.e rror("WebS erviceExce ption conn ecting to MVI. Mess age={}", s te.getMess age()); | |
| 93 | // only execute re tries on t imeout | |
| 94 | if(ste.g etCause() instanceof java.net. SocketTime outExcepti on) | |
| 95 | { | |
| 96 | if(--retri esRemainin g == 0) | |
| 97 | { | |
| 98 | th row new Da taAdapterE xception(s te); | |
| 99 | } | |
| 100 | else | |
| 101 | { | |
| 102 | lo gger.info( "Retrying connection to MVI du e to Socke tTimeoutEx ception. { } retries remaining. ", retries Remaining) ; | |
| 103 | } | |
| 104 | } | |
| 105 | else | |
| 106 | { | |
| 107 | throw new DataAdapte rException (ste); | |
| 108 | } | |
| 109 | } | |
| 110 | catch( Throwable t) | |
| 111 | { | |
| 112 | logger.e rror("Ther e was an e rror getti ng data fr om MVI. M essage={}" , t.getMes sage()); | |
| 113 | throw ne w DataAdap terExcepti on("There was an err or getting data from MVI.", t) ; | |
| 114 | } | |
| 115 | } | |
| 116 | retu rn ret; | |
| 117 | } | |
| 118 | ||
| 119 | pr ivate Map build1306R esultsMap( PRPAIN2013 06UV02 res ults1306) | |
| 120 | { | |
| 121 | Map map1306 = HL7Parser2 01306.extr actDemogra phics(resu lts1306); | |
| 122 | ||
| 123 | retu rn map1306 ; | |
| 124 | } | |
| 125 | ||
| 126 | /* | |
| 127 | * Build 130 5 request | |
| 128 | * | |
| 129 | * @param St ring ICN | |
| 130 | * / | |
| 131 | pr ivate PRPA IN201305UV 02 createA dapters130 5Request(S tring icn) | |
| 132 | { | |
| 133 | Obje ctFactory objFactory = new Obj ectFactory (); | |
| 134 | PRPA IN201305UV 02 adapter 1305Reques t = new PR PAIN201305 UV02(); | |
| 135 | ||
| 136 | // S et up mess age header fields | |
| 137 | adap ter1305Req uest.setId (createMes sageId(nul l)); | |
| 138 | ||
| 139 | adap ter1305Req uest.setCr eationTime (createCre ationTime( )); | |
| 140 | ||
| 141 | // S et Process ing Code | |
| 142 | CS p rocessingC ode = new CS(); | |
| 143 | proc essingCode .setCode(p rocessingC odeStr); | |
| 144 | adap ter1305Req uest.setPr ocessingCo de(process ingCode); | |
| 145 | ||
| 146 | // S et Acknowl egment Cod e | |
| 147 | CS a cceptAckCo de = new C S(); | |
| 148 | acce ptAckCode. setCode("A L"); | |
| 149 | adap ter1305Req uest.setAc ceptAckCod e(acceptAc kCode); | |
| 150 | ||
| 151 | // S et Sender | |
| 152 | adap ter1305Req uest.setSe nder(creat eSender(mv iSiteKey13 05, VA_OID , mviSiteK ey1305)); | |
| 153 | ||
| 154 | // S etup Contr olActProce s | |
| 155 | PRPA IN201305UV 02QUQIMT02 1001UV01Co ntrolActPr ocess cont rolActProc ess = new PRPAIN2013 05UV02QUQI MT021001UV 01ControlA ctProcess( ); | |
| 156 | adap ter1305Req uest.setCo ntrolActPr ocess(cont rolActProc ess); | |
| 157 | ||
| 158 | // S et DataEnt erer | |
| 159 | cont rolActProc ess.getDat aEnterer() .add(creat eDataEnter er2(null)) ; // expec ts | |
| 160 | // an | |
| 161 | // asser tion | |
| 162 | ||
| 163 | // Q ueryByPara mter | |
| 164 | PRPA MT201306UV 02QueryByP arameter q ueryByPara meter = ne w PRPAMT20 1306UV02Qu eryByParam eter(); | |
| 165 | JAXB Element<PR PAMT201306 UV02QueryB yParameter > queryByP arameterJA XB = objFa ctory.crea tePRPAIN20 1305UV02QU QIMT021001 UV01Contro lActProces sQueryByPa rameter(qu eryByParam eter); | |
| 166 | cont rolActProc ess.setQue ryByParame ter(queryB yParameter JAXB); | |
| 167 | ||
| 168 | CS m odifyCode = new CS() ; | |
| 169 | modi fyCode.set Code("MVI. COMP1"); | |
| 170 | quer yByParamet er.setModi fyCode(mod ifyCode); | |
| 171 | ||
| 172 | INT initQty = new INT(); | |
| 173 | init Qty.setVal ue(BigInte ger.ONE); | |
| 174 | quer yByParamet er.setInit ialQuantit y(initQty) ; | |
| 175 | ||
| 176 | // Q uery Param eterList | |
| 177 | PRPA MT201306UV 02Paramete rList para mList = ne w PRPAMT20 1306UV02Pa rameterLis t(); | |
| 178 | quer yByParamet er.setPara meterList( paramList) ; | |
| 179 | ||
| 180 | II i cnId = new II(); | |
| 181 | icnI d.setExten sion(this. getWellFor medICN(icn )); | |
| 182 | icnI d.setRoot( VA_OID); | |
| 183 | para mList.setI d(icnId); | |
| 184 | ||
| 185 | retu rn adapter 1305Reques t; | |
| 186 | } | |
| 187 | ||
| 188 | pr ivate Stri ng getWell FormedICN( String icn ) | |
| 189 | { | |
| 190 | Stri ng icnValu e = HL7Par ser201306. extractICN Value(icn) ; | |
| 191 | if(i cnValue != null) | |
| 192 | { | |
| 193 | icnVal ue = icnVa lue.concat ("^NI"); | |
| 194 | } | |
| 195 | retu rn icnValu e; | |
| 196 | } | |
| 197 | ||
| 198 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.