11. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 3/25/2019 8:58:00 AM Central 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.

11.1 Files compared

# Location File Last Modified
1 C:\AraxisMergeCompare\Pri_un\IMAG_Source\VISA\Java\CoreValueObjects\main\src\java\gov\va\med\imaging\exchange\business Study.java Mon Mar 18 20:39:09 2019 UTC
2 C:\AraxisMergeCompare\Pri_re\IMAG_Source\VISA\Java\CoreValueObjects\main\src\java\gov\va\med\imaging\exchange\business Study.java Tue Mar 19 12:03:26 2019 UTC

11.2 Comparison summary

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

11.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

11.4 Active regular expressions

No regular expressions were active.

11.5 Comparison detail

  1   /**
  2    * 
  3    */
  4   package go v.va.med.i maging.exc hange.busi ness;
  5  
  6   import gov .va.med.Gl obalArtifa ctIdentifi er;
  7   import gov .va.med.Mo ckDataGene rationFiel d;
  8   import gov .va.med.Pa tientIdent ifier;
  9   import gov .va.med.Pa tientIdent ifierType;
  10   import gov .va.med.St udyURNFact ory;
  11   import gov .va.med.im aging.Bhie StudyURN;
  12   import gov .va.med.im aging.Muse ImageURN;
  13   import gov .va.med.im aging.Muse StudyURN;
  14   import gov .va.med.im aging.P34S tudyURN;
  15   import gov .va.med.im aging.Stud yURN;
  16   import gov .va.med.im aging.exce ptions.URN FormatExce ption;
  17   import gov .va.med.im aging.exch ange.enums .ObjectOri gin;
  18   import gov .va.med.im aging.exch ange.enums .ObjectSta tus;
  19   import gov .va.med.im aging.exch ange.enums .StudyDele tedImageSt ate;
  20   import gov .va.med.im aging.exch ange.enums .StudyLoad Level;
  21  
  22   import jav a.io.Seria lizable;
  23   import jav a.util.Dat e;
  24   import jav a.util.Enu meration;
  25   import jav a.util.Has htable;
  26   import jav a.util.Ite rator;
  27   import jav a.util.Set ;
  28   import jav a.util.Tre eSet;
  29  
  30   import org .apache.lo gging.log4 j.LogManag er;
  31   import org .apache.lo gging.log4 j.Logger;
  32  
  33   /**
  34    * @author   DNS     werfej
  35    * 
  36    */
  37   public cla ss Study
  38   implements  Serializa ble, Compa rable<Stud y>, Iterab le<Series> , StudyFil terFiltera ble
  39   {
  40           pr ivate stat ic final l ong serial VersionUID  = -746774 0571635450 273L;
  41           pr ivate fina l static L ogger logg er = LogMa nager.getL ogger(Stud y.class);
  42  
  43           pr ivate fina l GlobalAr tifactIden tifier glo balArtifac tIdentifie r;
  44           //  JMW 9/30/ 2010 P104  - study lo ad level i s no longe r final to  support u pdating a  study to 
  45           //  include m ore inform ation (usu ally the r eport alth ough poten tially the  images)
  46           //  the Study LoadLevel  should onl y be chang ed by spec ific metho ds that se t other va lues
  47           //  ie: only  update the  StudyLoad Level if t he report  or images  are added  to the Stu dy object
  48           pr ivate Stud yLoadLevel  studyLoad Level;
  49           pr ivate fina l StudyDel etedImageS tate study DeletedIma geState;
  50           
  51           pr ivate Hash table<Stri ng, String > studyVal ues = new  Hashtable< String, St ring>(10);
  52           @M ockDataGen erationFie ld(minimum StringLeng th=32, max imumString Length=102 4)
  53           pr ivate Stri ng radiolo gyReport =  null;
  54           @M ockDataGen erationFie ld(pattern =MockDataG enerationF ield.NAME_ PATTERN)
  55           pr ivate Stri ng patient Name;
  56           @M ockDataGen erationFie ld(pattern =MockDataG enerationF ield.UID_P ATTERN)
  57           pr ivate Stri ng studyUi d; // dico m UID
  58           pr ivate Stri ng firstIm ageIen;
  59           @M ockDataGen erationFie ld(pattern ="[A-Z][a- z]{4,16},  [A-Z][a-z] ")
  60           pr ivate Stri ng siteNam e;
  61           @M ockDataGen erationFie ld(pattern ="[1-9][0- 9][0-9]")
  62           pr ivate Stri ng siteAbb r;
  63           @M ockDataGen erationFie ld(compone ntValueTyp e="gov.va. med.imagin g.exchange .business. Series")
  64           pr ivate Set< Series> se ries = new  TreeSet<S eries>(new  SeriesCom parator()) ;
  65           pr ivate Imag e firstIma ge;
  66           @M ockDataGen erationFie ld(pattern ="[A-Z][a- z][0-9] [A -Z][a-z][0 -9] [A-Z][ a-z][0-9]  [A-Z][a-z] [0-9] [A-Z ][a-z][0-9 ]")
  67           pr ivate Stri ng rpcResp onseMsg;
  68           pr ivate Set< String> mo dalities =  null;
  69           @M ockDataGen erationFie ld(minimum Date="01-0 1-1990", m aximumDate ="12-31-20 10")
  70           pr ivate Date  procedure Date;
  71           @M ockDataGen erationFie ld(pattern ="[A-Z][a- z][0-9] [A -Z][a-z][0 -9] [A-Z][ a-z][0-9]  [A-Z][a-z] [0-9] [A-Z ][a-z][0-9 ]")
  72           pr ivate Stri ng errorMe ssage;
  73           pr ivate Stri ng alienSi teNumber;
  74           
  75           pr ivate Obje ctStatus s tudyStatus  = ObjectS tatus.NO_S TATUS;
  76           pr ivate Obje ctStatus s tudyViewSt atus = Obj ectStatus. NO_STATUS;
  77           pr ivate bool ean sensit ive = fals e;
  78           pr ivate Date  documentD ate = null ;        
  79           pr ivate Stri ng cptCode  = null;
  80           pr ivate Stri ng consoli datedSiteN umber = nu ll;
  81           //  if this o bject was  created by  cloning a nother obj ect and ch anging the  site numb er, then h old onto t he old ide ntifier ju st in case
  82           pr ivate Glob alArtifact Identifier  alternate ArtifactId entifier =  null;
  83           pr ivate bool ean studyI magesHaveA nnotations  = false;
  84           pr ivate Stri ng groupIe n;
  85           pr ivate Stri ng alterna teExamNumb er = null;
  86           pr ivate Stri ng context Id = null;
  87           pr ivate Stri ng accessi onNumber =  null;
  88           pr ivate bool ean isStud yInNewData Structure  = false;
  89           pr ivate Stri ng museSer verId = nu ll;     
  90           pr ivate int  numberOfDi comImages  = -1;
  91           
  92           // NOTE: If y ou add mor e fields t o this cla ss, be sur e to add t he new fie lds to clo neWithCons olidatedSi teNumber()  
  93           //  to ensure  the new f ields are  copied cor rectly
  94  
  95           /* *
  96            *  
  97            *  @param ob jectOrigin
  98            *  @param si teNumber
  99            *  @param st udyIen
  100            *  @param st udyLoadLev el
  101            *  @return
  102            *  @throws U RNFormatEx ception 
  103            * /
  104           pu blic stati c Study cr eate(
  105                    Obje ctOrigin o bjectOrigi n, 
  106                    Stri ng reposit oryId, 
  107                    Stri ng studyIe n, 
  108                    Pati entIdentif ier patien tIdentifie r,
  109                    Stud yLoadLevel  studyLoad Level,
  110                    Stud yDeletedIm ageState s tudyDelete dImageStat e) 
  111           th rows URNFo rmatExcept ion
  112           {
  113                    if(o bjectOrigi n == null)
  114                    {
  115                             LogMan ager.getLo gger(Study .class).er ror("Unabl e to creat e Study in stance bec ause objec t origin i s null.");
  116                             return  null;
  117                    }
  118                    if(r epositoryI d == null)
  119                    {
  120                             LogMan ager.getLo gger(Study .class).er ror("Unabl e to creat e Study in stance bec ause repos itory ID i s null.");
  121                             return  null;
  122                    }
  123                    if(s tudyIen ==  null)
  124                    {
  125                             LogMan ager.getLo gger(Study .class).er ror("Unabl e to creat e Study in stance bec ause Study  IEN is nu ll.");
  126                             return  null;
  127                    }
  128                    if(p atientIden tifier ==  null)
  129                    {
  130                             LogMan ager.getLo gger(Study .class).er ror("Unabl e to creat e Study in stance bec ause Patie nt ID is n ull.");
  131                             return  null;
  132                    }
  133                    if(s tudyLoadLe vel == nul l)
  134                    {
  135                             LogMan ager.getLo gger(Study .class).er ror("Unabl e to creat e Study in stance bec ause given  StudyLoad Level is n ull.");
  136                             return  null;
  137                    }
  138                    
  139                    Stud yURN study Urn = Stud yURNFactor y.create(r epositoryI d, studyIe n, patient Identifier .getValue( ), StudyUR N.class);
  140                    // s et the pat ient ident ifier type  if it is  necessary
  141                    stud yUrn.setPa tientIdent ifierTypeI fNecessary (patientId entifier.g etPatientI dentifierT ype());
  142                    retu rn create( studyUrn,  studyLoadL evel, stud yDeletedIm ageState);
  143           }
  144           
  145           /* *
  146            *  
  147            *  @param ob jectOrigin
  148            *  @param si teNumber
  149            *  @param st udyIen
  150            *  @param st udyLoadLev el
  151            *  @return
  152            *  @throws U RNFormatEx ception 
  153            * /
  154           pu blic stati c Study cr eate(
  155                    Obje ctOrigin o bjectOrigi n, 
  156                    Stri ng reposit oryId, 
  157                    Stri ng studyIe n, 
  158                    Pati entIdentif ier patien tIdentifie r,
  159                    Stud yLoadLevel  studyLoad Level,
  160                    Stud yDeletedIm ageState s tudyDelete dImageStat e,
  161                    bool ean isNewD ataStructu re)
  162           th rows URNFo rmatExcept ion
  163           {
  164                    if(o bjectOrigi n == null)
  165                    {
  166                             LogMan ager.getLo gger(Study .class).er ror("Unabl e to creat e Study in stance bec ause objec t origin i s null.");
  167                             return  null;
  168                    }
  169                    if(r epositoryI d == null)
  170                    {
  171                             LogMan ager.getLo gger(Study .class).er ror("Unabl e to creat e Study in stance bec ause repos itory ID i s null.");
  172                             return  null;
  173                    }
  174                    if(s tudyIen ==  null)
  175                    {
  176                             LogMan ager.getLo gger(Study .class).er ror("Unabl e to creat e Study in stance bec ause Study  IEN is nu ll.");
  177                             return  null;
  178                    }
  179                    if(p atientIden tifier ==  null)
  180                    {
  181                             LogMan ager.getLo gger(Study .class).er ror("Unabl e to creat e Study in stance bec ause Patie nt ID is n ull.");
  182                             return  null;
  183                    }
  184                    if(s tudyLoadLe vel == nul l)
  185                    {
  186                             LogMan ager.getLo gger(Study .class).er ror("Unabl e to creat e Study in stance bec ause given  StudyLoad Level is n ull.");
  187                             return  null;
  188                    }
  189                    
  190                    Stud yURN study Urn = null ;
  191                    if(i sNewDataSt ructure){
  192                             studyU rn = Study URNFactory .create(re positoryId , studyIen , patientI dentifier. getValue() , P34Study URN.class) ;                       
  193                    }
  194                    else {
  195                             studyU rn = Study URNFactory .create(re positoryId , studyIen , patientI dentifier. getValue() , StudyURN .class);
  196                    }
  197                    // s et the pat ient ident ifier type  if it is  necessary
  198                    stud yUrn.setPa tientIdent ifierTypeI fNecessary (patientId entifier.g etPatientI dentifierT ype());
  199                    retu rn create( studyUrn,  studyLoadL evel, stud yDeletedIm ageState,  isNewDataS tructure);
  200           }
  201  
  202  
  203           /* *
  204            *  
  205            *  @param ob jectOrigin
  206            *  @param si teNumber
  207            *  @param st udyIen
  208            *  @param st udyLoadLev el
  209            *  @return
  210            *  @throws U RNFormatEx ception 
  211            * /
  212           pu blic stati c Study cr eate(
  213                    Obje ctOrigin o bjectOrigi n, 
  214                    Stri ng reposit oryId, 
  215                    Stri ng studyIe n, 
  216                    Pati entIdentif ier patien tIdentifie r,
  217                    Stud yLoadLevel  studyLoad Level,
  218                    Stud yDeletedIm ageState s tudyDelete dImageStat e,
  219                    bool ean isNewD ataStructu re,
  220                    bool ean isMuse )
  221           th rows URNFo rmatExcept ion
  222           {
  223                    if(o bjectOrigi n == null)
  224                    {
  225                             LogMan ager.getLo gger(Study .class).er ror("Unabl e to creat e Study in stance bec ause objec t origin i s null.");
  226                             return  null;
  227                    }
  228                    if(r epositoryI d == null)
  229                    {
  230                             LogMan ager.getLo gger(Study .class).er ror("Unabl e to creat e Study in stance bec ause repos itory ID i s null.");
  231                             return  null;
  232                    }
  233                    if(s tudyIen ==  null)
  234                    {
  235                             LogMan ager.getLo gger(Study .class).er ror("Unabl e to creat e Study in stance bec ause Study  IEN is nu ll.");
  236                             return  null;
  237                    }
  238                    if(p atientIden tifier ==  null)
  239                    {
  240                             LogMan ager.getLo gger(Study .class).er ror("Unabl e to creat e Study in stance bec ause Patie nt ID is n ull.");
  241                             return  null;
  242                    }
  243                    if(s tudyLoadLe vel == nul l)
  244                    {
  245                             LogMan ager.getLo gger(Study .class).er ror("Unabl e to creat e Study in stance bec ause given  StudyLoad Level is n ull.");
  246                             return  null;
  247                    }
  248                    
  249                    Stud yURN study Urn = null ;
  250                    if(i sNewDataSt ructure){
  251                             studyU rn = Study URNFactory .create(re positoryId , studyIen , patientI dentifier. getValue() , P34Study URN.class) ;                       
  252                    }
  253                    else  if(isMuse ){
  254                             studyU rn = Study URNFactory .create(re positoryId , studyIen , patientI dentifier. getValue() , MuseStud yURN.class );                                       
  255                    }
  256                    else {
  257                             studyU rn = Study URNFactory .create(re positoryId , studyIen , patientI dentifier. getValue() , StudyURN .class);
  258                    }
  259                    // s et the pat ient ident ifier type  if it is  necessary
  260                    stud yUrn.setPa tientIdent ifierTypeI fNecessary (patientId entifier.g etPatientI dentifierT ype());
  261                    retu rn create( studyUrn,  studyLoadL evel, stud yDeletedIm ageState,  isNewDataS tructure);
  262           }
  263  
  264           pu blic stati c Study cr eate(
  265                             Object Origin obj ectOrigin,  
  266                             String  repositor yId, 
  267                             String  studyIen,  
  268                             Patien tIdentifie r patientI dentifier,
  269                             String  museServe rId,
  270                             StudyL oadLevel s tudyLoadLe vel,
  271                             StudyD eletedImag eState stu dyDeletedI mageState,
  272                             boolea n isMuse)
  273                    thro ws URNForm atExceptio n
  274                    {
  275                             if(obj ectOrigin  == null)
  276                             {
  277                                      LogManag er.getLogg er(Study.c lass).erro r("Unable  to create  Study inst ance becau se object  origin is  null.");
  278                                      return n ull;
  279                             }
  280                             if(rep ositoryId  == null)
  281                             {
  282                                      LogManag er.getLogg er(Study.c lass).erro r("Unable  to create  Study inst ance becau se reposit ory ID is  null.");
  283                                      return n ull;
  284                             }
  285                             if(stu dyIen == n ull)
  286                             {
  287                                      LogManag er.getLogg er(Study.c lass).erro r("Unable  to create  Study inst ance becau se Study I EN is null .");
  288                                      return n ull;
  289                             }
  290                             if(pat ientIdenti fier == nu ll)
  291                             {
  292                                      LogManag er.getLogg er(Study.c lass).erro r("Unable  to create  Study inst ance becau se Patient  ID is nul l.");
  293                                      return n ull;
  294                             }
  295                             if(mus eServerId  == null)
  296                             {
  297                                      LogManag er.getLogg er(Study.c lass).erro r("Unable  to create  Study inst ance becau se Muse Se rver ID is  null.");
  298                                      return n ull;
  299                             }
  300                             if(stu dyLoadLeve l == null)
  301                             {
  302                                      LogManag er.getLogg er(Study.c lass).erro r("Unable  to create  Study inst ance becau se given S tudyLoadLe vel is nul l.");
  303                                      return n ull;
  304                             }
  305                             
  306                             StudyU RN studyUr n = null;
  307                             if(isM use){
  308                                      studyUrn  = StudyUR NFactory.c reate(repo sitoryId,  studyIen,  patientIde ntifier.ge tValue(),  museServer Id, MuseSt udyURN.cla ss);                                          
  309                             }
  310                             else{
  311                                      studyUrn  = StudyUR NFactory.c reate(repo sitoryId,  studyIen,  patientIde ntifier.ge tValue(),  StudyURN.c lass);
  312                             }
  313                             // set  the patie nt identif ier type i f it is ne cessary
  314                             studyU rn.setPati entIdentif ierTypeIfN ecessary(p atientIden tifier.get PatientIde ntifierTyp e());
  315                             return  create(st udyUrn, st udyLoadLev el, studyD eletedImag eState);
  316                    }
  317           
  318  
  319           /* *
  320            *  
  321            *  @param id entifier
  322            *  @return
  323            * /
  324           pu blic stati c Study cr eate(Globa lArtifactI dentifier  identifier , StudyLoa dLevel stu dyLoadLeve l,
  325                             StudyD eletedImag eState stu dyDeletedI mageState)
  326           {
  327                    if(i dentifier  == null)
  328                    {
  329                             LogMan ager.getLo gger(Study .class).er ror("Unabl e to creat e Study in stance bec ause given  identifie r is null. ");
  330                             return  null;
  331                    }
  332                    if(s tudyLoadLe vel == nul l)
  333                    {
  334                             LogMan ager.getLo gger(Study .class).er ror("Unabl e to creat e Study in stance bec ause given  StudyLoad Level is n ull.");
  335                             return  null;
  336                    }
  337                    
  338                    retu rn new Stu dy(identif ier, study LoadLevel,  studyDele tedImageSt ate);
  339           }
  340  
  341           pu blic stati c Study cr eate(Globa lArtifactI dentifier  identifier , StudyLoa dLevel stu dyLoadLeve l,
  342                             StudyD eletedImag eState stu dyDeletedI mageState,  boolean i sNewDataSt ructure)
  343           {
  344                    if(i dentifier  == null)
  345                    {
  346                             LogMan ager.getLo gger(Study .class).er ror("Unabl e to creat e Study in stance bec ause given  identifie r is null. ");
  347                             return  null;
  348                    }
  349                    if(s tudyLoadLe vel == nul l)
  350                    {
  351                             LogMan ager.getLo gger(Study .class).er ror("Unabl e to creat e Study in stance bec ause given  StudyLoad Level is n ull.");
  352                             return  null;
  353                    }
  354                    
  355                    retu rn new Stu dy(identif ier, study LoadLevel,  studyDele tedImageSt ate, isNew DataStruct ure);
  356           }
  357  
  358           /*
  359            *  private i nt imageCo unt; priva te String  noteTitle;  private S tring
  360            *  imagePack age; priva te String  imageType;  private S tring spec ialty; pri vate
  361            *  String ev ent; // ev ent title  private St ring origi n; // VA,  DOD, FEE,
  362            *  NON-VA pr ivate Stri ng capture Date; // d ate image  captured p rivate Str ing
  363            *  captureBy ; // empty  if coming  from Gate way
  364            * /
  365           pr ivate Stud y(GlobalAr tifactIden tifier glo balArtifac tIdentifie r, StudyLo adLevel st udyLoadLev el, 
  366                             StudyD eletedImag eState stu dyDeletedI mageState)
  367           {
  368                    this .globalArt ifactIdent ifier = gl obalArtifa ctIdentifi er;
  369                    this .studyLoad Level = st udyLoadLev el;
  370                    this .studyDele tedImageSt ate = stud yDeletedIm ageState;
  371                    
  372                    radi ologyRepor t = patien tName = st udyUid = f irstImageI en = siteN ame = site Abbr = "";
  373                    moda lities = n ew TreeSet <String>() ;
  374                    /*
  375                     * i mageCount  = 0; noteT itle = ima gePackage  = imageTyp e = specia lty =
  376                     * e vent = ori gin = capt ureBy = ca ptureDate  = "";
  377                     */
  378                    erro rMessage =  "";
  379                    alie nSiteNumbe r = "";
  380           }
  381  
  382           pr ivate Stud y(GlobalAr tifactIden tifier glo balArtifac tIdentifie r, StudyLo adLevel st udyLoadLev el, 
  383                             StudyD eletedImag eState stu dyDeletedI mageState,  boolean i sNewDataSt ructure)
  384           {
  385                    this .globalArt ifactIdent ifier = gl obalArtifa ctIdentifi er;
  386                    this .studyLoad Level = st udyLoadLev el;
  387                    this .studyDele tedImageSt ate = stud yDeletedIm ageState;
  388                    this .isStudyIn NewDataStr ucture = i sNewDataSt ructure;
  389                    
  390                    radi ologyRepor t = patien tName = st udyUid = f irstImageI en = siteN ame = site Abbr = "";
  391                    moda lities = n ew TreeSet <String>() ;
  392                    /*
  393                     * i mageCount  = 0; noteT itle = ima gePackage  = imageTyp e = specia lty =
  394                     * e vent = ori gin = capt ureBy = ca ptureDate  = "";
  395                     */
  396                    erro rMessage =  "";
  397                    alie nSiteNumbe r = "";
  398                    
  399           }
  400  
  401           /* *
  402            *  Get the u nique iden tifier of  this Study
  403            *  @return
  404            * /
  405           pu blic Globa lArtifactI dentifier  getGlobalA rtifactIde ntifier()
  406           {
  407                    retu rn this.gl obalArtifa ctIdentifi er;
  408           }
  409  
  410           pu blic int g etSeriesCo unt()
  411           {
  412                    retu rn this.se ries.size( );
  413           }
  414  
  415           pu blic Set<S eries> get Series()
  416           {
  417                    retu rn series;
  418           }
  419  
  420           pu blic void  addSeries( Series ser ies)
  421           {
  422                    this .series.ad d(series);
  423           }
  424  
  425           @O verride
  426           pu blic Itera tor<Series > iterator ()
  427           {
  428                    retu rn series. iterator() ;
  429           }
  430  
  431           /* *
  432            *  Return a  child Seri es from th e series ( group) IEN .
  433            *  Returns n ull if the  Series id entified b y the IEN  is not a c hild.
  434            *  Returns n ull if ser iesIen is  null.
  435            *  
  436            *  @param se riesIen
  437            *  @return
  438            * /
  439           pu blic Serie s getChild Series(Str ing series Ien)
  440           {
  441                    if(s eriesIen = = null ||  getSeries( ) == null)
  442                             return  null;
  443                    
  444                    for( Series ser ies : getS eries())
  445                             if( se riesIen.eq uals(serie s.getSerie sIen()) )
  446                                      return s eries;
  447                    
  448                    retu rn null;
  449           }
  450           
  451           pu blic void  setValue(S tring key,  String va lue)
  452           {
  453                    stud yValues.pu t(key, val ue);
  454           }
  455  
  456           pu blic Strin g getValue (String ke y)
  457           {
  458                    Stri ng value =  studyValu es.get(key );
  459                    retu rn value = = null ? " " : value;
  460           }
  461  
  462           pu blic void  setValue(S tring key,  int value )
  463           {
  464                    stud yValues.pu t(key, Int eger.toStr ing(value) );
  465           }
  466  
  467           pu blic int g etValueAsI nt(String  key)
  468           {
  469                    Stri ng value =  studyValu es.get(key );
  470                    int  valueAsInt  = 0;
  471                    if ( value != n ull)
  472                    {
  473                             valueA sInt = Int eger.parse Int(value) ;
  474                    }
  475                    retu rn valueAs Int;
  476           }
  477  
  478           pu blic Enume ration<Str ing> getKe ys()
  479           {
  480                    retu rn studyVa lues.keys( );
  481           }
  482  
  483           //  getters a nd setters  for Study  dynamic p roperties
  484           pu blic Strin g getProce dure()
  485           {
  486                    retu rn getValu e("Procedu re");
  487           }
  488  
  489           pu blic void  setProcedu re(String  procedure)
  490           {
  491                    setV alue("Proc edure", pr ocedure);
  492           }
  493  
  494   //  public  int getIm ageCount()  {
  495   //  return  getValueA sInt("# Im g");
  496   //}
  497  
  498           pu blic int g etImageCou nt() {
  499                // CPT - - 07/17/08 : make sur e all seri es' image  counts add ed up for  multiple g roups
  500                int numI mages = 0;
  501                Set<Seri es> series Set = this .getSeries ();
  502                if(serie sSet != nu ll && seri esSet.size () > 1) {
  503                      fo r(Iterator <Series> s eriesIter  = seriesSe t.iterator (); series Iter.hasNe xt(); )
  504                      {
  505                             Series  series =  seriesIter .next();
  506                             numIma ges += ser ies.getIma geCount();
  507                      }
  508                } else {  // no ser ies in stu dy ??
  509                      nu mImages =  getValueAs Int("# Img ");
  510                }
  511                return n umImages;
  512           }
  513  
  514           pu blic void  setImageCo unt(int im ageCount)
  515           {
  516                    setV alue("# Im g", imageC ount);
  517           }
  518  
  519           pu blic Strin g getNoteT itle()
  520           {
  521                    retu rn getValu e("Note Ti tle");
  522           }
  523  
  524           pu blic void  setNoteTit le(String  noteTitle)
  525           {
  526                    setV alue("Note  Title", n oteTitle);
  527           }
  528  
  529           pu blic Strin g getImage Package()
  530           {
  531                    retu rn getValu e("Pkg");
  532           }
  533  
  534           pu blic void  setImagePa ckage(Stri ng imagePa ckage)
  535           {
  536                    setV alue("Pkg" , imagePac kage);
  537           }
  538  
  539           pu blic Strin g getImage Type()
  540           {
  541                    retu rn getValu e("Type");
  542           }
  543  
  544           pu blic void  setImageTy pe(String  imageType)
  545           {
  546                    setV alue("Type ", imageTy pe);
  547           }
  548  
  549           pu blic Strin g getSpeci alty()
  550           {
  551                    retu rn getValu e("Special ty");
  552           }
  553  
  554           pu blic void  setSpecial ty(String  specialty)
  555           {
  556                    setV alue("Spec ialty", sp ecialty);
  557           }
  558  
  559           pu blic Strin g getEvent ()
  560           {
  561                    retu rn getValu e("Event") ;
  562           }
  563  
  564           pu blic void  setEvent(S tring even t)
  565           {
  566                    setV alue("Even t", event) ;
  567           }
  568  
  569           pu blic Strin g getOrigi n()
  570           {
  571                    retu rn getValu e("Origin" );
  572           }
  573  
  574           pu blic void  setOrigin( String ori gin)
  575           {
  576                    setV alue("Orig in", origi n);
  577           }
  578  
  579           pu blic Strin g getCaptu reDate()
  580           {
  581                    retu rn getValu e("Cap Dt" );
  582           }
  583  
  584           pu blic void  setCapture Date(Strin g captureD ate)
  585           {
  586                    setV alue("Cap  Dt", captu reDate);
  587           }
  588  
  589           pu blic Strin g getCaptu reBy()
  590           {
  591                    retu rn getValu e("Cap by" );
  592           }
  593  
  594           pu blic void  setCapture By(String  captureBy)
  595           {
  596                    setV alue("Cap  by", captu reBy);
  597           }
  598  
  599           pu blic Strin g getRadio logyReport ()
  600           {
  601                    retu rn radiolo gyReport;
  602           }
  603  
  604           pu blic void  setRadiolo gyReport(S tring radi ologyRepor t)
  605           {
  606                    // J MW 9/30/20 10 P104
  607                    // i f the repo rt is set,  ensure th e StudyLoa dLevel rep resents th at informa tion
  608                    if(r adiologyRe port != nu ll)
  609                    {
  610                             this.s tudyLoadLe vel = Stud yLoadLevel .promoteWi thReport(t his.studyL oadLevel);
  611                    }
  612                    this .radiology Report = r adiologyRe port;
  613           }
  614  
  615           pu blic void  setProcedu reDate(Dat e procedur eDate)
  616           {
  617                    this .procedure Date = pro cedureDate ;
  618           }
  619           
  620           pu blic Strin g getProce dureDateSt ring()
  621           {
  622                    retu rn getValu e("Proc DT ");
  623           }
  624           
  625           pu blic void  setProcedu reDateStri ng(String  value)
  626           {
  627                    setV alue("Proc  DT", valu e);
  628           }
  629  
  630           pu blic Date  getProcedu reDate()
  631           {
  632                    retu rn this.pr ocedureDat e;
  633           }
  634  
  635           pu blic void  setDescrip tion(Strin g descript ion)
  636           {
  637                    setV alue("Shor t Desc", d escription );
  638           }
  639  
  640           pu blic Strin g getDescr iption()
  641           {
  642                    retu rn getValu e("Short D esc");
  643           }
  644           
  645           pu blic void  setStudyCl ass(String  studyClas s)
  646           {
  647                    setV alue("Clas s", studyC lass);
  648           }
  649           
  650           pu blic Strin g getStudy Class()
  651           {
  652                    retu rn getValu e("Class") ;
  653           }
  654           pu blic Strin g getConte xtId()
  655           {
  656                    retu rn context Id;
  657           }
  658  
  659           pu blic void  setContext Id(String  value)
  660           {
  661                    cont extId = va lue;
  662           }
  663  
  664           /* *
  665            *  If this i s a VA Stu dy then th e patient  ICN is in  the global  artifact  identifier ,
  666            *  else we d on't have  it.
  667            *  
  668            *  @return t he patient Icn
  669            * /
  670           pu blic Strin g getPatie ntId()
  671           {
  672                    Glob alArtifact Identifier  gai = get GlobalArti factIdenti fier();
  673                    if(g ai instanc eof StudyU RN)
  674                             return  ((StudyUR N)gai).get PatientId( );
  675                    if(g ai instanc eof BhieSt udyURN)
  676                             return  ((BhieStu dyURN)gai) .getPatien tId();
  677                    
  678                    retu rn null;     
  679           }
  680           
  681           pu blic Patie ntIdentifi er getPati entIdentif ier()
  682           {
  683                    Stri ng patient Id = getPa tientId();
  684                    Pati entIdentif ierType pa tientIdent ifierType  = getPatie ntIdentifi erType();
  685                    if(p atientId = = null ||  patientIde ntifierTyp e == null)
  686                             return  null;
  687                    
  688                    retu rn new Pat ientIdenti fier(patie ntId, pati entIdentif ierType);
  689           }
  690           
  691           pu blic Patie ntIdentifi erType get PatientIde ntifierTyp e()
  692           {
  693                    Glob alArtifact Identifier  gai = get GlobalArti factIdenti fier();
  694                    if(g ai instanc eof StudyU RN)
  695                             return  ((StudyUR N)gai).get PatientIde ntifierTyp eOrDefault ();
  696                    if(g ai instanc eof BhieSt udyURN)
  697                             return  ((BhieStu dyURN)gai) .getPatien tIdentifie rTypeOrDef ault();
  698                    
  699                    retu rn null;     
  700           }
  701  
  702           /* *
  703            *  If this i s a VA Stu dy then th e study IE N is in th e global a rtifact id entifier,
  704            *  else we d on't have  it and the  correct t hing to as k for is t he documen tIdentifie r
  705            *  
  706            *  @return t he studyIe n
  707            * /
  708           pu blic Strin g getStudy Ien()
  709           {
  710                    Glob alArtifact Identifier  gai = get GlobalArti factIdenti fier();
  711                    if(g ai instanc eof StudyU RN)
  712                             return  ((StudyUR N)gai).get GroupId();
  713                    if(g ai instanc eof BhieSt udyURN)
  714                             return  ((BhieStu dyURN)gai) .getDocume ntUniqueId ();
  715                    
  716                    retu rn null;     
  717           }
  718  
  719           /* *
  720            *  @return t he siteNum ber
  721            * /
  722           pu blic Strin g getSiteN umber()
  723           {
  724                    retu rn getGlob alArtifact Identifier ().getRepo sitoryUniq ueId();
  725           }
  726  
  727           /* *
  728            *  @return t he patient Name
  729            * /
  730           pu blic Strin g getPatie ntName()
  731           {
  732                    retu rn patient Name;
  733           }
  734  
  735           /* *
  736            *  @param pa tientName
  737            *              the pati entName to  set
  738            * /
  739           pu blic void  setPatient Name(Strin g patientN ame)
  740           {
  741                    this .patientNa me = patie ntName;
  742           }
  743  
  744           /* *
  745            *  @return t he studyUi d (the DIC OM UID)
  746            * /
  747           pu blic Strin g getStudy Uid()
  748           {
  749                    retu rn studyUi d;
  750           }
  751  
  752           /* *
  753            *  @return t he firstIm ageIen
  754            * /
  755           pu blic Strin g getFirst ImageIen()
  756           {
  757                    retu rn firstIm ageIen;
  758           }
  759  
  760           /* *
  761            *  @param fi rstImageIe n
  762            *              the firs tImageIen  to set
  763            * /
  764           pu blic void  setFirstIm ageIen(Str ing firstI mageIen)
  765           {
  766                    this .firstImag eIen = fir stImageIen ;
  767           }
  768  
  769           /* *
  770            *  @return t he siteAbb r
  771            * /
  772           pu blic Strin g getSiteA bbr()
  773           {
  774                    retu rn siteAbb r;
  775           }
  776  
  777           /* *
  778            *  @param si teAbbr
  779            *              the site Abbr to se t
  780            * /
  781           pu blic void  setSiteAbb r(String s iteAbbr)
  782           {
  783                    this .siteAbbr  = siteAbbr ;
  784           }
  785  
  786           /* *
  787            *  @return t he siteNam e
  788            * /
  789           pu blic Strin g getSiteN ame()
  790           {
  791                    retu rn siteNam e;
  792           }
  793  
  794           /* *
  795            *  @param si teName
  796            *              the site Name to se t
  797            * /
  798           pu blic void  setSiteNam e(String s iteName)
  799           {
  800                    this .siteName  = siteName ;
  801           }
  802  
  803           /* *
  804            *  @param st udyUid
  805            *              the stud yUid to se t
  806            * /
  807           pu blic void  setStudyUi d(String s tudyUid)
  808           {
  809                    this .studyUid  = studyUid ;
  810           }
  811  
  812           /* *
  813            *  @return t he firstIm age
  814            * /
  815           pu blic Image  getFirstI mage()
  816           {
  817                    retu rn firstIm age;
  818           }
  819  
  820           /* *
  821            *  @param fi rstImage
  822            *              the firs tImage to  set
  823            * /
  824           pu blic void  setFirstIm age(Image  firstImage )
  825           {
  826                    this .firstImag e = firstI mage;
  827           }
  828  
  829           /* *
  830            *  @return t he rpcResp onseMsg
  831            * /
  832           pu blic Strin g getRpcRe sponseMsg( )
  833           {
  834                    retu rn rpcResp onseMsg;
  835           }
  836  
  837           /* *
  838            *  @param rp cResponseM sg
  839            *              the rpcR esponseMsg  to set
  840            * /
  841           pu blic void  setRpcResp onseMsg(St ring rpcRe sponseMsg)
  842           {
  843                    this .rpcRespon seMsg = rp cResponseM sg;
  844           }
  845  
  846           /* *
  847            *  @return t he objectO rigin
  848            * /
  849           pu blic Objec tOrigin ge tObjectOri gin()
  850           {
  851                    retu rn ObjectO rigin.infe rFromHomeC ommunityId (getGlobal ArtifactId entifier() .getHomeCo mmunityId( ));
  852           }
  853  
  854           pu blic Study URN getStu dyUrn() 
  855           {
  856                    retu rn getGlob alArtifact Identifier () instanc eof StudyU RN ?
  857                             (Study URN)getGlo balArtifac tIdentifie r() : null ;
  858           }
  859  
  860           pu blic void  addModalit y(String m odality)
  861           {
  862                    this .modalitie s.add(moda lity);
  863           }
  864  
  865           pu blic Set<S tring> get Modalities ()
  866           {
  867                    retu rn this.mo dalities;
  868           }        
  869  
  870           /* *
  871            *  @return t he errorMe ssage
  872            * /
  873           pu blic Strin g getError Message()  {
  874                    retu rn errorMe ssage;
  875           }
  876  
  877           /* *
  878            *  @param er rorMessage  the error Message to  set
  879            * /
  880           pu blic void  setErrorMe ssage(Stri ng errorMe ssage) {
  881                    this .errorMess age = erro rMessage;
  882           }
  883           
  884           pu blic boole an hasErro rMessage()
  885           {
  886                    if(( errorMessa ge == null ) || (erro rMessage.l ength() <=  0))
  887                             return  false;
  888                    retu rn true;
  889           }
  890           
  891           pu blic boole an isDelet ed()
  892           {
  893                    retu rn (studyV iewStatus  == ObjectS tatus.DELE TED);
  894           }
  895  
  896  
  897           /* *
  898            *  The alien  site numb er is the  number for  a site wh ere the st udy came f rom. This  number is  the number
  899            *  from the  alien data  source (D OD).  This  is not th e site num ber used i nternally  that exist s within t he
  900            *  site serv ice but an  external  number. Th is number  is not req uired to b e present  and should  not trans mit
  901            *  across Fe deration. 
  902            *  @return t he alienSi teNumber
  903            * /
  904           pu blic Strin g getAlien SiteNumber () {
  905                    retu rn alienSi teNumber;
  906           }
  907  
  908           /* *
  909            *  @param al ienSiteNum ber the al ienSiteNum ber to set
  910            * /
  911           pu blic void  setAlienSi teNumber(S tring alie nSiteNumbe r) {
  912                    this .alienSite Number = a lienSiteNu mber;
  913           }
  914  
  915           /* *
  916            *  @return t he studyLo adLevel
  917            * /
  918           pu blic Study LoadLevel  getStudyLo adLevel()  {
  919                    retu rn studyLo adLevel;
  920           }
  921  
  922           pu blic Objec tStatus ge tStudyStat us()
  923           {
  924                    retu rn studySt atus;
  925           }
  926  
  927           pu blic void  setStudySt atus(Objec tStatus st udyStatus)
  928           {
  929                    this .studyStat us = study Status;
  930           }
  931  
  932           pu blic Objec tStatus ge tStudyView Status()
  933           {
  934                    retu rn studyVi ewStatus;
  935           }
  936  
  937           pu blic void  setStudyVi ewStatus(O bjectStatu s studyVie wStatus)
  938           {
  939                    this .studyView Status = s tudyViewSt atus;
  940           }
  941  
  942           pu blic boole an isSensi tive()
  943           {
  944                    retu rn sensiti ve;
  945           }
  946  
  947           pu blic void  setSensiti ve(boolean  sensitive )
  948           {
  949                    this .sensitive  = sensiti ve;
  950           }
  951  
  952           pu blic Date  getDocumen tDate()
  953           {
  954                    retu rn documen tDate;
  955           }
  956  
  957           pu blic void  setDocumen tDate(Date  documentD ate)
  958           {
  959                    this .documentD ate = docu mentDate;
  960           }
  961  
  962           pu blic Strin g getCptCo de()
  963           {
  964                    retu rn cptCode ;
  965           }
  966  
  967           pu blic void  setCptCode (String cp tCode)
  968           {
  969                    this .cptCode =  cptCode;
  970           }
  971  
  972           pu blic Strin g getConso lidatedSit eNumber()
  973           {
  974                    retu rn consoli datedSiteN umber;
  975           }
  976  
  977           pu blic void  setConsoli datedSiteN umber(Stri ng consoli datedSiteN umber)
  978           {
  979                    this .consolida tedSiteNum ber = cons olidatedSi teNumber;
  980           }
  981           
  982           pu blic boole an contain sConsolida tedSiteNum ber()
  983           {
  984                    if(t his.consol idatedSite Number ==  null)
  985                             return  false;
  986                    if(t his.consol idatedSite Number.len gth() <= 0 )
  987                             return  false;
  988                    // i f the cons olidated s ite number  value is  the same a s the site  number, n o need to  update the  value
  989                    // j ust return  false to  avoid unne cessary ef fort
  990                    if(t his.consol idatedSite Number.equ als(this.g etSiteNumb er()))
  991                             return  false;
  992                    retu rn true;
  993           }
  994  
  995           /* *
  996            *  Needs to  be set if  the study  contains d eleted ima ges, to be  used to d etermine i f the stud y objects
  997            *  can satis fy a reque st from th e client
  998            *  @return
  999            * /
  1000           pu blic Study DeletedIma geState ge tStudyDele tedImageSt ate()
  1001           {
  1002                    retu rn studyDe letedImage State;
  1003           }
  1004  
  1005           pu blic Globa lArtifactI dentifier  getAlterna teArtifact Identifier ()
  1006           {
  1007                    retu rn alterna teArtifact Identifier ;
  1008           }
  1009  
  1010           pu blic void  setAlterna teArtifact Identifier (
  1011                             Global ArtifactId entifier a lternateAr tifactIden tifier)
  1012           {
  1013                    this .alternate ArtifactId entifier =  alternate ArtifactId entifier;
  1014           }
  1015  
  1016           //  ========= ========== ========== ========== ========== ========== ========== =====
  1017           //  StudyFilt erFilterab le Impleme ntation
  1018           //  ========= ========== ========== ========== ========== ========== ========== =====
  1019           @O verride
  1020           pu blic Strin g getFirst ImageClass ()
  1021           {
  1022                    retu rn getFirs tImage() = = null ? n ull : getF irstImage( ).getImage Class();
  1023           }
  1024  
  1025           @O verride
  1026           pu blic int g etFirstIma geType()
  1027           {
  1028                    retu rn getFirs tImage() = = null ? - 1 : getFir stImage(). getImgType ();
  1029           }
  1030           
  1031           pu blic boole an isStudy ImagesHave Annotation s()
  1032           {
  1033                    retu rn studyIm agesHaveAn notations;
  1034           }
  1035  
  1036           pu blic void  setStudyIm agesHaveAn notations( boolean st udyImagesH aveAnnotat ions)
  1037           {
  1038                    this .studyImag esHaveAnno tations =  studyImage sHaveAnnot ations;
  1039           }
  1040  
  1041           /* *
  1042            *  The natur al orderin g of Study  instances  is define d as: 1.)  decreasing  by
  1043            *  procedure Date
  1044            *  
  1045            *  @see java .lang.Comp arable#com pareTo(jav a.lang.Obj ect)
  1046            * /
  1047           @O verride
  1048           pu blic int c ompareTo(S tudy that)
  1049           {
  1050                    int  cumulative Compare =  0;
  1051                    
  1052                    cumu lativeComp are = Comp arableUtil .compare(t his.proced ureDate, t hat.proced ureDate, f alse);
  1053                    if(c umulativeC ompare !=  0)
  1054                             return  cumulativ eCompare;
  1055  
  1056                    retu rn getGlob alArtifact Identifier ().compare To(that.ge tGlobalArt ifactIdent ifier());
  1057           }
  1058  
  1059           /* *
  1060            *  The imple mentation  of hashCod e is consi stent with  the defin ition in
  1061            *  java.lang .Object, i ncluding c ompatibili ty with .e quals(). T he hashCod e is
  1062            *  based on  the site n umber and  the study  IEN, which  will prov ide the
  1063            *  correct b ehavior an d uniquene ss if thos e fields a re populat ed.
  1064            *  
  1065            *  @see java .lang.Obje ct#hashCod e()
  1066            * /
  1067           @O verride
  1068           pu blic int h ashCode()
  1069           {
  1070                    fina l int prim e = 31;
  1071                    int  result = 1 ;
  1072                    resu lt = prime  * result
  1073                             + ((th is.globalA rtifactIde ntifier ==  null) ? 0  : this.gl obalArtifa ctIdentifi er.hashCod e());
  1074                    retu rn result;
  1075           }
  1076  
  1077           /* *
  1078            *  The .equa ls() is ba sed on the  site numb er and the  study IEN , which wi ll
  1079            *  provide t he correct  behavior  and unique ness if th ose fields  are
  1080            *  populated .
  1081            *  
  1082            *  @see java .lang.Obje ct#equals( java.lang. Object)
  1083            * /
  1084           @O verride
  1085           pu blic boole an equals( Object obj )
  1086           {
  1087                    if ( this == ob j)
  1088                             return  true;
  1089                    if ( obj == nul l)
  1090                             return  false;
  1091                    if ( getClass()  != obj.ge tClass())
  1092                             return  false;
  1093                    fina l Study ot her = (Stu dy) obj;
  1094                    if ( this.globa lArtifactI dentifier  == null)
  1095                    {
  1096                             if (ot her.global ArtifactId entifier ! = null)
  1097                                      return f alse;
  1098                    }
  1099                    else  if (!this .globalArt ifactIdent ifier.equa lsGlobalAr tifactIden tifier(oth er.globalA rtifactIde ntifier))
  1100                             return  false;
  1101                    retu rn true;
  1102           }        
  1103           
  1104           /* *
  1105            *  
  1106            *  @see java .lang.Obje ct#toStrin g()
  1107            * /
  1108           @O verride
  1109           pu blic Strin g toString ()
  1110           {
  1111                    Stri ngBuilder  sb = new S tringBuild er();
  1112                    /*
  1113                     * S tring outp ut = super .toString( ); output  += "\nStud y Properti es:\n";
  1114                     * E numeration <String> e numeration  = studyVa lues.keys( );
  1115                     * w hile(enume ration.has MoreElemen ts()) { St ring key =
  1116                     * e numeration .nextEleme nt(); outp ut += key  + ": " +
  1117                     * s tudyValues .get(key)  + "\n"; }
  1118                     */
  1119                    sb.a ppend("Stu dy Details  [" + this .getGlobal ArtifactId entifier()  + "]\t" +  "Study UI D [" + thi s.studyUid  + "]\n" +  "Contains  " + serie s.size()
  1120                             + " se ries:\n");
  1121                    
  1122                    if(g etFirstIma ge() == nu ll){
  1123                             sb.app end("First  Image is  null.");
  1124                    }
  1125                    else {
  1126                             sb.app end("First  Image: "+ getFirstIm age().toSt ring());
  1127                    }
  1128  
  1129                    Iter ator<Serie s> seriesI ter = seri es.iterato r();
  1130                    whil e (seriesI ter.hasNex t())
  1131                    {
  1132                             Series  series =  seriesIter .next();
  1133                             sb.app end(series .toString( ));
  1134                    }
  1135  
  1136                    /*
  1137                     * o utput += " NoteTitle:  " + noteT itle + "\n "; output  += "ImageP ackage: "  +
  1138                     * i magePackag e + "\n";  output +=  "ImageType : " + imag eType + "\ n";
  1139                     * o utput += " Specialty:  " + speci alty + "\n "; output  += "Event:  " +
  1140                     * e vent + "\n "; output  += "Origin : " + orig in + "\n";  output +=
  1141                     * " CaptureDat e: " + cap tureDate +  "\n"; out put += "Ca pturedBy:  " +
  1142                     * c aptureBy +  "\n";
  1143                     */
  1144                    retu rn sb.toSt ring();
  1145           }
  1146  
  1147           /* *
  1148            *  This meth od clones  all pieces  of the St udy and up dates the  URN with t he value f rom the co nsolidated  site numb er.
  1149            *  This meth od should  only be ca lled if it s been con firmed tha t the cons olidated s ite number  is "valid "
  1150            *  @return
  1151            * /
  1152           pu blic Study  cloneWith Consolidat edSiteNumb er(Site si te)
  1153           {
  1154                    if(c ontainsCon solidatedS iteNumber( ))
  1155                    {
  1156                             if(!th is.getSite Number().e quals(this .consolida tedSiteNum ber))
  1157                             {
  1158                                      StudyURN  studyUrn  = this.get StudyUrn() ;
  1159                                      // if th e study UR N is null  then this  is not a V A study an d we shoul dn't do an ything wit h it
  1160                                      if(study Urn != nul l)
  1161                                      {
  1162                                               try
  1163                                               {
  1164                                                       
  1165                                                       St udyURN new Urn = 
  1166                                                                Stud yURNFactor y.create(t his.consol idatedSite Number, st udyUrn.get StudyId(),  
  1167                                                                                  studyUrn .getPatien tId(), Stu dyURN.clas s);
  1168                                                       ne wUrn.setPa tientIdent ifierTypeI fNecessary (studyUrn. getPatient Identifier Type());
  1169                                                       lo gger.debug ("Updating  study '"  + studyUrn .toString( ) + "' wit h new site  ID, creat ed new URN  '" + newU rn.toStrin g() + "'." );
  1170                                                       St udy study  = new Stud y(newUrn,  this.study LoadLevel,  this.stud yDeletedIm ageState);
  1171                                                                                                            
  1172                                                       st udy.alienS iteNumber  = this.ali enSiteNumb er;
  1173                                                       st udy.consol idatedSite Number = t his.consol idatedSite Number;
  1174                                                       st udy.cptCod e = this.c ptCode;
  1175                                                       st udy.docume ntDate = t his.docume ntDate;
  1176                                                       st udy.errorM essage = t his.errorM essage;
  1177                                                       st udy.firstI mage = thi s.firstIma ge;
  1178                                                       st udy.firstI mageIen =  this.first ImageIen;
  1179                                                       st udy.modali ties = thi s.modaliti es;
  1180                                                       st udy.patien tName = th is.patient Name;
  1181                                                       st udy.proced ureDate =  this.proce dureDate;
  1182                                                       st udy.radiol ogyReport  = this.rad iologyRepo rt;
  1183                                                       st udy.rpcRes ponseMsg =  this.rpcR esponseMsg ;
  1184                                                       st udy.sensit ive = this .sensitive ;
  1185                                                       st udy.series  = this.se ries;
  1186                                                       //  really ne ed to upda te these!
  1187                                                       st udy.siteAb br = this. siteAbbr;  // don't u pdate this  because i t should b e correct  from VistA
  1188                                                       st udy.siteNa me = site. getSiteNam e();
  1189                                                       st udy.studyS tatus = th is.studySt atus;
  1190                                                       st udy.studyU id = this. studyUid;
  1191                                                       st udy.studyV alues.putA ll(this.st udyValues) ;
  1192                                                       st udy.studyV iewStatus  = this.stu dyViewStat us;
  1193                                                       st udy.altern ateArtifac tIdentifie r = studyU rn;
  1194                                                       st udy.studyI magesHaveA nnotations  = this.st udyImagesH aveAnnotat ions;
  1195                                                       st udy.altern ateExamNum ber = this .alternate ExamNumber ;
  1196                                                       st udy.groupI en = this. groupIen;
  1197                                                       st udy.contex tId = this .contextId ;
  1198                                                       st udy.access ionNumber  = this.acc essionNumb er;
  1199                                                       st udy.isStud yInNewData Structure  = this.isS tudyInNewD ataStructu re;
  1200                                                       st udy.museSe rverId = t his.museSe rverId;
  1201                                                       
  1202                                                       //  add the s eries to t he study,  don't upda te the ima ge objects  because t hey could
  1203                                                       //  have diff erent cons olidated s ite number s than the  study
  1204                                                       //  updating  the images  happens e lsewhere
  1205                                                       fo r(Series s eries : th is)
  1206                                                       {
  1207                                                                stud y.addSerie s(series);
  1208                                                       }
  1209                                                       
  1210                                                       re turn study ;
  1211                                               }
  1212                                               catch(URNF ormatExcep tion urnfX )
  1213                                               {
  1214                                                       lo gger.warn( "Error cre ating new  StudyURN f rom consol idated sit e number,  " + urnfX. getMessage (), urnfX) ;
  1215                                               }                                          
  1216                                      }
  1217                             }
  1218                    }
  1219                    // i f we get h ere then e ither some thing went  wrong or  the conver sion was n ot necessa ry
  1220                    retu rn this;
  1221           }
  1222  
  1223           pu blic Strin g getGroup Ien() {
  1224                    retu rn groupIe n;
  1225           }
  1226  
  1227           pu blic void  setGroupIe n(String g roupIen) {
  1228                    this .groupIen  = groupIen ;
  1229           }
  1230  
  1231           pu blic Strin g getAlter nateExamNu mber() {
  1232                    retu rn alterna teExamNumb er;
  1233           }
  1234  
  1235           pu blic void  setAlterna teExamNumb er(String  alternateE xamNumber)  {
  1236                    this .alternate ExamNumber  = alterna teExamNumb er;
  1237           }
  1238  
  1239           pu blic Strin g getAcces sionNumber () {
  1240                    retu rn accessi onNumber;
  1241           }
  1242  
  1243           pu blic void  setAccessi onNumber(S tring acce ssionNumbe r) {
  1244                    this .accession Number = a ccessionNu mber;
  1245           }
  1246  
  1247           pu blic boole an isStudy InNewDataS tructure()  {
  1248                    retu rn isStudy InNewDataS tructure;
  1249           }
  1250  
  1251           pu blic void  setStudyIn NewDataStr ucture(boo lean isStu dyInNewDat aStructure ) {
  1252                    this .isStudyIn NewDataStr ucture = i sStudyInNe wDataStruc ture;
  1253           }
  1254  
  1255           /* *
  1256            *  @return t he museSer verId
  1257            * /
  1258           pu blic Strin g getMuseS erverId()  {
  1259                    retu rn museSer verId;
  1260           }
  1261  
  1262           /* *
  1263            *  @param mu seServerId  the museS erverId to  set
  1264            * /
  1265           pu blic void  setMuseSer verId(Stri ng museSer verId) {
  1266                    this .museServe rId = muse ServerId;
  1267           if (this.glob alArtifact Identifier  instanceo f MuseImag eURN){
  1268                    ((Mu seImageURN ) this.glo balArtifac tIdentifie r).setMuse ServerId(t his.museSe rverId);
  1269           }
  1270  
  1271           }
  1272  
  1273           pu blic int g etNumberOf DicomImage s() {
  1274                    retu rn numberO fDicomImag es;
  1275           }
  1276  
  1277           pu blic void  setNumberO fDicomImag es(int num berOfDicom Images) {
  1278                    this .numberOfD icomImages  = numberO fDicomImag es;
  1279           }
  1280  
  1281  
  1282           
  1283   }