Produced by Araxis Merge on 12/5/2017 12:06:43 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 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ImagingCommon\main\src\java\gov\va\med\imaging | StudyURN.java | Mon Dec 4 21:34:26 2017 UTC |
| 2 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ImagingCommon\main\src\java\gov\va\med\imaging | StudyURN.java | Mon Dec 4 22:01:58 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 1340 |
| 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.i maging; | |
| 2 | ||
| 3 | import gov .va.med.*; | |
| 4 | import gov .va.med.ex ceptions.G lobalArtif actIdentif ierFormatE xception; | |
| 5 | import gov .va.med.im aging.exce ptions.Ima geURNForma tException ; | |
| 6 | import gov .va.med.im aging.exce ptions.Stu dyURNForma tException ; | |
| 7 | import gov .va.med.im aging.exce ptions.URN FormatExce ption; | |
| 8 | import gov .va.med.im aging.exch ange.utili ty.Base32C onversionU tility; | |
| 9 | ||
| 10 | import jav a.io.Seria lizable; | |
| 11 | import jav a.util.reg ex.Matcher ; | |
| 12 | import jav a.util.reg ex.Pattern ; | |
| 13 | ||
| 14 | import org .apache.lo gging.log4 j.LogManag er; | |
| 15 | import org .apache.lo gging.log4 j.Logger; | |
| 16 | ||
| 17 | /** | |
| 18 | * | |
| 19 | * @author
|
|
| 20 | * | |
| 21 | * Defines the synta x of a URN used to i dentify VA studies t o the outs ide world. | |
| 22 | * An Stud yURN is de fined to b e in the f ollowing f ormat: | |
| 23 | * "urn" + ":" + "va study" + " :" + <site -id> + "-" + <assign ed-id> + " -" + <pati entICN> | |
| 24 | * where: | |
| 25 | * <site -id> is ei ther the s ite from w hich the i mage origi nated or t he string "va-imagin g" | |
| 26 | * <assi gned-id> i s the perm anent, imm utable ID as assigne d by the o riginating site or a | |
| 27 | * VA-do main uniqu e ID (an I maging GUI D) | |
| 28 | * <pati entICN> is the VA En terprise i dentifier for the pa tient of t he study | |
| 29 | * | |
| 30 | */ | |
| 31 | @URNType(n amespace=" vastudy") | |
| 32 | public cla ss StudyUR N | |
| 33 | extends Ab stractImag ingURN | |
| 34 | implements Serializa ble, Patie ntArtifact Identifier | |
| 35 | { | |
| 36 | pr ivate stat ic final l ong serial VersionUID = 1L; | |
| 37 | ||
| 38 | pr ivate stat ic final S tring name space = "v astudy"; | |
| 39 | pu blic stati c final We llKnownOID DEFAULT_H OME_COMMUN ITY_ID = W ellKnownOI D.VA_RADIO LOGY_IMAGE ; | |
| 40 | ||
| 41 | pr otected st atic Names paceIdenti fier names paceIdenti fier = new Namespace Identifier (namespace ); | |
| 42 | pu blic stati c synchron ized Names paceIdenti fier getMa nagedNames pace() | |
| 43 | { | |
| 44 | retu rn namespa ceIdentifi er; | |
| 45 | } | |
| 46 | ||
| 47 | pr ivate stat ic final S tring name spaceSpeci ficStringR egex = | |
| 48 | "([^ -]+)" + // the site ID | |
| 49 | URN. namespaceS pecificStr ingDelimit er + | |
| 50 | "([^ -]+)" + // t he group o r study ID | |
| 51 | URN. namespaceS pecificStr ingDelimit er + | |
| 52 | "([^ -]+)"; // t he patient ID | |
| 53 | pr ivate stat ic final P attern nam espaceSpec ificString Pattern = Pattern.co mpile(name spaceSpeci ficStringR egex); | |
| 54 | pr otected st atic final int SITE_ ID_GROUP = 1; | |
| 55 | pr otected st atic final int GROUP _ID_GROUP = 2; | |
| 56 | pr otected st atic final int PATIE NT_ID_GROU P = 3; | |
| 57 | ||
| 58 | pu blic stati c final in t ADDITION AL_IDENTIF IER_PATIEN T_IDENTIFI ER_TYPE_IN DEX = 0; | |
| 59 | ||
| 60 | st atic | |
| 61 | { | |
| 62 | Syst em.out.pri ntln("Stud yURN regul ar express ion is '" + namespac eSpecificS tringRegex + "'."); | |
| 63 | } | |
| 64 | ||
| 65 | pr ivate fina l static L ogger logg er = LogMa nager.getL ogger(Stud yURN.class ); | |
| 66 | ||
| 67 | /* * | |
| 68 | * @param or iginatingS iteId | |
| 69 | * @param as signedId | |
| 70 | * @return | |
| 71 | * / | |
| 72 | pu blic stati c StudyURN create(St ring origi natingSite Id, String assignedI d, String patientId) | |
| 73 | th rows URNFo rmatExcept ion | |
| 74 | { | |
| 75 | if(B hieStudyUR N.DEFAULT_ REPOSITORY _ID.equals (originati ngSiteId)) | |
| 76 | return BhieStudy URN.create (assignedI d, patient Id); | |
| 77 | else | |
| 78 | return new Study URN(origin atingSiteI d, assigne dId, patie ntId); | |
| 79 | } | |
| 80 | ||
| 81 | ||
| 82 | /* * | |
| 83 | * Create a StudyURN i nstance fr om an Docu mentSetURN . | |
| 84 | * This prov ide the tr anslation within the datasourc e, using t he same | |
| 85 | * RPCs as i mage retri eval and p resenting results in Document semantics. | |
| 86 | * | |
| 87 | * @param st udyUrn | |
| 88 | * @return | |
| 89 | * @throws U RNFormatEx ception | |
| 90 | * / | |
| 91 | pu blic stati c StudyURN create(Do cumentSetU RN documen tSetUrn) | |
| 92 | th rows URNFo rmatExcept ion | |
| 93 | { | |
| 94 | retu rn create( documentSe tUrn.getOr iginatingS iteId(), d ocumentSet Urn.getDoc umentSetId (), docume ntSetUrn.g etPatientI d()); | |
| 95 | } | |
| 96 | ||
| 97 | /* * | |
| 98 | * | |
| 99 | * @param ur nComponent s | |
| 100 | * @return | |
| 101 | * @throws U RNFormatEx ception | |
| 102 | * / | |
| 103 | pu blic stati c StudyURN create(UR NComponent s urnCompo nents, SER IALIZATION _FORMAT se rializatio nFormat) | |
| 104 | th rows URNFo rmatExcept ion | |
| 105 | { | |
| 106 | try | |
| 107 | { | |
| 108 | return new Study URN(urnCom ponents, s erializati onFormat); | |
| 109 | } | |
| 110 | catc h(URNForma tException urnfX) | |
| 111 | { | |
| 112 | // if the study URN origin ating Site ID is sit e 200 then this is r eally a BH IE URN, | |
| 113 | // Cli nicalDispl ay does no t recogniz e anything but VA UR Ns, this k ludge insu lates | |
| 114 | // the rest of t he system from that. | |
| 115 | // If this isn't a BHIE st udy URN th en throw t he origina l exceptio n. | |
| 116 | try{re turn BhieS tudyURN.cr eate(urnCo mponents, serializat ionFormat) ;} | |
| 117 | catch( URNFormatE xception u rnfX2){thr ow urnfX;} | |
| 118 | } | |
| 119 | } | |
| 120 | ||
| 121 | /* * | |
| 122 | * | |
| 123 | * @param ur nComponent s | |
| 124 | * @return | |
| 125 | * @throws U RNFormatEx ception | |
| 126 | * / | |
| 127 | pu blic stati c StudyURN createFro mBase32(UR NComponent s urnCompo nents) | |
| 128 | th rows URNFo rmatExcept ion | |
| 129 | { | |
| 130 | try | |
| 131 | { | |
| 132 | return new Study URN(urnCom ponents, S ERIALIZATI ON_FORMAT. PATCH83_VF TP); | |
| 133 | } | |
| 134 | catc h(URNForma tException urnfX) | |
| 135 | { | |
| 136 | // if the study URN origin ating Site ID is sit e 200 then this is r eally a BH IE URN, | |
| 137 | // Cli nicalDispl ay does no t recogniz e anything but VA UR Ns, this k ludge insu lates | |
| 138 | // the rest of t he system from that. | |
| 139 | return BhieStudy URN.create FromBase32 (urnCompon ents); | |
| 140 | } | |
| 141 | } | |
| 142 | ||
| 143 | /* * | |
| 144 | * | |
| 145 | * @param ho meCommunit yId | |
| 146 | * @param re positoryId | |
| 147 | * @param do cumentId | |
| 148 | * @return | |
| 149 | * @throws U RNFormatEx ception | |
| 150 | * / | |
| 151 | pu blic stati c StudyURN createFro mGlobalArt ifactIdent ifiers( | |
| 152 | Stri ng homeCom munityId, | |
| 153 | Stri ng reposit oryId, | |
| 154 | Stri ng documen tId) | |
| 155 | th rows URNFo rmatExcept ion | |
| 156 | { | |
| 157 | retu rn createF romGlobalA rtifactIde ntifiers( homeCommun ityId, rep ositoryId, documentI d, (String [])null); | |
| 158 | } | |
| 159 | ||
| 160 | /* * | |
| 161 | * | |
| 162 | * @param ho meCommunit yId | |
| 163 | * @param re positoryId | |
| 164 | * @param do cumentId | |
| 165 | * @return | |
| 166 | * @throws U RNFormatEx ception | |
| 167 | * / | |
| 168 | pu blic stati c StudyURN createFro mGlobalArt ifactIdent ifiers( | |
| 169 | Stri ng homeCom munityId, | |
| 170 | Stri ng reposit oryId, | |
| 171 | Stri ng documen tId, | |
| 172 | Stri ng... addi tionalIden tifiers) | |
| 173 | th rows URNFo rmatExcept ion | |
| 174 | { | |
| 175 | if( BhieStudyU RN.isAppli cableHomeC ommunityId (homeCommu nityId, re positoryId , document Id) ) | |
| 176 | return BhieStudy URN.create FromGlobal ArtifactId entifiers( homeCommun ityId, rep ositoryId, documentI d); | |
| 177 | else if( Study URN.isAppl icableHome CommunityI d(homeComm unityId, r epositoryI d, documen tId) ) | |
| 178 | return new Study URN( repos itoryId, d ocumentId ); | |
| 179 | else | |
| 180 | throw new URNFor matExcepti on("Home c ommunity I D '" + hom eCommunity Id + "' ca nnot be us ed to crea te an Imag eURN or it s derivati ves."); | |
| 181 | } | |
| 182 | ||
| 183 | /* * | |
| 184 | * Required static met hod, must return TRU E when thi s class ca n represen t | |
| 185 | * a global artifact I D with the given hom e communit y ID. | |
| 186 | * NOTE: thi s class sh ould not r eturn true when the home commu nity ID | |
| 187 | * indicates VA_RADIOL OGY becaus e that can be confus ed with th e ImageURN | |
| 188 | * which use s the same home comm unity ID. | |
| 189 | * | |
| 190 | * @param ho meCommunit yId | |
| 191 | * @param re positoryId | |
| 192 | * @param do cumentId | |
| 193 | * @return | |
| 194 | * / | |
| 195 | pu blic stati c boolean isApplicab leHomeComm unityId(St ring homeC ommunityId , String r epositoryI d, String documentId ) | |
| 196 | { | |
| 197 | retu rn | |
| 198 | StudyU RN.namespa ce.equalsI gnoreCase( homeCommun ityId) || | |
| 199 | WellKn ownOID.VA_ RADIOLOGY_ IMAGE.isAp plicable(h omeCommuni tyId); | |
| 200 | } | |
| 201 | ||
| 202 | // ========= ========== ========== ========== ========== ========== ========== ========== === | |
| 203 | // Instance Members | |
| 204 | // ========= ========== ========== ========== ========== ========== ========== ========== === | |
| 205 | pr otected St ring origi natingSite Id; | |
| 206 | pr otected St ring study Id; | |
| 207 | pr otected St ring patie ntId; | |
| 208 | ||
| 209 | // ========= ========== ========== ========== ========== ========== ========== ========== ======== | |
| 210 | // Construct ors | |
| 211 | // ========= ========== ========== ========== ========== ========== ========== ========== ======== | |
| 212 | /* * | |
| 213 | * Pass-thro ugh for de rived clas ses with d ifferent n amespace. | |
| 214 | * | |
| 215 | * @param na mespaceIde ntifier | |
| 216 | * @throws U RNFormatEx ception | |
| 217 | * / | |
| 218 | pr otected St udyURN(Nam espaceIden tifier nid ) | |
| 219 | th rows URNFo rmatExcept ion | |
| 220 | { | |
| 221 | supe r(nid); | |
| 222 | } | |
| 223 | ||
| 224 | /* * | |
| 225 | * Provided only as a pass throu gh for der ived class es. | |
| 226 | * | |
| 227 | * / | |
| 228 | pr otected St udyURN( | |
| 229 | Name spaceIdent ifier name spaceIdent ifier, | |
| 230 | Stri ng namespa ceSpecific String, | |
| 231 | Stri ng... addi tionalIden tifiers) | |
| 232 | th rows URNFo rmatExcept ion | |
| 233 | { | |
| 234 | supe r(namespac eIdentifie r, namespa ceSpecific String, ad ditionalId entifiers) ; | |
| 235 | } | |
| 236 | ||
| 237 | /* * | |
| 238 | * Used dire ctly and a pass thro ugh for de rived clas ses. | |
| 239 | * The const ructor cal led by the URN class when a UR N derived class | |
| 240 | * is being created fr om a Strin g represen tation. | |
| 241 | * | |
| 242 | * @param co mponents | |
| 243 | * @throws U RNFormatEx ception | |
| 244 | * / | |
| 245 | pr otected St udyURN(URN Components urnCompon ents, SERI ALIZATION_ FORMAT ser ialization Format) | |
| 246 | th rows URNFo rmatExcept ion | |
| 247 | { | |
| 248 | supe r(urnCompo nents, ser ialization Format); | |
| 249 | } | |
| 250 | ||
| 251 | /* * | |
| 252 | * | |
| 253 | * @param or iginatingS iteId | |
| 254 | * @param st udyId | |
| 255 | * @param pa tientId | |
| 256 | * @throws U RNFormatEx ception | |
| 257 | * / | |
| 258 | pr otected St udyURN( | |
| 259 | Stri ng origina tingSiteId , | |
| 260 | Stri ng studyId , | |
| 261 | Stri ng patient Id) | |
| 262 | th rows URNFo rmatExcept ion | |
| 263 | { | |
| 264 | this (StudyURN. getManaged Namespace( ), origina tingSiteId , studyId, patientId ); | |
| 265 | } | |
| 266 | ||
| 267 | ||
| 268 | /* * | |
| 269 | * Defined t o allow pa ssthrough from deriv ed classes | |
| 270 | * | |
| 271 | * @param na mespaceIde ntifier | |
| 272 | * @param or iginatingS iteId | |
| 273 | * @param st udyId | |
| 274 | * @param pa tientId | |
| 275 | * @throws U RNFormatEx ception | |
| 276 | * / | |
| 277 | pr otected St udyURN( | |
| 278 | Name spaceIdent ifier name spaceIdent ifier, | |
| 279 | Stri ng origina tingSiteId , | |
| 280 | Stri ng studyId , | |
| 281 | Stri ng patient Id) | |
| 282 | th rows URNFo rmatExcept ion | |
| 283 | { | |
| 284 | supe r(namespac eIdentifie r); | |
| 285 | ||
| 286 | setO riginating SiteId(ori ginatingSi teId); | |
| 287 | ||
| 288 | setS tudyId(stu dyId); | |
| 289 | ||
| 290 | setP atientId(p atientId); | |
| 291 | } | |
| 292 | ||
| 293 | ||
| 294 | /* * | |
| 295 | * | |
| 296 | * @param re positoryUn iqueId | |
| 297 | * @param do cumentId | |
| 298 | * @throws U RNFormatEx ception | |
| 299 | * / | |
| 300 | pr otected St udyURN(Str ing reposi toryUnique Id, String documentI d) | |
| 301 | th rows URNFo rmatExcept ion | |
| 302 | { | |
| 303 | this (StudyURN. getManaged Namespace( ), reposit oryUniqueI d, documen tId); | |
| 304 | } | |
| 305 | ||
| 306 | /* * | |
| 307 | * Construct or from th e GAI (IHE ) identifi ers | |
| 308 | * | |
| 309 | * @param re positoryUn iqueId | |
| 310 | * @param do cumentId | |
| 311 | * @throws U RNFormatEx ception | |
| 312 | * / | |
| 313 | pr otected St udyURN(Nam espaceIden tifier nam espaceIden tifier, St ring repos itoryUniqu eId, Strin g document Id) | |
| 314 | th rows URNFo rmatExcept ion | |
| 315 | { | |
| 316 | supe r(namespac eIdentifie r); | |
| 317 | try | |
| 318 | { | |
| 319 | this.o riginating SiteId = r epositoryU niqueId; | |
| 320 | parseD ocumentUni queId(docu mentId); | |
| 321 | } | |
| 322 | catc h (GlobalA rtifactIde ntifierFor matExcepti on x) | |
| 323 | { | |
| 324 | throw new URNFor matExcepti on(x); | |
| 325 | } | |
| 326 | } | |
| 327 | ||
| 328 | /* * | |
| 329 | * Override the do-not hing versi on of this method to parse the | |
| 330 | * namespace specific portion an d find the component parts. | |
| 331 | * | |
| 332 | * @param na mespaceSpe cificStrin g | |
| 333 | * @throws U RNFormatEx ception | |
| 334 | * / | |
| 335 | @O verride | |
| 336 | pu blic void parseNames paceSpecif icString(N amespaceId entifier n amespace, String nam espaceSpec ificString , SERIALIZ ATION_FORM AT seriali zationForm at) | |
| 337 | th rows URNFo rmatExcept ion | |
| 338 | { | |
| 339 | if(n amespaceSp ecificStri ng == null ) | |
| 340 | throw new URNFor matExcepti on("The na mespace sp ecific str ing for a( n) " + thi s.getClass ().getSimp leName() + " cannot be null.") ; | |
| 341 | ||
| 342 | Matc her nssMat cher = nam espaceSpec ificString Pattern.ma tcher(name spaceSpeci ficString) ; | |
| 343 | ||
| 344 | if(! nssMatche r.matches( )) | |
| 345 | { | |
| 346 | String msg = "Na mespace sp ecific str ing '" + n amespaceSp ecificStri ng + "' is not valid ."; | |
| 347 | logger .warn(msg) ; | |
| 348 | throw new StudyU RNFormatEx ception(ms g); | |
| 349 | } | |
| 350 | ||
| 351 | setO riginating SiteId( ns sMatcher.g roup(Study URN.SITE_I D_GROUP).t rim() ); | |
| 352 | setP atientId( nssMatcher .group(Stu dyURN.PATI ENT_ID_GRO UP).trim() ); | |
| 353 | Stri ng tmpStud yId = nssM atcher.gro up(StudyUR N.GROUP_ID _GROUP).tr im(); | |
| 354 | swit ch(seriali zationForm at) | |
| 355 | { | |
| 356 | case PATCH83_V FTP: | |
| 357 | setStu dyId( Base 32Conversi onUtility. base32Deco de(tmpStud yId) ); | |
| 358 | break; | |
| 359 | case RFC2141: | |
| 360 | case VFTP: | |
| 361 | case NATIVE: | |
| 362 | case RAW: | |
| 363 | setStu dyId(tmpSt udyId); | |
| 364 | break; | |
| 365 | case CDTP: | |
| 366 | setStu dyId(URN.F ILENAME_TO _RFC2141_E SCAPING.es capeIllega lCharacter s(tmpStudy Id)); | |
| 367 | break; | |
| 368 | } | |
| 369 | } | |
| 370 | ||
| 371 | @O verride | |
| 372 | pu blic Strin g getHomeC ommunityId () | |
| 373 | { | |
| 374 | // I mages are always in the VA com munity | |
| 375 | retu rn WellKno wnOID.VA_R ADIOLOGY_I MAGE.getCa nonicalVal ue().toStr ing(); | |
| 376 | } | |
| 377 | ||
| 378 | @O verride | |
| 379 | pu blic Strin g getOrigi natingSite Id() | |
| 380 | { | |
| 381 | retu rn URN.RFC 2141_ESCAP ING.unesca peIllegalC haracters( this.origi natingSite Id); | |
| 382 | } | |
| 383 | pu blic void setOrigina tingSiteId (String or iginatingS iteId) | |
| 384 | th rows Study URNFormatE xception | |
| 385 | { | |
| 386 | this .originati ngSiteId = URN.RFC21 41_ESCAPIN G.escapeIl legalChara cters(orig inatingSit eId); | |
| 387 | if( !AbstractI magingURN. siteIdPatt ern.matche r(this.ori ginatingSi teId).matc hes() ) | |
| 388 | throw new StudyU RNFormatEx ception("T he site ID '" + this .originati ngSiteId + "' does n ot match t he pattern '" + Abst ractImagin gURN.siteI dPattern.p attern()); | |
| 389 | } | |
| 390 | ||
| 391 | pu blic Strin g getGroup Id() | |
| 392 | { | |
| 393 | retu rn URN.RFC 2141_ESCAP ING.unesca peIllegalC haracters( this.study Id); | |
| 394 | } | |
| 395 | pu blic Strin g getStudy Id(){retur n getGroup Id();} | |
| 396 | ||
| 397 | pu blic void setGroupId (String st udyId) | |
| 398 | th rows Study URNFormatE xception | |
| 399 | { | |
| 400 | this .studyId = URN.RFC21 41_ESCAPIN G.escapeIl legalChara cters(stud yId); | |
| 401 | if( !AbstractI magingURN. groupIdPat tern.match er(this.st udyId).mat ches() ) | |
| 402 | throw new StudyU RNFormatEx ception("T he study I D '" + thi s.studyId + "' does not match the patter n '" + Abs tractImagi ngURN.grou pIdPattern .pattern() ); | |
| 403 | } | |
| 404 | ||
| 405 | pu blic void setStudyId (String st udyId) | |
| 406 | th rows Study URNFormatE xception | |
| 407 | {s etGroupId( studyId);} | |
| 408 | ||
| 409 | @O verride | |
| 410 | pu blic Strin g getPatie ntId() | |
| 411 | { | |
| 412 | retu rn URN.RFC 2141_ESCAP ING.unesca peIllegalC haracters( this.patie ntId); | |
| 413 | } | |
| 414 | ||
| 415 | pu blic void setPatient Id(String patientId) | |
| 416 | th rows Study URNFormatE xception | |
| 417 | { | |
| 418 | this .patientId = URN.RFC 2141_ESCAP ING.escape IllegalCha racters(pa tientId); | |
| 419 | if( !AbstractI magingURN. patientIdP attern.mat cher(this. patientId) .matches() ) | |
| 420 | throw new StudyU RNFormatEx ception("T he patient ID '" + t his.patien tId + "' d oes not ma tch the pa ttern '" + AbstractI magingURN. patientIdP attern.pat tern()); | |
| 421 | } | |
| 422 | ||
| 423 | // ========= ========== ========== ========== ========== ========== ========== ====== | |
| 424 | // Serializa tion forma ts | |
| 425 | // ========= ========== ========== ========== ========== ========== ========== ====== | |
| 426 | /* * | |
| 427 | * Stringifi ed into th e Patch83 VFTP forma t, | |
| 428 | * i.e. urn: vaimage:20 0-<base32 encoded in stance ID> -<base32 e ncoded gro up ID>-<pa tient ICN> -<modality > | |
| 429 | * The insta nce ID and group ID are base 3 2 encoded, | |
| 430 | * the patie nt ICN and modality, if it exi sts, are n ot BASE32 encoded | |
| 431 | * the names pace is "v aimage" an d | |
| 432 | * the site ID is the originatin g site ID. | |
| 433 | * | |
| 434 | * @see gov. va.med.URN #toStringP atch83VFTP () | |
| 435 | * / | |
| 436 | @O verride | |
| 437 | pr otected St ring toStr ingPatch83 VFTP() | |
| 438 | { | |
| 439 | Stri ngBuilder ahnold = n ew StringB uilder(); | |
| 440 | ||
| 441 | // b uild the s cheme iden tifier | |
| 442 | ahno ld.append( urnSchemaI dentifier) ; | |
| 443 | ahno ld.append( urnCompone ntDelimite r); | |
| 444 | ||
| 445 | // b uild the n amespace i dentifier | |
| 446 | ahno ld.append( this.getNa mespaceIde ntifier(). getNamespa ce()); | |
| 447 | ahno ld.append( urnCompone ntDelimite r); | |
| 448 | ahno ld.append( getOrigina tingSiteId ()); | |
| 449 | ahno ld.append( URN.namesp aceSpecifi cStringDel imiter); | |
| 450 | ahno ld.append( SERIALIZA TION_FORMA T.PATCH83_ VFTP.seria lize(this. getGroupId ()) ); | |
| 451 | if(g etPatientI d() != nul l) | |
| 452 | { | |
| 453 | ahnold .append(UR N.namespac eSpecificS tringDelim iter); | |
| 454 | ahnold .append( t his.getPat ientId() ) ; | |
| 455 | } | |
| 456 | ||
| 457 | retu rn ahnold. toString() ; | |
| 458 | } | |
| 459 | ||
| 460 | ||
| 461 | /* (non-Java doc) | |
| 462 | * @see gov. va.med.URN #toString( ) | |
| 463 | * / | |
| 464 | @O verride | |
| 465 | pu blic Strin g toString () | |
| 466 | { | |
| 467 | Stri ngBuilder ahnold = n ew StringB uilder(); | |
| 468 | ||
| 469 | // b uild the s cheme iden tifier | |
| 470 | ahno ld.append( urnSchemaI dentifier) ; | |
| 471 | ahno ld.append( urnCompone ntDelimite r); | |
| 472 | ||
| 473 | // b uild the n amespace i dentifier | |
| 474 | ahno ld.append( this.getNa mespaceIde ntifier()) ; | |
| 475 | ahno ld.append( urnCompone ntDelimite r); | |
| 476 | ||
| 477 | ahno ld.append( this.getNa mespaceSpe cificStrin g()); | |
| 478 | ||
| 479 | retu rn ahnold. toString() ; | |
| 480 | } | |
| 481 | ||
| 482 | /* (non-Java doc) | |
| 483 | * @see gov. va.med.URN #toStringA sNative() | |
| 484 | * / | |
| 485 | @O verride | |
| 486 | pr otected St ring toStr ingNative( ) | |
| 487 | { | |
| 488 | Stri ngBuilder ahnold = n ew StringB uilder(); | |
| 489 | ||
| 490 | // b uild the s cheme iden tifier | |
| 491 | ahno ld.append( urnSchemaI dentifier) ; | |
| 492 | ahno ld.append( urnCompone ntDelimite r); | |
| 493 | ||
| 494 | // b uild the n amespace i dentifier | |
| 495 | ahno ld.append( this.getNa mespaceIde ntifier()) ; | |
| 496 | ahno ld.append( urnCompone ntDelimite r); | |
| 497 | ||
| 498 | // r estore any RFC2141 i llegal cha racters | |
| 499 | ahno ld.append( RFC2141_E SCAPING.un escapeIlle galCharact ers(this.g etNamespac eSpecificS tring()) ) ; | |
| 500 | ||
| 501 | retu rn ahnold. toString() ; | |
| 502 | } | |
| 503 | ||
| 504 | /* (non-Java doc) | |
| 505 | * @see gov. va.med.URN #toStringA sVAInterna l() | |
| 506 | * / | |
| 507 | @O verride | |
| 508 | pu blic Strin g toString CDTP() | |
| 509 | { | |
| 510 | Stri ngBuilder ahnold = n ew StringB uilder(); | |
| 511 | ||
| 512 | // b uild the s cheme iden tifier | |
| 513 | ahno ld.append( urnSchemaI dentifier) ; | |
| 514 | ahno ld.append( urnCompone ntDelimite r); | |
| 515 | ||
| 516 | // b uild the n amespace i dentifier | |
| 517 | ahno ld.append( this.getNa mespaceIde ntifier()) ; | |
| 518 | ahno ld.append( urnCompone ntDelimite r); | |
| 519 | ||
| 520 | Stri ng nss = t his.getNam espaceSpec ificString (); | |
| 521 | // e scape any filename i llegal cha racters | |
| 522 | nss = FILENAME _ESCAPING. escapeIlle galCharact ers(nss); | |
| 523 | ahno ld.append( nss); | |
| 524 | ||
| 525 | Stri ng additio nalIdentif iers = thi s.getAddit ionalIdent ifiersStri ng(); | |
| 526 | // e scape any filename i llegal cha racters | |
| 527 | addi tionalIden tifiers = FILENAME_E SCAPING.es capeIllega lCharacter s(addition alIdentifi ers); | |
| 528 | ahno ld.append( additional Identifier s); | |
| 529 | ||
| 530 | retu rn ahnold. toString() ; | |
| 531 | } | |
| 532 | ||
| 533 | /* * | |
| 534 | * | |
| 535 | * / | |
| 536 | @O verride | |
| 537 | pu blic Strin g getNames paceSpecif icString(S ERIALIZATI ON_FORMAT serializat ionFormat) | |
| 538 | { | |
| 539 | Stri ngBuilder ahnold = n ew StringB uilder(); | |
| 540 | ||
| 541 | // b uild the n amespace s pecific st ring | |
| 542 | ahno ld.append( this.origi natingSite Id); | |
| 543 | ahno ld.append( URN.namesp aceSpecifi cStringDel imiter); | |
| 544 | ahno ld.append( this.study Id); | |
| 545 | ahno ld.append( URN.namesp aceSpecifi cStringDel imiter); | |
| 546 | ahno ld.append( this.patie ntId); | |
| 547 | ||
| 548 | retu rn ahnold. toString() ; | |
| 549 | } | |
| 550 | ||
| 551 | // ========= ========== ========== ========== ========== ========== ========== ========== ====== | |
| 552 | // Global Ar tifact Ide ntifier Im plementati on | |
| 553 | // ========= ========== ========== ========== ========== ========== ========== ========== ====== | |
| 554 | /* * | |
| 555 | * A special implement ation of . equals() t his is use d with oth er | |
| 556 | * GlobalArt ifactIdent ifier real izations. | |
| 557 | * | |
| 558 | * @param th at | |
| 559 | * @return | |
| 560 | * / | |
| 561 | pu blic boole an equalsG lobalArtif actIdentif ier(Global ArtifactId entifier t hat) | |
| 562 | { | |
| 563 | retu rn GlobalA rtifactIde ntifierImp l.equalsGl obalArtifa ctIdentifi er(this, t hat); | |
| 564 | } | |
| 565 | ||
| 566 | @O verride | |
| 567 | pu blic boole an isEquiv alent(Rout ingToken t hat) | |
| 568 | { | |
| 569 | retu rn Routing TokenImpl. isEquivale nt(this, t hat); | |
| 570 | } | |
| 571 | ||
| 572 | @O verride | |
| 573 | pu blic boole an isInclu ding(Routi ngToken th at) | |
| 574 | { | |
| 575 | retu rn Routing TokenImpl. isIncludin g(this, th at); | |
| 576 | } | |
| 577 | ||
| 578 | // formattin g of the d ocument un ique ID, u sed for Gl obalArtifa ctIdentifi er support | |
| 579 | pr otected st atic final String do cumentUniq ueIdRegex = | |
| 580 | "(" + GROUPID_ REGEX + ") " + | |
| 581 | URN. namespaceS pecificStr ingDelimit er + | |
| 582 | "(" + PATIENTI D_REGEX + ")"; | |
| 583 | pr otected st atic final Pattern d ocumentUni queIdPatte rn = Patte rn.compile (documentU niqueIdReg ex); | |
| 584 | pr otected st atic final int DOCUM ENTUNIQUEI D_STUDY_ID _GROUP = 1 ; | |
| 585 | pr otected st atic final int DOCUM ENTUNIQUEI D_PATIENT_ ID_GROUP = 3; | |
| 586 | ||
| 587 | @O verride | |
| 588 | pu blic Strin g getDocum entUniqueI d() | |
| 589 | { | |
| 590 | retu rn formatD ocumentUni queId( get StudyId(), getPatien tId() ); | |
| 591 | } | |
| 592 | ||
| 593 | /* * | |
| 594 | * | |
| 595 | * @param gr oupId | |
| 596 | * @param pa tientId | |
| 597 | * @return | |
| 598 | * / | |
| 599 | pr otected st atic Strin g formatDo cumentUniq ueId(Strin g groupId, String pa tientId) | |
| 600 | { | |
| 601 | Stri ngBuilder sb = new S tringBuild er(); | |
| 602 | ||
| 603 | sb.a ppend(grou pId); | |
| 604 | if(p atientId ! = null) | |
| 605 | { | |
| 606 | sb.app end(URN.na mespaceSpe cificStrin gDelimiter ); | |
| 607 | sb.app end(patien tId); | |
| 608 | } | |
| 609 | retu rn sb.toSt ring(); | |
| 610 | } | |
| 611 | ||
| 612 | pr otected vo id parseDo cumentUniq ueId(Strin g document Id) | |
| 613 | th rows Globa lArtifactI dentifierF ormatExcep tion | |
| 614 | { | |
| 615 | Matc her matche r = StudyU RN.documen tUniqueIdP attern.mat cher(docum entId); | |
| 616 | if(! matcher.ma tches()) | |
| 617 | throw new Global ArtifactId entifierFo rmatExcept ion("'" + documentId + "' is n ot a valid document identifier for type '" + this. getClass() .getSimple Name() + " '."); | |
| 618 | ||
| 619 | this .studyId = matcher.g roup(DOCUM ENTUNIQUEI D_STUDY_ID _GROUP); | |
| 620 | this .patientId = matcher .group(DOC UMENTUNIQU EID_PATIEN T_ID_GROUP ); | |
| 621 | } | |
| 622 | ||
| 623 | @O verride | |
| 624 | pu blic Strin g getRepos itoryUniqu eId() | |
| 625 | { | |
| 626 | // f or a VA do cument set , the sire ID is the repositor y ID | |
| 627 | retu rn origina tingSiteId ; | |
| 628 | } | |
| 629 | ||
| 630 | @O verride | |
| 631 | pu blic Names paceIdenti fier getNa mespaceIde ntifier() | |
| 632 | { | |
| 633 | retu rn StudyUR N.namespac eIdentifie r; | |
| 634 | } | |
| 635 | ||
| 636 | @O verride | |
| 637 | pu blic int c ompareTo(G lobalArtif actIdentif ier o) | |
| 638 | { | |
| 639 | retu rn GlobalA rtifactIde ntifierImp l.compareT o(this, o) ; | |
| 640 | } | |
| 641 | ||
| 642 | @O verride | |
| 643 | pu blic Strin g getImagi ngIdentifi er() | |
| 644 | { | |
| 645 | retu rn getStud yId(); | |
| 646 | } | |
| 647 | ||
| 648 | ||
| 649 | // ========= ========== ========== ========== ========== ========== ========== ========== ======= | |
| 650 | // Make a de ep copy cl one | |
| 651 | // ========= ========== ========== ========== ========== ========== ========== ========== ======= | |
| 652 | @O verride | |
| 653 | pu blic Study URN clone( ) | |
| 654 | th rows Clone NotSupport edExceptio n | |
| 655 | { | |
| 656 | try | |
| 657 | { | |
| 658 | return create(ge tOriginati ngSiteId() , getStudy Id(), getP atientId() ); | |
| 659 | } | |
| 660 | catc h (URNForm atExceptio n e) | |
| 661 | { | |
| 662 | throw new CloneN otSupporte dException (e.getMess age()); | |
| 663 | } | |
| 664 | } | |
| 665 | ||
| 666 | @O verride | |
| 667 | pr otected in t getPatie ntIdentifi erTypeAddi tionalIden tifierInde x() | |
| 668 | { | |
| 669 | retu rn ADDITIO NAL_IDENTI FIER_PATIE NT_IDENTIF IER_TYPE_I NDEX; | |
| 670 | } | |
| 671 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.