176. EPMO Open Source Coordination Office Redaction File Detail Report

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

176.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ExchangeDataSource\main\src\java\gov\va\med\imaging\exchangedatasource ExchangeImageDataSourceService.java Mon Dec 4 21:34:44 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ExchangeDataSource\main\src\java\gov\va\med\imaging\exchangedatasource ExchangeImageDataSourceService.java Mon Dec 4 22:00:07 2017 UTC

176.2 Comparison summary

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

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

176.4 Active regular expressions

No regular expressions were active.

176.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: Jan  10, 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.exc hangedatas ource;
  27  
  28   import gov .va.med.Gl obalArtifa ctIdentifi er;
  29   import gov .va.med.SE RIALIZATIO N_FORMAT;
  30   import gov .va.med.im aging.Abst ractImagin gURN;
  31   import gov .va.med.im aging.Imag eURN;
  32   import gov .va.med.im aging.arti factsource .ArtifactS ource;
  33   import gov .va.med.im aging.arti factsource .ResolvedA rtifactSou rce;
  34   import gov .va.med.im aging.conv ersion.Ima geConversi onFilePath ;
  35   import gov .va.med.im aging.conv ersion.Ima geConversi onUtility;
  36   import gov .va.med.im aging.conv ersion.enu ms.ImageCo nversionSa tisfaction ;
  37   import gov .va.med.im aging.core .interface s.exceptio ns.*;
  38   import gov .va.med.im aging.data source.Abs tractVersi onableData Source;
  39   import gov .va.med.im aging.data source.Ima geDataSour ceSpi;
  40   import gov .va.med.im aging.data source.exc eptions.Un supportedP rotocolExc eption;
  41   import gov .va.med.im aging.exch ange.busin ess.*;
  42   import gov .va.med.im aging.exch ange.enums .ImageForm at;
  43   import gov .va.med.im aging.exch ange.enums .ImageQual ity;
  44   import gov .va.med.im aging.exch ange.proxy .v1.ImageX ChangeProx y;
  45   import gov .va.med.im aging.exch ange.proxy .v1.ImageX ChangeProx yFactory;
  46   import gov .va.med.im aging.exch ange.stora ge.DataSou rceInputSt ream;
  47   import gov .va.med.im aging.exch ange.stora ge.Exchang eStorageUt ility;
  48   import gov .va.med.im aging.tran sactioncon text.Trans actionCont extFactory ;
  49   import gov .va.med.im aging.url. exchange.E xchangeCon nection;
  50   import gov .va.med.im aging.url. exchange.c onfigurati on.Exchang eSiteConfi guration;
  51   import gov .va.med.im aging.url. exchange.e xceptions. ExchangeCo nfiguratio nException ;
  52   import gov .va.med.im aging.url. exchange.e xceptions. ExchangeCo nnectionEx ception;
  53   import jav a.io.IOExc eption;
  54   import jav a.net.URL;
  55   import jav a.util.Arr ayList;
  56   import jav a.util.Has hMap;
  57   import jav a.util.Lis t;
  58   import org .apache.lo gging.log4 j.LogManag er;
  59   import org .apache.lo gging.log4 j.Logger;
  60  
  61   /**
  62    * @author         
WERFEJ
  63    *
  64    */
  65   public cla ss Exchang eImageData SourceServ ice 
  66   extends Ab stractVers ionableDat aSource
  67   implements  ImageData SourceSpi
  68   {
  69           
  70           pu blic stati c final Li st<ImageFo rmat> acce ptableThum bnailRespo nseTypes;
  71           pu blic stati c final Li st<ImageFo rmat> acce ptableRefe renceRespo nseTypes;
  72           pu blic stati c final Li st<ImageFo rmat> acce ptableDiag nosticResp onseTypes;
  73           
  74           st atic
  75           {
  76                    acce ptableThum bnailRespo nseTypes =  new Array List<Image Format>();
  77                    acce ptableThum bnailRespo nseTypes.a dd(ImageFo rmat.JPEG) ;
  78                    
  79                    acce ptableRefe renceRespo nseTypes =  new Array List<Image Format>();
  80                    acce ptableRefe renceRespo nseTypes.a dd(ImageFo rmat.DICOM JPEG2000);
  81                    
  82                    acce ptableDiag nosticResp onseTypes  = new Arra yList<Imag eFormat>() ;
  83                    acce ptableDiag nosticResp onseTypes. add(ImageF ormat.DICO MJPEG2000) ;
  84   //               acce ptableDiag nosticResp onseTypes. add(ImageF ormat.DICO M); // DIC OM must be  here beca use the re quest type  will be a pplication /dicom whi ch literal ly convert s to this  one
  85           }        
  86           
  87           pr ivate fina l Exchange Connection  exchangeC onnection;
  88           
  89           //  Hashmap t o hold pro xies based  on the al ien site n umber (if  empty stri ng, will r eturn prox y to BIA),  otherwise  will use  wormhole.
  90           pr ivate Hash Map<String , ImageXCh angeProxy>  xchangePr oxies = ne w HashMap< String, Im ageXChange Proxy>();
  91           
  92           pr ivate fina l static L ogger logg er = LogMa nager.getL ogger(Exch angeImageD ataSourceS ervice.cla ss);
  93           pr ivate fina l static S tring EXCH ANGE_PROXY _SERVICE_N AME = "Exc hange";
  94           pr ivate fina l static S tring DATA SOURCE_VER SION = "1" ;
  95           pu blic final  static St ring SUPPO RTED_PROTO COL = "exc hange";
  96           
  97           /* *
  98        * The  Provider  will use t he create( ) factory  method pre ferentiall y
  99        * ove r a constr uctor.  Th is allows  for cachin g of Vista StudyGraph DataSource Service
  100        * ins tances acc ording to  the criter ia set her e.
  101        * 
  102        * @pa ram url
  103        * @pa ram site
  104        * @re turn
  105        * @th rows Conne ctionExcep tion
  106        * @th rows Unsup portedProt ocolExcept ion 
  107        */
  108       public  static Ex changeImag eDataSourc eService c reate(Reso lvedArtifa ctSource r esolvedArt ifactSourc e, String  protocol)
  109       throws  Connectio nException , Unsuppor tedProtoco lException
  110       {
  111           re turn new E xchangeIma geDataSour ceService( resolvedAr tifactSour ce, protoc ol);
  112       }
  113           
  114       /**
  115        * 
  116        * @pa ram resolv edArtifact Source
  117        * @pa ram protoc ol
  118        * @th rows Unsup portedProt ocolExcept ion if the  ResolvedA rtifactSou rce is not  an instan ce of Reso lvedSite
  119        */
  120           pu blic Excha ngeImageDa taSourceSe rvice(Reso lvedArtifa ctSource r esolvedArt ifactSourc e, String  protocol) 
  121           th rows Unsup portedProt ocolExcept ion
  122           {
  123                    supe r(resolved ArtifactSo urce, prot ocol);                  
  124                    exch angeConnec tion = new  ExchangeC onnection( getArtifac tUrl());
  125           }        
  126           
  127           @O verride
  128           pu blic boole an isVersi onCompatib le() 
  129           {
  130                    // n othing rea lly to che ck
  131                    retu rn true;
  132           }
  133  
  134           /*  (non-Java doc)
  135            *  @see gov. va.med.ima ging.datas ource.Imag eDataSourc eSpi#getUr l()
  136            * /
  137           pu blic URL g etUrl() 
  138           {
  139                    retu rn exchang eConnectio n.getURL() ;
  140           }
  141           
  142           @O verride
  143           pu blic DataS ourceInput Stream get ImageTXTFi le(Image i mage)
  144           th rows Metho dException , Connecti onExceptio n
  145           {
  146                    retu rn null;
  147           }
  148  
  149           /* *
  150            *  
  151            *  @see gov. va.med.ima ging.datas ource.Imag eDataSourc e#getImage (gov.va.me d.imaging. exchange.b usiness.Im age, int,  java.lang. String)
  152            * /
  153           @O verride
  154           pu blic Image StreamResp onse getIm age(Image  image, Ima geFormatQu alityList  requestFor matQuality List) 
  155           th rows Metho dException , Connecti onExceptio n
  156           {
  157                    logg er.info("g etImage("  + image.ge tIen() + " ) from Ima ge object  Transactio nContext ( " + Transa ctionConte xtFactory. get().getD isplayIden tity() + " ).");
  158                    try 
  159                    {                         
  160                             ImageX ChangeProx y proxy =  getProxy(i mage);
  161                             ImageU RN imageUr n = image. getImageUr n();
  162                             //Imag eURN image Urn = Imag eURN.creat e(image.ge tSiteNumbe r(), image .getIen(),  image.get StudyIen() , image.ge tPatientIC N());
  163                             return  getImage( imageUrn,  requestFor matQuality List, prox y);
  164                    }
  165                    catc h(IOExcept ion ioX)
  166                    {
  167                             logger .error("Er ror gettin g image",  ioX);
  168                             throw  new Method RemoteExce ption(ioX) ;
  169                    }
  170           }
  171  
  172           /*  (non-Java doc)
  173            *  @see gov. va.med.ima ging.datas ource.Imag eDataSourc eSpi#getIm age(gov.va .med.imagi ng.ImageUR N, int, ja va.lang.St ring)
  174            * /
  175           @O verride
  176           pu blic Image StreamResp onse getIm age(Global ArtifactId entifier g ai, ImageF ormatQuali tyList req uestFormat QualityLis t) 
  177           th rows Metho dException , Exchange Connection Exception,  Connectio nException
  178           {                 
  179                    if(! (gai insta nceof Imag eURN))
  180                    {
  181                             throw  new Method Exception( "GlobalArt ifactIdent ifier '" +  gai.toStr ing() + "'  is not in stanceof I mageURN, c annot retr ieve image  from Exch ange.");
  182                    }
  183                    Imag eURN image Urn = (Ima geURN)gai;
  184                    logg er.info("g etImage("  + imageUrn .toString( ) + ") fro m Image UR N Transact ionContext  (" + Tran sactionCon textFactor y.get().ge tDisplayId entity() +  ").");
  185                    try
  186                    {
  187                             ImageX ChangeProx y proxy =  getProxy(n ull);
  188                             return  getImage( imageUrn,  requestFor matQuality List, prox y);
  189                    }
  190                    catc h(IOExcept ion ioX)
  191                    {
  192                             logger .error("Er ror gettin g image",  ioX);
  193                             throw  new Method RemoteExce ption(ioX) ;
  194                    }                 
  195           }
  196           
  197           pr ivate Imag eStreamRes ponse getI mage(
  198                    Imag eURN image Urn, 
  199                    Imag eFormatQua lityList r equestForm atQualityL ist, 
  200                    Imag eXChangePr oxy proxy)  
  201           th rows Metho dException , Exchange Connection Exception,  Connectio nException
  202           {
  203                    try 
  204                    {
  205                             exchan geConnecti on.connect ();                     
  206                    }
  207                    catc h(IOExcept ion ioX)
  208                    {
  209                             logger .error("Er ror gettin g image",  ioX);
  210                             throw  new Exchan geConnecti onExceptio n(ioX);
  211                    }
  212                    try 
  213                    {
  214                             Exchan geDataSour ceCommon.s etDataSour ceMethodAn dVersion(" getImage",  DATASOURC E_VERSION) ;
  215                             String  imageId =  imageUrn. toString(S ERIALIZATI ON_FORMAT. NATIVE);
  216                             if(pro xy.getAlie nSiteNumbe r() != nul l)
  217                                      Transact ionContext Factory.ge t().addDeb ugInformat ion("Retri eving imag e from ali en site nu mber [" +  proxy.getA lienSiteNu mber() + " ]");
  218                             logger .info("Ret rieving im age [" + i mageId + " ] from sit e [" + get ResolvedAr tifactSour ceString()  + "]");
  219                             
  220                             List<I mageConver sionFilePa th> files  = new Arra yList<Imag eConversio nFilePath> (1);
  221                             files. add(new Im ageConvers ionFilePat h(imageId,  null, nul l));                      
  222                             ImageF ormatQuali tyList pru nedList =  pruneReque stList(req uestFormat QualityLis t);
  223                             
  224                             Exchan geStorageU tility sto rageUtilit y = new Ex changeStor ageUtility (proxy);
  225                             ImageC onversionU tility ima geConversi onUtility  = new Imag eConversio nUtility(s torageUtil ity, 
  226                                               ImageConve rsionSatis faction.SA TISFY_ANY_ REQUEST, f alse);                                            
  227                             return  imageConv ersionUtil ity.getIma ge(files,  prunedList , requestF ormatQuali tyList, fa lse);                       
  228                    }
  229                    catc h (ImageNo tFoundExce ption infX )
  230           {
  231                             logger .warn("Err or getting  image", i nfX);
  232                             return  null;
  233           }
  234           }
  235  
  236           pr ivate Exch angeSiteCo nfiguratio n getExcha ngeSiteCon figuration (String al ienSiteNum ber)
  237           th rows IOExc eption
  238           {
  239                    Exch angeSiteCo nfiguratio n exchange Configurat ion = null ;
  240                    Stri ng reposit oryId = ge tResolvedA rtifactSou rce().getA rtifactSou rce().getR epositoryI d();
  241                    Stri ng primary SiteNumber  = reposit oryId;
  242                    Stri ng seconda rySiteNumb er = null;
  243                    if(( alienSiteN umber != n ull) && (a lienSiteNu mber.lengt h() > 0))
  244                    {
  245                             second arySiteNum ber = repo sitoryId;
  246                             primar ySiteNumbe r = alienS iteNumber;
  247                    }
  248                    try 
  249                    {
  250                             
  251                             exchan geConfigur ation = 
  252                                      Exchange DataSource Provider.g etExchange Configurat ion().getS iteConfigu ration(pri marySiteNu mber, seco ndarySiteN umber);
  253                    }
  254                    catc h(Exchange Configurat ionExcepti on ecX)
  255                    {
  256                             throw  new IOExce ption(ecX) ;
  257                    }                 
  258                    retu rn exchang eConfigura tion;
  259           }
  260           
  261           /*
  262           pr ivate Imag eXChangePr oxy getPro xy()
  263           th rows IOExc eption
  264           {
  265                    retu rn getProx y(null);
  266           }
  267           */
  268           
  269           pr ivate Imag eXChangePr oxy getPro xy(Image i mage)
  270           th rows IOExc eption
  271           {
  272                    Stri ng alienSi teNumber =  null;
  273                    bool ean isAlie nSiteNumbe r = false;
  274                    if(( image != n ull) && (i mage.getAl ienSiteNum ber() != n ull))
  275                    {
  276                             alienS iteNumber  = image.ge tAlienSite Number();
  277                             if(xch angeProxie s.contains Key(alienS iteNumber) )
  278                             {
  279                                      return x changeProx ies.get(al ienSiteNum ber);
  280                             }                         
  281                    }                 
  282                    Exch angeSiteCo nfiguratio n exchange SiteConfig uration =  getExchang eSiteConfi guration(a lienSiteNu mber);
  283                    Stri ng host =  exchangeCo nnection.g etURL().ge tHost();
  284                    int  port = exc hangeConne ction.getU RL().getPo rt();
  285                    if(e xchangeSit eConfigura tion.conta insHostAnd Port())
  286                    {
  287                             host =  exchangeS iteConfigu ration.get Host();
  288                             port =  exchangeS iteConfigu ration.get Port();
  289                             isAlie nSiteNumbe r = true;
  290                    }
  291                    Imag eXChangePr oxy proxy  = ImageXCh angeProxyF actory.get Singleton( ).get(
  292                                      host, 
  293                                      port, 
  294                                      exchange SiteConfig uration,
  295                                      isAlienS iteNumber  ? alienSit eNumber :  null,
  296                                      Exchange DataSource Provider.g etExchange Configurat ion()); 
  297                    
  298                    xcha ngeProxies .put(alien SiteNumber , proxy);      
  299                    
  300                    retu rn proxy;            
  301                    
  302           }
  303  
  304           @O verride
  305           pu blic DataS ourceInput Stream get ImageTXTFi le(ImageUR N imageURN )
  306           th rows Unsup portedOper ationExcep tion, Meth odExceptio n,
  307                    Conn ectionExce ption, Ima geNotFound Exception,  ImageNear LineExcept ion 
  308           {
  309                    retu rn null;
  310           }
  311  
  312           @O verride
  313           pu blic Strin g getImage Informatio n(Abstract ImagingURN  imagingUr n, boolean  includeDe letedImage s)
  314           th rows Unsup portedOper ationExcep tion, Meth odExceptio n,
  315                    Conn ectionExce ption, Ima geNotFound Exception 
  316           {
  317                    thro w new Unsu pportedOpe rationExce ption("The  Exchange  ImageDataS ource does  not suppo rt the get ImageInfor mation met hod.");
  318           }
  319  
  320           @O verride
  321           pu blic Strin g getImage SystemGlob alNode(Abs tractImagi ngURN imag ingUrn)
  322                             throws  Unsupport edOperatio nException , MethodEx ception,
  323                             Connec tionExcept ion, Image NotFoundEx ception {
  324                    thro w new Unsu pportedOpe rationExce ption("The  Exchange  ImageDataS ource does  not suppo rt the get ImageInfor mation met hod.");
  325           }
  326           
  327           @O verride
  328           pu blic Strin g getImage DevFields( AbstractIm agingURN i magingUrn,  String fl ags)
  329           th rows Unsup portedOper ationExcep tion, Meth odExceptio n,
  330                    Conn ectionExce ption, Ima geNotFound Exception 
  331           {
  332                    thro w new Unsu pportedOpe rationExce ption("The  Exchange  ImageDataS ource does  not suppo rt the get ImageInfor mation met hod.");
  333           }
  334  
  335           /* *
  336            *  This func tion reduc es the req uested for mat list t o a list a cceptable  by the DOD .
  337            *  If the re quest incl udes forma ts that th e DOD does  not expec t, they wi ll not wor k properly
  338            *  so if the  request c ame from t he Clinica l Display  client, it  must be r educed to  eliminate
  339            *  types lik e TGA, J2K , PDF, DOC , etc.
  340            * /
  341           pr ivate Imag eFormatQua lityList p runeReques tList(Imag eFormatQua lityList r equestList )
  342           {
  343                    Imag eFormatQua lityList p runedList  = new Imag eFormatQua lityList() ;
  344                    for( ImageForma tQuality q uality : r equestList )
  345                    {
  346                             List<I mageFormat > allowabl eFormats =  getAccept ableImageF ormatsForQ uality(qua lity.getIm ageQuality ());
  347                             if(isQ ualityForm atAllowed( quality.ge tImageForm at(), allo wableForma ts))
  348                             {
  349                                      prunedLi st.addUniq ueMime(qua lity);
  350                             }
  351                    }
  352                    retu rn prunedL ist;
  353           }
  354           
  355           pr ivate List <ImageForm at> getAcc eptableIma geFormatsF orQuality( ImageQuali ty quality )
  356           {                 
  357                    if(q uality ==  ImageQuali ty.REFEREN CE) 
  358                             return  acceptabl eReference ResponseTy pes;
  359                    else  if(qualit y == Image Quality.DI AGNOSTIC)
  360                             return  acceptabl eDiagnosti cResponseT ypes;
  361                    else  if(qualit y == Image Quality.DI AGNOSTICUN COMPRESSED )
  362                             return  acceptabl eDiagnosti cResponseT ypes;
  363                    else  // thumbn ail or oth er
  364                             return  acceptabl eThumbnail ResponseTy pes;
  365           }
  366           
  367           pr ivate bool ean isQual ityFormatA llowed(Ima geFormat f ormat, Lis t<ImageFor mat> accep tableForma ts)
  368           {
  369                    for( ImageForma t acceptab leFormat :  acceptabl eFormats)
  370                    {
  371                             if((ac ceptableFo rmat == Im ageFormat. ANYTHING)  ||
  372                                      (accepta bleFormat. getMime(). equalsIgno reCase(for mat.getMim e())))
  373                             {
  374                                      return t rue;
  375                             }
  376                    }                 
  377                    retu rn false;
  378           }
  379           
  380           pr otected St ring getRe solvedArti factSource String()
  381           {
  382                    Arti factSource  artifactS ource = ge tResolvedA rtifactSou rce().getA rtifactSou rce();
  383                    retu rn artifac tSource.ge tHomeCommu nityId() +  ", " + ar tifactSour ce.getRepo sitoryId() ;   
  384           }
  385   }