256. EPMO Open Source Coordination Office Redaction File Detail Report

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.

256.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ImagingCommon\main\src\java\gov\va\med\imaging DocumentSetURN.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 DocumentSetURN.java Mon Dec 4 22:01:54 2017 UTC

256.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 1200
Changed 1 2
Inserted 0 0
Removed 0 0

256.3 Comparison options

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

256.4 Active regular expressions

No regular expressions were active.

256.5 Comparison detail

  1   /**
  2    * 
  3    */
  4   package go v.va.med.i maging;
  5  
  6   import gov .va.med.*;
  7   import gov .va.med.ex ceptions.G lobalArtif actIdentif ierFormatE xception;
  8   import gov .va.med.im aging.exce ptions.URN FormatExce ption;
  9   import gov .va.med.im aging.exch ange.utili ty.Base32C onversionU tility;
  10   import org .apache.lo gging.log4 j.LogManag er;
  11   import org .apache.lo gging.log4 j.Logger;
  12   import jav a.util.reg ex.Matcher ;
  13   import jav a.util.reg ex.Pattern ;
  14  
  15   /**
  16    * 
  17    * @author         
BECKEC
  18    * 
  19    *          Defines t he syntax  of a URN u sed to ide ntify VA s tudies to  the
  20    *          outside w orld. An S tudyURN is  defined t o be in th e followin g format:
  21    *          "urn" + " :" + "vado cset" + ": " + <site- id> + "-"  + <assigne d-id> +
  22    *          "-" + <pa tientICN>  where: <si te-id> is  either the  site from  which the
  23    *          image ori ginated or  the strin g "va-imag ing" <assi gned-id> i s the
  24    *          permanent , immutabl e ID as as signed by  the origin ating site  or a
  25    *          VA-domain  unique ID  (an Imagi ng GUID) < patientICN > is the V A
  26    *          Enterpris e identifi er for the  patient o f the stud y
  27    * 
  28    */
  29   @URNType(n amespace=" vadocset")
  30   public cla ss Documen tSetURN
  31           ex tends Abst ractImagin gURN
  32           im plements G lobalArtif actIdentif ier
  33   {
  34           pr ivate stat ic final l ong serial VersionUID  = 8014532 8948798374 53L;
  35  
  36           /* *
  37            *  All docum ent sets a re VA docu ment sets  by definit ion and mu st have th e
  38            *  following  home comm unity ID.
  39            * /
  40           // private st atic final  String RE QUIRED_HOM E_COMMUNIT Y_ID = Wel lKnownOID. VA_DOCUMEN T.toString ();
  41  
  42           pr ivate stat ic final S tring name space = "v adocset";
  43           pr ivate stat ic Namespa ceIdentifi er namespa ceIdentifi er = null;
  44  
  45           pu blic stati c synchron ized Names paceIdenti fier getMa nagedNames pace()
  46           {
  47                    if ( namespaceI dentifier  == null)
  48                             namesp aceIdentif ier = new  NamespaceI dentifier( namespace) ;
  49                    retu rn namespa ceIdentifi er;
  50           }
  51  
  52           pr ivate stat ic final S tring name spaceSpeci ficStringR egex = "([ ^-]+)" + / / the
  53                                                                                                                                                                          // site
  54                                                                                                                                                                          // ID
  55                    URN. namespaceS pecificStr ingDelimit er + "([^- ]+)" + //  the group  or study
  56                                                                                                                                       // ID
  57                    URN. namespaceS pecificStr ingDelimit er + "([^- ]+)"; // t he patient  ID
  58           pr ivate stat ic final P attern nam espaceSpec ificString Pattern =  Pattern.co mpile(name spaceSpeci ficStringR egex);
  59           pr ivate stat ic final i nt SITE_ID _GROUP = 1 ;
  60           pr ivate stat ic final i nt GROUP_I D_GROUP =  2;
  61           pr ivate stat ic final i nt PATIENT _ID_GROUP  = 3;
  62           
  63           pu blic stati c final in t ADDITION AL_IDENTIF IER_PATIEN T_IDENTIFI ER_TYPE_IN DEX = 0;
  64  
  65           pr ivate fina l static L ogger logg er = LogMa nager.getL ogger(Docu mentSetURN .class);
  66  
  67           /* *
  68            *  @param or iginatingS iteId
  69            *  @param as signedId
  70            *  @return
  71            * /
  72           pu blic stati c Document SetURN cre ate(String  originati ngSiteId,  String ass ignedId, S tring pati entId)
  73                    thro ws URNForm atExceptio n
  74           {
  75                    retu rn new Doc umentSetUR N(originat ingSiteId,  assignedI d, patient Id);
  76           }
  77  
  78           /* *
  79            *  Create a  StudyURN i nstance fr om an Docu mentSetURN . This pro vide the
  80            *  translati on within  the dataso urce, usin g the same  RPCs as i mage retri eval
  81            *  and prese nting resu lts in Doc ument sema ntics.
  82            *  
  83            *  @param st udyUrn
  84            *  @return
  85            *  @throws U RNFormatEx ception
  86            * /
  87           pu blic stati c Document SetURN cre ate(StudyU RN studyUr n) throws  URNFormatE xception
  88           {
  89                    retu rn create( studyUrn.g etOriginat ingSiteId( ), studyUr n.getStudy Id(), stud yUrn.getPa tientId()) ;
  90           }
  91  
  92           /* *
  93            *  
  94            *  @param ur nComponent s
  95            *  @return
  96            *  @throws U RNFormatEx ception
  97            * /
  98           pu blic stati c Document SetURN cre ate(URNCom ponents ur nComponent s, SERIALI ZATION_FOR MAT serial izationFor mat) 
  99           th rows URNFo rmatExcept ion
  100           {
  101                    retu rn new Doc umentSetUR N(urnCompo nents, ser ialization Format);
  102           }
  103  
  104           /* *
  105            *  
  106            *  @param ur nComponent s
  107            *  @return
  108            *  @throws U RNFormatEx ception
  109            * /
  110           pu blic stati c Document SetURN cre ateFromBas e32(URNCom ponents ur nComponent s) 
  111           th rows URNFo rmatExcept ion
  112           {
  113                    retu rn new Doc umentSetUR N(urnCompo nents, SER IALIZATION _FORMAT.PA TCH83_VFTP );
  114           }
  115  
  116           /* *
  117            *  
  118            *  @param ho meCommunit yId
  119            *  @param re positoryId
  120            *  @param do cumentId
  121            *  @return
  122            *  @throws U RNFormatEx ception
  123            * /
  124           pu blic stati c Document SetURN cre ateFromGlo balArtifac tIdentifie rs(
  125                    Stri ng homeCom munityId, 
  126                    Stri ng reposit oryId,
  127                    Stri ng documen tId) 
  128           th rows URNFo rmatExcept ion
  129           {
  130                    retu rn createF romGlobalA rtifactIde ntifiers(  homeCommun ityId, rep ositoryId,  documentI d, (String [])null);
  131           }
  132           
  133           /* *
  134            *  
  135            *  @param ho meCommunit yId
  136            *  @param re positoryId
  137            *  @param do cumentId
  138            *  @return
  139            *  @throws U RNFormatEx ception
  140            * /
  141           pu blic stati c Document SetURN cre ateFromGlo balArtifac tIdentifie rs(
  142                    Stri ng homeCom munityId, 
  143                    Stri ng reposit oryId,
  144                    Stri ng documen tId,
  145                    Stri ng... addi tionalIden tifiers) 
  146           th rows URNFo rmatExcept ion
  147           {
  148                    if ( DocumentSe tURN.isApp licableHom eCommunity Id(homeCom munityId,  repository Id, docume ntId))
  149                             return  new Docum entSetURN( repository Id, docume ntId);
  150                    else
  151                             throw  new URNFor matExcepti on("Home c ommunity I D '" + hom eCommunity Id
  152                                      + "' can not be use d to creat e an Image URN or its  derivativ es.");
  153           }
  154  
  155           /* *
  156            *  Required  static met hod, must  return TRU E when thi s class ca n represen t a
  157            *  global ar tifact ID  with the g iven home  community  ID. NOTE:  this class
  158            *  should no t return t rue when t he home co mmunity ID  indicates  VA_RADIOL OGY
  159            *  because t hat can be  confused  with the I mageURN wh ich uses t he same ho me
  160            *  community  ID.
  161            *  
  162            *  @param ho meCommunit yId
  163            *  @param re positoryId  
  164            *  @param do cumentId 
  165            *  @return
  166            * /
  167           pu blic stati c boolean  isApplicab leHomeComm unityId(St ring homeC ommunityId , String r epositoryI d, String  documentId )
  168           {
  169                    retu rn Documen tSetURN.na mespace.eq ualsIgnore Case(homeC ommunityId )
  170                             || Wel lKnownOID. VA_DOCUMEN T.isApplic able(homeC ommunityId );
  171           }
  172  
  173           //  ========= ========== ========== ========== ========== ========== ========== ========== ========
  174           //  Construct ors
  175           //  ========= ========== ========== ========== ========== ========== ========== ========== ========
  176           /* *
  177            *  Pass-thro ugh for de rived clas ses with d ifferent n amespace.
  178            *  
  179            *  @param na mespaceIde ntifier
  180            *  @throws U RNFormatEx ception
  181            * /
  182           pr otected Do cumentSetU RN(Namespa ceIdentifi er nid) th rows URNFo rmatExcept ion
  183           {
  184                    supe r(nid);
  185           }
  186  
  187           /* *
  188            *  Provided  only as a  pass throu gh for der ived class es.
  189            *  
  190            * /
  191           pr otected Do cumentSetU RN(Namespa ceIdentifi er namespa ceIdentifi er, String  namespace SpecificSt ring,
  192                    Stri ng... addi tionalIden tifiers) t hrows URNF ormatExcep tion
  193           {
  194                    supe r(namespac eIdentifie r, namespa ceSpecific String, ad ditionalId entifiers) ;
  195           }
  196  
  197           /* *
  198            *  Used dire ctly and a  pass thro ugh for de rived clas ses. The c onstructor
  199            *  called by  the URN c lass when  a URN deri ved class  is being c reated fro m a
  200            *  String re presentati on.
  201            *  
  202            *  @param co mponents
  203            *  @throws U RNFormatEx ception
  204            * /
  205           pr otected Do cumentSetU RN(URNComp onents urn Components , SERIALIZ ATION_FORM AT seriali zationForm at) 
  206           th rows URNFo rmatExcept ion
  207           {
  208                    supe r(urnCompo nents, ser ialization Format);
  209           }
  210  
  211           /* *
  212            *  
  213            *  @param or iginatingS iteId
  214            *  @param st udyId
  215            *  @param pa tientId
  216            *  @throws U RNFormatEx ception
  217            * /
  218           pr ivate Docu mentSetURN (String or iginatingS iteId, Str ing studyI d, String  patientId)  throws UR NFormatExc eption
  219           {
  220                    this (DocumentS etURN.getM anagedName space(), o riginating SiteId, st udyId, pat ientId);
  221           }
  222  
  223           /* *
  224            *  Defined t o allow pa ssthrough  from deriv ed classes
  225            *  
  226            *  @param na mespaceIde ntifier
  227            *  @param or iginatingS iteId
  228            *  @param st udyId
  229            *  @param pa tientId
  230            *  @throws U RNFormatEx ception
  231            * /
  232           pr otected Do cumentSetU RN(
  233                    Name spaceIdent ifier name spaceIdent ifier, 
  234                    Stri ng origina tingSiteId
  235                    Stri ng studyId ,
  236                    Stri ng patient Id) 
  237           th rows URNFo rmatExcept ion
  238           {
  239                    supe r(namespac eIdentifie r);
  240  
  241                    if ( !AbstractI magingURN. siteIdPatt ern.matche r(originat ingSiteId) .matches() )
  242                             throw  new URNFor matExcepti on("The si te ID '" +  originati ngSiteId +  "' does n ot match t he pattern  '"
  243                                      + Abstra ctImagingU RN.siteIdP attern.pat tern());
  244                    this .originati ngSiteId =  originati ngSiteId;
  245  
  246                    if ( !AbstractI magingURN. groupIdPat tern.match er(studyId ).matches( ))
  247                             throw  new URNFor matExcepti on("The do cument set  ID '" + s tudyId + " ' does not  match the  pattern ' "
  248                                      + Abstra ctImagingU RN.groupId Pattern.pa ttern());
  249                    this .studyId =  studyId;
  250  
  251                    if ( !AbstractI magingURN. patientIdP attern.mat cher(patie ntId).matc hes())
  252                             throw  new URNFor matExcepti on("The pa tient ID ' " + patien tId + "' d oes not ma tch the pa ttern '"
  253                                      + Abstra ctImagingU RN.patient IdPattern. pattern()) ;
  254                    this .patientId  = patient Id;
  255           }
  256  
  257           /* *
  258            *  
  259            *  @param re positoryUn iqueId
  260            *  @param do cumentId
  261            *  @throws U RNFormatEx ception
  262            * /
  263           pr ivate Docu mentSetURN (String re positoryUn iqueId, St ring docum entId) thr ows URNFor matExcepti on
  264           {
  265                    this (DocumentS etURN.getM anagedName space(), r epositoryU niqueId, d ocumentId) ;
  266           }
  267  
  268           /* *
  269            *  Construct or from th e GAI (IHE ) identifi ers
  270            *  
  271            *  @param re positoryUn iqueId
  272            *  @param do cumentId
  273            *  @throws U RNFormatEx ception
  274            * /
  275           pr otected Do cumentSetU RN(Namespa ceIdentifi er namespa ceIdentifi er, String  repositor yUniqueId,  String do cumentId)
  276                    thro ws URNForm atExceptio n
  277           {
  278                    supe r(namespac eIdentifie r);
  279                    try
  280                    {
  281                             this.o riginating SiteId = r epositoryU niqueId;
  282                             parseD ocumentUni queId(docu mentId);
  283                    }
  284                    catc h (GlobalA rtifactIde ntifierFor matExcepti on x)
  285                    {
  286                             throw  new URNFor matExcepti on(x);
  287                    }
  288           }
  289  
  290           //  ========= ========== ========== ========== ========== ========== ========== ========== ========== ========== ==
  291           //  
  292           //  ========= ========== ========== ========== ========== ========== ========== ========== ========== ========== ==
  293  
  294           /* *
  295            *  Override  the do-not hing versi on of this  method to  parse the  namespace
  296            *  specific  portion an d find the  component  parts.
  297            *  
  298            *  @param na mespaceSpe cificStrin g
  299            *  @throws I mageURNFor matExcepti on
  300            * /
  301           @O verride
  302           pu blic void  parseNames paceSpecif icString(N amespaceId entifier n amespace,  String nam espaceSpec ificString , SERIALIZ ATION_FORM AT seriali zationForm at) 
  303           th rows URNFo rmatExcept ion
  304           {
  305                    if ( namespaceS pecificStr ing == nul l)
  306                             throw  new URNFor matExcepti on("The na mespace sp ecific str ing for a( n) " + thi s.getClass ().getSimp leName()
  307                                      + " cann ot be null .");
  308  
  309                    Matc her nssMat cher = nam espaceSpec ificString Pattern.ma tcher(name spaceSpeci ficString) ;
  310  
  311                    if ( !nssMatche r.matches( ))
  312                    {
  313                             String  msg = "Na mespace sp ecific str ing '" + n amespaceSp ecificStri ng + "' is  not valid .";
  314                             logger .warn(msg) ;
  315                             throw  new URNFor matExcepti on(msg);
  316                    }
  317  
  318                    setO riginating SiteId( ns sMatcher.g roup(Docum entSetURN. SITE_ID_GR OUP).trim( ) );
  319                    setP atientIcn(  nssMatche r.group(Do cumentSetU RN.PATIENT _ID_GROUP) .trim() );
  320                    
  321                    Stri ng tmpGrou pId = nssM atcher.gro up(Documen tSetURN.GR OUP_ID_GRO UP).trim() ;
  322                    swit ch(seriali zationForm at)
  323                    {
  324                    case  PATCH83_V FTP:
  325                             setGro upId( Base 32Conversi onUtility. base32Deco de(tmpGrou pId) );
  326                             break;
  327                    case  RFC2141:
  328                             this.s tudyId = t mpGroupId;
  329                             break;
  330                    case  CDTP:
  331                             this.s tudyId = U RN.FILENAM E_TO_RFC21 41_ESCAPIN G.escapeIl legalChara cters(tmpG roupId);
  332                             break;
  333                    case  NATIVE:
  334                             setGro upId(tmpGr oupId);
  335                             break;
  336                    }
  337           }
  338  
  339           //  ========= ========== ========== ========== ========== ========== ========== ========== ===
  340           //  Instance  Members
  341           //  ========= ========== ========== ========== ========== ========== ========== ========== ===
  342  
  343           pr otected St ring origi natingSite Id;
  344           pr otected St ring study Id;
  345           pr otected St ring patie ntId;
  346  
  347           @O verride
  348           pu blic Strin g getHomeC ommunityId ()
  349           {
  350                    // I mages are  always in  the VA com munity
  351                    retu rn WellKno wnOID.VA_D OCUMENT.ge tCanonical Value().to String();
  352           }
  353  
  354           @O verride
  355           pu blic Strin g getOrigi natingSite Id()
  356           {
  357                    retu rn URN.RFC 2141_ESCAP ING.unesca peIllegalC haracters(  this.orig inatingSit eId );
  358           }
  359           pu blic void  setOrigina tingSiteId (String or iginatingS iteId)
  360           {
  361                    this .originati ngSiteId =  URN.RFC21 41_ESCAPIN G.escapeIl legalChara cters( ori ginatingSi teId );
  362           }
  363  
  364           pu blic Strin g getDocum entSetId() {return ge tStudyId() ;}
  365           pu blic Strin g getStudy Id(){retur n getGroup Id();}
  366           pu blic Strin g getGroup Id()
  367           {
  368                    retu rn URN.RFC 2141_ESCAP ING.unesca peIllegalC haracters(  this.stud yId );
  369           }
  370           
  371           pu blic void  setGroupId (String gr oupId)
  372           {
  373                    this .studyId =  URN.RFC21 41_ESCAPIN G.escapeIl legalChara cters(grou pId);
  374           }
  375  
  376           @O verride
  377           pu blic Strin g getPatie ntId(){ret urn getPat ientIcn(); }
  378           pu blic Strin g getPatie ntIcn()
  379           {
  380                    retu rn URN.RFC 2141_ESCAP ING.unesca peIllegalC haracters( this.patie ntId);
  381           }
  382           pu blic void  setPatient Icn(String  patientId )
  383           {
  384                    this .patientId  = URN.RFC 2141_ESCAP ING.escape IllegalCha racters(pa tientId);
  385           }
  386  
  387           //  ========= ========== ========== ========== ========== ========== ========== ======
  388           //  Serializa tion forma ts
  389           //  ========= ========== ========== ========== ========== ========== ========== ======
  390           
  391           /*  (non-Java doc)
  392            *  @see gov. va.med.URN #toString( )
  393            * /
  394           @O verride
  395           pu blic Strin g toString ()
  396           {
  397                    Stri ngBuilder  ahnold = n ew StringB uilder();
  398                    
  399                    // b uild the s cheme iden tifier
  400                    ahno ld.append( urnSchemaI dentifier) ;
  401                    ahno ld.append( urnCompone ntDelimite r);
  402  
  403                    // b uild the n amespace i dentifier
  404                    ahno ld.append( this.getNa mespaceIde ntifier()) ;
  405                    ahno ld.append( urnCompone ntDelimite r);
  406                    
  407                    ahno ld.append( this.getNa mespaceSpe cificStrin g(SERIALIZ ATION_FORM AT.RFC2141 ));
  408                    
  409                    retu rn ahnold. toString() ;
  410           }
  411  
  412           /*  (non-Java doc)
  413            *  @see gov. va.med.URN #toStringA sNative()
  414            * /
  415           @O verride
  416           pu blic Strin g toString Native()
  417           {
  418                    Stri ngBuilder  ahnold = n ew StringB uilder();
  419                    
  420                    // b uild the s cheme iden tifier
  421                    ahno ld.append( urnSchemaI dentifier) ;
  422                    ahno ld.append( urnCompone ntDelimite r);
  423  
  424                    // b uild the n amespace i dentifier
  425                    ahno ld.append( this.getNa mespaceIde ntifier()) ;
  426                    ahno ld.append( urnCompone ntDelimite r);
  427                    
  428                    ahno ld.append( this.getNa mespaceSpe cificStrin g(SERIALIZ ATION_FORM AT.NATIVE) );
  429                    
  430                    retu rn ahnold. toString() ;
  431           }
  432  
  433           /*  (non-Java doc)
  434            *  @see gov. va.med.URN #toStringA sVAInterna l()
  435            * /
  436           @O verride
  437           pu blic Strin g toString CDTP()
  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()) ;
  447                    ahno ld.append( urnCompone ntDelimite r);
  448                    
  449                    ahno ld.append( this.getNa mespaceSpe cificStrin g(SERIALIZ ATION_FORM AT.CDTP));
  450                    
  451                    retu rn ahnold. toString() ;
  452           }
  453  
  454           /* *
  455            *  
  456            * /
  457           @O verride
  458           pu blic Strin g getNames paceSpecif icString(S ERIALIZATI ON_FORMAT  encoding)
  459           {
  460                    Stri ngBuilder  ahnold = n ew StringB uilder();
  461  
  462                    // b uild the n amespace s pecific st ring
  463                    ahno ld.append(  
  464                             encodi ng == SERI ALIZATION_ FORMAT.RFC 2141 ? thi s.originat ingSiteId 
  465                             encodi ng == SERI ALIZATION_ FORMAT.CDT P ? URN.FI LENAME_ESC APING.esca peIllegalC haracters( this.origi natingSite Id) : 
  466                             getOri ginatingSi teId() 
  467                    );
  468                    ahno ld.append(  URN.names paceSpecif icStringDe limiter );
  469                    ahno ld.append(  
  470                             encodi ng == SERI ALIZATION_ FORMAT.RFC 2141 ? thi s.studyId 
  471                             encodi ng == SERI ALIZATION_ FORMAT.CDT P ? URN.FI LENAME_ESC APING.esca peIllegalC haracters( this.study Id) : 
  472                             getGro upId() 
  473                    );
  474                    ahno ld.append(  URN.names paceSpecif icStringDe limiter );
  475                    ahno ld.append(  
  476                             encodi ng == SERI ALIZATION_ FORMAT.RFC 2141 ? thi s.patientI d : 
  477                             encodi ng == SERI ALIZATION_ FORMAT.CDT P ? URN.FI LENAME_ESC APING.esca peIllegalC haracters( this.patie ntId) : 
  478                             getPat ientIcn() 
  479                    );
  480  
  481                    retu rn ahnold. toString() ;
  482           }
  483  
  484           //  ========= ========== ========== ========== ========== ========== ========== ========== ======
  485           //  Global Ar tifact Ide ntifier Im plementati on
  486           //  ========= ========== ========== ========== ========== ========== ========== ========== ======
  487           /* *
  488            *  A special  implement ation of . equals() t his is use d with oth er
  489            *  GlobalArt ifactIdent ifier real izations.
  490            *  
  491            *  @param th at
  492            *  @return
  493            * /
  494           pu blic boole an equalsG lobalArtif actIdentif ier(Global ArtifactId entifier t hat)
  495           {
  496                    retu rn GlobalA rtifactIde ntifierImp l.equalsGl obalArtifa ctIdentifi er(this, t hat);
  497           }
  498  
  499           @O verride
  500           pu blic boole an isEquiv alent(Rout ingToken t hat)
  501           {
  502                    retu rn Routing TokenImpl. isEquivale nt(this, t hat);
  503           }
  504  
  505           @O verride
  506           pu blic boole an isInclu ding(Routi ngToken th at)
  507           {
  508                    retu rn Routing TokenImpl. isIncludin g(this, th at);
  509           }
  510  
  511           @O verride
  512           pu blic Strin g getDocum entUniqueI d()
  513           {
  514                    retu rn formatD ocumentUni queId(getS tudyId(),  getPatient Id());
  515           }
  516  
  517           //  formattin g of the d ocument un ique ID, u sed for Gl obalArtifa ctIdentifi er
  518           //  support
  519           pr ivate stat ic final S tring docu mentUnique IdRegex =  "(" + GROU PID_REGEX  + ")"
  520                    + UR N.namespac eSpecificS tringDelim iter + "("  + PATIENT ID_REGEX +  ")";
  521           pr ivate stat ic final P attern doc umentUniqu eIdPattern  = Pattern .compile(d ocumentUni queIdRegex );
  522           pr ivate stat ic final i nt DOCUMEN TUNIQUEID_ STUDY_ID_G ROUP = 1;
  523           pr ivate stat ic final i nt DOCUMEN TUNIQUEID_ PATIENT_ID _GROUP = 3 ;
  524  
  525           /* *
  526            *  
  527            *  @param gr oupId
  528            *  @param pa tientId
  529            *  @return
  530            * /
  531           pr otected st atic Strin g formatDo cumentUniq ueId(Strin g groupId,  String pa tientId)
  532           {
  533                    Stri ngBuilder  sb = new S tringBuild er();
  534  
  535                    sb.a ppend(grou pId);
  536                    if ( patientId  != null)
  537                    {
  538                             sb.app end(URN.na mespaceSpe cificStrin gDelimiter );
  539                             sb.app end(patien tId);
  540                    }
  541                    retu rn sb.toSt ring();
  542           }
  543  
  544           pr otected vo id parseDo cumentUniq ueId(Strin g document Id) throws  GlobalArt ifactIdent ifierForma tException
  545           {
  546                    Matc her matche r = Docume ntSetURN.d ocumentUni queIdPatte rn.matcher (documentI d);
  547                    if ( !matcher.m atches())
  548                             throw  new Global ArtifactId entifierFo rmatExcept ion("'" +  documentId
  549                                      + "' is  not a vali d document  identifie r for type  '" + this .getClass( ).getSimpl eName() +  "'.");
  550  
  551                    this .studyId =  matcher.g roup(DOCUM ENTUNIQUEI D_STUDY_ID _GROUP);
  552                    this .patientId  = matcher .group(DOC UMENTUNIQU EID_PATIEN T_ID_GROUP );
  553           }
  554  
  555           @O verride
  556           pu blic Strin g getRepos itoryUniqu eId()
  557           {
  558                    // f or a VA do cument set , the sire  ID is the  repositor y ID
  559                    retu rn origina tingSiteId ;
  560           }
  561  
  562           @O verride
  563           pu blic Names paceIdenti fier getNa mespaceIde ntifier()
  564           {
  565                    retu rn Documen tSetURN.ge tManagedNa mespace();
  566           }
  567  
  568           @O verride
  569           pu blic int c ompareTo(G lobalArtif actIdentif ier o)
  570           {
  571                    retu rn GlobalA rtifactIde ntifierImp l.compareT o(this, o) ;
  572           }
  573  
  574           @O verride
  575           pu blic Strin g getImagi ngIdentifi er()
  576           {
  577                    retu rn getStud yId();
  578           }
  579  
  580           //  ========= ========== ========== ========== ========== ========== ========== ========== =======
  581           //  Make a de ep copy cl one
  582           //  ========= ========== ========== ========== ========== ========== ========== ========== =======
  583           @O verride
  584           pu blic Docum entSetURN  clone() th rows Clone NotSupport edExceptio n
  585           {
  586                    try
  587                    {
  588                             return  create(ge tOriginati ngSiteId() , getStudy Id(), getP atientId() );
  589                    }
  590                    catc h (URNForm atExceptio n e)
  591                    {
  592                             throw  new CloneN otSupporte dException (e.getMess age());
  593                    }
  594           }
  595  
  596           @O verride
  597           pr otected in t getPatie ntIdentifi erTypeAddi tionalIden tifierInde x()
  598           {
  599                    retu rn ADDITIO NAL_IDENTI FIER_PATIE NT_IDENTIF IER_TYPE_I NDEX;
  600           }
  601   }