Produced by Araxis Merge on 6/9/2017 3:50:56 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 | Fri Jun 9 19:50:56 2017 UTC | ||
| 2 | eHealth_Exch (eHealth Exchange Enhancements) Build 3 docs & code_May_2017.zip\VAP_CIF_CODE0502.zip\VAP_CIF_CODE0502\VAP_CIF_CODE0502\nvap-server\src\main\java\gov\va\nvap\server\endpoint\adapter\doc | AdapterDocQueryEndpoint.java | Fri Apr 21 20:15:58 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 276 |
| 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 | /* | |||||
| 2 | * To chan ge this te mplate, ch oose Tools | Templat es | |||||
| 3 | * and ope n the temp late in th e editor. | |||||
| 4 | */ | |||||
| 5 | ||||||
| 6 | package go v.va.nvap. server.end point.adap ter.doc; | |||||
| 7 | ||||||
| 8 | import gov .hhs.fha.n hinc.commo n.nhinccom monadapter .Respondin gGatewayCr ossGateway QueryReque st; | |||||
| 9 | import gov .va.nvap.c ommon.vali dation.Nul lChecker; | |||||
| 10 | ||||||
| 11 | import jav a.text.Sim pleDateFor mat; | |||||
| 12 | import jav a.util.Arr ayList; | |||||
| 13 | import jav a.util.Dat e; | |||||
| 14 | import jav a.util.Has hMap; | |||||
| 15 | import jav a.util.Lis t; | |||||
| 16 | import jav a.util.Map ; | |||||
| 17 | ||||||
| 18 | import jav ax.xml.bin d.JAXBElem ent; | |||||
| 19 | ||||||
| 20 | import oas is.names.t c.ebxml_re grep.xsd.q uery._3.Ad hocQueryRe quest; | |||||
| 21 | import oas is.names.t c.ebxml_re grep.xsd.q uery._3.Ad hocQueryRe sponse; | |||||
| 22 | import oas is.names.t c.ebxml_re grep.xsd.q uery._3.Re sponseOpti onType; | |||||
| 23 | import oas is.names.t c.ebxml_re grep.xsd.r im._3.Adho cQueryType ; | |||||
| 24 | import oas is.names.t c.ebxml_re grep.xsd.r im._3.Exte rnalIdenti fierType; | |||||
| 25 | import oas is.names.t c.ebxml_re grep.xsd.r im._3.Extr insicObjec tType; | |||||
| 26 | import oas is.names.t c.ebxml_re grep.xsd.r im._3.Iden tifiableTy pe; | |||||
| 27 | import oas is.names.t c.ebxml_re grep.xsd.r im._3.Regi stryObject ListType; | |||||
| 28 | import oas is.names.t c.ebxml_re grep.xsd.r im._3.Slot Type1; | |||||
| 29 | import oas is.names.t c.ebxml_re grep.xsd.r im._3.Valu eListType; | |||||
| 30 | ||||||
| 31 | import org .springfra mework.bea ns.factory .annotatio n.Required ; | |||||
| 32 | import org .springfra mework.ws. client.cor e.WebServi ceTemplate ; | |||||
| 33 | ||||||
| 34 | /** | |||||
| 35 | * The end point to c all the ad pater's we bservice. | |||||
| 36 | * | |||||
| 37 | * @author Asha Amri traj | |||||
| 38 | */ | |||||
| 39 | public cla ss Adapter DocQueryEn dpoint { | |||||
| 40 | public static fi nal String C_CDA_CLA SS_CODE = "34133-9-C "; | |||||
| 41 | ||||||
| 42 | privat e static f inal Strin g EBXML_DO CENTRY_CLA SS_CODE = "$XDSDocum entEntryCl assCode"; | |||||
| 43 | pr ivate stat ic final S tring EBXM L_DOCENTRY _CLASS_COD E_SCHEME = "$XDSDocu mentEntryC lassCodeSc heme"; | |||||
| 44 | pr ivate stat ic final S tring EBXM L_DOCENTRY _PATIENT_I D = "$XDSD ocumentEnt ryPatientI d"; | |||||
| 45 | pr ivate stat ic final S tring EBXM L_DOCENTRY _SERVICE_S TART_TIME_ FROM = "$X DSDocument EntryServi ceStartTim eFrom"; | |||||
| 46 | pr ivate stat ic final S tring EBXM L_DOCENTRY _SERVICE_S TOP_TIME_T O = "$XDSD ocumentEnt ryServiceS topTimeTo" ; | |||||
| 47 | pr ivate stat ic final S tring EBXM L_DOCENTRY _STATUS = "$XDSDocum entEntrySt atus"; | |||||
| 48 | ||||||
| 49 | // We need t o be able to do a se arch using AdhocQuer yRequest p arameters, but | |||||
| 50 | // XDS.b doe s not have a search parameter slot name defined fo r reposito ry | |||||
| 51 | // ID and do cument ID. So we had to create our own c ustom ones . | |||||
| 52 | // --------- ---------- ---------- ---------- ---------- ---------- ---------- ------- | |||||
| 53 | ||||||
| 54 | pr ivate stat ic final S tring EBXM L_RESPONSE _DOCID_NAM E = "XDSDo cumentEntr y.uniqueId "; | |||||
| 55 | pr ivate stat ic final S tring EBXM L_RESPONSE _REPOSITOR Y_UNIQUE_I D_SLOTNAME = "reposi toryUnique Id"; | |||||
| 56 | pr ivate stat ic final S tring EBXM L_RESPONSE _SIZE_SLOT NAME = "si ze"; | |||||
| 57 | ||||||
| 58 | privat e WebServi ceTemplate adapterDo cQueryServ iceTemplat e; | |||||
| 59 | ||||||
| 60 | pr ivate Stri ng homeCom munityOid; | |||||
| 61 | pr ivate Stri ng homeCom munityOidE xt; | |||||
| 62 | ||||||
| 63 | pr ivate Stri ng extract DocumentNa me(final E xtrinsicOb jectType e ot) { | |||||
| 64 | Stri ng ret = n ull; | |||||
| 65 | ||||||
| 66 | if ( !NullCheck er.isNullO rEmpty(eot .getName() ) | |||||
| 67 | && !Null Checker.is NullOrEmpt y(eot.getN ame() | |||||
| 68 | .g etLocalize dString()) | |||||
| 69 | && !Null Checker.is NullOrEmpt y(eot.getN ame() | |||||
| 70 | .g etLocalize dString(). get(0))) { | |||||
| 71 | ret = eot.getNam e().getLoc alizedStri ng().get(0 ).getValue (); | |||||
| 72 | } | |||||
| 73 | ||||||
| 74 | retu rn ret; | |||||
| 75 | } | |||||
| 76 | ||||||
| 77 | pr ivate Stri ng extract ExternalId entifier( | |||||
| 78 | final List<Exter nalIdentif ierType> e xternalIds , final St ring name) { | |||||
| 79 | Stri ng ret = n ull; | |||||
| 80 | ||||||
| 81 | for (final Ext ernalIdent ifierType eit : exte rnalIds) { | |||||
| 82 | if (!N ullChecker .isNullOrE mpty(eit.g etName()) | |||||
| 83 | && !NullCh ecker.isNu llOrEmpty( eit.getNam e() | |||||
| 84 | .get LocalizedS tring()) | |||||
| 85 | && !NullCh ecker.isNu llOrEmpty( eit.getNam e() | |||||
| 86 | .get LocalizedS tring().ge t(0)) | |||||
| 87 | && name.eq ualsIgnore Case(eit.g etName().g etLocalize dString() | |||||
| 88 | .get (0).getVal ue())) { | |||||
| 89 | ret = ei t.getValue (); | |||||
| 90 | break; | |||||
| 91 | } | |||||
| 92 | } | |||||
| 93 | ||||||
| 94 | retu rn ret; | |||||
| 95 | } | |||||
| 96 | ||||||
| 97 | /* * | |||||
| 98 | * Extract t he Reposit ory ID fro m the slot s | |||||
| 99 | * | |||||
| 100 | * @param sl ots | |||||
| 101 | * The slot s to be se arched. | |||||
| 102 | * @return T he Reposit ory Id. | |||||
| 103 | * / | |||||
| 104 | pr ivate Stri ng extract Repository Id(final L ist<SlotTy pe1> slots ) { | |||||
| 105 | Stri ng reposit oryId = nu ll; | |||||
| 106 | fina l List<Str ing> slotV alues = th is | |||||
| 107 | .extract SlotValues ( | |||||
| 108 | sl ots, | |||||
| 109 | Ad apterDocQu eryEndpoin t.EBXML_RE SPONSE_REP OSITORY_UN IQUE_ID_SL OTNAME); | |||||
| 110 | if ( (slotValue s != null) && (!slot Values.isE mpty())) { | |||||
| 111 | // We should onl y have one - so use the first one. | |||||
| 112 | // --- ---------- ---------- ---------- ---------- ------ | |||||
| 113 | reposi toryId = s lotValues. get(0).tri m(); | |||||
| 114 | } | |||||
| 115 | retu rn reposit oryId; | |||||
| 116 | } | |||||
| 117 | ||||||
| 118 | pr ivate Stri ng extract Size(final List<Slot Type1> slo ts) { | |||||
| 119 | Stri ng ret = n ull; | |||||
| 120 | fina l List<Str ing> slotV alues = th is.extract SlotValues (slots, | |||||
| 121 | AdapterD ocQueryEnd point.EBXM L_RESPONSE _SIZE_SLOT NAME); | |||||
| 122 | if ( !NullCheck er.isNullO rEmpty(slo tValues)) { | |||||
| 123 | ret = slotValues .get(0).tr im(); | |||||
| 124 | } | |||||
| 125 | retu rn ret; | |||||
| 126 | } | |||||
| 127 | ||||||
| 128 | pr ivate List <String> e xtractSlot Values(fin al List<Sl otType1> s lots, | |||||
| 129 | final String slo tName) { | |||||
| 130 | List <String> r eturnValue s = null; | |||||
| 131 | for (final Slo tType1 slo t : slots) { | |||||
| 132 | if ((s lot.getNam e() != nul l) && (slo t.getName( ).length() > 0) | |||||
| 133 | && (slot.g etValueLis t() != nul l) | |||||
| 134 | && (slot.g etValueLis t().getVal ue() != nu ll) | |||||
| 135 | && (slot.g etValueLis t().getVal ue().size( ) > 0)) { | |||||
| 136 | ||||||
| 137 | if (slot .getName() .equals(sl otName)) { | |||||
| 138 | final Valu eListType valueListT ype = slot .getValueL ist(); | |||||
| 139 | final List <String> s lotValues = valueLis tType.getV alue(); | |||||
| 140 | returnValu es = new A rrayList<S tring>(); | |||||
| 141 | for (final String sl otValue : slotValues ) { | |||||
| 142 | re turnValues .add(slotV alue); | |||||
| 143 | } | |||||
| 144 | } | |||||
| 145 | } | |||||
| 146 | ||||||
| 147 | } | |||||
| 148 | retu rn returnV alues; | |||||
| 149 | } | |||||
| 150 | ||||||
| 151 | pu blic List< Map<String , String>> getDocume nts(final String pat ientId, | |||||
| 152 | final Date fromD ate, final Date toDa te) | |||||
| 153 | { | |||||
| 154 | retu rn getDocu mentsByCla ssCode(pat ientId, fr omDate, to Date, "341 33-9"); | |||||
| 155 | } | |||||
| 156 | ||||||
| 157 | pu blic List< Map<String , String>> getDocume ntsByClass Code(final String pa tientId, | |||||
| 158 | final Date fromD ate, final Date toDa te, String classCode Value) { | |||||
| 159 | // C onstrcut t he query | |||||
| 160 | fina l List<Map <String, S tring>> re t = new Ar rayList<Ma p<String, String>>() ; | |||||
| 161 | fina l Respondi ngGatewayC rossGatewa yQueryRequ est reques t = new Re spondingGa tewayCross GatewayQue ryRequest( ); | |||||
| 162 | fina l String c lassCodeVa lues = cla ssCodeValu e; | |||||
| 163 | fina l String c lassCodeSc heme = "2. 16.840.1.1 13883.6.1" ; | |||||
| 164 | fina l oasis.na mes.tc.ebx ml_regrep. xsd.query. _3.ObjectF actory que ryObjFact = new oasi s.names.tc .ebxml_reg rep.xsd.qu ery._3.Obj ectFactory (); | |||||
| 165 | fina l AdhocQue ryRequest queryReque st = query ObjFact | |||||
| 166 | .createA dhocQueryR equest(); | |||||
| 167 | requ est.setAdh ocQueryReq uest(query Request); | |||||
| 168 | // S et the opt ions | |||||
| 169 | fina l Response OptionType rot = new ResponseO ptionType( ); | |||||
| 170 | rot. setReturnT ype("LeafC lass"); | |||||
| 171 | rot. setReturnC omposedObj ects(true) ; | |||||
| 172 | quer yRequest.s etResponse Option(rot ); | |||||
| 173 | // C reate the AdhocQuery | |||||
| 174 | fina l oasis.na mes.tc.ebx ml_regrep. xsd.rim._3 .ObjectFac tory rimOb jFact = ne w oasis.na mes.tc.ebx ml_regrep. xsd.rim._3 .ObjectFac tory(); | |||||
| 175 | fina l AdhocQue ryType que ry = rimOb jFact.crea teAdhocQue ryType(); | |||||
| 176 | quer yRequest.s etAdhocQue ry(query); | |||||
| 177 | ||||||
| 178 | quer y.setHome( this.homeC ommunityOi dExt); | |||||
| 179 | quer y.setId("u rn:uuid:14 d4debf-8f9 7-4251-9a7 4-a90016b0 af0d"); | |||||
| 180 | ||||||
| 181 | fina l SimpleDa teFormat f ormatter = new Simpl eDateForma t( | |||||
| 182 | "yyyyMMd dhhmmss"); | |||||
| 183 | ||||||
| 184 | fina l List<Slo tType1> sl ots = quer y.getSlot( ); | |||||
| 185 | slot s.add(this .loadSlot( patientId + "^^^&" + this.home CommunityO id | |||||
| 186 | + "&ISO" , AdapterD ocQueryEnd point.EBXM L_DOCENTRY _PATIENT_I D)); | |||||
| 187 | slot s.add(this .loadSlot( classCodeV alues, | |||||
| 188 | AdapterD ocQueryEnd point.EBXM L_DOCENTRY _CLASS_COD E)); | |||||
| 189 | slot s.add(this .loadSlot( classCodeS cheme, | |||||
| 190 | AdapterD ocQueryEnd point.EBXM L_DOCENTRY _CLASS_COD E_SCHEME)) ; | |||||
| 191 | slot s.add(this | |||||
| 192 | .loadSlo t( | |||||
| 193 | "( 'urn:ihe:i ti:2010:St atusType:D eferredCre ation', 'u rn:oasis:n ames:tc:eb xmlregrep: StatusType :Approved' )", | |||||
| 194 | Ad apterDocQu eryEndpoin t.EBXML_DO CENTRY_STA TUS)); | |||||
| 195 | if ( fromDate ! = null) { | |||||
| 196 | final String ser viceStartT imeFrom = formatter. format(fro mDate); | |||||
| 197 | slots. add(this | |||||
| 198 | .loadSlot( | |||||
| 199 | serv iceStartTi meFrom, | |||||
| 200 | Adap terDocQuer yEndpoint. EBXML_DOCE NTRY_SERVI CE_START_T IME_FROM)) ; | |||||
| 201 | } | |||||
| 202 | if ( toDate != null) { | |||||
| 203 | final String ser viceStopTi meTo = for matter.for mat(toDate ); | |||||
| 204 | slots. add(this | |||||
| 205 | .loadSlot( | |||||
| 206 | serv iceStopTim eTo, | |||||
| 207 | Adap terDocQuer yEndpoint. EBXML_DOCE NTRY_SERVI CE_STOP_TI ME_TO)); | |||||
| 208 | } | |||||
| 209 | // C all the ad apter's qu ery webser ivce | |||||
| 210 | fina l AdhocQue ryResponse response = (AdhocQu eryRespons e) this.ad apterDocQu eryService Template | |||||
| 211 | .marshal SendAndRec eive(reque st); | |||||
| 212 | ||||||
| 213 | fina l Registry ObjectList Type regis tryObjectL istType = response | |||||
| 214 | .getRegi stryObject List(); | |||||
| 215 | if ( registryOb jectListTy pe != null ) { | |||||
| 216 | final List<JAXBE lement<? e xtends Ide ntifiableT ype>> iden tifiable = registryO bjectListT ype | |||||
| 217 | .getIdenti fiable(); | |||||
| 218 | for (f inal JAXBE lement<? e xtends Ide ntifiableT ype> i : i dentifiabl e) { | |||||
| 219 | if (i.ge tValue() i nstanceof ExtrinsicO bjectType) { | |||||
| 220 | final Extr insicObjec tType eot = (Extrins icObjectTy pe) i | |||||
| 221 | .get Value(); | |||||
| 222 | final Stri ng homeCom munityId = eot.getHo me(); | |||||
| 223 | final Stri ng reposit oryId = th is.extract Repository Id(eot | |||||
| 224 | .get Slot()); | |||||
| 225 | final Stri ng documen tUniqueId = this | |||||
| 226 | .ext ractExtern alIdentifi er( | |||||
| 227 | eot.getE xternalIde ntifier(), | |||||
| 228 | AdapterD ocQueryEnd point.EBXM L_RESPONSE _DOCID_NAM E); | |||||
| 229 | final Stri ng documen tName = th is.extract DocumentNa me(eot); | |||||
| 230 | final Stri ng size = this.extra ctSize(eot .getSlot() ); | |||||
| 231 | ||||||
| 232 | // Put the fields in to the res ponse | |||||
| 233 | final Hash Map<String , String> doc = new HashMap<St ring, Stri ng>(); | |||||
| 234 | doc.put("h omeCommuni tyId", hom eCommunity Id); | |||||
| 235 | doc.put("d ocumentRep ositoryId" , reposito ryId); | |||||
| 236 | doc.put("d ocumentUni queId", do cumentUniq ueId); | |||||
| 237 | doc.put("d ocumentNam e", docume ntName); | |||||
| 238 | doc.put("s ize", size ); | |||||
| 239 | doc.put("s ource", ho meCommunit yId); | |||||
| 240 | ret.add(do c); | |||||
| 241 | } | |||||
| 242 | } | |||||
| 243 | } | |||||
| 244 | // S end the re turn respo nse | |||||
| 245 | retu rn ret; | |||||
| 246 | } | |||||
| 247 | ||||||
| 248 | /* * | |||||
| 249 | * Create sl ots. | |||||
| 250 | * / | |||||
| 251 | pr ivate Slot Type1 load Slot(final String va lue, final String sl otName) { | |||||
| 252 | fina l ValueLis tType valu eListType = new Valu eListType( ); | |||||
| 253 | valu eListType. getValue() .add(value ); | |||||
| 254 | fina l SlotType 1 slot = n ew SlotTyp e1(); | |||||
| 255 | slot .setValueL ist(valueL istType); | |||||
| 256 | slot .setName(s lotName); | |||||
| 257 | ||||||
| 258 | retu rn slot; | |||||
| 259 | } | |||||
| 260 | ||||||
| 261 | @R equired | |||||
| 262 | pu blic void setAdapter DocQuerySe rviceTempl ate( | |||||
| 263 | final WebService Template a dapterDocQ ueryServic eTemplate) { | |||||
| 264 | this .adapterDo cQueryServ iceTemplat e = adapte rDocQueryS erviceTemp late; | |||||
| 265 | } | |||||
| 266 | ||||||
| 267 | @R equired | |||||
| 268 | pu blic void setHomeCom munityOid( final Stri ng homeCom munityOid) { | |||||
| 269 | this .homeCommu nityOid = homeCommun ityOid; | |||||
| 270 | } | |||||
| 271 | ||||||
| 272 | @R equired | |||||
| 273 | pu blic void setHomeCom munityOidE xt(final S tring home CommunityO idExt) { | |||||
| 274 | this .homeCommu nityOidExt = homeCom munityOidE xt; | |||||
| 275 | } | |||||
| 276 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.