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

328.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\MIXWebApp\main\src\java\gov\va\med\imaging\mix\webservices MixWebservices.java Mon Dec 4 21:35:16 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\MIXWebApp\main\src\java\gov\va\med\imaging\mix\webservices MixWebservices.java Mon Dec 4 22:04:20 2017 UTC

328.2 Comparison summary

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

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

328.4 Active regular expressions

No regular expressions were active.

328.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  30, 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 .webservic es;
  27  
  28   import gov .va.med.Pa tientIdent ifier;
  29   import gov .va.med.ex ceptions.R outingToke nFormatExc eption;
  30   import gov .va.med.im aging.exch ange.Routi ngTokenHel per;
  31   import gov .va.med.im aging.core .interface s.exceptio ns.Connect ionExcepti on;
  32   import gov .va.med.im aging.core .interface s.exceptio ns.Insuffi cientPatie ntSensitiv ityExcepti on;
  33   import gov .va.med.im aging.core .interface s.exceptio ns.MethodE xception;
  34   import gov .va.med.im aging.exce ptions.URN FormatExce ption;
  35   import gov .va.med.im aging.mix. MixRouter;
  36   import gov .va.med.im aging.mix. MixContext ;
  37   import gov .va.med.im aging.exch ange.busin ess.Study;
  38   import gov .va.med.im aging.exch ange.busin ess.StudyF ilter;
  39   import gov .va.med.im aging.mix. webservice s.rest.exc eptions.MI XMetadataE xception;
  40   import gov .va.med.im aging.mix. webservice s.rest.typ es.v1.Filt erType;
  41   import gov .va.med.im aging.mix. webservice s.rest.typ es.v1.Repo rtStudyLis tResponseT ype;
  42   import gov .va.med.im aging.mix. webservice s.rest.typ es.v1.Repo rtType;
  43   import gov .va.med.im aging.mix. webservice s.rest.typ es.v1.Requ estorType;
  44   import gov .va.med.im aging.mix. webservice s.rest.typ es.v1.Stud yType;
  45   import gov .va.med.im aging.mix. webservice s.translat or.v1.MixT ranslator;
  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  
  49   import jav a.beans.XM LEncoder;
  50   import jav a.io.Buffe redOutputS tream;
  51   import jav a.io.FileN otFoundExc eption;
  52   import jav a.io.FileO utputStrea m;
  53   // import  java.rmi.R emoteExcep tion;
  54   import jav a.text.Par seExceptio n;
  55   import jav a.util.Lis t;
  56  
  57   import org .apache.lo gging.log4 j.LogManag er;
  58   import org .apache.lo gging.log4 j.Logger;
  59  
  60   /**
  61    * @author         
WERFEJ
  62    *
  63    */
  64   public cla ss MixWebs ervices 
  65   implements  gov.va.me d.imaging. mix.webser vices.rest .v1.ImageM etadata
  66   {
  67           pr ivate MixT ranslator  mixTransla tor = new  MixTransla tor();
  68           pr ivate fina l static L ogger logg er = LogMa nager.getL ogger(MixW ebservices .class);
  69  
  70           //  @Override
  71           pu blic Repor tStudyList ResponseTy pe getPati entReportS tudyList(S tring data source,
  72                             Reques torType re questor, F ilterType  filter, St ring patie ntId, Bool ean fullTr ee, // ful l Tree val ue ignored ; Full ret urned
  73                             String  transacti onId, Stri ng request edSite) 
  74           th rows MIXMe tadataExce ption 
  75           {
  76                    setT ransaction Context(re questor, t ransaction Id);
  77                    Long  startTime  = System. currentTim eMillis();
  78                    Repo rtStudyLis tResponseT ype rsrt =  null;
  79                    logg er.info("s tart getPa tientRepor tStudyList  transacti on(" + tra nsactionId  + ")");
  80                    MixR outer rout er = MixCo ntext.getM ixRouter() ;
  81                    if(r outer == n ull)
  82                             throw  new MIXMet adataExcep tion("Inte rnal error , unable t o retrieve  patient r eports/stu dies");
  83                    
  84                    Stud yFilter st udyFilter  = mixTrans lator.tran sformFilte r(filter);                           
  85                    
  86                    Tran sactionCon text trans actionCont ext = Tran sactionCon textFactor y.get();
  87                    tran sactionCon text.setRe questType( "Mix WebAp p getStudy List");
  88                    //TO DO: look a t requesti ng site nu mber and s etRequesti ngSource 
  89                    tran sactionCon text.setRe questingSo urce("unkn own");               
  90                    tran sactionCon text.setPa tientID(pa tientId);
  91                    tran sactionCon text.setQu eryFilter( Transactio nContextFa ctory.getF ilterDateR ange(study Filter.get FromDate() , studyFil ter.getToD ate()));
  92                    tran sactionCon text.setQu ality("n/a ");
  93                    tran sactionCon text.setUr n("n/a");
  94                    
  95                    //TO DO: get th e site num ber from t he request  (somewher e). if non e is speci fied then  get the si te 
  96                    // n umber from  appConfig  and go ag ainst the  local site
  97                    Stri ng siteNum ber = MixC ontext.get AppConfigu ration().g etLocalSit eNumber(); // "660";                                
  98                    try 
  99                    {
  100                             List<S tudy> stud ies = rout er.getPati entStudyLi st(Routing TokenHelpe r.createSi teAppropri ateRouting Token(site Number), 
  101                                               PatientIde ntifier.ic nPatientId entifier(p atientId),  studyFilt er);
  102                    
  103                             gov.va .med.imagi ng.mix.web services.r est.types. v1.StudyTy pe[] study Types = 
  104                                      mixTrans lator.tran sformStudi es(studies );
  105                             logger .info("Con verted ["  + (studies  == null ?  0 : studi es.size())  + "] busi ness studi es into ["  + (studyT ypes == nu ll ? 0 : s tudyTypes. length) +  "] studies  to return ");
  106                             transa ctionConte xt.setEntr iesReturne d( studyTy pes == nul l ? 0 : st udyTypes.l ength );
  107                             if (st udyTypes ! = null)
  108                             {
  109                                      String d umpExchang eGraphs =  System.get env("dumpv aexchangeg raphs");
  110                                      if (dump ExchangeGr aphs != nu ll && dump ExchangeGr aphs.equal sIgnoreCas e("true"))
  111                                      {
  112                                               dumpVaStud yGraph(pat ientId, st udyTypes);
  113                                      }
  114                             }
  115                             logger .info("SUC CESS getPa tientRepor tStudyList  transacti on(" + tra nsactionId  + ") in "  + 
  116                                               (System.cu rrentTimeM illis() -  startTime)  +      "  ms)" );
  117                             rsrt =  new Repor tStudyList ResponseTy pe();
  118                             rsrt.s etPartialR esponse(fa lse); // * *** studie s.isPartia lResult()) ;
  119                             rsrt.s etStudies( studyTypes );
  120                             rsrt.s etErrors(n ull); // * **
  121   //                    for (int i  = 0; i <  studyTypes .length; i ++) {
  122   //                        rsrt.s etStudies( i, studyTy pes.get(i) );
  123   //                     }
  124  
  125                             return  rsrt;
  126                    }
  127                    catc h(Insuffic ientPatien tSensitivi tyExceptio n ipsX)
  128                    {
  129                             logger .info("Ins ufficient  patient se nsitivity  to view sp ecified pa tient, ret urning emp ty study l ist for no w... This  is not bei ng logged  as an exce ption", ip sX);
  130                             transa ctionConte xt.setEntr iesReturne d(0);
  131                             logger .info("SUC CESS getPa tientStudy List trans action(" +  transacti onId + ")  in " + 
  132                                               (System.cu rrentTimeM illis() -  startTime)  +      "  ms, return ed no stud ies)" );
  133                             return  rsrt;
  134                    }
  135                    catc h(ParseExc eption pX)
  136                    {
  137                             transa ctionConte xt.setErro rMessage(p X.getMessa ge());
  138                             transa ctionConte xt.setExce ptionClass Name(pX.ge tClass().g etSimpleNa me());
  139                             throw  new MIXMet adataExcep tion("Inte rnal error , unable t o translat e study pr ocedure da te", pX);
  140                    }
  141                    catc h(URNForma tException  iurnfX)
  142                    {
  143                             transa ctionConte xt.setErro rMessage(i urnfX.getM essage());
  144                             transa ctionConte xt.setExce ptionClass Name(iurnf X.getClass ().getSimp leName());
  145                             throw  new MIXMet adataExcep tion("Inte rnal error , unable t o translat e study me tadata", i urnfX);
  146                    }
  147                    catc h(MethodEx ception mX )
  148                    {
  149                             transa ctionConte xt.setErro rMessage(m X.getMessa ge());
  150                             transa ctionConte xt.setExce ptionClass Name(mX.ge tClass().g etSimpleNa me());
  151                             throw  new MIXMet adataExcep tion("Inte rnal error , unable t o translat e study me tadata", m X);
  152                    }
  153                    catc h(Connecti onExceptio n cX)
  154                    {
  155                             transa ctionConte xt.setErro rMessage(c X.getMessa ge());
  156                             transa ctionConte xt.setExce ptionClass Name(cX.ge tClass().g etSimpleNa me());
  157                             throw  new MIXMet adataExcep tion("Inte rnal error , unable t o translat e study me tadata", c X);
  158                    }
  159                    catc h (Routing TokenForma tException  rtfX)
  160                    {
  161                             transa ctionConte xt.setErro rMessage(r tfX.getMes sage());
  162                             transa ctionConte xt.setExce ptionClass Name(rtfX. getClass() .getSimple Name());
  163                             throw  new MIXMet adataExcep tion("Inte rnal error , unable t o translat e study me tadata", r tfX);
  164                    }
  165           }
  166           
  167           /* *
  168            *  Set the t ransaction  context p roperties  that are p assed in t he webserv ices.
  169            *  @param re questor
  170            *  @param tr ansactionI d
  171            * /
  172           pr ivate void  setTransa ctionConte xt(
  173                    gov. va.med.ima ging.mix.w ebservices .rest.type s.v1.Reque storType r equestor,
  174                    java .lang.Stri ng transac tionId)
  175           {
  176                    logg er.info(
  177                                      "setTran sactionCon text, id=' " + transa ctionId + 
  178                                      "', user name='" +  requestor  == null ||  requestor .getUserna me() == nu ll ? "null " : reques tor.getUse rname() + 
  179                                      "'.");
  180                    Tran sactionCon text trans actionCont ext = Tran sactionCon textFactor y.get();
  181                    
  182                    if(t ransaction Id != null )
  183                             transa ctionConte xt.setTran sactionId( transactio nId);
  184                    
  185                    if(r equestor ! = null)
  186                    {
  187                             if( re questor.ge tUsername( ) != null  )
  188                                      transact ionContext .setFullNa me(request or.getUser name());
  189                             if( re questor.ge tFacilityI d() != nul l )
  190                                      transact ionContext .setSiteNu mber(reque stor.getFa cilityId() );
  191                             if( re questor.ge tFacilityN ame() != n ull )
  192                                      transact ionContext .setSiteNa me(request or.getFaci lityName() );
  193                             if( re questor.ge tPurposeOf Use() != n ull )
  194                                      transact ionContext .setPurpos eOfUse(req uestor.get PurposeOfU se().toStr ing());
  195                             if( re questor.ge tSsn() !=  null )
  196                                      transact ionContext .setSsn(re questor.ge tSsn());
  197                    }
  198           }
  199  
  200           pr ivate void  dumpVaStu dyGraph(St ring patie ntIcn, gov .va.med.im aging.mix. webservice s.rest.typ es.v1.Stud yType[] ex changeStud ies)
  201           {
  202                    Stri ng vixcach e = System .getenv("v ixcache");
  203                    if ( vixcache ! = null)
  204                    {
  205                             XMLEnc oder xmlEn coder = nu ll;
  206                             try
  207                             {
  208                                      String f ileSpec =  vixcache +  "/vaexcha nge" + pat ientIcn +  ".xml";
  209                                      xmlEncod er = new X MLEncoder( new Buffer edOutputSt ream(new F ileOutputS tream(file Spec)));
  210                                      xmlEncod er.writeOb ject(excha ngeStudies );
  211                             }
  212                             catch  (FileNotFo undExcepti on ex)
  213                             {
  214                                      logger.e rror("Erro r dumping  study grap h: " + ex. getMessage ());
  215                             }
  216                             finall y
  217                             {
  218                                      if (xmlE ncoder !=  null)
  219                                      {
  220                                               xmlEncoder .close();
  221                                      }
  222                             }
  223                    }
  224           }
  225  
  226   //      @O verride
  227   //      pu blic Repor tStudyList ResponseTy pe getPati entReportS tudyList(
  228   //                        String  datasourc e, Request orType req tor, Filte rType filt r,
  229   //                        String  patId, Bo olean full Tree, Stri ng transac tId)
  230   //                        throws  MIXMetada taExceptio n {
  231   //               // T ODO Auto-g enerated m ethod stub
  232   //               retu rn null;
  233   //      }
  234  
  235           @O verride
  236           pu blic Repor tType getP atientRepo rt(String  datasource , Requesto rType reqt or,
  237                             String  patId, St ring study Id, String  transactI d)
  238                             throws  MIXMetada taExceptio n {
  239                    // T ODO Auto-g enerated m ethod stub
  240                    retu rn null;
  241           }
  242  
  243           
  244   }