Produced by Araxis Merge on 6/9/2017 3:50:36 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:36 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-mock\src\main\java\gov\va\nvap\mock\endpoint\adapter | MockAdapterDocQueryPortImpl.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 | 1087 |
| 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.nvap. mock.endpo int.adapte r; | |||||
| 2 | ||||||
| 3 | import gov .hhs.fha.n hinc.commo n.nhinccom monadapter .Respondin gGatewayCr ossGateway QueryReque st; | |||||
| 4 | import gov .va.nvap.c ommon.tran sformer.Tr ansformerE xception; | |||||
| 5 | import gov .va.nvap.c ommon.tran sformer.xm l.XMLToStr ing; | |||||
| 6 | import gov .va.nvap.c ommon.vali dation.Nul lChecker; | |||||
| 7 | ||||||
| 8 | import jav a.io.IOExc eption; | |||||
| 9 | import jav a.text.Sim pleDateFor mat; | |||||
| 10 | import jav a.util.Arr ayList; | |||||
| 11 | import jav a.util.Arr ays; | |||||
| 12 | import jav a.util.Dat e; | |||||
| 13 | import jav a.util.Has hMap; | |||||
| 14 | import jav a.util.Lis t; | |||||
| 15 | import jav a.util.Map ; | |||||
| 16 | import jav a.util.Tim eZone; | |||||
| 17 | import jav a.util.UUI D; | |||||
| 18 | import jav a.util.log ging.Level ; | |||||
| 19 | import jav a.util.log ging.Logge r; | |||||
| 20 | import jav a.util.reg ex.Matcher ; | |||||
| 21 | import jav a.util.reg ex.Pattern ; | |||||
| 22 | ||||||
| 23 | import jav ax.xml.bin d.JAXBElem ent; | |||||
| 24 | import jav ax.xml.tra nsform.Res ult; | |||||
| 25 | import jav ax.xml.tra nsform.dom .DOMResult ; | |||||
| 26 | ||||||
| 27 | import oas is.names.t c.ebxml_re grep.xsd.q uery._3.Ad hocQueryRe quest; | |||||
| 28 | import oas is.names.t c.ebxml_re grep.xsd.q uery._3.Ad hocQueryRe sponse; | |||||
| 29 | import oas is.names.t c.ebxml_re grep.xsd.r im._3.Adho cQueryType ; | |||||
| 30 | import oas is.names.t c.ebxml_re grep.xsd.r im._3.Clas sification Type; | |||||
| 31 | import oas is.names.t c.ebxml_re grep.xsd.r im._3.Exte rnalIdenti fierType; | |||||
| 32 | import oas is.names.t c.ebxml_re grep.xsd.r im._3.Extr insicObjec tType; | |||||
| 33 | import oas is.names.t c.ebxml_re grep.xsd.r im._3.Iden tifiableTy pe; | |||||
| 34 | import oas is.names.t c.ebxml_re grep.xsd.r im._3.Inte rnationalS tringType; | |||||
| 35 | import oas is.names.t c.ebxml_re grep.xsd.r im._3.Loca lizedStrin gType; | |||||
| 36 | import oas is.names.t c.ebxml_re grep.xsd.r im._3.Regi stryObject ListType; | |||||
| 37 | import oas is.names.t c.ebxml_re grep.xsd.r im._3.Slot Type1; | |||||
| 38 | import oas is.names.t c.ebxml_re grep.xsd.r im._3.Valu eListType; | |||||
| 39 | import oas is.names.t c.ebxml_re grep.xsd.r s._3.Regis tryError; | |||||
| 40 | import oas is.names.t c.ebxml_re grep.xsd.r s._3.Regis tryErrorLi st; | |||||
| 41 | ||||||
| 42 | import org .springfra mework.oxm .Marshalle r; | |||||
| 43 | import org .springfra mework.ws. client.cor e.WebServi ceTemplate ; | |||||
| 44 | import org .springfra mework.ws. transport. WebService MessageSen der; | |||||
| 45 | ||||||
| 46 | public cla ss MockAda pterDocQue ryPortImpl extends W ebServiceT emplate { | |||||
| 47 | ||||||
| 48 | st atic priva te final S tring DATE _FORMAT_CR EATION = M ockAdapter DocQueryPo rtImpl.DAT E_FORMAT_F ULL; | |||||
| 49 | st atic priva te final S tring DATE _FORMAT_FU LL = "yyyy MMddHHmmss Z"; | |||||
| 50 | st atic priva te final S tring DATE _FORMAT_SE RVICE = "y yyyMMdd"; | |||||
| 51 | st atic priva te final S tring EBXM L_DOCENTRY _CLASS_COD E = "$XDSD ocumentEnt ryClassCod e"; | |||||
| 52 | st atic priva te final S tring EBXM L_DOCENTRY _CLASS_COD E_SCHEME = "$XDSDocu mentEntryC lassCodeSc heme"; | |||||
| 53 | st atic priva te final S tring EBXM L_DOCENTRY _PATIENT_I D = "$XDSD ocumentEnt ryPatientI d"; | |||||
| 54 | st atic priva te final S tring EBXM L_DOCENTRY _SERVICE_S TART_TIME_ FROM = "$X DSDocument EntryServi ceStartTim eFrom"; | |||||
| 55 | st atic priva te final S tring EBXM L_DOCENTRY _SERVICE_S TOP_TIME_T O = "$XDSD ocumentEnt ryServiceS topTimeTo" ; | |||||
| 56 | st atic priva te final S tring EBXM L_RESPONSE _AUTHOR_CL ASS_SCHEME = "urn:uu id:93606bc f-9494-43e c-9b4e-a77 48d1a838d" ; | |||||
| 57 | st atic priva te final S tring EBXM L_RESPONSE _AUTHOR_IN STITUTION_ SLOTNAME = "authorIn stitution" ; | |||||
| 58 | st atic priva te final S tring EBXM L_RESPONSE _CLASSCODE _CLASS_SCH EME = "urn :uuid:41a5 887f-8865- 4c09-adf7- e362475b14 3a"; | |||||
| 59 | st atic priva te final S tring EBXM L_RESPONSE _CODE_CODE SCHEME_SLO TNAME = "c odingSchem e"; | |||||
| 60 | st atic priva te final S tring EBXM L_RESPONSE _CREATIONT IME_SLOTNA ME = "crea tionTime"; | |||||
| 61 | st atic priva te final S tring EBXM L_RESPONSE _DOCID_IDE NTIFICATIO N_SCHEME = "urn:uuid :2e82c1f6- a085-4c72- 9da3-8640a 32e42ab"; | |||||
| 62 | st atic priva te final S tring EBXM L_RESPONSE _DOCID_NAM E = "XDSDo cumentEntr y.uniqueId "; | |||||
| 63 | st atic priva te final S tring EBXM L_RESPONSE _HASH_SLOT NAME = "ha sh"; | |||||
| 64 | st atic priva te final S tring EBXM L_RESPONSE _PATIENTID _IDENTIFIC ATION_SCHE ME = "urn: uuid:58a6f 841-87b3-4 a3e-92fd-a 8ffeff9842 7"; | |||||
| 65 | st atic priva te final S tring EBXM L_RESPONSE _PATIENTID _NAME = "X DSDocument Entry.pati entId"; | |||||
| 66 | // We need t o be able to do a se arch using AdhocQuer yRequest p arameters, but | |||||
| 67 | // XDS.b doe s not have a search parameter slot name defined fo r reposito ry | |||||
| 68 | // ID and do cument ID. So we had to create our own c ustom ones . | |||||
| 69 | // --------- ---------- ---------- ---------- ---------- ---------- ---------- ------- | |||||
| 70 | st atic priva te final S tring EBXM L_RESPONSE _REPOSITOR Y_UNIQUE_I D_SLOTNAME = "reposi toryUnique Id"; | |||||
| 71 | st atic priva te final S tring EBXM L_RESPONSE _SERVICEST ARTTIME_SL OTNAME = " serviceSta rtTime"; | |||||
| 72 | st atic priva te final S tring EBXM L_RESPONSE _SERVICEST OPTIME_SLO TNAME = "s erviceStop Time"; | |||||
| 73 | st atic priva te final S tring EBXM L_RESPONSE _SIZE_SLOT NAME = "si ze"; | |||||
| 74 | st atic priva te final L ogger logg er = Logge r | |||||
| 75 | .getLo gger(MockA dapterDocQ ueryPortIm pl.class.g etName()); | |||||
| 76 | st atic priva te final S tring REPO SITORY_UNI QUE_ID = " 1"; | |||||
| 77 | // Propertie s file key s | |||||
| 78 | st atic priva te final l ong TWO_YE ARS = 60 * 60 * 24 * 365 * 2 * 1000L; | |||||
| 79 | st atic priva te final S tring XDS_ QUERY_RESP ONSE_EXTRI NSIC_OBJCE CT_OBJECT_ TYPE = "ur n:uuid:7ed ca82f-054d -47f2-a032 -9b2a5b518 6c1"; | |||||
| 80 | st atic priva te final S tring XDS_ QUERY_RESP ONSE_STATU S_FAILURE = "urn:oas is:names:t c:ebxml-re grep:Respo nseStatusT ype:Failur e"; | |||||
| 81 | ||||||
| 82 | st atic priva te final S tring XDS_ QUERY_RESP ONSE_STATU S_SUCCESS = "urn:oas is:names:t c:ebxml-re grep:Respo nseStatusT ype:Succes s"; | |||||
| 83 | ||||||
| 84 | @O verride | |||||
| 85 | pu blic void afterPrope rtiesSet() { | |||||
| 86 | } | |||||
| 87 | ||||||
| 88 | pr ivate Adho cQueryResp onse creat eAdhocQuer yResponse( | |||||
| 89 | final AdhocQuery Request ad hocQueryRe quest, fin al List<Do cument> do cs) { | |||||
| 90 | fina l oasis.na mes.tc.ebx ml_regrep. xsd.query. _3.ObjectF actory ret ObjFactory = new oas is.names.t c.ebxml_re grep.xsd.q uery._3.Ob jectFactor y(); | |||||
| 91 | fina l AdhocQue ryResponse ret = ret ObjFactory .createAdh ocQueryRes ponse(); | |||||
| 92 | ret. setStatus( MockAdapte rDocQueryP ortImpl.XD S_QUERY_RE SPONSE_STA TUS_SUCCES S); | |||||
| 93 | ret. setRequest Id(adhocQu eryRequest .getId()); | |||||
| 94 | fina l oasis.na mes.tc.ebx ml_regrep. xsd.rim._3 .ObjectFac tory oRimO bjectFacto ry = new o asis.names .tc.ebxml_ regrep.xsd .rim._3.Ob jectFactor y(); | |||||
| 95 | fina l Registry ObjectList Type regOb jList = ne w Registry ObjectList Type(); | |||||
| 96 | ret. setRegistr yObjectLis t(regObjLi st); | |||||
| 97 | // C ollect the home comm unity id | |||||
| 98 | fina l String h omeCommuni tyId = thi s.retrieve HomeCommun ityId(); | |||||
| 99 | if ( (docs != n ull) && (! docs.isEmp ty())) { | |||||
| 100 | final List<JAXBE lement<? e xtends Ide ntifiableT ype>> olRe gObjs = re gObjList | |||||
| 101 | .getIdenti fiable(); | |||||
| 102 | // Sav e these so that they u can be a dded in la ter after all of the | |||||
| 103 | // oth er items.. | |||||
| 104 | // --- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----- | |||||
| 105 | final ArrayList< JAXBElemen t<? extend s Identifi ableType>> olObjRef = new Arra yList<JAXB Element<? extends Id entifiable Type>>(); | |||||
| 106 | final ArrayList< JAXBElemen t<? extend s Identifi ableType>> olAssoc = new Array List<JAXBE lement<? e xtends Ide ntifiableT ype>>(); | |||||
| 107 | for (f inal Docum ent doc : docs) { | |||||
| 108 | final Ex trinsicObj ectType oE xtObj = ne w Extrinsi cObjectTyp e(); | |||||
| 109 | final JA XBElement< ? extends Identifiab leType> oJ AXBExtObj = oRimObje ctFactory | |||||
| 110 | .c reateExtri nsicObject (oExtObj); | |||||
| 111 | final Li st<SlotTyp e1> olSlot = oExtObj .getSlot() ; | |||||
| 112 | final Li st<Classif icationTyp e> olClass ifications = oExtObj | |||||
| 113 | .g etClassifi cation(); | |||||
| 114 | boolean bHaveData = false; | |||||
| 115 | oExtObj. setIsOpaqu e(Boolean. FALSE); | |||||
| 116 | oExtObj. setObjectT ype(MockAd apterDocQu eryPortImp l.XDS_QUER Y_RESPONSE _EXTRINSIC _OBJCECT_O BJECT_TYPE ); | |||||
| 117 | // Gener ate a UUID for the d ocument | |||||
| 118 | final UU ID oDocume ntUUID = U UID.random UUID(); | |||||
| 119 | final St ring sDocu mentUUID = "urn:uuid :" | |||||
| 120 | + oDocumentU UID.toStri ng(); | |||||
| 121 | oExtObj. setId(sDoc umentUUID) ; | |||||
| 122 | // Docum ent Unique ID | |||||
| 123 | // ----- ---------- --- | |||||
| 124 | String s DocumentId = ""; // need to ke ep a handl e to this to | |||||
| 125 | // be us ed later.. . | |||||
| 126 | if (!Nul lChecker.i sNullOrEmp ty(doc.get DocumentUn iqueId())) { | |||||
| 127 | sDocumentI d = doc.ge tDocumentU niqueId(); | |||||
| 128 | final Exte rnalIdenti fierType o ExtId = ne w External Identifier Type(); | |||||
| 129 | oExtId.set Id("urn:uu id:" + UUI D.randomUU ID().toStr ing()); | |||||
| 130 | oExtObj.ge tExternalI dentifier( ).add(oExt Id); | |||||
| 131 | oExtId.set RegistryOb ject(sDocu mentUUID); | |||||
| 132 | oExtId.set Value(sDoc umentId); | |||||
| 133 | oExtId.set Identifica tionScheme (MockAdapt erDocQuery PortImpl.E BXML_RESPO NSE_DOCID_ IDENTIFICA TION_SCHEM E); | |||||
| 134 | final Inte rnationalS tringType oName = th is | |||||
| 135 | .Cre ateSingleV alueIntern ationalStr ingType(Mo ckAdapterD ocQueryPor tImpl.EBXM L_RESPONSE _DOCID_NAM E); | |||||
| 136 | oExtId.set Name(oName ); | |||||
| 137 | bHaveData = true; | |||||
| 138 | } | |||||
| 139 | // Autho r data | |||||
| 140 | boolean bHasAuthor Data = fal se; | |||||
| 141 | final Cl assificati onType oCl assificati on = new C lassificat ionType(); | |||||
| 142 | oClassif ication.se tId("urn:u uid:" | |||||
| 143 | + UUID.rando mUUID().to String()); | |||||
| 144 | oClassif ication | |||||
| 145 | .s etClassifi cationSche me(MockAda pterDocQue ryPortImpl .EBXML_RES PONSE_AUTH OR_CLASS_S CHEME); | |||||
| 146 | oClassif ication.se tClassifie dObject(sD ocumentUUI D); | |||||
| 147 | oClassif ication.se tNodeRepre sentation( ""); | |||||
| 148 | final Li st<SlotTyp e1> olClas sification Slot = oCl assificati on | |||||
| 149 | .g etSlot(); | |||||
| 150 | // TODO: AuthorPers on | |||||
| 151 | // ----- -------- | |||||
| 152 | /* | |||||
| 153 | * if(!N ullChecker .isNullOrE mpty(doc.g etAuthorPe rson())) { | |||||
| 154 | * SlotT ype1 oSlot = | |||||
| 155 | * Creat eSingleVal ueSlot(EBX ML_RESPONS E_AUTHOR_P ERSON_SLOT NAME, | |||||
| 156 | * doc.g etAuthorPe rson()); o lClassific ationSlot. add(oSlot) ; | |||||
| 157 | * bHasA uthorData = true; } | |||||
| 158 | */ | |||||
| 159 | // Autho r institut ion | |||||
| 160 | // ----- ---------- ---------- ---------- ---------- --------- | |||||
| 161 | ||||||
| 162 | final Sl otType1 ox Slot = thi s | |||||
| 163 | .C reateSingl eValueSlot ( | |||||
| 164 | MockAd apterDocQu eryPortImp l.EBXML_RE SPONSE_AUT HOR_INSTIT UTION_SLOT NAME, | |||||
| 165 | "Depar tment of V eterans Af fairs"); | |||||
| 166 | olClassi ficationSl ot.add(oxS lot); | |||||
| 167 | bHasAuth orData = t rue; | |||||
| 168 | // TODO: AuthorRol e | |||||
| 169 | // ----- ------- | |||||
| 170 | /* | |||||
| 171 | * if(!N ullChecker .isNullOrE mpty(doc.g etAuthorRo le())) { | |||||
| 172 | * SlotT ype1 oSlot = | |||||
| 173 | * Creat eSingleVal ueSlot(EBX ML_RESPONS E_AUTHOR_R OLE_SLOTNA ME, | |||||
| 174 | * doc.g etAuthorRo le()); olC lassificat ionSlot.ad d(oSlot); | |||||
| 175 | * bHasA uthorData = true; } | |||||
| 176 | */ | |||||
| 177 | // TODO: AuthorSpe cialty | |||||
| 178 | // ----- ---------- - | |||||
| 179 | /* | |||||
| 180 | * if(!N ullChecker .isNullOrE mpty(doc.g etAuthorSp ecialty()) ) { | |||||
| 181 | * SlotT ype1 oSlot = | |||||
| 182 | * Creat eSingleVal ueSlot(EBX ML_RESPONS E_AUTHOR_S PECIALTY_S LOTNAME | |||||
| 183 | * , doc .getAuthor Specialty( )); olClas sification Slot.add(o Slot); | |||||
| 184 | * bHasA uthorData = true; } | |||||
| 185 | */ | |||||
| 186 | if (bHas AuthorData ) { | |||||
| 187 | olClassifi cations.ad d(oClassif ication); | |||||
| 188 | bHaveData = true; | |||||
| 189 | } | |||||
| 190 | // TODO: Availabil ity Status | |||||
| 191 | // ----- ---------- ------ | |||||
| 192 | /* | |||||
| 193 | * if(!N ullChecker .isNullOrE mpty(doc.g etAvailabl ityStatus( ))) { | |||||
| 194 | * oExtO bj.setStat us(doc.get Availablit yStatus()) ; bHaveDat a = | |||||
| 195 | * true; } | |||||
| 196 | */ | |||||
| 197 | // Class Code | |||||
| 198 | // ----- ------- | |||||
| 199 | final Cl assificati onType cla ssCodeClas sification = this | |||||
| 200 | .c reateClass ificationF romCodedDa ta( | |||||
| 201 | doc.ge tClassCode (), | |||||
| 202 | doc.ge tClassCode Scheme(), | |||||
| 203 | doc.ge tClassCode DisplayNam e(), | |||||
| 204 | MockAd apterDocQu eryPortImp l.EBXML_RE SPONSE_CLA SSCODE_CLA SS_SCHEME, | |||||
| 205 | sDocum entUUID); | |||||
| 206 | if (clas sCodeClass ification != null) { | |||||
| 207 | olClassifi cations.ad d(classCod eClassific ation); | |||||
| 208 | bHaveData = true; | |||||
| 209 | } | |||||
| 210 | // TODO: Comments | |||||
| 211 | // ----- ---- | |||||
| 212 | /* | |||||
| 213 | * if(!N ullChecker .isNullOrE mpty(doc.g etComments ())) { | |||||
| 214 | * Inter nationalSt ringType o Comments = | |||||
| 215 | * Creat eSingleVal ueInternat ionalStrin gType(doc. getComment s()); | |||||
| 216 | * oExtO bj.setDesc ription(oC omments); bHaveData = true; } | |||||
| 217 | */ | |||||
| 218 | // TODO: Confident iality Cod e | |||||
| 219 | // ----- ---------- ------ | |||||
| 220 | /* | |||||
| 221 | * Class ificationT ype confid entialityC odeClassif ication = | |||||
| 222 | * creat eClassific ationFromC odedData | |||||
| 223 | * (doc. getConfide ntialityCo de(), | |||||
| 224 | * doc.g etConfiden tialityCod eScheme(), | |||||
| 225 | * doc.g etConfiden tialityCod eDisplayNa me(), | |||||
| 226 | * EBXML _RESPONSE_ CONFIDENTI ALITYCODE_ CLASS_SCHE ME, | |||||
| 227 | * sDocu mentUUID); if (confi dentiality CodeClassi fication ! = | |||||
| 228 | * null) { | |||||
| 229 | * olCla ssificatio ns.add(con fidentiali tyCodeClas sification ); | |||||
| 230 | * bHave Data = tru e; } | |||||
| 231 | */ | |||||
| 232 | // Creat ion Time | |||||
| 233 | // ----- --------- | |||||
| 234 | if (doc. getCreatio nTime() != null) { | |||||
| 235 | final Slot Type1 oSlo t = this | |||||
| 236 | .Cre ateSingleV alueSlot( | |||||
| 237 | MockAdap terDocQuer yPortImpl. EBXML_RESP ONSE_CREAT IONTIME_SL OTNAME, | |||||
| 238 | this.for matCreatio nDate(doc | |||||
| 239 | .g etCreation Time())); | |||||
| 240 | olSlot.add (oSlot); | |||||
| 241 | bHaveData = true; | |||||
| 242 | } | |||||
| 243 | // TODO: Event Cod e List | |||||
| 244 | // ----- ---------- - | |||||
| 245 | /* | |||||
| 246 | * if((d oc.getEven tCodes() ! = null) && | |||||
| 247 | * (!doc .getEventC odes().isE mpty())) { for(Event Code event Code : | |||||
| 248 | * doc.g etEventCod es()) { Cl assificati onType | |||||
| 249 | * event CodeClassi fication = | |||||
| 250 | * creat eClassific ationFromC odedData(e ventCode.g etEventCod e(), | |||||
| 251 | * event Code.getEv entCodeSch eme(), | |||||
| 252 | * event Code.getEv entCodeDis playName() , | |||||
| 253 | * EBXML _RESPONSE_ EVENTCODE_ CLASS_SCHE ME, sDocum entUUID); if | |||||
| 254 | * (even tCodeClass ification != null) { | |||||
| 255 | * olCla ssificatio ns.add(eve ntCodeClas sification ); bHaveDa ta = | |||||
| 256 | * true; } } } | |||||
| 257 | */ | |||||
| 258 | // TODO: Format Co de | |||||
| 259 | // ----- -------- | |||||
| 260 | /* | |||||
| 261 | * Class ificationT ype format CodeClassi fication = | |||||
| 262 | * creat eClassific ationFromC odedData(d oc.getForm atCode(), | |||||
| 263 | * doc.g etFormatCo deScheme() , doc.getF ormatCodeD isplayName (), | |||||
| 264 | * EBXML _RESPONSE_ FORMATCODE _CLASS_SCH EME, sDocu mentUUID); if | |||||
| 265 | * (form atCodeClas sification != null) { | |||||
| 266 | * olCla ssificatio ns.add(for matCodeCla ssificatio n); bHaveD ata = | |||||
| 267 | * true; } | |||||
| 268 | */ | |||||
| 269 | // Hash Code | |||||
| 270 | // ----- ----- | |||||
| 271 | if (!Nul lChecker.i sNullOrEmp ty(doc.get Hash())) { | |||||
| 272 | final Slot Type1 oSlo t = this | |||||
| 273 | .Cre ateSingleV alueSlot( | |||||
| 274 | MockAdap terDocQuer yPortImpl. EBXML_RESP ONSE_HASH_ SLOTNAME, | |||||
| 275 | doc.getH ash()); | |||||
| 276 | olSlot.add (oSlot); | |||||
| 277 | bHaveData = true; | |||||
| 278 | } | |||||
| 279 | // TODO: Healthcar e Facility Type Code | |||||
| 280 | // ----- ---------- ---------- ----- | |||||
| 281 | /* | |||||
| 282 | * Class ificationT ype health careFacili tyTypeCode Classifica tion = | |||||
| 283 | * creat eClassific ationFromC odedData(d oc.getFaci lityCode() , | |||||
| 284 | * doc.g etFacility CodeScheme (), | |||||
| 285 | * doc.g etFacility CodeDispla yName(), | |||||
| 286 | * EBXML _RESPONSE_ HEALTHCARE FACILITYTY PE_CLASS_S CHEME, | |||||
| 287 | * sDocu mentUUID); if (healt hcareFacil ityTypeCod eClassific ation | |||||
| 288 | * != nu ll) { | |||||
| 289 | * olCla ssificatio ns.add(hea lthcareFac ilityTypeC odeClassif ication | |||||
| 290 | * ); bH aveData = true; } | |||||
| 291 | */ | |||||
| 292 | // TODO: Intended Recipients | |||||
| 293 | // ----- ---------- ----- | |||||
| 294 | /* | |||||
| 295 | * List< String> in tendedReci pients = n ew ArrayLi st<String> (); | |||||
| 296 | * if( | |||||
| 297 | * !Null Checker.is NullOrEmpt y(doc.getI ntendedRec ipientPers on() | |||||
| 298 | * )) { | |||||
| 299 | * inten dedRecipie nts.add(do c.getInten dedRecipie ntPerson() ); } | |||||
| 300 | * else if(!NullCh ecker.isNu llOrEmpty( doc. | |||||
| 301 | * getIn tendedReci pientOrgan ization()) ) { | |||||
| 302 | * inten dedRecipie nts.add( | |||||
| 303 | * doc.g etIntended RecipientO rganizatio n()) ; } | |||||
| 304 | * if(!i ntendedRec ipients.is Empty()) { String[] | |||||
| 305 | * inten dedRecipie ntArray = intendedRe cipients.t oArray(new | |||||
| 306 | * Strin g[intended Recipients .size()]); SlotType1 oSlot = | |||||
| 307 | * Creat eMultiValu eSlot | |||||
| 308 | * (EBXM L_RESPONSE _INTENDEDR ECIPIENTS_ SLOTNAME , | |||||
| 309 | * inten dedRecipie ntArray); olSlot.add (oSlot); b HaveData = true; | |||||
| 310 | * } | |||||
| 311 | */ | |||||
| 312 | // TODO: Language Code | |||||
| 313 | // ----- ---------- | |||||
| 314 | /* | |||||
| 315 | * if(!N ullChecker .isNullOrE mpty(doc.g etLanguage Code())) { | |||||
| 316 | * SlotT ype1 oSlot = | |||||
| 317 | * Creat eSingleVal ueSlot(EBX ML_RESPONS E_LANGUAGE CODE_SLOTN AME, | |||||
| 318 | * doc.g etLanguage Code()); o lSlot.add( oSlot); bH aveData = true; | |||||
| 319 | * } | |||||
| 320 | */ | |||||
| 321 | // TODO: LegalAuth enticator Code | |||||
| 322 | // ----- ---------- --------- | |||||
| 323 | /* | |||||
| 324 | * if(!N ullChecker .isNullOrE mpty(doc.g etLegalAut henticator ())) { | |||||
| 325 | * SlotT ype1 oSlot = | |||||
| 326 | * Creat eSingleVal ueSlot(EBX ML_RESPONS E_LEGALAUT HENTICATOR _SLOTNAME | |||||
| 327 | * , doc .getLegalA uthenticat or()); olS lot.add(oS lot); bHav eData | |||||
| 328 | * = tru e; } | |||||
| 329 | */ | |||||
| 330 | // Mime Type | |||||
| 331 | // ----- ----- | |||||
| 332 | if (!Nul lChecker.i sNullOrEmp ty(doc.get MimeType() )) { | |||||
| 333 | ||||||
| 334 | oExtObj.se tMimeType( doc.getMim eType()); | |||||
| 335 | ||||||
| 336 | bHaveData = true; | |||||
| 337 | } | |||||
| 338 | // Patie nt ID | |||||
| 339 | // ----- ------ | |||||
| 340 | if (!Nul lChecker.i sNullOrEmp ty(doc.get PatientId( ))) { | |||||
| 341 | final Stri ng formatt edPatientI d = doc.ge tPatientId () | |||||
| 342 | + "^ ^^&" + hom eCommunity Id + "&ISO ";// Patie ntIdFormat Util.hl7En codePatien tId(doc.ge tPatientId (), | |||||
| 343 | // homeCom munityId); | |||||
| 344 | final Exte rnalIdenti fierType o ExtId = ne w External Identifier Type(); | |||||
| 345 | oExtId.set Id("urn:uu id:" + UUI D.randomUU ID().toStr ing()); | |||||
| 346 | oExtId.set Identifica tionScheme (MockAdapt erDocQuery PortImpl.E BXML_RESPO NSE_PATIEN TID_IDENTI FICATION_S CHEME); | |||||
| 347 | final Inte rnationalS tringType oPatIdName = this | |||||
| 348 | .Cre ateSingleV alueIntern ationalStr ingType(Mo ckAdapterD ocQueryPor tImpl.EBXM L_RESPONSE _PATIENTID _NAME); | |||||
| 349 | oExtId.set Name(oPatI dName); | |||||
| 350 | oExtId.set RegistryOb ject(sDocu mentUUID); | |||||
| 351 | oExtId.set Value(form attedPatie ntId); | |||||
| 352 | oExtObj.ge tExternalI dentifier( ).add(oExt Id); | |||||
| 353 | bHaveData = true; | |||||
| 354 | } | |||||
| 355 | // TODO: Practice Setting Co de | |||||
| 356 | // ----- ---------- ------- | |||||
| 357 | /* | |||||
| 358 | * Class ificationT ype practi ceSettingC odeClassif ication = | |||||
| 359 | * creat eClassific ationFromC odedData(d oc.getPrac ticeSettin g(), | |||||
| 360 | * doc.g etPractice SettingSch eme(), | |||||
| 361 | * doc.g etPractice SettingDis playName() , | |||||
| 362 | * EBXML _RESPONSE_ PRACTICESE TTING_CLAS S_SCHEME, sDocumentU UID); | |||||
| 363 | * if (p racticeSet tingCodeCl assificati on != null ) { | |||||
| 364 | * olCla ssificatio ns.add(pra cticeSetti ngCodeClas sification ); | |||||
| 365 | * bHave Data = tru e; } | |||||
| 366 | */ | |||||
| 367 | // Servi ce Start T ime | |||||
| 368 | // ----- ---------- ---- | |||||
| 369 | if (doc. getBeginDa te() != nu ll) { | |||||
| 370 | final Slot Type1 oSlo t = this | |||||
| 371 | .Cre ateSingleV alueSlot( | |||||
| 372 | MockAdap terDocQuer yPortImpl. EBXML_RESP ONSE_SERVI CESTARTTIM E_SLOTNAME , | |||||
| 373 | this.for matService Date(doc.g etBeginDat e())); | |||||
| 374 | olSlot.add (oSlot); | |||||
| 375 | bHaveData = true; | |||||
| 376 | } | |||||
| 377 | // Servi ce Stop Ti me | |||||
| 378 | // ----- ---------- --- | |||||
| 379 | if (doc. getEndDate () != null ) { | |||||
| 380 | final Slot Type1 oSlo t = this | |||||
| 381 | .Cre ateSingleV alueSlot( | |||||
| 382 | MockAdap terDocQuer yPortImpl. EBXML_RESP ONSE_SERVI CESTOPTIME _SLOTNAME, | |||||
| 383 | this.for matService Date(doc.g etEndDate( ))); | |||||
| 384 | olSlot.add (oSlot); | |||||
| 385 | bHaveData = true; | |||||
| 386 | } | |||||
| 387 | // Size | |||||
| 388 | // ----- | |||||
| 389 | if ((doc .getSize() != null) && (doc.ge tSize().in tValue() > 0)) { | |||||
| 390 | final Slot Type1 oSlo t = this | |||||
| 391 | .Cre ateSingleV alueSlot( | |||||
| 392 | MockAdap terDocQuer yPortImpl. EBXML_RESP ONSE_SIZE_ SLOTNAME, | |||||
| 393 | doc.getS ize().toSt ring()); | |||||
| 394 | olSlot.add (oSlot); | |||||
| 395 | bHaveData = true; | |||||
| 396 | } | |||||
| 397 | // TODO: Source Pa tient Id | |||||
| 398 | // ----- ---------- --- | |||||
| 399 | /* | |||||
| 400 | * if(!N ullChecker .isNullOrE mpty(doc.g etSourcePa tientId()) ) { | |||||
| 401 | * SlotT ype1 oSlot = | |||||
| 402 | * Creat eSingleVal ueSlot(EBX ML_RESPONS E_SOURCEPA TIENTID_SL OTNAME | |||||
| 403 | * , doc .getSource PatientId( )); olSlot .add(oSlot ); bHaveDa ta = | |||||
| 404 | * true; } | |||||
| 405 | */ | |||||
| 406 | ||||||
| 407 | // TODO: Source Pa tient Info | |||||
| 408 | // ----- ---------- ----- | |||||
| 409 | /* | |||||
| 410 | * List< String> so urcePatien tInfoValue s = new | |||||
| 411 | * Array List<Strin g>(); | |||||
| 412 | * if(!N ullChecker .isNullOrE mpty(doc.g etPid3())) { | |||||
| 413 | * sourc ePatientIn foValues.a dd("PID-3| " + doc.ge tPid3()); } | |||||
| 414 | * if(!N ullChecker .isNullOrE mpty(doc.g etPid5())) { | |||||
| 415 | * sourc ePatientIn foValues.a dd("PID-5| " + doc.ge tPid5()); } | |||||
| 416 | * if(!N ullChecker .isNullOrE mpty(doc.g etPid7())) { | |||||
| 417 | * sourc ePatientIn foValues.a dd("PID-7| " + doc.ge tPid7()); } | |||||
| 418 | * if(!N ullChecker .isNullOrE mpty(doc.g etPid8())) { | |||||
| 419 | * sourc ePatientIn foValues.a dd("PID-8| " + doc.ge tPid8()); } | |||||
| 420 | * if(!N ullChecker .isNullOrE mpty(doc.g etPid11()) ) { | |||||
| 421 | * sourc ePatientIn foValues.a dd("PID-11 |" + doc.g etPid11()) ; } | |||||
| 422 | * if(!s ourcePatie ntInfoValu es.isEmpty ()) { Stri ng[] | |||||
| 423 | * sourc ePatientIn foValuesAr ray = | |||||
| 424 | * sourc ePatientIn foValues.t oArray(new | |||||
| 425 | * Strin g[sourcePa tientInfoV alues.size ()]); Slot Type1 oSlo t = | |||||
| 426 | * Creat eMultiValu eSlot | |||||
| 427 | * (EBXM L_RESPONSE _SOURCEPAT IENTINFO_S LOTNAME , | |||||
| 428 | * sourc ePatientIn foValuesAr ray); olSl ot.add(oSl ot); bHave Data = | |||||
| 429 | * true; } | |||||
| 430 | */ | |||||
| 431 | ||||||
| 432 | // Title | |||||
| 433 | // ----- -- | |||||
| 434 | if (!Nul lChecker.i sNullOrEmp ty(doc.get Title())) { | |||||
| 435 | ||||||
| 436 | final Inte rnationalS tringType oTitle = t his | |||||
| 437 | .Cre ateSingleV alueIntern ationalStr ingType(do c | |||||
| 438 | .getTitl e()); | |||||
| 439 | ||||||
| 440 | oExtObj.se tName(oTit le); | |||||
| 441 | ||||||
| 442 | bHaveData = true; | |||||
| 443 | ||||||
| 444 | } | |||||
| 445 | ||||||
| 446 | // TODO: Type Code | |||||
| 447 | ||||||
| 448 | // ----- ----- | |||||
| 449 | ||||||
| 450 | /* | |||||
| 451 | * Class ificationT ype typeCo deClassifi cation = | |||||
| 452 | * creat eClassific ationFromC odedData(d oc.getType Code(), | |||||
| 453 | * doc.g etTypeCode Scheme(), doc.getTyp eCodeDispl ayName(), | |||||
| 454 | * EBXML _RESPONSE_ TYPECODE_C LASS_SCHEM E, sDocume ntUUID); i f | |||||
| 455 | * (type CodeClassi fication ! = null) { | |||||
| 456 | * olCla ssificatio ns.add(typ eCodeClass ification) ; bHaveDat a = | |||||
| 457 | * true; } | |||||
| 458 | */ | |||||
| 459 | ||||||
| 460 | // TODO: URI | |||||
| 461 | // ---- | |||||
| 462 | /* | |||||
| 463 | * if(!N ullChecker .isNullOrE mpty(doc.g etDocument Uri())) { | |||||
| 464 | * SlotT ype1 oSlot = null; S tring docu mentUri = | |||||
| 465 | * doc.g etDocument Uri(); if (documentU ri.length( ) <= | |||||
| 466 | * EBXML _RESPONSE_ URI_LINE_L ENGTH) { o Slot = | |||||
| 467 | * Creat eSingleVal ueSlot(EBX ML_RESPONS E_URI_SLOT NAME, | |||||
| 468 | * docum entUri); } else { in t iStart = 0; String sURI = | |||||
| 469 | * docum entUri; in t iTotalLe n = sURI.l ength(); i nt iIndex = 1; | |||||
| 470 | * Strin g saURIPar t[] = null ; if ((iTo talLen % | |||||
| 471 | * EBXML _RESPONSE_ URI_LINE_L ENGTH) == 0) { saURI Part = new | |||||
| 472 | * Strin g[iTotalLe n / EBXML_ RESPONSE_U RI_LINE_LE NGTH]; } e lse { | |||||
| 473 | * saURI Part = new String[iT otalLen / | |||||
| 474 | * EBXML _RESPONSE_ URI_LINE_L ENGTH + 1] ; } while (iStart < | |||||
| 475 | * iTota lLen) { if ((iStart + EBXML_RE SPONSE_URI _LINE_LENG TH) > | |||||
| 476 | * iTota lLen) { sa URIPart[iI ndex - 1] = iIndex + "|" + | |||||
| 477 | * sURI. substring( iStart, iT otalLen); iStart = i TotalLen; } else | |||||
| 478 | * { saU RIPart[iIn dex - 1] = iIndex + "|" + | |||||
| 479 | * sURI. substring( iStart, iS tart + | |||||
| 480 | * EBXML _RESPONSE_ URI_LINE_L ENGTH); iS tart += | |||||
| 481 | * EBXML _RESPONSE_ URI_LINE_L ENGTH; } i Index++; } oSlot = | |||||
| 482 | * Creat eMultiValu eSlot(EBXM L_RESPONSE _URI_SLOTN AME, saURI Part); | |||||
| 483 | * } // else if (o Slot != nu ll) { olSl ot.add(oSl ot); bHave Data = | |||||
| 484 | * true; } } | |||||
| 485 | */ | |||||
| 486 | ||||||
| 487 | if (bHav eData) { | |||||
| 488 | ||||||
| 489 | // Home co mmunity ID | |||||
| 490 | ||||||
| 491 | // ------- ---------- - | |||||
| 492 | ||||||
| 493 | oExtObj.se tHome("urn :oid:" + h omeCommuni tyId); | |||||
| 494 | ||||||
| 495 | // Reposit ory Unique ID | |||||
| 496 | ||||||
| 497 | // ------- ---------- ---- | |||||
| 498 | ||||||
| 499 | final Slot Type1 oSlo t = this | |||||
| 500 | .Cre ateSingleV alueSlot( | |||||
| 501 | MockAdap terDocQuer yPortImpl. EBXML_RESP ONSE_REPOS ITORY_UNIQ UE_ID_SLOT NAME, | |||||
| 502 | ||||||
| 503 | MockAdap terDocQuer yPortImpl. REPOSITORY _UNIQUE_ID ); | |||||
| 504 | ||||||
| 505 | olSlot.add (oSlot); | |||||
| 506 | ||||||
| 507 | olRegObjs. add(oJAXBE xtObj); | |||||
| 508 | ||||||
| 509 | } | |||||
| 510 | ||||||
| 511 | } | |||||
| 512 | ||||||
| 513 | // if we have an y Object R eferences, add them in now. | |||||
| 514 | ||||||
| 515 | // --- ---------- ---------- ---------- ---------- -------- | |||||
| 516 | ||||||
| 517 | if (ol ObjRef.siz e() > 0) { | |||||
| 518 | ||||||
| 519 | olRegObj s.addAll(o lObjRef); | |||||
| 520 | ||||||
| 521 | } | |||||
| 522 | ||||||
| 523 | // if we have an y associat ions, add them in no w. | |||||
| 524 | ||||||
| 525 | // --- ---------- ---------- ---------- ---------- -------- | |||||
| 526 | ||||||
| 527 | if (ol Assoc.size () > 0) { | |||||
| 528 | ||||||
| 529 | olRegObj s.addAll(o lAssoc); | |||||
| 530 | ||||||
| 531 | } | |||||
| 532 | ||||||
| 533 | } | |||||
| 534 | ||||||
| 535 | retu rn ret; | |||||
| 536 | ||||||
| 537 | } | |||||
| 538 | ||||||
| 539 | pr ivate Adho cQueryResp onse creat eAdhocQuer yResponseE rror( | |||||
| 540 | final AdhocQuery Request ad hocQueryRe quest) | |||||
| 541 | ||||||
| 542 | { | |||||
| 543 | ||||||
| 544 | fina l oasis.na mes.tc.ebx ml_regrep. xsd.query. _3.ObjectF actory obj Factory = new oasis. names.tc.e bxml_regre p.xsd.quer y._3.Objec tFactory() ; | |||||
| 545 | ||||||
| 546 | fina l AdhocQue ryResponse ret = obj Factory.cr eateAdhocQ ueryRespon se(); | |||||
| 547 | ||||||
| 548 | ret. setRegistr yErrorList (this.crea teDefaultR egistryErr orList()); | |||||
| 549 | ||||||
| 550 | ret. setStatus( MockAdapte rDocQueryP ortImpl.XD S_QUERY_RE SPONSE_STA TUS_FAILUR E); | |||||
| 551 | ||||||
| 552 | ret. setRequest Id(adhocQu eryRequest .getId()); | |||||
| 553 | ||||||
| 554 | retu rn ret; | |||||
| 555 | ||||||
| 556 | } | |||||
| 557 | ||||||
| 558 | /* * | |||||
| 559 | * This meth od creates a classif ication fr om a coded item. | |||||
| 560 | * | |||||
| 561 | * @param oC oded | |||||
| 562 | * The code d to be tr ansformed. | |||||
| 563 | * @param sC lassificat ionScheme | |||||
| 564 | * The clas sification scheme va lue. | |||||
| 565 | * @param sD ocumentId | |||||
| 566 | * The docu ment ID fo r the docu ment assoc iated with this | |||||
| 567 | * classifi caation. | |||||
| 568 | * @return T he classif ication cr eated base d on the i nformation in the co ded. | |||||
| 569 | * / | |||||
| 570 | ||||||
| 571 | pr ivate Clas sification Type creat eClassific ationFromC odedData( | |||||
| 572 | final String cod e, final S tring code Scheme, | |||||
| 573 | final String cod eDisplayNa me, final String sCl assificati onScheme, | |||||
| 574 | final String sDo cumentId) | |||||
| 575 | ||||||
| 576 | { | |||||
| 577 | ||||||
| 578 | Mock AdapterDoc QueryPortI mpl.logger | |||||
| 579 | .finest( "DocumentR egistryHel per.Create Classifica tionFromCo dedData() -- Begin") ; | |||||
| 580 | ||||||
| 581 | fina l Classifi cationType oClassifi cation = n ew Classif icationTyp e(); | |||||
| 582 | ||||||
| 583 | oCla ssificatio n.setId("u rn:uuid:" + UUID.ran domUUID(). toString() ); | |||||
| 584 | ||||||
| 585 | bool ean bHasCo de = false ; | |||||
| 586 | ||||||
| 587 | oCla ssificatio n.setClass ificationS cheme(sCla ssificatio nScheme); | |||||
| 588 | ||||||
| 589 | oCla ssificatio n.setClass ifiedObjec t(sDocumen tId); | |||||
| 590 | ||||||
| 591 | oCla ssificatio n.setNodeR epresentat ion(""); | |||||
| 592 | ||||||
| 593 | fina l List<Slo tType1> ol Classifica tionSlot = oClassifi cation.get Slot(); | |||||
| 594 | ||||||
| 595 | // C ode | |||||
| 596 | ||||||
| 597 | // - ---- | |||||
| 598 | ||||||
| 599 | if ( !NullCheck er.isNullO rEmpty(cod e)) { | |||||
| 600 | ||||||
| 601 | oClass ification. setNodeRep resentatio n(code); | |||||
| 602 | ||||||
| 603 | bHasCo de = true; | |||||
| 604 | ||||||
| 605 | } | |||||
| 606 | ||||||
| 607 | // C ode System | |||||
| 608 | ||||||
| 609 | // - ---------- - | |||||
| 610 | ||||||
| 611 | if ( !NullCheck er.isNullO rEmpty(cod eScheme)) { | |||||
| 612 | ||||||
| 613 | final SlotType1 oSlot = th is | |||||
| 614 | .CreateSin gleValueSl ot( | |||||
| 615 | Mock AdapterDoc QueryPortI mpl.EBXML_ RESPONSE_C ODE_CODESC HEME_SLOTN AME, | |||||
| 616 | ||||||
| 617 | code Scheme); | |||||
| 618 | ||||||
| 619 | olClas sification Slot.add(o Slot); | |||||
| 620 | ||||||
| 621 | bHasCo de = true; | |||||
| 622 | ||||||
| 623 | } | |||||
| 624 | ||||||
| 625 | // D isplayName | |||||
| 626 | ||||||
| 627 | // - ---------- - | |||||
| 628 | ||||||
| 629 | if ( !NullCheck er.isNullO rEmpty(cod eDisplayNa me)) { | |||||
| 630 | ||||||
| 631 | final Internatio nalStringT ype oDispl ayName = t his | |||||
| 632 | .CreateSin gleValueIn ternationa lStringTyp e(codeDisp layName); | |||||
| 633 | ||||||
| 634 | oClass ification. setName(oD isplayName ); | |||||
| 635 | ||||||
| 636 | bHasCo de = true; | |||||
| 637 | ||||||
| 638 | } | |||||
| 639 | ||||||
| 640 | if ( bHasCode) { | |||||
| 641 | ||||||
| 642 | return oClassifi cation; | |||||
| 643 | ||||||
| 644 | } | |||||
| 645 | ||||||
| 646 | else { | |||||
| 647 | ||||||
| 648 | MockAd apterDocQu eryPortImp l.logger | |||||
| 649 | .finest("D ocumentReg istryHelpe r.CreateCl assificati onFromCode dData() -- End"); | |||||
| 650 | ||||||
| 651 | return null; | |||||
| 652 | ||||||
| 653 | } | |||||
| 654 | ||||||
| 655 | } | |||||
| 656 | ||||||
| 657 | pr ivate Regi stryError createDefa ultRegistr yError() | |||||
| 658 | ||||||
| 659 | { | |||||
| 660 | ||||||
| 661 | fina l Registry Error ret = new Regi stryError( ); | |||||
| 662 | ||||||
| 663 | ret. setErrorCo de("XDSReg istryError "); | |||||
| 664 | ||||||
| 665 | ret. setCodeCon text("Inte rnal Regis try/Reposi tory Error "); | |||||
| 666 | ||||||
| 667 | ret. setSeverit y("urn:oas is:names:t c:ebxml-re grep:Error SeverityTy pe:Error") ; | |||||
| 668 | ||||||
| 669 | retu rn ret; | |||||
| 670 | ||||||
| 671 | } | |||||
| 672 | ||||||
| 673 | pr ivate Regi stryErrorL ist create DefaultReg istryError List() | |||||
| 674 | ||||||
| 675 | { | |||||
| 676 | ||||||
| 677 | fina l Registry ErrorList ret = new RegistryEr rorList(); | |||||
| 678 | ||||||
| 679 | ret. getRegistr yError().a dd(this.cr eateDefaul tRegistryE rror()); | |||||
| 680 | ||||||
| 681 | ret. setHighest Severity(" urn:oasis: names:tc:e bxml-regre p:ErrorSev erityType: Error"); | |||||
| 682 | ||||||
| 683 | retu rn ret; | |||||
| 684 | ||||||
| 685 | } | |||||
| 686 | ||||||
| 687 | /* * | |||||
| 688 | * This meth od creates a Slot co ntaining a single va lue. | |||||
| 689 | * | |||||
| 690 | * @param sS lotName | |||||
| 691 | * The name of the sl ot. | |||||
| 692 | * @param sa SlotValue | |||||
| 693 | * The arra y of value s for the slot. | |||||
| 694 | * @return T he SlotTyp e1 object containing the data passed in. | |||||
| 695 | * / | |||||
| 696 | ||||||
| 697 | pr ivate Slot Type1 Crea teMultiVal ueSlot(fin al String sSlotName, | |||||
| 698 | final String[] s aSlotValue ) | |||||
| 699 | ||||||
| 700 | { | |||||
| 701 | ||||||
| 702 | Mock AdapterDoc QueryPortI mpl.logger | |||||
| 703 | .finest( "DocumentR egistryHel per.Create MultiValue Slot() -- Begin"); | |||||
| 704 | ||||||
| 705 | fina l SlotType 1 oSlot = new SlotTy pe1(); | |||||
| 706 | ||||||
| 707 | oSlo t.setName( sSlotName) ; | |||||
| 708 | ||||||
| 709 | fina l ValueLis tType oVal ueList = n ew ValueLi stType(); | |||||
| 710 | ||||||
| 711 | oSlo t.setValue List(oValu eList); | |||||
| 712 | ||||||
| 713 | fina l List<Str ing> olVal ue = oValu eList.getV alue(); | |||||
| 714 | ||||||
| 715 | for (final Str ing elemen t : saSlot Value) { | |||||
| 716 | ||||||
| 717 | olValu e.add(elem ent); | |||||
| 718 | ||||||
| 719 | } | |||||
| 720 | ||||||
| 721 | Mock AdapterDoc QueryPortI mpl.logger | |||||
| 722 | .finest( "DocumentR egistryHel per.Create MultiValue Slot() -- End"); | |||||
| 723 | ||||||
| 724 | retu rn oSlot; | |||||
| 725 | ||||||
| 726 | } | |||||
| 727 | ||||||
| 728 | /* * | |||||
| 729 | * This meth od creates an Intern ationalStr ingType wi th a singl e value. | |||||
| 730 | * | |||||
| 731 | * @param sL ocStrValue | |||||
| 732 | * The valu e to be pl aced in th e string. | |||||
| 733 | * @return T he Interna tionString Type that is being r eturned. | |||||
| 734 | * / | |||||
| 735 | ||||||
| 736 | pr ivate Inte rnationalS tringType CreateSing leValueInt ernational StringType ( | |||||
| 737 | final String sLo cStrValue) | |||||
| 738 | ||||||
| 739 | { | |||||
| 740 | ||||||
| 741 | Mock AdapterDoc QueryPortI mpl.logger | |||||
| 742 | .finest( "DocumentT ransforms. CreateSing leValueInt ernational StringType () -- Begi n"); | |||||
| 743 | ||||||
| 744 | fina l Internat ionalStrin gType oNam e = new In ternationa lStringTyp e(); | |||||
| 745 | ||||||
| 746 | fina l List<Loc alizedStri ngType> ol LocStr = o Name.getLo calizedStr ing(); | |||||
| 747 | ||||||
| 748 | fina l Localize dStringTyp e oNameLoc Str = new LocalizedS tringType( ); | |||||
| 749 | ||||||
| 750 | olLo cStr.add(o NameLocStr ); | |||||
| 751 | ||||||
| 752 | oNam eLocStr.se tValue(sLo cStrValue) ; | |||||
| 753 | ||||||
| 754 | Mock AdapterDoc QueryPortI mpl.logger | |||||
| 755 | .finest( "DocumentT ransforms. CreateSing leValueInt ernational StringType () -- End" ); | |||||
| 756 | ||||||
| 757 | retu rn oName; | |||||
| 758 | ||||||
| 759 | } | |||||
| 760 | ||||||
| 761 | /* * | |||||
| 762 | * This meth od creates a Slot co ntaining a single va lue. | |||||
| 763 | * | |||||
| 764 | * @param sS lotName | |||||
| 765 | * The name of the sl ot. | |||||
| 766 | * @param sS lotValue | |||||
| 767 | * The valu e for the slot. | |||||
| 768 | * @return T he SlotTyp e1 object containing the data passed in. | |||||
| 769 | * / | |||||
| 770 | ||||||
| 771 | pr ivate Slot Type1 Crea teSingleVa lueSlot(fi nal String sSlotName , | |||||
| 772 | final String sSl otValue) | |||||
| 773 | ||||||
| 774 | { | |||||
| 775 | ||||||
| 776 | Mock AdapterDoc QueryPortI mpl.logger | |||||
| 777 | .finest( "DocumentR egistryHel per.Create SingleValu eSlot() -- Begin"); | |||||
| 778 | ||||||
| 779 | fina l String s aSlotValue [] = new S tring[1]; | |||||
| 780 | ||||||
| 781 | saSl otValue[0] = sSlotVa lue; | |||||
| 782 | ||||||
| 783 | Mock AdapterDoc QueryPortI mpl.logger | |||||
| 784 | .finest( "DocumentR egistryHel per.Create SingleValu eSlot() -- End"); | |||||
| 785 | ||||||
| 786 | retu rn this.Cr eateMultiV alueSlot(s SlotName, saSlotValu e); | |||||
| 787 | ||||||
| 788 | } | |||||
| 789 | ||||||
| 790 | pr otected St ring forma tCreationD ate(final Date sourc eDate) | |||||
| 791 | ||||||
| 792 | { | |||||
| 793 | ||||||
| 794 | retu rn this.fo rmatDate(s ourceDate, | |||||
| 795 | MockAdap terDocQuer yPortImpl. DATE_FORMA T_CREATION ); | |||||
| 796 | ||||||
| 797 | } | |||||
| 798 | ||||||
| 799 | pr ivate Stri ng formatD ate(final Date sourc eDate, fin al String formatStri ng) | |||||
| 800 | ||||||
| 801 | { | |||||
| 802 | ||||||
| 803 | Stri ng formatt ed = ""; | |||||
| 804 | ||||||
| 805 | if ( (sourceDat e != null) && (forma tString != null)) { | |||||
| 806 | ||||||
| 807 | try { | |||||
| 808 | ||||||
| 809 | final Si mpleDateFo rmat forma tter = new SimpleDat eFormat( | |||||
| 810 | fo rmatString ); | |||||
| 811 | ||||||
| 812 | formatte r.setTimeZ one(TimeZo ne.getTime Zone("UTC" )); | |||||
| 813 | ||||||
| 814 | formatte d = format ter.format (sourceDat e); | |||||
| 815 | ||||||
| 816 | } | |||||
| 817 | ||||||
| 818 | catch (final Thr owable t) { | |||||
| 819 | ||||||
| 820 | MockAdap terDocQuer yPortImpl. logger.log p(Level.WA RNING, thi s | |||||
| 821 | .g etClass(). getName(), "formatDa te", | |||||
| 822 | "F ailed to f ormat a da te (" + so urceDate.t oString() | |||||
| 823 | + ") t o a format ted string using the format '" | |||||
| 824 | + form atString + "': " + t .getMessag e(), t); | |||||
| 825 | ||||||
| 826 | } | |||||
| 827 | ||||||
| 828 | } | |||||
| 829 | ||||||
| 830 | retu rn formatt ed; | |||||
| 831 | ||||||
| 832 | } | |||||
| 833 | ||||||
| 834 | pr otected St ring forma tServiceDa te(final D ate source Date) | |||||
| 835 | ||||||
| 836 | { | |||||
| 837 | ||||||
| 838 | retu rn this.fo rmatDate(s ourceDate, | |||||
| 839 | MockAdap terDocQuer yPortImpl. DATE_FORMA T_SERVICE) ; | |||||
| 840 | ||||||
| 841 | } | |||||
| 842 | ||||||
| 843 | pr ivate Map< String, Li st<String> > getMapFr omSlots( | |||||
| 844 | final List<SlotT ype1> slot s) { | |||||
| 845 | fina l HashMap< String, Li st<String> > ret = ne w HashMap< String, Li st<String> >(); | |||||
| 846 | for (final Slo tType1 slo t : slots) { | |||||
| 847 | if (!N ullChecker .isNullOrE mpty(slot. getName()) | |||||
| 848 | && !NullCh ecker.isNu llOrEmpty( slot.getVa lueList()) | |||||
| 849 | && !NullCh ecker.isNu llOrEmpty( slot.getVa lueList() | |||||
| 850 | .get Value())) { | |||||
| 851 | List<Str ing> value s = ret.ge t(slot.get Name()); | |||||
| 852 | if (valu es == null ) { | |||||
| 853 | values = n ew ArrayLi st<String> (); | |||||
| 854 | ret.put(sl ot.getName (), values ); | |||||
| 855 | } | |||||
| 856 | values.a ddAll(slot .getValueL ist().getV alue()); | |||||
| 857 | } | |||||
| 858 | } | |||||
| 859 | retu rn ret; | |||||
| 860 | } | |||||
| 861 | ||||||
| 862 | @O verride | |||||
| 863 | pr otected vo id initDef aultStrate gies() { | |||||
| 864 | } | |||||
| 865 | ||||||
| 866 | @O verride | |||||
| 867 | pu blic Objec t marshalS endAndRece ive(final Object req uestPayloa d) { | |||||
| 868 | retu rn this | |||||
| 869 | .respond ingGateway CrossGatew ayQuery((R espondingG atewayCros sGatewayQu eryRequest ) requestP ayload); | |||||
| 870 | } | |||||
| 871 | ||||||
| 872 | pu blic void parseParam FormattedS tring(fina l String p aramFormat tedString, | |||||
| 873 | final List<Strin g> resultC ollection) | |||||
| 874 | ||||||
| 875 | { | |||||
| 876 | ||||||
| 877 | if ( (paramForm attedStrin g != null) && (resul tCollectio n != null) ) { | |||||
| 878 | ||||||
| 879 | if (pa ramFormatt edString.s tartsWith( "(")) { | |||||
| 880 | ||||||
| 881 | String w orking = p aramFormat tedString. substring( 1); | |||||
| 882 | ||||||
| 883 | final in t endIndex = working .indexOf(" )"); | |||||
| 884 | ||||||
| 885 | if (endI ndex != -1 ) { | |||||
| 886 | ||||||
| 887 | working = working.su bstring(0, endIndex) ; | |||||
| 888 | ||||||
| 889 | } | |||||
| 890 | ||||||
| 891 | final St ring[] mul tiValueStr ing = work ing.split( ","); | |||||
| 892 | ||||||
| 893 | if (mult iValueStri ng != null ) { | |||||
| 894 | ||||||
| 895 | for (final String el ement : mu ltiValueSt ring) { | |||||
| 896 | ||||||
| 897 | St ring singl eValue = e lement; | |||||
| 898 | ||||||
| 899 | if (singleVa lue != nul l) { | |||||
| 900 | ||||||
| 901 | sing leValue = singleValu e.trim(); | |||||
| 902 | ||||||
| 903 | } | |||||
| 904 | ||||||
| 905 | if (singleVa lue.starts With("'")) { | |||||
| 906 | ||||||
| 907 | sing leValue = singleValu e.substrin g(1); | |||||
| 908 | ||||||
| 909 | fina l int endT ickIndex = singleVal ue.indexOf ("'"); | |||||
| 910 | ||||||
| 911 | if ( endTickInd ex != -1) { | |||||
| 912 | ||||||
| 913 | single Value = si ngleValue. substring( 0, | |||||
| 914 | endTickInd ex); | |||||
| 915 | ||||||
| 916 | } | |||||
| 917 | ||||||
| 918 | } | |||||
| 919 | ||||||
| 920 | re sultCollec tion.add(s ingleValue ); | |||||
| 921 | ||||||
| 922 | } | |||||
| 923 | ||||||
| 924 | } | |||||
| 925 | ||||||
| 926 | } | |||||
| 927 | ||||||
| 928 | else { | |||||
| 929 | ||||||
| 930 | resultCo llection.a dd(paramFo rmattedStr ing); | |||||
| 931 | ||||||
| 932 | } | |||||
| 933 | ||||||
| 934 | } | |||||
| 935 | ||||||
| 936 | } | |||||
| 937 | ||||||
| 938 | pu blic List< String> pa rseParamFo rmattedStr ings( | |||||
| 939 | final List<Strin g> paramFo rmattedStr ings) | |||||
| 940 | ||||||
| 941 | { | |||||
| 942 | ||||||
| 943 | fina l List<Str ing> ret = new Array List<Strin g>(); | |||||
| 944 | ||||||
| 945 | for (final Str ing paramF ormattedSt ring : par amFormatte dStrings) { | |||||
| 946 | ||||||
| 947 | this.p arseParamF ormattedSt ring(param FormattedS tring, ret ); | |||||
| 948 | ||||||
| 949 | } | |||||
| 950 | ||||||
| 951 | retu rn ret; | |||||
| 952 | ||||||
| 953 | } | |||||
| 954 | ||||||
| 955 | pu blic Adhoc QueryRespo nse respon dingGatewa yCrossGate wayQuery( | |||||
| 956 | final Responding GatewayCro ssGatewayQ ueryReques t respondi ngGatewayC rossGatewa yQueryRequ est) { | |||||
| 957 | ||||||
| 958 | try { | |||||
| 959 | final Result res ult = new DOMResult( ); | |||||
| 960 | final Marshaller marshalle r = this.g etMarshall er(); | |||||
| 961 | marsha ller.marsh al(respond ingGateway CrossGatew ayQueryReq uest, | |||||
| 962 | result); | |||||
| 963 | ((DOMR esult) res ult).getNo de(); | |||||
| 964 | new XM LToString( ) | |||||
| 965 | .transform ((org.w3c. dom.Docume nt) ((DOMR esult) res ult) | |||||
| 966 | .get Node()); | |||||
| 967 | } ca tch (final Transform erExceptio n ex) { | |||||
| 968 | throw new Runtim eException (ex); | |||||
| 969 | } ca tch (final IOExcepti on ex) { | |||||
| 970 | throw new Runtim eException (ex); | |||||
| 971 | } | |||||
| 972 | ||||||
| 973 | Mock AdapterDoc QueryPortI mpl.logger .entering( this.getCl ass().getN ame(), | |||||
| 974 | "respond ingGateway CrossGatew ayQuery"); | |||||
| 975 | Adho cQueryResp onse ret; | |||||
| 976 | fina l AdhocQue ryRequest body = res pondingGat ewayCrossG atewayQuer yRequest | |||||
| 977 | .getAdho cQueryRequ est(); | |||||
| 978 | try { | |||||
| 979 | if (bo dy != null ) { | |||||
| 980 | final Ad hocQueryTy pe adhocQu ery = body .getAdhocQ uery(); | |||||
| 981 | final Li st<SlotTyp e1> slots = adhocQue ry.getSlot (); | |||||
| 982 | final Ma p<String, List<Strin g>> queryP arams = th is | |||||
| 983 | .s etDefaults (this.getM apFromSlot s(slots)); | |||||
| 984 | final Li st<Documen t> results = new Arr ayList<Doc ument>(); | |||||
| 985 | if (!Nul lChecker | |||||
| 986 | .i sNullOrEmp ty(queryPa rams | |||||
| 987 | .get(M ockAdapter DocQueryPo rtImpl.EBX ML_DOCENTR Y_PATIENT_ ID))) { | |||||
| 988 | for (final String qu eryName : this | |||||
| 989 | .par seParamFor mattedStri ngs(queryP arams | |||||
| 990 | .get(Moc kAdapterDo cQueryPort Impl.EBXML _DOCENTRY_ CLASS_CODE ))) { | |||||
| 991 | ||||||
| 992 | fo r (int i = 0; i < 2; i++) { | |||||
| 993 | fina l Document document = new Docu ment(); | |||||
| 994 | docu ment.setBe ginDate(ne w Date()); | |||||
| 995 | docu ment.setCl assCode("T estClassCo de" + i); | |||||
| 996 | docu ment.setCl assCodeDis playName(" TestClassC odeDisplay Name" | |||||
| 997 | + i); | |||||
| 998 | docu ment.setCl assCodeSch eme("TestC lassCodeSc heme" | |||||
| 999 | + i); | |||||
| 1000 | docu ment.setCr eationTime (new Date( )); | |||||
| 1001 | docu ment.setDo cumentId(i * 1000L); | |||||
| 1002 | do cument.set DocumentUn iqueId("2. 25." + Mat h.random() * 10000d) ; | |||||
| 1003 | docu ment.setEn dDate(new Date()); | |||||
| 1004 | docu ment.setTi tle("TestT itle" + i) ; | |||||
| 1005 | resu lts.add(do cument); | |||||
| 1006 | } | |||||
| 1007 | ||||||
| 1008 | } | |||||
| 1009 | ret = this .createAdh ocQueryRes ponse(body , results) ; | |||||
| 1010 | } else { | |||||
| 1011 | ret = this .createAdh ocQueryRes ponseError (body); | |||||
| 1012 | } | |||||
| 1013 | } else { | |||||
| 1014 | ret = th is.createA dhocQueryR esponseErr or(body); | |||||
| 1015 | } | |||||
| 1016 | } ca tch (final Throwable t) { | |||||
| 1017 | MockAd apterDocQu eryPortImp l.logger.l ogp(Level. WARNING, t his | |||||
| 1018 | .getClass( ).getName( ), | |||||
| 1019 | "respondin gGatewayCr ossGateway Query", "E xception", t); | |||||
| 1020 | ret = this.creat eAdhocQuer yResponseE rror(body) ; | |||||
| 1021 | } fi nally { | |||||
| 1022 | MockAd apterDocQu eryPortImp l.logger.e xiting(thi s.getClass () | |||||
| 1023 | .getName() , "respond ingGateway CrossGatew ayQuery"); | |||||
| 1024 | } | |||||
| 1025 | retu rn ret; | |||||
| 1026 | } | |||||
| 1027 | ||||||
| 1028 | pr ivate Stri ng retriev eHomeCommu nityId() | |||||
| 1029 | ||||||
| 1030 | { | |||||
| 1031 | retu rn "2.16.8 40.1.11388 3.4.349"; | |||||
| 1032 | } | |||||
| 1033 | ||||||
| 1034 | pr ivate Map< String, Li st<String> > setDefau lts( | |||||
| 1035 | final Map<String , List<Str ing>> valu es) { | |||||
| 1036 | if ( NullChecke r.isNullOr Empty(valu es | |||||
| 1037 | .get(Moc kAdapterDo cQueryPort Impl.EBXML _DOCENTRY_ CLASS_CODE ))) { | |||||
| 1038 | values .put(MockA dapterDocQ ueryPortIm pl.EBXML_D OCENTRY_CL ASS_CODE, | |||||
| 1039 | Arrays.asL ist(new St ring[] { " 34133-9" } )); | |||||
| 1040 | } | |||||
| 1041 | if ( NullChecke r | |||||
| 1042 | .isNullO rEmpty(val ues | |||||
| 1043 | .g et(MockAda pterDocQue ryPortImpl .EBXML_DOC ENTRY_CLAS S_CODE_SCH EME))) { | |||||
| 1044 | values .put( | |||||
| 1045 | MockAdapte rDocQueryP ortImpl.EB XML_DOCENT RY_CLASS_C ODE_SCHEME , | |||||
| 1046 | Arrays.asL ist(new St ring[] { " 2.16.840.1 .113883.6. 1" })); | |||||
| 1047 | } | |||||
| 1048 | fina l SimpleDa teFormat f ormatter = new Simpl eDateForma t( | |||||
| 1049 | MockAdap terDocQuer yPortImpl. DATE_FORMA T_FULL); | |||||
| 1050 | if ( NullChecke r | |||||
| 1051 | .isNullO rEmpty(val ues | |||||
| 1052 | .g et(MockAda pterDocQue ryPortImpl .EBXML_DOC ENTRY_SERV ICE_START_ TIME_FROM) )) { | |||||
| 1053 | values .put( | |||||
| 1054 | MockAdapte rDocQueryP ortImpl.EB XML_DOCENT RY_SERVICE _START_TIM E_FROM, | |||||
| 1055 | Arrays.asL ist(new St ring[] { f ormatter.f ormat(new Date( | |||||
| 1056 | Syst em.current TimeMillis () | |||||
| 1057 | - MockAd apterDocQu eryPortImp l.TWO_YEAR S)) })); | |||||
| 1058 | } | |||||
| 1059 | if ( NullChecke r | |||||
| 1060 | .isNullO rEmpty(val ues | |||||
| 1061 | .g et(MockAda pterDocQue ryPortImpl .EBXML_DOC ENTRY_SERV ICE_STOP_T IME_TO))) { | |||||
| 1062 | values .put( | |||||
| 1063 | MockAdapte rDocQueryP ortImpl.EB XML_DOCENT RY_SERVICE _STOP_TIME _TO, | |||||
| 1064 | Arrays.asL ist(new St ring[] { f ormatter.f ormat(new Date()) }) ); | |||||
| 1065 | } | |||||
| 1066 | fina l List<Str ing> patie ntIds = va lues | |||||
| 1067 | .get(Moc kAdapterDo cQueryPort Impl.EBXML _DOCENTRY_ PATIENT_ID ); | |||||
| 1068 | if ( !NullCheck er.isNullO rEmpty(pat ientIds)) { | |||||
| 1069 | final List<Strin g> fixed = new Array List<Strin g>(); | |||||
| 1070 | final Pattern p = Pattern. compile("\ \d{10}V\\d {6}"); | |||||
| 1071 | for (f inal Strin g patientI d : patien tIds) { | |||||
| 1072 | final Ma tcher m = p.matcher( patientId) ; | |||||
| 1073 | if (m.fi nd()) { | |||||
| 1074 | fixed.add( m.group()) ; | |||||
| 1075 | } | |||||
| 1076 | } | |||||
| 1077 | values .put(MockA dapterDocQ ueryPortIm pl.EBXML_D OCENTRY_PA TIENT_ID, | |||||
| 1078 | fixed); | |||||
| 1079 | } | |||||
| 1080 | retu rn values; | |||||
| 1081 | } | |||||
| 1082 | ||||||
| 1083 | @O verride | |||||
| 1084 | pu blic void setMessage Sender(Web ServiceMes sageSender messageSe nder) { | |||||
| 1085 | supe r.setMessa geSender(m essageSend er); | |||||
| 1086 | } | |||||
| 1087 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.