325. EPMO Open Source Coordination Office Redaction File Detail Report

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

325.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\MIXDataSource\main\src\java\gov\va\med\imaging\mixdatasource MixStudyGraphDataSourceService.java Mon Dec 4 21:34:38 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\MIXDataSource\main\src\java\gov\va\med\imaging\mixdatasource MixStudyGraphDataSourceService.java Mon Dec 4 22:04:14 2017 UTC

325.2 Comparison summary

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

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

325.4 Active regular expressions

No regular expressions were active.

325.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  8, 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.mix datasource ;
  27  
  28   import gov .va.med.Gl obalArtifa ctIdentifi er;
  29   import gov .va.med.Pa tientIdent ifier;
  30   import gov .va.med.Ro utingToken ;
  31   import gov .va.med.im aging.arti factsource .ResolvedA rtifactSou rce;
  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.MethodE xception;
  34   import gov .va.med.im aging.data source.Abs tractVersi onableData Source;
  35   import gov .va.med.im aging.data source.Stu dyGraphDat aSourceSpi ;
  36   import gov .va.med.im aging.data source.exc eptions.Un supportedP rotocolExc eption;
  37   import gov .va.med.im aging.data source.exc eptions.Un supportedS erviceMeth odExceptio n;
  38   import gov .va.med.im aging.mix. proxy.MixD ataSourceP roxy;
  39   import gov .va.med.im aging.exch ange.busin ess.*;
  40   import gov .va.med.im aging.exch ange.enums .StudyLoad Level;
  41   import gov .va.med.im aging.mix. proxy.v1.M ixProxyUti lities;
  42   import gov .va.med.im aging.mix. proxy.v1.I mageMixPro xy;
  43   import gov .va.med.im aging.mix. proxy.v1.I mageMixPro xyFactory;
  44   import gov .va.med.im aging.mix. proxy.v1.S tudyResult ;
  45   import gov .va.med.im aging.mix. translator .MixTransl ator;
  46   import gov .va.med.im aging.prox y.exchange .StudyPara meters;
  47   import gov .va.med.im aging.tran sactioncon text.Trans actionCont extFactory ;
  48   // import  gov.va.med .imaging.u rl.mix.MIX Connection ;
  49   import gov .va.med.im aging.url. mix.config uration.MI XSiteConfi guration;
  50   import gov .va.med.im aging.url. mix.except ions.MIXCo nfiguratio nException ;
  51   // import  gov.va.med .imaging.u rl.mix.exc eptions.MI XConnectio nException ;
  52   import gov .va.med.im aging.url. mix.except ions.MIXMe thodExcept ion;
  53   import gov .va.med.im aging.url. mixs.MIXsC onnection;
  54  
  55   import jav a.beans.XM LEncoder;
  56   import jav a.io.Buffe redOutputS tream;
  57   import jav a.io.FileN otFoundExc eption;
  58   import jav a.io.FileO utputStrea m;
  59   import jav a.io.IOExc eption;
  60   import jav a.net.Malf ormedURLEx ception;
  61   import jav a.net.URL;
  62   import jav a.util.Dat e;
  63  
  64   import jav ax.xml.rpc .ServiceEx ception;
  65  
  66   import org .apache.lo gging.log4 j.LogManag er;
  67   import org .apache.lo gging.log4 j.Logger;
  68  
  69   /**
  70    * @author         
WERFEJ
  71    *
  72    */
  73   public cla ss MixStud yGraphData SourceServ ice 
  74   extends Ab stractVers ionableDat aSource 
  75   implements  StudyGrap hDataSourc eSpi
  76   {
  77           pr ivate fina l static L ogger logg er = LogMa nager.getL ogger(MixS tudyGraphD ataSourceS ervice.cla ss);
  78           
  79           pr ivate fina l MIXsConn ection mix Connection ;
  80           pr ivate Imag eMixProxy  proxy = nu ll;
  81           pr otected st atic MixTr anslator t ranslator  = new MixT ranslator( );
  82           pr ivate fina l static S tring MIX_ PROXY_SERV ICE_NAME =  "MIX";
  83           pr ivate fina l static S tring DATA SOURCE_VER SION = "1" ;
  84           pr ivate MIXS iteConfigu ration mix Configurat ion = null ;
  85           pu blic final  static St ring SUPPO RTED_PROTO COL = "mix ";
  86           
  87           /* *
  88        * The  Provider  will use t he create( ) factory  method pre ferentiall y
  89        * ove r a constr uctor.  Th is allows  for cachin g of Vista StudyGraph DataSource Service
  90        * ins tances acc ording to  the criter ia set her e.
  91        * 
  92        * @pa ram url
  93        * @pa ram site
  94        * @re turn
  95        * @th rows Conne ctionExcep tion
  96        * @th rows Unsup portedProt ocolExcept ion 
  97        */
  98       public  static Mi xStudyGrap hDataSourc eService c reate(Reso lvedArtifa ctSource r esolvedArt ifactSourc e, String  protocol)
  99       throws  Connectio nException , Unsuppor tedProtoco lException
  100       {
  101           re turn new M ixStudyGra phDataSour ceService( resolvedAr tifactSour ce, protoc ol);
  102       }
  103           
  104           pu blic MixSt udyGraphDa taSourceSe rvice(Reso lvedArtifa ctSource r esolvedArt ifactSourc e, String  protocol)
  105           th rows Unsup portedProt ocolExcept ion
  106           {
  107                    supe r(resolved ArtifactSo urce, prot ocol);
  108                    if(!  (resolved ArtifactSo urce insta nceof Reso lvedSite)  )
  109                             throw  new Unsupp ortedOpera tionExcept ion("The a rtifact so urce must  be an inst ance of Re solvedSite  and it is  a '" + re solvedArti factSource .getClass( ).getSimpl eName() +  "'.");
  110                    
  111                    mixC onnection  = new MIXs Connection (getMetada taUrl());
  112           }
  113           
  114           /* *
  115            *  The artif act source  must be c hecked in  the constr uctor to a ssure that  it is an  instance
  116            *  of Resolv edSite.
  117            *  
  118            *  @return
  119            * /
  120   //      pr ivate Reso lvedSite g etResolved Site()
  121   //      {
  122   //               retu rn (Resolv edSite)get ResolvedAr tifactSour ce();
  123   //      }
  124   //      
  125           pr ivate  Sit e getMixSi te()
  126           {
  127                    Site  site = nu ll;
  128                    try  {
  129                             site =  new SiteI mpl("200",  "DOD", "D OD", null,  0, "", 80 80, "200") ;
  130                    } 
  131                    catc h (Malform edURLExcep tion mue)
  132                    {
  133                             logger .info("get MixSite ex ception: "  + mue.get Message()) ;
  134                    }
  135                    retu rn site;
  136           }
  137           
  138           pr ivate Site  getSite()
  139           {
  140                    retu rn getMixS ite(); //  getResolve dSite().ge tSite();
  141           }
  142           
  143           @O verride
  144           pu blic boole an isVersi onCompatib le() {
  145                    MIXS iteConfigu ration sit eConfig =  null;
  146                    try
  147                    {
  148                             siteCo nfig = get MixSiteCon figuration ();
  149                    }
  150                    catc h(IOExcept ion ioX)
  151                    {
  152                             logger .error("Er ror readin g configur ation for  datasource ", ioX);
  153                             return  false;
  154                    }
  155                    // i f versioni ng is turn ed on for  this site  configurat ion
  156                    if(s iteConfig. isUseVersi oning())
  157                    {
  158                             MixPro xyUtilitie s.isMixSit eServiceAv ailable(ge tSite(), M IX_PROXY_S ERVICE_NAM E, DATASOU RCE_VERSIO N);
  159                    }
  160                    retu rn true;
  161           }
  162  
  163           pr ivate Imag eMixProxy  getProxy()
  164           th rows IOExc eption
  165           {
  166                    if(p roxy == nu ll)
  167                    {
  168                             MIXSit eConfigura tion mixSi teConfigur ation = nu ll;
  169                             try 
  170                             {
  171                                      mixSiteC onfigurati on = 
  172                                               MixDataSou rceProvide r.getMixCo nfiguratio n().getSit eConfigura tion(getSi te().getSi teNumber() , null);
  173                             }
  174                             catch( MIXConfigu rationExce ption ecX)
  175                             {
  176                                      throw ne w IOExcept ion(ecX);
  177                             }
  178                             proxy  = ImageMix ProxyFacto ry.getSing leton().ge t(
  179                                               mixConnect ion.getURL ().getHost (), 
  180                                               mixConnect ion.getURL ().getPort (), 
  181                                               mixSiteCon figuration , null,
  182                                               MixDataSou rceProvide r.getMixCo nfiguratio n());
  183                    }
  184                    retu rn proxy;
  185           }
  186  
  187           
  188  
  189           /*  (non-Java doc)
  190            *  @see gov. va.med.ima ging.datas ource.Stud yGraphData SourceSpi# getUrl()
  191            * /
  192           pu blic URL g etUrl() {
  193                    retu rn mixConn ection.get URL();
  194           }        
  195  
  196           @S uppressWar nings("box ing")
  197           @O verride
  198           pu blic Study SetResult  getPatient Studies(Ro utingToken  globalRou tingToken,  
  199                    Pati entIdentif ier patien tIdentifie r, 
  200                    Stud yFilter fi lter, 
  201                    Stud yLoadLevel  studyLoad Level)
  202           th rows Unsup portedOper ationExcep tion, MIXM ethodExcep tion, Conn ectionExce ption 
  203           {
  204                    MixD ataSourceC ommon.setD ataSourceM ethodAndVe rsion("get PatientStu dies", DAT ASOURCE_VE RSION);
  205                    logg er.info("g etPatientS tudies for  patient ( " + patien tIdentifie r + ") Tra nsactionCo ntext (" +  Transacti onContextF actory.get ().getDisp layIdentit y() + ")." );
  206                    if(p atientIden tifier.get PatientIde ntifierTyp e().isLoca l())
  207                             throw  new MIXMet hodExcepti on("Cannot  use local  patient i dentifier  to retriev e remote p atient inf ormation") ;
  208                    Stri ng patient Icn = pati entIdentif ier.getVal ue();
  209  
  210                    // v alidate pr otocol reg istration!
  211                    try  {
  212                             new Mi xDataSourc eProxy(Mix DataSource Provider.g etMixConfi guration() );
  213                    } 
  214                    catc h (Connect ionExcepti on e)
  215                    {
  216                             logger .debug(e.g etMessage( ));
  217                             throw  new MIXMet hodExcepti on("Mix pr otocol reg istration  failed: ",  e);
  218                    }
  219  
  220                    // n ow get met adata for  ICN and da te range ( (MIX Pass  1, level 1 &2)
  221  
  222   //               try 
  223   //               {
  224   //                        mixCon nection.co nnect();                           
  225   //               }
  226   //               catc h(IOExcept ion ioX) 
  227   //               {
  228   //                        logger .error("Er ror gettin g patient  studies",  ioX);
  229   //                        throw  new MIXCon nectionExc eption(ioX );
  230   //               }
  231                    try 
  232                    {                         
  233                             StudyP arameters  parameters  = 
  234                                      new Stud yParameter s(
  235                                               patientIcn
  236                                               filter ==  null ? new  Date(0l)  : filter.g etFromDate (), 
  237                                               filter ==  null ? new  Date() :  filter.get ToDate(), 
  238                                               filter ==  null ? nul l : filter .getStudyI d()
  239                                      );                        
  240                             StudyR esult stud yResult =  getProxy() .getStudie s(paramete rs);                      
  241                             gov.va .med.imagi ng.mix.web services.r est.types. v1.ReportS tudyListRe sponseType  mixStudie s = studyR esult.getS tudies();
  242                             logger .info("get PatientStu dies got [ " + (mixSt udies == n ull ? "0"  : mixStudi es.getStud ies().leng th) + "] s tudies fro m site ["  + getSite( ).getSiteN umber() +  "]");
  243                             if (mi xStudies ! = null)
  244                             {
  245                                      String d umpExchang eGraphs =  System.get env("dumpd odexchange graphs");
  246                                      if (dump ExchangeGr aphs != nu ll && dump ExchangeGr aphs.equal sIgnoreCas e("true"))
  247                                      {
  248                                               dumpDodStu dyGraph(pa tientIcn,  mixStudies .getStudie s());
  249                                      }
  250                             }
  251                             return  StudySetR esult.crea teFullResu lt(transla tor.transf ormStudies (getSite() , mixStudi es.getStud ies(), 
  252                                               filter, Mi xDataSourc eProvider. getMixConf iguration( ).getEmpty StudyModal ities()));         
  253                    }
  254                    catc h(IOExcept ion ioX) 
  255                    {
  256                             logger .error("Er ror gettin g patient  studies",  ioX);
  257                             throw  new MIXMet hodExcepti on(ioX);
  258                    }
  259                    catc h(ServiceE xception s X) {
  260                             logger .error("Er ror gettin g patient  studies",  sX);
  261                             throw  new MIXMet hodExcepti on(sX);
  262                    }
  263           }
  264  
  265           pr ivate void  dumpDodSt udyGraph(S tring pati entIcn, go v.va.med.i maging.mix .webservic es.rest.ty pes.v1.Stu dyType[] e xchangeStu dies)
  266           {
  267                    Stri ng vixcach e = System .getenv("v ixcache");
  268                    if ( vixcache ! = null)
  269                    {
  270                             XMLEnc oder xmlEn coder = nu ll;
  271                             try
  272                             {
  273                                      String f ileSpec =  vixcache +  "/dodexch ange" + pa tientIcn +  ".xml";
  274                                      xmlEncod er = new X MLEncoder( new Buffer edOutputSt ream(new F ileOutputS tream(file Spec)));
  275                                      xmlEncod er.writeOb ject(excha ngeStudies );
  276                             }
  277                             catch  (FileNotFo undExcepti on ex)
  278                             {
  279                                      logger.e rror("Erro r dumping  study grap h: " + ex. getMessage ());
  280                             }
  281                             finall y
  282                             {
  283                                      if (xmlE ncoder !=  null)
  284                                      {
  285                                               xmlEncoder .close();
  286                                      }
  287                             }
  288                    }
  289           }
  290           
  291           pr ivate MIXS iteConfigu ration get MixSiteCon figuration ()
  292           th rows IOExc eption
  293           {
  294                    if(m ixConfigur ation == n ull)
  295                    {
  296                             try 
  297                             {
  298                                      mixConfi guration =  
  299                                               MixDataSou rceProvide r.getMixCo nfiguratio n().getSit eConfigura tion(getSi te().getSi teNumber() , null);
  300                             }
  301                             catch( MIXConfigu rationExce ption ecX)
  302                             {
  303                                      throw ne w IOExcept ion(ecX);
  304                             }
  305                    }
  306                    retu rn mixConf iguration;
  307           }
  308  
  309           /*  (non-Java doc)
  310            *  @see gov. va.med.ima ging.datas ource.Stud yGraphData SourceSpi# getStudy(j ava.lang.S tring, gov .va.med.Gl obalArtifa ctIdentifi er)
  311            * /
  312           @O verride
  313           pu blic Study  getStudy( PatientIde ntifier pa tientIdent ifier, Glo balArtifac tIdentifie r studyId)  
  314           th rows Metho dException , Connecti onExceptio n
  315           {
  316                    thro w new Unsu pportedSer viceMethod Exception( StudyGraph DataSource Spi.class,  "getStudy ");
  317           }
  318  
  319           /*  (non-Java doc)
  320            *  @see gov. va.med.ima ging.datas ource.Stud yGraphData SourceSpi# getStudyRe port(java. lang.Strin g, gov.va. med.Global ArtifactId entifier)
  321            * /
  322           @O verride
  323           pu blic Strin g getStudy Report(Pat ientIdenti fier patie ntIdentifi er, Global ArtifactId entifier s tudyId) 
  324           th rows Metho dException , Connecti onExceptio n
  325           {
  326                    thro w new Unsu pportedSer viceMethod Exception( StudyGraph DataSource Spi.class,  "getStudy Report");
  327           }
  328           
  329   }