89. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 12/5/2017 12:06:37 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.

89.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ClinicalDisplayWebApp\main\src\java\gov\va\med\imaging\clinicaldisplay\webservices\translator ClinicalDisplayTranslator2.java Mon Dec 4 21:35:20 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ClinicalDisplayWebApp\main\src\java\gov\va\med\imaging\clinicaldisplay\webservices\translator ClinicalDisplayTranslator2.java Mon Dec 4 21:58:17 2017 UTC

89.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 3 1214
Changed 2 4
Inserted 0 0
Removed 0 0

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

89.4 Active regular expressions

No regular expressions were active.

89.5 Comparison detail

  1   /**
  2    * 
  3     Package:  MAG - Vis tA Imaging
  4     WARNING:  Per VHA D irective 2 004-038, t his routin e should n ot be modi fied.
  5     Date Cre ated: Feb  21, 2008
  6     Site Nam e:  Washin gton OI Fi eld Office , Silver S pring, MD
  7       Developer:          
WERFEJ
  8     Descript ion: 
  9  
  10           ;;  +-------- ---------- ---------- ---------- ---------- ---------- ---------- +
  11           ;;  Property  of the US  Government .
  12           ;;  No permis sion to co py or redi stribute t his softwa re is give n.
  13           ;;  Use of un released v ersions of  this soft ware requi res the us er
  14           ;;   to execu te a writt en test ag reement wi th the Vis tA Imaging
  15           ;;   Developm ent Office  of the De partment o f Veterans  Affairs,
  16           ;;   telephon e (301) 73 4-0100.
  17           ;;
  18           ;;  The Food  and Drug A dministrat ion classi fies this  software a s
  19           ;;  a Class I I medical  device.  A s such, it  may not b e changed
  20           ;;  in any wa y.  Modifi cations to  this soft ware may r esult in a n
  21           ;;  adulterat ed medical  device un der 21CFR8 20, the us e of which
  22           ;;  is consid ered to be  a violati on of US F ederal Sta tutes.
  23           ;;  +-------- ---------- ---------- ---------- ---------- ---------- ---------- +
  24  
  25    */
  26   package go v.va.med.i maging.cli nicaldispl ay.webserv ices.trans lator;
  27  
  28   import gov .va.med.SE RIALIZATIO N_FORMAT;
  29   import gov .va.med.UR N;
  30   import gov .va.med.UR NFactory;
  31   import gov .va.med.im aging.Imag eURN;
  32   import gov .va.med.im aging.Stud yURN;
  33   import gov .va.med.im aging.exce ptions.URN FormatExce ption;
  34   import gov .va.med.im aging.exch ange.Image AccessLogE vent;
  35   import gov .va.med.im aging.exch ange.Image AccessLogE vent.Image AccessLogE ventType;
  36   import gov .va.med.im aging.exch ange.busin ess.Artifa ctResults;
  37   import gov .va.med.im aging.exch ange.busin ess.Image;
  38   import gov .va.med.im aging.exch ange.busin ess.Series ;
  39   import gov .va.med.im aging.exch ange.busin ess.Study;
  40   import gov .va.med.im aging.exch ange.busin ess.StudyF ilter;
  41   import gov .va.med.im aging.exch ange.enums .ImageForm at;
  42   import gov .va.med.im aging.exch ange.enums .SiteConne ctivitySta tus;
  43  
  44   import jav a.math.Big Integer;
  45   import jav a.text.Dat eFormat;
  46   import jav a.text.Par seExceptio n;
  47   import jav a.text.Sim pleDateFor mat;
  48   import jav a.util.Col lection;
  49   import jav a.util.Dat e;
  50   import jav a.util.Ite rator;
  51  
  52   import org .apache.lo gging.log4 j.LogManag er;
  53   import org .apache.lo gging.log4 j.Logger;
  54  
  55   /**
  56    * @author         
WERFEJ
  57    *
  58    */
  59   public cla ss Clinica lDisplayTr anslator2 
  60   {
  61   private fi nal static  Logger lo gger = Log Manager.ge tLogger(Cl inicalDisp layTransla tor2.class );
  62           
  63           pr ivate fina l static S tring clin icalDispla yWebservic eShortDate Format = " MM/dd/yyyy ";
  64           pr ivate fina l static S tring clin icalDispla yWebservic eLongDateF ormat = "M M/dd/yyyy  HH:mm";
  65           
  66           pu blic Clini calDisplay Translator 2()
  67           {
  68                    supe r();
  69           }
  70           
  71           //  be carefu l about re -using Sim pleDateFor mat instan ces becaus e they are  not threa d-safe 
  72           pr ivate Date Format get ClinicalDi splayWebse rviceShort DateFormat ()
  73           {
  74                    retu rn new Sim pleDateFor mat(clinic alDisplayW ebserviceS hortDateFo rmat);
  75           }
  76           
  77           pr ivate Date Format get ClinicalDi splayWebse rviceLongD ateFormat( )
  78           {
  79                    retu rn new Sim pleDateFor mat(clinic alDisplayW ebserviceL ongDateFor mat);
  80           }
  81           
  82           /* *
  83            *  Transform  a clinica l display  webservice  FilterTyp e to an in ternal Fil ter instan ce.
  84            *  
  85            * /
  86           pu blic Study Filter tra nsformFilt er(gov.va. med.imagin g.clinical display.we bservices. soap.v2.Fi lterType f ilterType)  
  87           {
  88                    Stud yFilter fi lter = new  StudyFilt er();
  89                    
  90                    if(f ilterType  != null) 
  91                    {
  92                             DateFo rmat df =  getClinica lDisplayWe bserviceSh ortDateFor mat();
  93                             
  94                             Date f romDate =  null;
  95                             try
  96                             {
  97                                      fromDate  = filterT ype.getFro mDate() ==  null  ||  filterType .getFromDa te().lengt h() == 0 ?  null : df .parse(fil terType.ge tFromDate( ));
  98                             } 
  99                             catch  (ParseExce ption x)
  100                             {
  101                                      logger.e rror("Pars eException  convertin g webservi ce format  string fro m-date '"  +  filterT ype.getFro mDate() +  "' to inte rnal Date" , x);
  102                                      fromDate  = null;
  103                             }
  104                             
  105                             Date t oDate = nu ll;
  106                             try
  107                             {
  108                                      toDate =  filterTyp e.getToDat e() == nul l || filte rType.getT oDate().le ngth() ==  0 ? null :  df.parse( filterType .getToDate ());
  109                             } 
  110                             catch  (ParseExce ption x)
  111                             {
  112                                      logger.e rror("Pars eException  convertin g webservi ce format  string to- date '" +   filterTyp e.getToDat e() + "' t o internal  Date", x) ;
  113                                      fromDate  = null;
  114                             }
  115                             
  116                             // som e business  rules for  the filte r dates
  117                             if (fr omDate !=  null && to Date == nu ll)
  118                             {
  119                                      // defau lt toDate  to today
  120                                      toDate =  new Date( );
  121                             }
  122                             else i f (fromDat e == null  && toDate  != null)
  123                             {
  124                                      // defau lt to unfi ltered
  125                                      toDate =  null;
  126                             }
  127                             
  128                             filter .setFromDa te(fromDat e);
  129                             filter .setToDate (toDate);
  130                             
  131                             filter .setStudy_ class(filt erType.get _class() = = null ? " " : filter Type.get_c lass());
  132                             filter .setStudy_ event(filt erType.get Event() ==  null ? ""  : filterT ype.getEve nt());
  133                             filter .setStudy_ package(fi lterType.g et_package () == null  ? "" : fi lterType.g et_package ());
  134                             filter .setStudy_ specialty( filterType .getSpecia lty() == n ull ? "" :  filterTyp e.getSpeci alty());
  135                             filter .setStudy_ type(filte rType.getT ypes() ==  null ? ""  : filterTy pe.getType s());
  136                             
  137                             if(fil terType.ge tOrigin()  == null) {
  138                                      filter.s etOrigin(" ");
  139                             }
  140                             else {
  141                                      if("UNSP ECIFIED".e quals(filt erType.get Origin().g etValue()) ) {
  142                                               filter.set Origin("") ;
  143                                      }
  144                                      else {
  145                                               filter.set Origin(fil terType.ge tOrigin(). getValue() );
  146                                      }
  147                             }
  148                             // don 't have a  study id u sed here
  149                    }
  150                    retu rn filter;
  151           }
  152           pu blic gov.v a.med.imag ing.clinic aldisplay. webservice s.soap.v2. ShallowStu dyType[] t ransformSt udiesToSha llowStudie s(
  153                             Artifa ctResults  artifactRe sults) 
  154           th rows URNFo rmatExcept ion 
  155           {
  156                    if(a rtifactRes ults == nu ll)
  157                             return  null;
  158                    if(a rtifactRes ults.getSt udySetResu lt() == nu ll)
  159                             return  null;
  160                    retu rn transfo rmStudiesT oShallowSt udies(arti factResult s.getStudy SetResult( ).getArtif acts());
  161                    
  162           }
  163           
  164           pr ivate gov. va.med.ima ging.clini caldisplay .webservic es.soap.v2 .ShallowSt udyType[]  transformS tudiesToSh allowStudi es(Collect ion<Study>  studyList
  165           th rows URNFo rmatExcept ion 
  166           {
  167                    if(s tudyList = = null ||  studyList. size() ==  0)
  168                             return  null;
  169                    
  170                    gov. va.med.ima ging.clini caldisplay .webservic es.soap.v2 .ShallowSt udyType []  res = 
  171                             new go v.va.med.i maging.cli nicaldispl ay.webserv ices.soap. v2.Shallow StudyType[ studyList. size()];
  172                    
  173                    int  index=0;
  174                    for( Iterator<S tudy> stud iesIter =  studyList. iterator() ; studiesI ter.hasNex t(); ++ind ex)
  175                             res[in dex] = tra nsformStud yToShallow Study(stud iesIter.ne xt());
  176                    
  177                    retu rn res;
  178           }
  179           
  180           /* *
  181            *  
  182            *  @param st udy
  183            *  @return
  184            *  @throws U RNFormatEx ception
  185            * /
  186           pu blic gov.v a.med.imag ing.clinic aldisplay. webservice s.soap.v2. ShallowStu dyType tra nsformStud yToShallow Study(
  187                    Stud y study) 
  188           th rows URNFo rmatExcept ion 
  189           {
  190                    if(s tudy == nu ll)
  191                             return  null;
  192                    
  193                    gov. va.med.ima ging.clini caldisplay .webservic es.soap.v2 .ShallowSt udyType re sult = 
  194                             new go v.va.med.i maging.cli nicaldispl ay.webserv ices.soap. v2.Shallow StudyType( );
  195                    
  196                    resu lt.setDesc ription(ex tractIlleg alCharacte rs(study.g etDescript ion()));
  197                    //re sult.setDi comImageNu mber(study .get);
  198                    //re sult.setDi comSequenc eNumber(st udy.getst)
  199                    resu lt.setEven t(extractI llegalChar acters(stu dy.getEven t()));
  200                    resu lt.setImag eCount(Big Integer.va lueOf(stud y.getImage Count()));
  201                    resu lt.setImag ePackage(e xtractIlle galCharact ers(study. getImagePa ckage()));
  202                    resu lt.setImag eType(stud y.getImage Type());
  203                    resu lt.setNote Title(extr actIllegal Characters (study.get NoteTitle( )));
  204                    resu lt.setOrig in(extract IllegalCha racters(st udy.getOri gin()));
  205                    resu lt.setPati entIcn(stu dy.getPati entId());
  206                    resu lt.setPati entName(st udy.getPat ientName() );
  207                    resu lt.setProc edure(extr actIllegal Characters (study.get Procedure( )));
  208                    resu lt.setRadi ologyRepor t(study.ge tRadiology Report());
  209                    resu lt.setSite Number(stu dy.getSite Number());
  210                    resu lt.setSpec ialty(extr actIllegal Characters (study.get Specialty( )));
  211                    
  212                    // 2 /19/08 - n ow include  the site  name so th e Display  client sho ws what sp ecific DOD  facility  the study  is from
  213                    if(s tudy.getSt udyUrn().i sOriginDOD ())
  214                             result .setSiteAb breviation (study.get SiteAbbr() + (study.g etSiteName () != null  ? "-" + s tudy.getSi teName() :  ""));                          
  215                    else
  216                             result .setSiteAb breviation (study.get SiteAbbr() );
  217                    
  218                    resu lt.setStud yPackage(e xtractIlle galCharact ers(study. getImagePa ckage()));
  219                    resu lt.setStud yClass(ext ractIllega lCharacter s(study.ge tStudyClas s() == nul l ? "" : s tudy.getSt udyClass() )); // get  this from  study
  220                    resu lt.setStud yType(extr actIllegal Characters (study.get ImageType( )));
  221                    resu lt.setCapt ureDate(st udy.getCap tureDate() );
  222                    resu lt.setCapt uredBy(stu dy.getCapt ureBy());               
  223                    if(s tudy.getPr ocedureDat e() == nul l)
  224                    {
  225                             logger .warn("Set ting null  procedure  date for s tudy");
  226                             result .setProced ureDate("" );
  227                    }
  228                    else
  229                    {
  230                             if((st udy.getPro cedureDate String() = = null) ||  (study.ge tProcedure DateString ().length( ) <= 0))
  231                             {
  232                                      // if th e hour and  minute ar e not 0, t hen likely  they cont ain real v alues for  hour and m inute (not  00:00)
  233                                      // this  leaves ope n the poss ibility of  invalid d ata, if th e real dat e was at 0 0:00 then  this would  not show  that time.
  234                                      // we wo uld then o mit data,  not show i nvalid dat a
  235                                      if((stud y.getProce dureDate() .getHours( ) <= 0) &&  (study.ge tProcedure Date().get Minutes()  <= 0))
  236                                      {
  237                                               result.set ProcedureD ate(getCli nicalDispl ayWebservi ceShortDat eFormat(). format(stu dy.getProc edureDate( )));
  238                                      }
  239                                      else
  240                                      {
  241                                               result.set ProcedureD ate(getCli nicalDispl ayWebservi ceLongDate Format().f ormat(stud y.getProce dureDate() ));
  242                                      }
  243                                      
  244                             }
  245                             else i f(study.ge tProcedure DateString ().length( ) > 10)
  246                             {
  247                                      result.s etProcedur eDate(getC linicalDis playWebser viceLongDa teFormat() .format(st udy.getPro cedureDate ()));
  248                             }
  249                             else {
  250                                      result.s etProcedur eDate(getC linicalDis playWebser viceShortD ateFormat( ).format(s tudy.getPr ocedureDat e()));
  251                             }
  252                    }
  253                    resu lt.setRpcR esponseMsg (study.get RpcRespons eMsg());
  254                    // J MW - need  to find se ries for f irst image , ugly but  necessary
  255                    Seri es firstSe ries = nul l;
  256                    for( Series ser ies : stud y.getSerie s())
  257                    {
  258                             for(Im age image  : series)
  259                             {
  260                                      if(image .equals(st udy.getFir stImage()) )
  261                                      {
  262                                               firstSerie s = series ;
  263                                               break;
  264                                      }                                                   
  265                             }
  266                             if(fir stSeries ! = null)
  267                             {
  268                                      break;
  269                             }                          
  270                    }
  271                    gov. va.med.ima ging.clini caldisplay .webservic es.soap.v2 .FatImageT ype firstI mage = 
  272                             transf ormImageTo FatImage(s tudy.getFi rstImage() , firstSer ies);
  273                    
  274                    resu lt.setFirs tImage(fir stImage);
  275                    
  276                    // u se the VA  Internal f orm of the  URN becau se this is  going to  Clinical D isplay
  277                    resu lt.setStud yId( study .getStudyU rn().toStr ingCDTP()  );
  278                    
  279                    retu rn result;
  280           }
  281           
  282           pu blic gov.v a.med.imag ing.clinic aldisplay. webservice s.soap.v2. FatImageTy pe[] trans formStudyT oFatImages (
  283                    Stud y study) 
  284           th rows URNFo rmatExcept ion 
  285           {
  286                    if(s tudy == nu ll)
  287                             return  null;
  288                    if(s tudy.getSe ries() ==  null)
  289                             return  null;
  290                    
  291                    gov. va.med.ima ging.clini caldisplay .webservic es.soap.v2 .FatImageT ype[] resu lt = 
  292                             new go v.va.med.i maging.cli nicaldispl ay.webserv ices.soap. v2.FatImag eType[stud y.getImage Count()];
  293                    
  294                    int  index=0;
  295                    //fo r(Iterator <Image> im agesIter =  images.it erator();  imagesIter .hasNext() ; ++index)
  296                    //       result [index] =  transformI mageToFatI mage(image sIter.next ());
  297                    
  298                    for( Series ser ies : stud y.getSerie s())
  299                    {
  300                             if(ser ies != nul l)
  301                             {
  302                                      for(Imag e image :  series)
  303                                      {
  304                                               result[ind ex] = tran sformImage ToFatImage (image, se ries);
  305                                               index++;
  306                                      }
  307                             }
  308                                       
  309                    }
  310                    retu rn result;
  311           }
  312           
  313           /*
  314           pu blic gov.v a.med.imag ing.clinic aldisplay. webservice s.soap.v2. FatImageTy pe[] trans formImages ToFatImage s(List<Ima ge> images
  315           th rows Imagi ngURNForma tException  
  316           {
  317                    if(i mages == n ull)
  318                             return  null;
  319                    
  320                    gov. va.med.ima ging.clini caldisplay .webservic es.soap.v2 .FatImageT ype[] resu lt = 
  321                             new go v.va.med.i maging.cli nicaldispl ay.webserv ices.soap. v2.FatImag eType[imag es.size()] ;
  322                    
  323                    int  index=0;
  324                    for( Iterator<I mage> imag esIter = i mages.iter ator(); im agesIter.h asNext();  ++index)
  325                             result [index] =  transformI mageToFatI mage(image sIter.next ());
  326                    
  327                    retu rn result;
  328           }
  329           */
  330  
  331           pu blic gov.v a.med.imag ing.clinic aldisplay. webservice s.soap.v2. FatImageTy pe transfo rmImageToF atImage(
  332                    Imag e image, S eries seri es) 
  333           th rows URNFo rmatExcept ion 
  334           {
  335                    if(i mage == nu ll)
  336                             return  null;
  337                    
  338                    gov. va.med.ima ging.clini caldisplay .webservic es.soap.v2 .FatImageT ype result  = 
  339                             new go v.va.med.i maging.cli nicaldispl ay.webserv ices.soap. v2.FatImag eType();
  340                    
  341                    resu lt.setDesc ription(ex tractIlleg alCharacte rs(image.g etDescript ion()));
  342                    resu lt.setDico mImageNumb er(image.g etDicomIma geNumberFo rDisplay() );
  343                    //re sult.setDi comSequenc eNumber(im age.getDic omSequence NumberForD isplay());
  344                    resu lt.setDico mSequenceN umber((ser ies != nul l) && (ser ies.getSer iesNumber( ) != null)  && (serie s.getSerie sNumber(). length() >  0) ? seri es.getSeri esNumber()  : image.g etDicomSeq uenceNumbe rForDispla y());
  345                    resu lt.setPati entIcn(ima ge.getPati entId());
  346                    resu lt.setPati entName(im age.getPat ientName() );
  347                    resu lt.setProc edure(extr actIllegal Characters (image.get Procedure( )));
  348                    if(i mage.getPr ocedureDat e() == nul l)
  349                    {
  350                             logger .warn("Set ting null  procedure  date for i mage");
  351                             result .setProced ureDate("" );
  352                    }
  353                    else  
  354                    {
  355                             // if  the hour a nd minute  are not 0,  then like ly they co ntain real  values fo r hour and  minute (n ot 00:00)
  356                             // thi s leaves o pen the po ssibility  of invalid  data, if  the real d ate was at  00:00 the n this wou ld not sho w that tim e.
  357                             // we  would then  omit data , not show  invalid d ata
  358                             if((im age.getPro cedureDate ().getHour s() <= 0)  && (image. getProcedu reDate().g etMinutes( ) <= 0))
  359                             {
  360                                      result.s etProcedur eDate(getC linicalDis playWebser viceShortD ateFormat( ).format(i mage.getPr ocedureDat e()));
  361                             }
  362                             else
  363                             {
  364                                      result.s etProcedur eDate(getC linicalDis playWebser viceLongDa teFormat() .format(im age.getPro cedureDate ()));
  365                             }
  366                    }
  367                    resu lt.setSite Number(ima ge.getSite Number());
  368                    resu lt.setSite Abbr(image .getSiteAb br());
  369                    resu lt.setImag eClass(ext ractIllega lCharacter s(image.ge tImageClas s()));
  370                    resu lt.setAbsL ocation(im age.getAbs Location() );
  371                    resu lt.setFull Location(i mage.getFu llLocation ());
  372                    
  373                    resu lt.setQaMe ssage(imag e.getQaMes sage());
  374                    resu lt.setImag eType(BigI nteger.val ueOf(image .getImgTyp e()));
  375  
  376                    // u se the VA  Internal f orm of the  URN becau se this is  going to  Clinical
  377                    // D isplay.
  378                    resu lt.setImag eId( image .getImageU rn().toStr ingCDTP()  );
  379  
  380                    //re sult.setIm ageUrn(ima geUrn.toSt ring());
  381                    
  382                    if(( image.getF ullFilenam e() != nul l) && (ima ge.getFull Filename() .startsWit h("-1")))
  383                    {
  384                             result .setFullIm ageURI(ima ge.getFull Filename() ); // put  in error s tate
  385                    }
  386                    else
  387                    {
  388                             //resu lt.setFull ImageURI(" imageURN="  + imageUr n.toString () + "&ima geQuality= 70&content Type=*/*") ;
  389                             result .setFullIm ageURI("im ageURN=" +  result.ge tImageId()  + "&image Quality=70 &contentTy pe=" + get ContentTyp e(image, f alse));
  390                    }
  391                    if(( image.getA bsFilename () != null ) && (imag e.getAbsFi lename().s tartsWith( "-1")))
  392                    {
  393                             result .setAbsIma geURI(imag e.getAbsFi lename());
  394                    }
  395                    else
  396                    {
  397                             //resu lt.setAbsI mageURI("i mageURN="  + imageUrn .toString( ) + "&imag eQuality=2 0&contentT ype=*/*");
  398                             result .setAbsIma geURI("ima geURN=" +  result.get ImageId()  + "&imageQ uality=20& contentTyp e=" + getC ontentType (image, tr ue));
  399                    }
  400                    if(( image.getB igFilename () != null ) && (imag e.getBigFi lename().s tartsWith( "-1")))
  401                    {
  402                             result .setBigIma geURI(imag e.getBigFi lename());
  403                    }
  404                    else
  405                    {
  406                             //resu lt.setBigI mageURI("i mageURN="  + imageUrn .toString( ) + "&imag eQuality=9 0&contentT ype=*/*");
  407                             result .setBigIma geURI("ima geURN=" +  result.get ImageId()  + "&imageQ uality=90& contentTyp e=" + getC ontentType (image, fa lse));
  408                    }
  409                    retu rn result;
  410           }
  411           
  412           pr ivate Stri ng getCont entType(Im age image,  boolean i sThumbnail )
  413           {
  414                    Stri ng content Type = "";
  415                    swit ch(image.g etImgType( ))
  416                    {
  417                             // sti ll color i mages
  418                             case 1 : // JPEG
  419                             case 9 : // bwmed
  420                             case 1 7: // colo r scan
  421                             case 1 8: // pati ent photo
  422                             case 1 9: // XRAY  JPEG
  423                             // doc ument imag es
  424                             case 1 5: // TIF
  425                                      contentT ype = Imag eFormat.JP EG.getMime () + "," +  ImageForm at.TIFF.ge tMime() +  "," + 
  426                                               ImageForma t.BMP.getM ime();
  427                                      break;
  428                             case 2 1: // moti on video
  429                                      if(isThu mbnail)
  430                                      {
  431                                               contentTyp e = ImageF ormat.JPEG .getMime()  + "," + I mageFormat .BMP.getMi me();
  432                                      }
  433                                      else
  434                                      {
  435                                               contentTyp e = ImageF ormat.AVI. getMime();
  436                                      }
  437                                      break;
  438                             case 1 01: // htm l
  439                                      if(isThu mbnail)
  440                                      {
  441                                               contentTyp e = ImageF ormat.JPEG .getMime()  + "," + I mageFormat .BMP.getMi me();
  442                                      }
  443                                      else
  444                                      {
  445                                               contentTyp e = ImageF ormat.HTML .getMime() ;
  446                                      }
  447                                      break;
  448                             case 1 02: // Wor d document
  449                                      if(isThu mbnail)
  450                                      {
  451                                               contentTyp e = ImageF ormat.JPEG .getMime()  + "," + I mageFormat .BMP.getMi me();
  452                                      }
  453                                      else
  454                                      {
  455                                               contentTyp e = ImageF ormat.DOC. getMime();
  456                                      }
  457                                      break;
  458                             case 1 03: // tex t (ASCII t ext)
  459                                      if(isThu mbnail)
  460                                      {
  461                                               contentTyp e = ImageF ormat.JPEG .getMime()  + "," + I mageFormat .BMP.getMi me();
  462                                      }
  463                                      else
  464                                      {
  465                                               contentTyp e = ImageF ormat.TEXT _PLAIN.get Mime();
  466                                      }
  467                                      break;
  468                             case 1 04: // PDF
  469                                      if(isThu mbnail)
  470                                      {
  471                                               contentTyp e = ImageF ormat.JPEG .getMime()  + "," + I mageFormat .BMP.getMi me();
  472                                      }
  473                                      else
  474                                      {
  475                                               contentTyp e = ImageF ormat.PDF. getMime();
  476                                      }
  477                                      break;
  478                             case 1 05: // RTF
  479                                      if(isThu mbnail)
  480                                      {
  481                                               contentTyp e = ImageF ormat.JPEG .getMime()  + "," + I mageFormat .BMP.getMi me();
  482                                      }
  483                                      else
  484                                      {
  485                                               contentTyp e = ImageF ormat.RTF. getMime();
  486                                      }
  487                                      break;
  488                             case 1 06: // Aud io
  489                                      if(isThu mbnail)
  490                                      {
  491                                               contentTyp e = ImageF ormat.JPEG .getMime()  + "," + I mageFormat .BMP.getMi me();
  492                                      }
  493                                      else
  494                                      {
  495                                               contentTyp e = ImageF ormat.WAV  + "," + Im ageFormat. MP3;
  496                                      }
  497                                      break;
  498                             case 3 : // XRAY
  499                             case 1 00: // DIC OM
  500                                      if(isThu mbnail)
  501                                      {
  502                                               contentTyp e = ImageF ormat.JPEG .getMime()  + "," + I mageFormat .TGA.getMi me() + 
  503                                               "," + Imag eFormat.BM P.getMime( );
  504                                      }
  505                                      else
  506                                      {
  507                                               contentTyp e = ImageF ormat.DICO M.getMime( ) + "," +  ImageForma t.J2K.getM ime() + ", " + ImageF ormat.TGA. getMime();
  508                                      }
  509                                      break;
  510                    }
  511                    
  512                    if(c ontentType .length()  > 0)
  513                    {
  514                             conten tType += " ,*/*";
  515                    }
  516                    else
  517                    {
  518                             conten tType = "* /*";
  519                    }
  520                    retu rn content Type;
  521           }
  522           
  523           pu blic Image AccessLogE vent trans formLogEve nt(gov.va. med.imagin g.clinical display.we bservices. soap.v2.Im ageAccessL ogEventTyp e logEvent Type) 
  524           th rows URNFo rmatExcept ion 
  525           {
  526                    if(l ogEventTyp e == null)
  527                             return  null;
  528                    // J MW 9/22/08  In the v2  Clin Disp  web servi ce the URN  from the  client mig ht either  be
  529                    // a n image UR N or a stu dy URN (fo r a single  image stu dy). In th is case we  don't kno w
  530                    // w hich it wi ll be so w e try to c onvert the  input int o both bef ore throwi ng an 
  531                    // e xception.  This is ha ndled bett er in the  v3 Clin Di sp web ser vice.
  532                    Stri ng imageId  = "";
  533                    Stri ng siteId  = "";
  534                    try
  535                    {
  536                             URN ur n = URNFac tory.creat e(logEvent Type.getIm ageId(), 
  537                                               SERIALIZAT ION_FORMAT .CDTP, Ima geURN.clas s);
  538                             if(urn  instanceo f ImageURN )
  539                             {
  540                                      imageId  = ((ImageU RN)urn).ge tImageId() ;
  541                                      siteId =  ((ImageUR N)urn).get Originatin gSiteId();
  542                             }
  543                             else i f(urn inst anceof Stu dyURN)
  544                             {
  545                                      imageId  = ((StudyU RN)urn).ge tStudyId() ;
  546                                      siteId =  ((StudyUR N)urn).get Originatin gSiteId();
  547                             }
  548                    }
  549                    catc h(URNForma tException  iurnfX)
  550                    {
  551                    }
  552                    Imag eAccessLog EventType  imageAcces sLogEventT ype = tran sformLogEv entType(lo gEventType .getEventT ype());
  553                    Imag eAccessLog Event resu lt = 
  554                             new Im ageAccessL ogEvent(im ageId, "",  logEventT ype.getPat ientIcn(),  siteId, 
  555                                      System.c urrentTime Millis(),  logEventTy pe.getReas on(), "", 
  556                                      imageAcc essLogEven tType, log EventType. getCredent ials().get SiteNumber ());
  557                             //new  ImageAcces sLogEvent( imageUrn.g etImageId( ), "", log EventType. getPatient Icn(), ima geUrn.getO riginating SiteId(),  System.cur rentTimeMi llis(), lo gEventType .getReason (), imageA ccessLogEv entType);
  558                    
  559                    retu rn result;
  560           }
  561  
  562           pu blic Image AccessLogE ventType t ransformLo gEventType (gov.va.me d.imaging. clinicaldi splay.webs ervices.so ap.v2.Imag eAccessLog EventTypeE ventType e ventType)  {
  563                    Imag eAccessLog EventType  result;//  = new gov. va.med.ima ging.excha nge.enums. ImageAcces sLogEventT ype();
  564                    if(e ventType = = gov.va.m ed.imaging .clinicald isplay.web services.s oap.v2.Ima geAccessLo gEventType EventType. IMAGE_COPY ) {
  565                             result  = ImageAc cessLogEve ntType.IMA GE_COPY;
  566                    }
  567                    else  if(eventT ype == gov .va.med.im aging.clin icaldispla y.webservi ces.soap.v 2.ImageAcc essLogEven tTypeEvent Type.PATIE NT_ID_MISM ATCH)
  568                    {
  569                             result  = ImageAc cessLogEve ntType.PAT IENT_ID_MI SMATCH;
  570                    }
  571                    else  {
  572                             result  = ImageAc cessLogEve ntType.IMA GE_PRINT;
  573                    }
  574                    retu rn result;
  575           }
  576           
  577           pu blic gov.v a.med.imag ing.clinic aldisplay. webservice s.soap.v2. PingServer TypeRespon se transfo rmServerSt atusToPing ServerResp onse(SiteC onnectivit yStatus si teStatus)
  578           {
  579                    gov. va.med.ima ging.clini caldisplay .webservic es.soap.v2 .PingServe rTypeRespo nse respon se = null;
  580                    if(s iteStatus  == SiteCon nectivityS tatus.VIX_ READY)
  581                    {
  582                             respon se = gov.v a.med.imag ing.clinic aldisplay. webservice s.soap.v2. PingServer TypeRespon se.SERVER_ READY;
  583                    }
  584                    else  if(siteSt atus == Si teConnecti vityStatus .DATASOURC E_UNAVAILA BLE)
  585                    {
  586                             respon se = gov.v a.med.imag ing.clinic aldisplay. webservice s.soap.v2. PingServer TypeRespon se.VISTA_U NAVAILABLE ;
  587                    }
  588                    else  
  589                    {
  590                             respon se = gov.v a.med.imag ing.clinic aldisplay. webservice s.soap.v2. PingServer TypeRespon se.SERVER_ UNAVAILABL E;
  591                    }
  592                    
  593                    retu rn respons e;
  594           }
  595           
  596           /* *
  597            *  Certain c haracters  cannot be  given to t he Clinica l Display  client bec ause they  will cause  exception s
  598            *  in the pa rsing, the y must be  removed to  ensure pr oper displ ay of meta data. This  function  removes th ose
  599            *  character s and repl aces them  with a spa ce
  600            *  @param in put Input  string to  check
  601            *  @return
  602            * /
  603           pr ivate Stri ng extract IllegalCha racters(St ring input )
  604           {
  605                    if(i nput == nu ll)
  606                             return  "";
  607                    retu rn input.r eplaceAll( "\\^", " " );    
  608           }
  609   }