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 | MVI1305DataAdapter.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 | MVI1305DataAdapter.java | Mon Apr 3 14:25:18 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 678 |
| 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.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.JAXBCont ext; | |
| 15 | import jav ax.xml.bin d.JAXBExce ption; | |
| 16 | import jav ax.xml.bin d.util.JAX BSource; | |
| 17 | import jav ax.xml.ws. BindingPro vider; | |
| 18 | import jav ax.xml.ws. WebService Exception; | |
| 19 | import jav ax.xml.ws. soap.SOAPF aultExcept ion; | |
| 20 | ||
| 21 | import org .hl7.v3.CS ; | |
| 22 | import org .hl7.v3.IN T; | |
| 23 | import org .hl7.v3.PR PAIN201305 UV02; | |
| 24 | import org .hl7.v3.PR PAIN201305 UV02QUQIMT 021001UV01 ControlAct Process; | |
| 25 | import org .hl7.v3.PR PAIN201306 UV02; | |
| 26 | import org .hl7.v3.PR PAMT201306 UV02Living SubjectId; | |
| 27 | import org .hl7.v3.PR PAMT201306 UV02Living SubjectNam e; | |
| 28 | import org .hl7.v3.PR PAMT201306 UV02Parame terList; | |
| 29 | import org .hl7.v3.PR PAMT201306 UV02Patien tAddress; | |
| 30 | import org .hl7.v3.PR PAMT201306 UV02QueryB yParameter ; | |
| 31 | import org .hl7.v3.ST ; | |
| 32 | import org .slf4j.Log ger; | |
| 33 | import org .slf4j.Log gerFactory ; | |
| 34 | ||
| 35 | /** | |
| 36 | * | |
| 37 | * @author DN S VAZQUD | |
| 38 | */ | |
| 39 | public cla ss MVI1305 DataAdapte r extends MVIDataAda pter imple ments Data Adapter | |
| 40 | { | |
| 41 | pr ivate stat ic final L ogger logg er = Logge rFactory.g etLogger(M VI1305Data Adapter.cl ass.getNam e()); | |
| 42 | ||
| 43 | pr ivate stat ic JAXBCon text conte xt; | |
| 44 | st atic | |
| 45 | { | |
| 46 | try | |
| 47 | { | |
| 48 | cont ext = JAXB Context.ne wInstance( PRPAIN2013 05UV02.cla ss); | |
| 49 | } | |
| 50 | catch (J AXBExcepti on e) | |
| 51 | { | |
| 52 | logg er.debug(" JAXBExcept ion occurr ed at init ialization : ", e); | |
| 53 | } | |
| 54 | } | |
| 55 | ||
| 56 | pu blic List getData(Da taQuery da taQuery) | |
| 57 | { | |
| 58 | init ializeProp erties(dat aQuery); | |
| 59 | ||
| 60 | Arra yList ret = new Arra yList(); | |
| 61 | PRPA IN201306UV 02 respons e1306 = nu ll; | |
| 62 | ||
| 63 | PRPA IN201305UV 02 partner sRequest13 05 = (PRPA IN201305UV 02) dataQu ery.getPar ameter("13 05Request" ); | |
| 64 | PRPA IN201305UV 02 request 1305 = nul l; | |
| 65 | ||
| 66 | Asse rtionType assertion = (Asserti onType) da taQuery.ge tParameter ("assertio n"); | |
| 67 | Stri ng sending FacilityOI D = (Strin g) dataQue ry.getPara meter("sen dingFacili tyOID"); | |
| 68 | Stri ng sending FacilityNu mber = (St ring) data Query.getP arameter(" sendingFac ilityNumbe r"); | |
| 69 | ||
| 70 | // I mplement a requireme nt to retr y the oper ation on f ailure, up to a | |
| 71 | // r etry limit | |
| 72 | int retriesRem aining = m viRetryLim it; | |
| 73 | whil e(true) | |
| 74 | { | |
| 75 | try | |
| 76 | { | |
| 77 | request1 305 = crea teAdapters 1305Reques t(partners Request130 5, asserti on, sendin gFacilityO ID, sendin gFacilityN umber); | |
| 78 | VAIdMPor t port = g etVAIdMPor t(wsdlURL) ; | |
| 79 | Map<Stri ng, Object > requestC ontext = ( (BindingPr ovider) po rt).getReq uestContex t(); | |
| 80 | requestC ontext.put (BindingPr oviderProp erties.REQ UEST_TIMEO UT, mviReq uestTimeou t); | |
| 81 | requestC ontext.put (BindingPr oviderProp erties.CON NECT_TIMEO UT, mviCon nectTimeou t); | |
| 82 | response 1306 = (PR PAIN201306 UV02) port .prpaIN201 305UV02(re quest1305) ; | |
| 83 | break; | |
| 84 | } | |
| 85 | catch( SOAPFaultE xception s fe) | |
| 86 | { | |
| 87 | String m sg = sfe.g etMessage( ); | |
| 88 | String s fStr = sfe .getFault( ).getFault String(); | |
| 89 | String s fCode = sf e.getFault ().getFaul tCode(); | |
| 90 | ||
| 91 | throw ne w DataAdap terExcepti on("SOAPFa ultExcepti on occurre d in proce ssing MVI 1305 :" + "Message: " + msg + "; " + "Fa ultString: " + sfStr + ";" + " FaultCode: " + sfCod e, sfe); | |
| 92 | } | |
| 93 | catch( WebService Exception ste) | |
| 94 | { | |
| 95 | logger.e rror("WebS erviceExce ption conn ecting to MVI. Mess age={}", s te.getMess age()); | |
| 96 | ||
| 97 | // only execute re tries on t imeout | |
| 98 | if(ste.g etCause() instanceof java.net. SocketTime outExcepti on) | |
| 99 | { | |
| 100 | if(--retri esRemainin g == 0) | |
| 101 | { | |
| 102 | th row new Da taAdapterE xception(s te); | |
| 103 | } | |
| 104 | else | |
| 105 | { | |
| 106 | lo gger.debug ("Retrying connectio n to MVI d ue to Sock etTimeoutE xception. {} retries remaining .", retrie sRemaining ); | |
| 107 | } | |
| 108 | } | |
| 109 | else | |
| 110 | { | |
| 111 | throw new DataAdapte rException (ste); | |
| 112 | } | |
| 113 | } | |
| 114 | catch( Throwable t) | |
| 115 | { | |
| 116 | logger.e rror("Ther e was an e rror getti ng data fr om MVI. M essage={}" , t.getMes sage()); | |
| 117 | throw ne w DataAdap terExcepti on("There was an err or getting data from MVI", t); | |
| 118 | } | |
| 119 | } | |
| 120 | ||
| 121 | ret. add(respon se1306); | |
| 122 | ||
| 123 | retu rn ret; | |
| 124 | } | |
| 125 | ||
| 126 | /* | |
| 127 | * Build 130 5 request | |
| 128 | * | |
| 129 | * @param PR PAIN201305 UV02 the 1 305 reques t sent to Adapter. | |
| 130 | * / | |
| 131 | pr ivate PRPA IN201305UV 02 createA dapters130 5Request(P RPAIN20130 5UV02 part ners1305Re quest, Ass ertionType assertion , String s endingFaci lityOID, S tring send ingFacilit yNumber) | |
| 132 | { | |
| 133 | // O bjectFacto ry objFact ory = new ObjectFact ory(); | |
| 134 | ||
| 135 | // D ecided to create new instance of 1305 me ssage to u se for MVI request | |
| 136 | // s o that | |
| 137 | // o riginal in bound 1305 message f rom partne r would be preserved . | |
| 138 | PRPA IN201305UV 02 adapter 1305Reques t = null; | |
| 139 | try | |
| 140 | { | |
| 141 | adapte r1305Reque st = (PRPA IN201305UV 02) contex t.createUn marshaller ().unmarsh al(new JAX BSource(co ntext, par tners1305R equest)); | |
| 142 | } | |
| 143 | catc h(JAXBExce ption e) | |
| 144 | { | |
| 145 | throw new DataAd apterExcep tion("JAXB Exception occurred w hile makin g copy of inbound PR PAIN201305 UV02 messa ge", e); | |
| 146 | } | |
| 147 | ||
| 148 | // S et up mess age header fields | |
| 149 | adap ter1305Req uest.setId (createMes sageId(ada pter1305Re quest.getI d())); | |
| 150 | ||
| 151 | adap ter1305Req uest.setCr eationTime (createCre ationTime( )); | |
| 152 | ||
| 153 | // S et Process ing Code | |
| 154 | CS p rocessingC ode = new CS(); | |
| 155 | proc essingCode .setCode(p rocessingC odeStr); | |
| 156 | adap ter1305Req uest.setPr ocessingCo de(process ingCode); | |
| 157 | ||
| 158 | // S et Acknowl egment Cod e | |
| 159 | CS a cceptAckCo de = new C S(); | |
| 160 | acce ptAckCode. setCode("A L"); | |
| 161 | adap ter1305Req uest.setAc ceptAckCod e(acceptAc kCode); | |
| 162 | ||
| 163 | // S et Sender | |
| 164 | adap ter1305Req uest.setSe nder(creat eSender(mv iSiteKey13 05, sendin gFacilityO ID, sendin gFacilityN umber)); | |
| 165 | ||
| 166 | // S et DataEnt erer | |
| 167 | PRPA IN201305UV 02QUQIMT02 1001UV01Co ntrolActPr ocess cont rolActProc ess = adap ter1305Req uest.getCo ntrolActPr ocess(); | |
| 168 | cont rolActProc ess.getDat aEnterer() .add(creat eDataEnter er2(assert ion)); | |
| 169 | // a dapter1305 Request.se tControlAc tProcess(c ontrolActP rocess); | |
| 170 | ||
| 171 | // Q ueryByPara mter | |
| 172 | PRPA MT201306UV 02QueryByP arameter q ueryByPara meter = ad apter1305R equest.get ControlAct Process(). getQueryBy Parameter( ).getValue (); | |
| 173 | ||
| 174 | CS m odifyCode = new CS() ; | |
| 175 | modi fyCode.set Code("MVI. COMP1"); | |
| 176 | quer yByParamet er.setModi fyCode(mod ifyCode); | |
| 177 | ||
| 178 | INT initQty = new INT(); | |
| 179 | init Qty.setVal ue(BigInte ger.ONE); | |
| 180 | quer yByParamet er.setInit ialQuantit y(initQty) ; | |
| 181 | ||
| 182 | // Q uery Param eterList | |
| 183 | PRPA MT201306UV 02Paramete rList para mList = qu eryByParam eter.getPa rameterLis t(); | |
| 184 | ||
| 185 | // M VI require s the use of the sem anticsText element o n each que ry | |
| 186 | // p arameter.. ..as manda ted in the integrati on process (not enfo rced at | |
| 187 | // r untime how ever). | |
| 188 | // S ince the V LER Health Exchange Partners h ave not be en sending this | |
| 189 | // e lement...a s it was n ot needed for the RP C calls... we are che cking to | |
| 190 | // s ee if | |
| 191 | // i t's there and if not adding it for them. | |
| 192 | // G ender | |
| 193 | if(p aramList.g etLivingSu bjectAdmin istrativeG ender() != null && p aramList.g etLivingSu bjectAdmin istrativeG ender().si ze() > 0 & & paramLis t.getLivin gSubjectAd ministrati veGender() .get(0) != null) | |
| 194 | // & & | |
| 195 | // ( paramList. getLivingS ubjectAdmi nistrative Gender().g et(0).getS emanticsTe xt() | |
| 196 | // = = null || | |
| 197 | // N ullChecker .isNullOrE mpty(param List.getLi vingSubjec tAdministr ativeGende r().get(0) .getSemant icsText(). getValue() ))) | |
| 198 | { | |
| 199 | ST st2 = new ST( ); | |
| 200 | st2.se tValue("Ge nder"); | |
| 201 | paramL ist.getLiv ingSubject Administra tiveGender ().get(0). setSemanti csText(st2 ); | |
| 202 | } | |
| 203 | ||
| 204 | // D ate of Bir th | |
| 205 | if(p aramList.g etLivingSu bjectBirth Time() != null && pa ramList.ge tLivingSub jectBirthT ime().size () > 0 && paramList. getLivingS ubjectBirt hTime().ge t(0) != nu ll) | |
| 206 | // & & (paramLi st.getLivi ngSubjectB irthTime() .get(0).ge tSemantics Text() | |
| 207 | // = = null || | |
| 208 | // N ullChecker .isNullOrE mpty(param List.getLi vingSubjec tBirthTime ().get(0). getSemanti csText().g etValue()) )) | |
| 209 | { | |
| 210 | ST st2 = new ST( ); | |
| 211 | st2.se tValue("Da te of Birt h"); | |
| 212 | paramL ist.getLiv ingSubject BirthTime( ).get(0).s etSemantic sText(st2) ; | |
| 213 | } | |
| 214 | ||
| 215 | // P lace of Bi rth | |
| 216 | if(p aramList.g etLivingSu bjectBirth PlaceAddre ss() != nu ll && para mList.getL ivingSubje ctBirthPla ceAddress( ).size() > 0 && para mList.getL ivingSubje ctBirthPla ceAddress( ).get(0) ! = null) | |
| 217 | // & & | |
| 218 | // ( paramList. getLivingS ubjectBirt hPlaceAddr ess().get( 0).getSema nticsText( ) | |
| 219 | // = = null || | |
| 220 | // N ullChecker .isNullOrE mpty(param List.getLi vingSubjec tBirthPlac eAddress() .get(0).ge tSemantics Text().get Value()))) | |
| 221 | { | |
| 222 | ST st2 = new ST( ); | |
| 223 | st2.se tValue("PO B"); | |
| 224 | paramL ist.getLiv ingSubject BirthPlace Address(). get(0).set SemanticsT ext(st2); | |
| 225 | } | |
| 226 | ||
| 227 | // S SN | |
| 228 | if(p aramList.g etLivingSu bjectId() != null && paramList .getLiving SubjectId( ).size() > 0 && para mList.getL ivingSubje ctId().get (0) != nul l) | |
| 229 | { | |
| 230 | // onl y SSN is v alid for t he person trait sear ch....so r emove | |
| 231 | // eve rything el se the Par tner may h ave sent.. .namely th eir ID. | |
| 232 | remove NonSSNSubj ectIds(par amList.get LivingSubj ectId()); | |
| 233 | ||
| 234 | PRPAMT 201306UV02 LivingSubj ectId ssn = this.get SSN(paramL ist.getLiv ingSubject Id()); | |
| 235 | if(ssn != null) | |
| 236 | // && (ssn.getSe manticsTex t() == nul l || | |
| 237 | // Nul lChecker.i sNullOrEmp ty(ssn.get SemanticsT ext().getV alue()))) | |
| 238 | { | |
| 239 | ST st2 = new ST(); | |
| 240 | st2.setV alue("SSN" ); | |
| 241 | ssn.setS emanticsTe xt(st2); | |
| 242 | } | |
| 243 | } | |
| 244 | ||
| 245 | // L egal Name | |
| 246 | if(p aramList.g etLivingSu bjectName( ) != null && paramLi st.getLivi ngSubjectN ame().size () > 0 && paramList. getLivingS ubjectName ().get(0) != null) | |
| 247 | { | |
| 248 | PRPAMT 201306UV02 LivingSubj ectName le galName = HL7Parser2 01306.extr actSubject Name(param List.getLi vingSubjec tName(), " L"); | |
| 249 | if(leg alName != null) | |
| 250 | // && (legalName .getSemant icsText() == null || | |
| 251 | // Nul lChecker.i sNullOrEmp ty(legalNa me.getSema nticsText( ).getValue ()))) | |
| 252 | { | |
| 253 | if(legal Name.getVa lue().get( 0).getUse( ) == null || legalNa me.getValu e().get(0) .getUse(). size() <= 0) | |
| 254 | { | |
| 255 | // if null set to "L " otherwis e MVI will return "N F" for not | |
| 256 | // found. | |
| 257 | legalName. getValue() .get(0).ge tUse().add ("L"); | |
| 258 | } | |
| 259 | ST st2 = new ST(); | |
| 260 | st2.setV alue("Lega l Name"); | |
| 261 | legalNam e.setSeman ticsText(s t2); | |
| 262 | } | |
| 263 | } | |
| 264 | ||
| 265 | // M other's Ma iden Name | |
| 266 | if(p aramList.g etLivingSu bjectName( ) != null && paramLi st.getLivi ngSubjectN ame().size () > 0 && paramList. getLivingS ubjectName ().get(0) != null) | |
| 267 | { | |
| 268 | PRPAMT 201306UV02 LivingSubj ectName ma idenName = HL7Parser 201306.ext ractSubjec tName(para mList.getL ivingSubje ctName(), "C"); | |
| 269 | if(mai denName != null) | |
| 270 | // && (maidenNam e.getSeman ticsText() == null | | | |
| 271 | // Nul lChecker.i sNullOrEmp ty(maidenN ame.getSem anticsText ().getValu e()))) | |
| 272 | { | |
| 273 | ST st2 = new ST(); | |
| 274 | st2.setV alue("Moth er's Maide n Name"); | |
| 275 | maidenNa me.setSema nticsText( st2); | |
| 276 | } | |
| 277 | } | |
| 278 | ||
| 279 | // P atient Add ress | |
| 280 | PRPA MT201306UV 02PatientA ddress add ress = HL7 Parser2013 06.extract PatientAdd ress(param List.getPa tientAddre ss(), "PHY S"); | |
| 281 | if(a ddress != null) | |
| 282 | // & & (paramLi st.getPati entAddress ().get(0). getSemanti csText() = = null | |
| 283 | // | | | |
| 284 | // N ullChecker .isNullOrE mpty(param List.getPa tientAddre ss().get(0 ).getSeman ticsText() .getValue( )))) | |
| 285 | { | |
| 286 | if(add ress.getVa lue().get( 0).getUse( ) == null || address .getValue( ).get(0).g etUse().si ze() <= 0) | |
| 287 | { | |
| 288 | // if nu ll set to "PHYS" oth erwise MVI will not use this | |
| 289 | // param eter and m ay return a "NF" for not found . | |
| 290 | address. getValue() .get(0).ge tUse().add ("PHYS"); | |
| 291 | } | |
| 292 | ST st2 = new ST( ); | |
| 293 | st2.se tValue("AD DR"); | |
| 294 | addres s.setSeman ticsText(s t2); | |
| 295 | } | |
| 296 | retu rn adapter 1305Reques t; | |
| 297 | } | |
| 298 | ||
| 299 | pr ivate void removeNon SSNSubject Ids(List<P RPAMT20130 6UV02Livin gSubjectId > ids) | |
| 300 | { | |
| 301 | List <PRPAMT201 306UV02Liv ingSubject Id> nonSSN Ids = new ArrayList( ); | |
| 302 | ||
| 303 | for( PRPAMT2013 06UV02Livi ngSubjectI d id : ids ) | |
| 304 | { | |
| 305 | if(id. getValue() != null & & id.getVa lue().size () > 0 && id.getValu e().get(0) != null & & id.getVa lue().get( 0).getRoot () != null && id.get Value().ge t(0).getRo ot().equal s("2.16.84 0.1.113883 .4.1")) | |
| 306 | { | |
| 307 | // it's an SSN so keep it an d move on. | |
| 308 | continue ; | |
| 309 | } | |
| 310 | else | |
| 311 | { | |
| 312 | // it's not an SSN so remove it since only SSNs are valid for | |
| 313 | // the 1 305 queryB yParameter /person tr ait search . | |
| 314 | nonSSNId s.add(id); | |
| 315 | } | |
| 316 | } | |
| 317 | ||
| 318 | for( PRPAMT2013 06UV02Livi ngSubjectI d nonSSNId : nonSSNI ds) | |
| 319 | { | |
| 320 | ids.re move(nonSS NId); | |
| 321 | } | |
| 322 | } | |
| 323 | ||
| 324 | pr ivate PRPA MT201306UV 02LivingSu bjectId ge tSSN(List< PRPAMT2013 06UV02Livi ngSubjectI d> ids) | |
| 325 | { | |
| 326 | ||
| 327 | PRPA MT201306UV 02LivingSu bjectId ss n = null; | |
| 328 | ||
| 329 | for( PRPAMT2013 06UV02Livi ngSubjectI d id : ids ) | |
| 330 | { | |
| 331 | if(id. getValue() != null & & id.getVa lue().size () > 0 && id.getValu e().get(0) != null & & id.getVa lue().get( 0).getRoot () != null && id.get Value().ge t(0).getRo ot().equal s("2.16.84 0.1.113883 .4.1")) | |
| 332 | { | |
| 333 | ssn = id ; | |
| 334 | break; | |
| 335 | } | |
| 336 | } | |
| 337 | retu rn ssn; | |
| 338 | } | |
| 339 | ||
| 340 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.