32. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 6/5/2018 10:24:11 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.

32.1 Files compared

# Location File Last Modified
1 patch_205_build_9.zip\Java\ImagingRouter\main\src\java\gov\va\med\imaging\router\commands\vistarad AbstractExamImageCommandImpl.java Wed May 30 14:35:27 2018 UTC
2 patch_205_build_9.zip\Java\ImagingRouter\main\src\java\gov\va\med\imaging\router\commands\vistarad AbstractExamImageCommandImpl.java Mon Jun 4 14:34:37 2018 UTC

32.2 Comparison summary

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

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

32.4 Active regular expressions

No regular expressions were active.

32.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: Apr  29, 2009
  6     Site Nam e:  Washin gton OI Fi eld Office , Silver S pring, MD
  7       Developer:     PII
  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.rou ter.comman ds.vistara d;
  27  
  28   import gov .va.med.im aging.Imag eURN;
  29   import gov .va.med.im aging.chan nels.ByteS treamPump;
  30   import gov .va.med.im aging.core .interface s.ImageMet adataNotif ication;
  31   import gov .va.med.im aging.core .interface s.StorageC redentials ;
  32   import gov .va.med.im aging.core .interface s.exceptio ns.Connect ionExcepti on;
  33   import gov .va.med.im aging.core .interface s.exceptio ns.ImageCo nversionEx ception;
  34   import gov .va.med.im aging.core .interface s.exceptio ns.ImageNe arLineExce ption;
  35   import gov .va.med.im aging.core .interface s.exceptio ns.ImageNo tFoundExce ption;
  36   import gov .va.med.im aging.core .interface s.exceptio ns.MethodE xception;
  37   import gov .va.med.im aging.exch ange.busin ess.ImageF ormatQuali tyList;
  38   import gov .va.med.im aging.exch ange.busin ess.ImageS treamRespo nse;
  39   import gov .va.med.im aging.exch ange.busin ess.util.E xchangeUti l;
  40   import gov .va.med.im aging.exch ange.busin ess.vistar ad.ExamIma ge;
  41   import gov .va.med.im aging.exch ange.enums .ImageForm at;
  42   import gov .va.med.im aging.exch ange.enums .ImageQual ity;
  43   import gov .va.med.im aging.exch ange.stora ge.DataSou rceInputSt ream;
  44   import gov .va.med.im aging.rout er.command s.CommonIm ageCacheFu nctions;
  45   import gov .va.med.im aging.rout er.facade. ImagingCon text;
  46   import gov .va.med.im aging.tran sactioncon text.Trans actionCont ext;
  47   import gov .va.med.im aging.tran sactioncon text.Trans actionCont extFactory ;
  48   import gov .va.med.im aging.url. vista.imag e.ImagingS torageCred entials;
  49   import gov .va.med.im aging.vist a.storage. SmbStorage Utility;
  50  
  51   import jav a.io.IOExc eption;
  52   import jav a.io.Input Stream;
  53   import jav a.io.Outpu tStream;
  54  
  55   /**
  56    * @author   PII
  57    *
  58    */
  59   public abs tract clas s Abstract ExamImageC ommandImpl <R extends  Object> 
  60   extends Ab stractExam CommandImp l<R>
  61   {
  62           pr ivate stat ic final l ong serial VersionUID  = -864205 2358902816 33L;
  63  
  64           pu blic Abstr actExamIma geCommandI mpl()
  65           {
  66                    supe r();
  67           }
  68           
  69           /* *
  70            *  
  71            *  @param im ageUrn
  72            *              Unique i dentifier  of the ima ge to requ est from t he data so urce
  73            *  @param qu alityValue
  74            *  @param co ntentType
  75            *  @param ou tStream
  76            *  @return a  String va lue indica ting the c hecksum an d checksum  algorithm
  77            *  @see gov. va.med.ima ging.Check sumValue r eturns "ok " or "not  ok" if
  78            *       chec ksum was c alculated  for data s ource stre am before  compressio n
  79            *  @throws M ethodExcep tion
  80            *  @throws I OException
  81            *  @throws I mageNearLi neExceptio n
  82            * /
  83           pr otected Im ageStreamR esponse st reamImageF romDataSou rce(
  84                             ImageU RN imageUr n, 
  85                             ImageF ormatQuali tyList req uestFormat QualityLis t) 
  86           th rows Metho dException , Connecti onExceptio n, IOExcep tion
  87           {
  88                    Imag eStreamRes ponse imag eResponse  = null;
  89                    
  90                    Stri ng imageId  = imageUr n.getImage Id();
  91                    getL ogger().in fo("Reques ting exam  image [" +  imageId +  "] from d ata source .");
  92                    
  93                    // t ry to get  exam image  metadata  from cache
  94                    Exam Image imag e = getExa mImageFrom Cache(imag eUrn);               
  95                    if(i mage != nu ll)
  96                             imageR esponse =  ImagingCon text.getRo uter().get ExamInstan ceFromData Source(ima ge, reques tFormatQua lityList);
  97                    else
  98                             imageR esponse =  ImagingCon text.getRo uter().get ExamInstan ceFromData Source(ima geUrn, req uestFormat QualityLis t);
  99                    
  100                    if(i mageRespon se == null )
  101                             throw  new ImageN otFoundExc eption("Im age [" + i mageId + " ] not foun d");
  102  
  103                    if(i mageRespon se.getImag eStream()  == null)
  104                             throw  new Method Exception( "No input  stream ret urned from  data sour ce for ima ge [" + im ageId + "] .");
  105                    //in Stream = s izedStream .getInStre am();
  106                    
  107                    if(! imageRespo nse.getIma geStream() .isReadabl e())
  108                             throw  new Method Exception( "No input  stream ret urned from  data sour ce for ima ge [" + im ageId + "] .");
  109                    
  110                    Comm onImageCac heFunction s.cacheTXT File(getCo mmandConte xt(), imag eUrn, imag eResponse. getTxtStre am(), fals e);
  111                    Imag eFormat cu rImgFormat  = imageRe sponse.get ImageForma t();
  112                    getL ogger().in fo("Image  returned f rom dataso urce in fo rmat [" +  curImgForm at + "]");
  113                    retu rn imageRe sponse;            
  114           }
  115           
  116           /* *
  117            *  
  118            *  @param im ageUrn
  119            *              Unique i dentifier  of the ima ge to requ est from t he data so urce
  120            *  @param qu alityValue
  121            *  @return a  String va lue indica ting the c hecksum an d checksum  algorithm
  122            *  @see gov. va.med.ima ging.Check sumValue r eturns "ok " or "not  ok" if
  123            *       chec ksum was c alculated  for data s ource stre am before  compressio n
  124            *  @throws M ethodExcep tion
  125            *  @throws I OException
  126            *  @throws I mageNearLi neExceptio n
  127            * /
  128           pr otected Im ageStreamR esponse st reamImageF romDataSou rceWithout Cache(
  129                             ImageU RN imageUr n, 
  130                             ImageF ormatQuali tyList req uestFormat QualityLis t) 
  131           th rows Metho dException , Connecti onExceptio n, IOExcep tion
  132           {
  133                    Imag eStreamRes ponse imag eResponse  = null;
  134                    
  135                    Stri ng imageId  = imageUr n.getImage Id();
  136                    getL ogger().in fo("Reques ting exam  image [" +  imageId +  "] from d ata source . No Cachi ng");
  137                    
  138                    imag eResponse  = ImagingC ontext.get Router().g etExamInst anceFromDa taSource(i mageUrn, r equestForm atQualityL ist);
  139                    
  140                    if(i mageRespon se == null )
  141                             throw  new ImageN otFoundExc eption("Im age [" + i mageId + " ] not foun d");
  142  
  143                    if(i mageRespon se.getImag eStream()  == null)
  144                             throw  new Method Exception( "No input  stream ret urned from  data sour ce for ima ge [" + im ageId + "] .");
  145                    //in Stream = s izedStream .getInStre am();
  146                    
  147                    if(! imageRespo nse.getIma geStream() .isReadabl e())
  148                             throw  new Method Exception( "No input  stream ret urned from  data sour ce for ima ge [" + im ageId + "] .");
  149                    
  150                    Imag eFormat cu rImgFormat  = imageRe sponse.get ImageForma t();
  151                    getL ogger().in fo("Image  returned f rom dataso urce in fo rmat [" +  curImgForm at + "]");
  152                    retu rn imageRe sponse;            
  153           }
  154  
  155           
  156           
  157           /* *
  158            *  
  159            *  @param im ageUrn
  160            *  @param ou tStream
  161            *  @return
  162            *  @throws M ethodExcep tion
  163            *  @throws I OException
  164            *  @throws I mageNearLi neExceptio n
  165            *  @throws I mageNotFou ndExceptio n
  166            * /
  167           pr otected in t streamTX TFileFromD ataSource(
  168                             ImageU RN imageUr n,
  169                             Output Stream out Stream) 
  170           th rows Metho dException , Connecti onExceptio n, 
  171           IO Exception
  172           {
  173                    Data SourceInpu tStream im ageRespons e = null;
  174                    Inpu tStream tx tStream =  null;
  175                    
  176                    try
  177                    {
  178                             String  imageId =  imageUrn. getImageId ();
  179                             getLog ger().info ("Requesti ng txt fil e for exam  image ["  + imageId  + "] from  data sourc e.");
  180                             
  181                             // try  to get ex am image m etadata fr om cache
  182                             ExamIm age image  = getExamI mageFromCa che(imageU rn);               
  183                             if(ima ge != null )
  184                                      imageRes ponse = Im agingConte xt.getRout er().getEx amTextFile FromDataSo urce(image );
  185                             else
  186                                      imageRes ponse = Im agingConte xt.getRout er().getEx amTextFile FromDataSo urce(image Urn);
  187                             
  188                             if(ima geResponse  == null)
  189                                      throw ne w MethodEx ception("N o input st ream retur ned from d ata source  for TXT f ile [" + i mageId + " ].");
  190                             
  191                             if(!im ageRespons e.isReadab le())
  192                                      throw ne w MethodEx ception("U nreadable  input stre am returne d from dat a source f or TXT fil e [" + ima geId + "]. ");
  193                             txtStr eam = imag eResponse. getInputSt ream();
  194           
  195                             // wri te the inp ut stream  to the out put stream , which co uld be the  destinati on output  stream or
  196                             // the  cache out put stream  (in this  method we  don't know  or care).
  197                             ByteSt reamPump p ump = Byte StreamPump .getByteSt reamPump(B yteStreamP ump.TRANSF ER_TYPE.Ne tworkToNet work);
  198                             // if  the cacheS tream is n ull the By teStreamPu mp will ig nore it
  199                             return  pump.xfer (txtStream , outStrea m); 
  200                    }
  201                    fina lly
  202                    {
  203                             if(txt Stream !=  null)
  204                             {
  205                                      try
  206                                      {
  207                                               txtStream. close();
  208                                      }
  209                                      catch(Ex ception ex ) {getLogg er().warn( ex); }
  210                             }
  211                    }
  212           }
  213  
  214  
  215   }