Produced by Araxis Merge on 3/1/2018 12:13:17 PM Central Standard 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_xchange_cif.zip\NHIN_adapter\AdapterLIB\src\main\java\gov\va\med\nhin\adapter\datamanager\adapters | MVIDataAdapter.java | Thu Feb 22 14:26:50 2018 UTC |
| 2 | ehealth_xchange_cif.zip\NHIN_adapter\AdapterLIB\src\main\java\gov\va\med\nhin\adapter\datamanager\adapters | MVIDataAdapter.java | Tue Feb 27 14:28:30 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 628 |
| 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 gov .va.med.nh in.adapter .utils.soa p.handler. SOAPHandle rResolver; | |
| 4 | import gov .hhs.fha.n hinc.commo n.nhinccom mon.Assert ionType; | |
| 5 | ||
| 6 | import jav ax.xml.nam espace.QNa me; | |
| 7 | ||
| 8 | import gov .va.med.nh in.adapter .datamanag er.DataAda pter; | |
| 9 | import gov .va.med.nh in.adapter .datamanag er.DataQue ry; | |
| 10 | import gov .va.med.nh in.adapter .utils.Nul lChecker; | |
| 11 | import gov .va.med.nh in.adapter .utils.Pro pertiesCol lectionFac tory; | |
| 12 | import gov .va.oit.oe d.vaww.VAI dM; | |
| 13 | import gov .va.oit.oe d.vaww.VAI dMPort; | |
| 14 | import sta tic java.l ang.Intege r.parseInt ; | |
| 15 | import jav a.net.URL; | |
| 16 | import jav a.text.Sim pleDateFor mat; | |
| 17 | import jav a.util.Dat e; | |
| 18 | import jav a.util.Pro perties; | |
| 19 | import jav a.util.Tim eZone; | |
| 20 | ||
| 21 | import jav ax.xml.bin d.JAXBElem ent; | |
| 22 | import org .hl7.v3.CO CTMT090100 UV01Assign edPerson; | |
| 23 | import org .hl7.v3.CO CTMT090100 UV01Person ; | |
| 24 | import org .hl7.v3.Co mmunicatio nFunctionT ype; | |
| 25 | import org .hl7.v3.EN Explicit; | |
| 26 | import org .hl7.v3.En ExplicitFa mily; | |
| 27 | import org .hl7.v3.En ExplicitGi ven; | |
| 28 | import org .hl7.v3.En tityClassD evice; | |
| 29 | import org .hl7.v3.II ; | |
| 30 | import org .hl7.v3.MC CIMT000100 UV01Agent; | |
| 31 | import org .hl7.v3.MC CIMT000100 UV01Device ; | |
| 32 | import org .hl7.v3.MC CIMT000100 UV01Organi zation; | |
| 33 | import org .hl7.v3.MC CIMT000100 UV01Receiv er; | |
| 34 | import org .hl7.v3.MC CIMT000100 UV01Sender ; | |
| 35 | import org .hl7.v3.MF MIMT700701 UV01DataEn terer; | |
| 36 | import org .hl7.v3.Ob jectFactor y; | |
| 37 | import org .hl7.v3.QU QIMT021001 UV01DataEn terer; | |
| 38 | import org .hl7.v3.TS Explicit; | |
| 39 | import org .slf4j.Log ger; | |
| 40 | import org .slf4j.Log gerFactory ; | |
| 41 | ||
| 42 | import jav a.security .SecureRan dom; | |
| 43 | ||
| 44 | /** | |
| 45 | * | |
| 46 | * @author DN S VAZQUD | |
| 47 | * @param <T> | |
| 48 | */ | |
| 49 | public abs tract clas s MVIDataA dapter<T> implements DataAdapt er<T> | |
| 50 | { | |
| 51 | privat e static f inal Logge r logger = LoggerFac tory.getLo gger(MVIDa taAdapter. class); | |
| 52 | ||
| 53 | privat e Properti es connect ionPropert ies; | |
| 54 | protec ted String wsdlURL; | |
| 55 | protec ted String processin gCodeStr; | |
| 56 | protec ted String mviSiteKe y1301; | |
| 57 | protec ted String mviSiteKe y1302; | |
| 58 | protec ted String mviSiteKe y1305; | |
| 59 | protec ted String mviSiteKe y1309; | |
| 60 | ||
| 61 | // MVI timeout p roperties | |
| 62 | protec ted int mv iRetryLimi t = 5; | |
| 63 | protec ted int mv iConnectTi meout = 10 000; | |
| 64 | protec ted int mv iRequestTi meout = 30 000; | |
| 65 | ||
| 66 | public static fi nal String VA_OID = "2.16.840. 1.113883.4 .349"; | |
| 67 | ||
| 68 | privat e static S ecureRando m random = null; | |
| 69 | ||
| 70 | static { | |
| 71 | ra ndom = new SecureRan dom(); | |
| 72 | } | |
| 73 | ||
| 74 | privat e VAIdM mv iService = null; | |
| 75 | ||
| 76 | protec ted void i nitializeP roperties( DataQuery dataQuery) | |
| 77 | { | |
| 78 | tr y { | |
| 79 | String c onnectionF ilename = dataQuery. getPropert y("connect ionFilenam e"); | |
| 80 | String c onnection = dataQuer y.getPrope rty("conne ction"); | |
| 81 | Properti es propert iesCollect ion = Prop ertiesColl ectionFact ory.getPro pertiesCol lection(co nnectionFi lename); | |
| 82 | connecti onProperti es = (Prop erties) pr opertiesCo llection.g et(connect ion); | |
| 83 | ||
| 84 | logger.d ebug("conn props {} :", connec tionProper ties); | |
| 85 | ||
| 86 | wsdlURL = connecti onProperti es.getProp erty("wsdl URL"); | |
| 87 | ||
| 88 | logger.d ebug("wsdl {} :", ws dlURL); | |
| 89 | ||
| 90 | processi ngCodeStr = connecti onProperti es.getProp erty("proc essingCode "); | |
| 91 | mviSiteK ey1301 = c onnectionP roperties. getPropert y("mviSite Key1301"); | |
| 92 | mviSiteK ey1302 = c onnectionP roperties. getPropert y("mviSite Key1302"); | |
| 93 | mviSiteK ey1305 = c onnectionP roperties. getPropert y("mviSite Key1305"); | |
| 94 | mviSiteK ey1309 = c onnectionP roperties. getPropert y("mviSite Key1309"); | |
| 95 | try { | |
| 96 | mviR etryLimit = parseInt (connectio nPropertie s.getPrope rty("mviRe tryLimit") ); | |
| 97 | mviC onnectTime out = pars eInt(conne ctionPrope rties.getP roperty("m viConnectT imeout")); | |
| 98 | mviR equestTime out = pars eInt(conne ctionPrope rties.getP roperty("m viRequestT imeout")); | |
| 99 | } | |
| 100 | catch (N umberForma tException nfe) { | |
| 101 | logg er.error(" Could not get MVI ti meout prop erties, pr oceeding w ith defaul ts."); | |
| 102 | } | |
| 103 | ||
| 104 | logger.d ebug("Site keys for mviSiteKey 1301 = {}, mviSiteKe y1305 = {} and mviS iteKey1309 = {} ", n ew Object[ ]{mviSiteK ey1301, mv iSiteKey13 05, mviSit eKey1309}) ; | |
| 105 | } | |
| 106 | ca tch (Excep tion ex) { | |
| 107 | throw ne w DataAdap terExcepti on(ex); | |
| 108 | } | |
| 109 | } | |
| 110 | ||
| 111 | protec ted synchr onized VAI dMPort get VAIdMPort( String mvi ServiceWSD L) | |
| 112 | { | |
| 113 | if (mviServi ce == null ) { | |
| 114 | try { | |
| 115 | mviService = new VAI dM(new URL (mviServic eWSDL), ne w QName("h ttp:// URL . DNS ", "VAIdM" )); | |
| 116 | mviS ervice.set HandlerRes olver(new SOAPHandle rResolver( true)); | |
| 117 | } | |
| 118 | catch (E xception e ) { | |
| 119 | thro w new Data AdapterExc eption("Er ror gettin g MVI Serv ice - VAId MPort.", e ); | |
| 120 | } | |
| 121 | } | |
| 122 | re turn mviSe rvice.getV AIdMPort() ; | |
| 123 | } | |
| 124 | ||
| 125 | protec ted II cre ateMessage Id(II id) | |
| 126 | { | |
| 127 | if (id == nu ll) { | |
| 128 | id = new II(); | |
| 129 | } | |
| 130 | id .setRoot(" 2.16.840.1 .113883.3. 933"); // VA OID | |
| 131 | ||
| 132 | // if partne r passed i n a messag e id then just use i t, otherwi se | |
| 133 | // generate one. | |
| 134 | if (id.getEx tension() == null || id.getExt ension().t rim().isEm pty()) { | |
| 135 | id.setEx tension("M CID-" + cr eateCreati onTimeStri ng() + "-" + random. nextLong() ); | |
| 136 | } | |
| 137 | ||
| 138 | lo gger.debug ("message id {} :", id); | |
| 139 | ||
| 140 | re turn id; | |
| 141 | } | |
| 142 | ||
| 143 | privat e String c reateCreat ionTimeStr ing() | |
| 144 | { | |
| 145 | // Create ti mestamp | |
| 146 | St ring times tamp = ""; | |
| 147 | tr y { | |
| 148 | Date now = new Dat e(); | |
| 149 | SimpleDa teFormat f ormatter = new Simpl eDateForma t("yyyyMMd dHHmmss"); | |
| 150 | formatte r.setTimeZ one(TimeZo ne.getTime Zone("UTC" )); | |
| 151 | timestam p = format ter.format (now); | |
| 152 | ||
| 153 | logger.d ebug("time stamp {} : ", timesta mp); | |
| 154 | } | |
| 155 | ca tch (Excep tion e) { | |
| 156 | logger.e rror("erro r message ", e); | |
| 157 | throw ne w DataAdap terExcepti on("Except ion when c reating XM LGregorian Date", e) ; | |
| 158 | } | |
| 159 | ||
| 160 | re turn times tamp; | |
| 161 | } | |
| 162 | ||
| 163 | protec ted TSExpl icit creat eCreationT ime() | |
| 164 | { | |
| 165 | // Set up th e creation time stri ng | |
| 166 | TS Explicit c reationTim e = new TS Explicit() ; | |
| 167 | cr eationTime .setValue( createCrea tionTimeSt ring()); | |
| 168 | ||
| 169 | re turn creat ionTime; | |
| 170 | } | |
| 171 | ||
| 172 | protec ted MCCIMT 000100UV01 Receiver c reateRecei ver() | |
| 173 | { | |
| 174 | // Set the r eceiver | |
| 175 | MC CIMT000100 UV01Receiv er receive r = new MC CIMT000100 UV01Receiv er(); | |
| 176 | re ceiver.set TypeCode(C ommunicati onFunction Type.RCV); | |
| 177 | ||
| 178 | MC CIMT000100 UV01Device receiverD evice = ne w MCCIMT00 0100UV01De vice(); | |
| 179 | re ceiverDevi ce.setDete rminerCode ("INSTANCE "); // HL7 Constants. RECEIVER_D ETERMINER_ CODE | |
| 180 | re ceiverDevi ce.setClas sCode(Enti tyClassDev ice.DEV); | |
| 181 | ||
| 182 | II receiverI d = new II (); | |
| 183 | re ceiverId.s etRoot("2. 16.840.1.1 13883.3.36 4"); // VA OID | |
| 184 | re ceiverDevi ce.getId() .add(recei verId); | |
| 185 | re ceiver.set Device(rec eiverDevic e); | |
| 186 | ||
| 187 | re turn recei ver; | |
| 188 | } | |
| 189 | ||
| 190 | protec ted MCCIMT 000100UV01 Sender cre ateSender( String mvi SiteKey, S tring home CommunityO ID, String facilityN umber) | |
| 191 | { | |
| 192 | Ob jectFactor y objFacto ry = new O bjectFacto ry(); | |
| 193 | ||
| 194 | // added tri m since ha d issue wi th extrane ous charac ter in Ada pter DB | |
| 195 | // facility table. | |
| 196 | fa cilityNumb er = facil ityNumber. trim(); | |
| 197 | // perhaps t he VA's re cord in Ad apter DB f acility ta ble should use | |
| 198 | // "200NH".. the NHIE/E xchange's site key.. .but for n ow just ma p here. | |
| 199 | fa cilityNumb er = (faci lityNumber .equals("V A")) ? mvi SiteKey : facilityNu mber; | |
| 200 | ||
| 201 | // Set the s ender | |
| 202 | MC CIMT000100 UV01Sender sender = new MCCIMT 000100UV01 Sender(); | |
| 203 | se nder.setTy peCode(Com munication FunctionTy pe.SND); | |
| 204 | ||
| 205 | MC CIMT000100 UV01Device senderDev ice = new MCCIMT0001 00UV01Devi ce(); | |
| 206 | se nderDevice .setDeterm inerCode(" INSTANCE") ; // HL7Co nstants.SE NDER_DETER MINER_CODE | |
| 207 | se nderDevice .setClassC ode(Entity ClassDevic e.DEV); | |
| 208 | ||
| 209 | II senderDev iceId = ne w II(); | |
| 210 | se nderDevice Id.setRoot (VA_OID); | |
| 211 | // senderDev iceId.setE xtension(m viSiteKey) ; // SITEK EY_OBTAINE D_FROM_MVI | |
| 212 | se nderDevice Id.setExte nsion(faci lityNumber ); // Per feedback f rom | |
| 213 | // MVI/Danny Reed, we | |
| 214 | // should se nd the | |
| 215 | // partner's | |
| 216 | // station#/ facility | |
| 217 | // number... rather tha n | |
| 218 | // the Excha nge's site | |
| 219 | // key. | |
| 220 | se nderDevice .getId().a dd(senderD eviceId); | |
| 221 | ||
| 222 | // Setup Sen der -> Dev ice -> Age nt | |
| 223 | MC CIMT000100 UV01Agent senderDevi ceAgent = new MCCIMT 000100UV01 Agent(); | |
| 224 | se nderDevice Agent.getC lassCode() .add("AGNT "); | |
| 225 | MC CIMT000100 UV01Organi zation rep resentedOr g = new MC CIMT000100 UV01Organi zation(); | |
| 226 | re presentedO rg.setClas sCode("ORG "); | |
| 227 | re presentedO rg.setDete rminerCode ("INSTANCE "); | |
| 228 | ||
| 229 | II represent edOrgId = new II(); | |
| 230 | re presentedO rgId.setRo ot(homeCom munityOID) ; | |
| 231 | re presentedO rgId.setEx tension(fa cilityNumb er); | |
| 232 | re presentedO rg.getId() .add(repre sentedOrgI d); | |
| 233 | ||
| 234 | JA XBElement jaxbElemen tAgent = o bjFactory. createMCCI MT000100UV 01DeviceAs Agent(send erDeviceAg ent); | |
| 235 | JA XBElement jaxbElemen tRepresent edOrg = ob jFactory.c reateMCCIM T000100UV0 1AgentRepr esentedOrg anization( represente dOrg); | |
| 236 | ||
| 237 | se nderDevice Agent.setR epresented Organizati on(jaxbEle mentRepres entedOrg); | |
| 238 | se nderDevice .setAsAgen t(jaxbElem entAgent); | |
| 239 | se nder.setDe vice(sende rDevice); | |
| 240 | ||
| 241 | re turn sende r; | |
| 242 | } | |
| 243 | ||
| 244 | protec ted MFMIMT 700701UV01 DataEntere r createDa taEnterer1 (Assertion Type asser tion) | |
| 245 | { | |
| 246 | MF MIMT700701 UV01DataEn terer data Enterer = new MFMIMT 700701UV01 DataEntere r(); | |
| 247 | th is.createD ataEnterer (assertion , dataEnte rer); | |
| 248 | re turn dataE nterer; | |
| 249 | } | |
| 250 | ||
| 251 | protec ted QUQIMT 021001UV01 DataEntere r createDa taEnterer2 (Assertion Type asser tion) | |
| 252 | { | |
| 253 | QU QIMT021001 UV01DataEn terer data Enterer = new QUQIMT 021001UV01 DataEntere r(); | |
| 254 | th is.createD ataEnterer (assertion , dataEnte rer); | |
| 255 | re turn dataE nterer; | |
| 256 | } | |
| 257 | ||
| 258 | privat e void cre ateDataEnt erer(Asser tionType a ssertion, Object dat aEntererOb j) | |
| 259 | { | |
| 260 | Ob jectFactor y objFacto ry = new O bjectFacto ry(); | |
| 261 | ||
| 262 | CO CTMT090100 UV01Assign edPerson a ssignedPer son = new COCTMT0901 00UV01Assi gnedPerson (); | |
| 263 | as signedPers on.setClas sCode("ASS IGNED"); | |
| 264 | II assignedP ersonId = new II(); | |
| 265 | as signedPers onId.setRo ot("2.16.8 40.1.11388 3.3.2017") ; | |
| 266 | as signedPers onId.setEx tension("1 22"); | |
| 267 | as signedPers on.getId() .add(assig nedPersonI d); | |
| 268 | ||
| 269 | CO CTMT090100 UV01Person person = new COCTMT 090100UV01 Person(); | |
| 270 | pe rson.setDe terminerCo de("INSTAN CE"); | |
| 271 | pe rson.getCl assCode(). add("PSN") ; | |
| 272 | EN Explicit n ame = new ENExplicit (); | |
| 273 | ||
| 274 | St ring famil yNameStr = null; | |
| 275 | if (assertio n != null && asserti on.getUser Info() != null && as sertion.ge tUserInfo( ).getPerso nName() != null && N ullChecker .isNotNull OrEmpty(as sertion.ge tUserInfo( ).getPerso nName().ge tFamilyNam e())) { | |
| 276 | familyNa meStr = as sertion.ge tUserInfo( ).getPerso nName().ge tFamilyNam e(); | |
| 277 | } | |
| 278 | el se { | |
| 279 | familyNa meStr = "N one Provid ed"; | |
| 280 | } | |
| 281 | En ExplicitFa mily famil yName = ne w EnExplic itFamily() ; | |
| 282 | fa milyName.s etContent( familyName Str); | |
| 283 | JA XBElement jaxbFamily Name = obj Factory.cr eateENExpl icitFamily (familyNam e); | |
| 284 | ||
| 285 | St ring given NameStr = null; | |
| 286 | if (assertio n != null && asserti on.getUser Info() != null && as sertion.ge tUserInfo( ).getPerso nName() != null && N ullChecker .isNotNull OrEmpty(as sertion.ge tUserInfo( ).getPerso nName().ge tGivenName ())) { | |
| 287 | givenNam eStr = ass ertion.get UserInfo() .getPerson Name().get GivenName( ); | |
| 288 | } | |
| 289 | el se { | |
| 290 | givenNam eStr = "No ne Provide d"; | |
| 291 | } | |
| 292 | ||
| 293 | En ExplicitGi ven givenN ame = new EnExplicit Given(); | |
| 294 | gi venName.se tContent(g ivenNameSt r); | |
| 295 | JA XBElement jaxbGivenN ame = objF actory.cre ateENExpli citGiven(g ivenName); | |
| 296 | ||
| 297 | na me.getCont ent().add( jaxbGivenN ame); | |
| 298 | na me.getCont ent().add( jaxbFamily Name); | |
| 299 | pe rson.getNa me().add(n ame); | |
| 300 | JA XBElement jaxbElemen tPerson = objFactory .createCOC TMT090100U V01Assigne dPersonAss ignedPerso n(person); | |
| 301 | ||
| 302 | as signedPers on.setAssi gnedPerson (jaxbEleme ntPerson); | |
| 303 | ||
| 304 | if (dataEnte rerObj ins tanceof MF MIMT700701 UV01DataEn terer) { | |
| 305 | ((MFMIMT 700701UV01 DataEntere r) dataEnt ererObj).s etContextC ontrolCode ("AP"); | |
| 306 | ((MFMIMT 700701UV01 DataEntere r) dataEnt ererObj).g etTypeCode ().add("EN T"); | |
| 307 | ((MFMIMT 700701UV01 DataEntere r) dataEnt ererObj).s etAssigned Person(ass ignedPerso n); | |
| 308 | } | |
| 309 | el se if (dat aEntererOb j instance of QUQIMT0 21001UV01D ataEnterer ) { | |
| 310 | ((QUQIMT 021001UV01 DataEntere r) dataEnt ererObj).s etContextC ontrolCode ("AP"); | |
| 311 | ((QUQIMT 021001UV01 DataEntere r) dataEnt ererObj).g etTypeCode ().add("EN T"); | |
| 312 | ((QUQIMT 021001UV01 DataEntere r) dataEnt ererObj).s etAssigned Person(ass ignedPerso n); | |
| 313 | } | |
| 314 | ||
| 315 | } | |
| 316 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.