66. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 3/25/2019 8:58:04 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.

66.1 Files compared

# Location File Last Modified
1 C:\AraxisMergeCompare\Pri_un\IMAG_Source\VISA\Java\ViewerImagingDataSourceProvider\main\src\java\gov\va\med\imaging\viewer\datasource ViewerImagingDataSourceService.java Mon Mar 18 20:39:10 2019 UTC
2 C:\AraxisMergeCompare\Pri_re\IMAG_Source\VISA\Java\ViewerImagingDataSourceProvider\main\src\java\gov\va\med\imaging\viewer\datasource ViewerImagingDataSourceService.java Tue Mar 19 12:04:08 2019 UTC

66.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 1770
Changed 1 2
Inserted 0 0
Removed 0 0

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

66.4 Active regular expressions

No regular expressions were active.

66.5 Comparison detail

  1   /**
  2    * 
  3    * Date Cr eated: Apr  26, 2017
  4    * Develop er:  DNS     tjahjb
  5    */
  6   package go v.va.med.i maging.vie wer.dataso urce;
  7  
  8   import jav a.io.IOExc eption;
  9   import jav a.util.Arr ayList;
  10   import jav a.util.Has hMap;
  11   import jav a.util.Ite rator;
  12   import jav a.util.Lis t;
  13   import jav a.util.Map ;
  14  
  15   import org .apache.lo gging.log4 j.LogManag er;
  16   import org .apache.lo gging.log4 j.Logger;
  17  
  18  
  19   import gov .va.med.Pa tientIdent ifier;
  20   import gov .va.med.Ro utingToken ;
  21   import gov .va.med.im aging.arti factsource .ResolvedA rtifactSou rce;
  22   import gov .va.med.im aging.core .interface s.exceptio ns.Connect ionExcepti on;
  23   import gov .va.med.im aging.core .interface s.exceptio ns.MethodE xception;
  24   import gov .va.med.im aging.core .interface s.exceptio ns.Patient NotFoundEx ception;
  25   import gov .va.med.im aging.core .interface s.exceptio ns.Securit yCredentia lsExpiredE xception;
  26   import gov .va.med.im aging.data source.exc eptions.In validCrede ntialsExce ption;
  27   import gov .va.med.im aging.data source.exc eptions.Un supportedP rotocolExc eption;
  28   import gov .va.med.im aging.exch ange.busin ess.Resolv edSite;
  29   import gov .va.med.im aging.exch ange.busin ess.Site;
  30   import gov .va.med.im aging.exch ange.enums .ImagingSe curityCont extType;
  31   import gov .va.med.im aging.prot ocol.vista .VistaImag ingTransla tor;
  32   import gov .va.med.im aging.tran sactioncon text.Trans actionCont extFactory ;
  33   import gov .va.med.im aging.url. vista.Stri ngUtils;
  34   import gov .va.med.im aging.url. vista.Vist aQuery;
  35   import gov .va.med.im aging.url. vista.exce ptions.Inv alidVistaC redentials Exception;
  36   import gov .va.med.im aging.url. vista.exce ptions.Vis taMethodEx ception;
  37   import gov .va.med.im aging.view er.busines s.CaptureU serResult;
  38   import gov .va.med.im aging.view er.busines s.DeleteIm ageUrn;
  39   import gov .va.med.im aging.view er.busines s.DeleteIm ageUrnResu lt;
  40   import gov .va.med.im aging.view er.busines s.FlagSens itiveImage Urn;
  41   import gov .va.med.im aging.view er.busines s.FlagSens itiveImage UrnResult;
  42   import gov .va.med.im aging.view er.busines s.ImageFil terFieldVa lue;
  43   import gov .va.med.im aging.view er.busines s.ImageFil terResult;
  44   import gov .va.med.im aging.view er.busines s.ImagePro perty;
  45   import gov .va.med.im aging.view er.busines s.LogAcces sImageUrn;
  46   import gov .va.med.im aging.view er.busines s.LogAcces sImageUrnR esult;
  47   import gov .va.med.im aging.view er.busines s.QAReview ReportResu lt;
  48   import gov .va.med.im aging.view er.busines s.Treating FacilityRe sult;
  49   import gov .va.med.im aging.vist adatasourc e.VistaCom monQueryFa ctory;
  50   import gov .va.med.im aging.vist adatasourc e.common.V istaCommon Utilities;
  51   import gov .va.med.im aging.vist adatasourc e.session. VistaSessi on;
  52   import gov .va.med.im aging.vist aimagingda tasource.A bstractVis taImagingD ataSourceS ervice;
  53   import gov .va.med.im aging.vist aimagingda tasource.V istaImagin gQueryFact ory;
  54   import gov .va.med.im aging.vist aimagingda tasource.c ommon.Vist aImagingCo mmonUtilit ies;
  55  
  56   /**
  57    * @author  Administr ator
  58    *s
  59    */
  60   public cla ss ViewerI magingData SourceServ ice
  61   extends Ab stractVist aImagingDa taSourceSe rvice
  62   implements  ViewerIma gingDataSo urceSpi
  63   {
  64           
  65           pu blic final  static St ring SUPPO RTED_PROTO COL = "vis taimaging" ;
  66  
  67           pr ivate fina l static L ogger logg er = LogMa nager.getL ogger(View erImagingD ataSourceS ervice.cla ss);
  68  
  69           //  The requi red versio n of VistA  Imaging n eeded to e xecute the  RPC calls  for this  operation
  70           pu blic final  static St ring MAG_R EQUIRED_VE RSION ="3. 0P59"; 
  71                    
  72           // private Sm bStorageUt ility stor ageUtility  = new Smb StorageUti lity();
  73           
  74           /* *
  75            *  @param re solvedArti factSource
  76            *  @param pr otocol
  77            * /
  78           pu blic Viewe rImagingDa taSourceSe rvice(Reso lvedArtifa ctSource r esolvedArt ifactSourc e, 
  79                             String  protocol)
  80           {
  81                    supe r(resolved ArtifactSo urce, prot ocol);
  82                    if(!  (resolved ArtifactSo urce insta nceof Reso lvedSite)  )
  83                             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() +  "'.");
  84           }
  85  
  86           pu blic stati c ViewerIm agingDataS ourceServi ce create( ResolvedAr tifactSour ce resolve dArtifactS ource, Str ing protoc ol)
  87           th rows Conne ctionExcep tion, Unsu pportedPro tocolExcep tion
  88           {
  89                    retu rn new Vie werImaging DataSource Service(re solvedArti factSource , protocol );
  90           }
  91           
  92           /* *
  93            *  The artif act source  must be c hecked in  the constr uctor to a ssure that  it is an  instance
  94            *  of Resolv edSite.
  95            *  
  96            *  @return
  97            * /
  98           pr otected Re solvedSite  getResolv edSite()
  99           {
  100                    retu rn (Resolv edSite)get ResolvedAr tifactSour ce();
  101           }
  102           
  103           pr otected Si te getSite ()
  104           {
  105                    retu rn getReso lvedSite() .getSite() ;
  106           }
  107           
  108           pr ivate Vist aSession g etVistaSes sion() 
  109       throws  IOExcepti on, Connec tionExcept ion, Metho dException
  110       {
  111                return V istaSessio n.getOrCre ate(getMet adataUrl() , getSite( ), Imaging SecurityCo ntextType. MAG_WINDOW S);
  112       }
  113           
  114           pr ivate Vist aSession g etVistaSes sion(Imagi ngSecurity ContextTyp e security Context) 
  115       throws  IOExcepti on, Connec tionExcept ion, Metho dException
  116       {
  117                return V istaSessio n.getOrCre ate(getMet adataUrl() , getSite( ), securit yContext);
  118       }
  119           pr ivate Logg er getLogg er()
  120           {
  121                    retu rn logger;
  122           }
  123           
  124           /*  (non-Java doc)
  125            *  @see gov. va.med.ima ging.datas ource.Imag ingPatient DataSource #isVersion Compatible ()
  126            * /
  127           @O verride
  128       public  boolean i sVersionCo mpatible()
  129       {
  130                    // f or this im plementati on we are  not using  any MAG rp c calls, j ust assume  version i s ok
  131                    retu rn true;
  132       }
  133  
  134           
  135           pr otected St ring getDa taSourceVe rsion()
  136           {
  137                    retu rn "1";
  138           }
  139  
  140           /*  (non-Java doc)
  141            *  @see gov. va.med.ima ging.viewe r.datasour ce.ViewerI magingData SourceSpi# deleteImag e(gov.va.m ed.Routing Token, Str ing)
  142            * /
  143           @O verride
  144           pu blic List< DeleteImag eUrnResult > deleteIm ages(
  145                             Routin gToken glo balRouting Token,
  146                             List<D eleteImage Urn> image Urns)
  147           th rows Metho dException ,Connectio nException  
  148           {
  149                    Vist aCommonUti lities.set DataSource MethodAndV ersion("de leteImage" , getDataS ourceVersi on());
  150                    Vist aSession v istaSessio n = null;
  151                    getL ogger().in fo(
  152                                      "deleteI mage image Urns(" + i mageUrns +  ") " +
  153                                      "Transac tionContex t (" + Tra nsactionCo ntextFacto ry.get().g etTransact ionId() +  ").");
  154                    try
  155                    {
  156                             List<S tring> p34 ImageUrns  = getP34Im ageFromDel eteImageUr nList(imag eUrns);
  157                             List<D eleteImage UrnResult>  deletedLi st = null;
  158                             
  159                             if ((i mageUrns ! = null) &&  (imageUrn s.size() >  0))
  160                             {
  161                                      vistaSes sion = get VistaSessi on();
  162                                      
  163                                      Map<Stri ng, String > imageUrn Map = MapI mageUrnByI en(imageUr ns);
  164                                      VistaQue ry query =  ViewerIma gingQueryF actory.cre ateDeleteI magesQuery (imageUrns );
  165                                      
  166                                      String r et = vista Session.ca ll(query);
  167                                      
  168                                      deletedL ist = View erImagingT ranslator. translateD eleteImage sResult(re t, imageUr nMap);
  169                             }
  170                             
  171                             if ((p 34ImageUrn s == null)  || (p34Im ageUrns.si ze() == 0) )
  172                             {
  173                                      return d eletedList ;
  174                             }
  175                             else
  176                             {
  177                                      return V iewerImagi ngTranslat or.mergeDe leteImages ErrorResul t(
  178                                                       de letedList,  p34ImageU rns);
  179                             }
  180                    }
  181                    catc h(VistaMet hodExcepti on vmX)
  182                    {
  183                             throw  new Method Exception( vmX);
  184                    }
  185                    catc h(InvalidV istaCreden tialsExcep tion icX)
  186                    {
  187                             throw  new Invali dCredentia lsExceptio n(icX);
  188                    }
  189                    catc h(IOExcept ion ioX)
  190                    {
  191                             throw  new Connec tionExcept ion(ioX);
  192                    }
  193                    fina lly
  194                    {
  195                             try{vi staSession .close();}
  196                             catch( Throwable  t){}
  197                    }
  198           }
  199  
  200           pr ivate List <String> g etP34Image FromDelete ImageUrnLi st(List<De leteImageU rn> imageU rns) 
  201           {
  202                    List <String> e rrList = n ew ArrayLi st<String> ();
  203                    Iter ator<Delet eImageUrn>  iter = im ageUrns.it erator();
  204                    
  205                    whil e (iter.ha sNext()) {
  206                             Delete ImageUrn u rn = iter. next();
  207  
  208                             if (ur n.getValue ().toLower Case().sta rtsWith("u rn:vap34im age:"))
  209                             {
  210                                      errList. add(urn.ge tValue());
  211                                      iter.rem ove();
  212                             }
  213                    }
  214                    
  215                    retu rn errList ;
  216           }
  217  
  218           pr ivate Map< String, St ring> MapI mageUrnByI en(List<De leteImageU rn> imageU rns) {
  219                    Map< String, St ring> resu lt = new H ashMap<Str ing, Strin g>();
  220                    for( int i = 0;  i < image Urns.size( ); i++)
  221                    {
  222                             result .put(     
  223                                               ViewerImag ingTransla tor.getIma geIen(imag eUrns.get( i).getValu e()), 
  224                                               imageUrns. get(i).get Value());
  225                    }
  226  
  227                    retu rn result;
  228           }
  229           
  230           /*  (non-Java doc)
  231            *  @see gov. va.med.ima ging.viewe r.datasour ce.ViewerI magingData SourceSpi# flagImages AsSensitiv e(gov.va.m ed.Routing Token, Lis t)
  232            * /
  233           @O verride
  234           pu blic List< FlagSensit iveImageUr nResult> f lagImagesA sSensitive (
  235                             Routin gToken glo balRouting Token,
  236                             List<F lagSensiti veImageUrn > imageUrn s)
  237           th rows Metho dException ,Connectio nException  
  238           {
  239                    Vist aCommonUti lities.set DataSource MethodAndV ersion("fl agImagesAs Sensitive" , getDataS ourceVersi on());
  240                    Vist aSession v istaSessio n = null;
  241                    getL ogger().in fo(
  242                                      "flagIma gesAsSensi tive image Urns(" + i mageUrns +  ") " +
  243                                      "Transac tionContex t (" + Tra nsactionCo ntextFacto ry.get().g etTransact ionId() +  ").");
  244                    try
  245                    {
  246                             List<S tring> p34 ImageUrns  = getP34Im ageFromFla gSensitive ImageUrnLi st(imageUr ns);
  247                             List<F lagSensiti veImageUrn Result> fl agSensList  = null;
  248  
  249                             if ((i mageUrns ! = null) &&  (imageUrn s.size() >  0))
  250                             {
  251                                      vistaSes sion = get VistaSessi on();
  252                                      
  253                                      Map<Stri ng, String > imageUrn Map = MapF lagSensiti veImageUrn ByIen(imag eUrns);
  254                                      VistaQue ry query =  ViewerIma gingQueryF actory.cre ateFlagSen sitiveImag esQuery(im ageUrns);
  255                                      
  256                                      String r et = vista Session.ca ll(query);
  257  
  258                                      flagSens List = Vie werImaging Translator .translate FlagSensit iveImagesR esult(
  259                                                       re t, imageUr nMap);  
  260                             }
  261                             
  262                             if ((p 34ImageUrn s == null)  || (p34Im ageUrns.si ze() == 0) )
  263                             {
  264                                      return f lagSensLis t;
  265                             }
  266                             else
  267                             {
  268                                      return V iewerImagi ngTranslat or.mergeFl agSensitiv eErrorResu lt(flagSen sList, p34 ImageUrns) ;
  269                             }
  270                    }
  271                    catc h(VistaMet hodExcepti on vmX)
  272                    {
  273                             throw  new Method Exception( vmX);
  274                    }
  275                    catc h(InvalidV istaCreden tialsExcep tion icX)
  276                    {
  277                             throw  new Invali dCredentia lsExceptio n(icX);
  278                    }
  279                    catc h(IOExcept ion ioX)
  280                    {
  281                             throw  new Connec tionExcept ion(ioX);
  282                    }
  283                    fina lly
  284                    {
  285                             try{vi staSession .close();}
  286                             catch( Throwable  t){}
  287                    }
  288           }
  289  
  290           pr ivate List <String> g etP34Image FromFlagSe nsitiveIma geUrnList( List<FlagS ensitiveIm ageUrn> im ageUrns) 
  291           {
  292                    List <String> e rrList = n ew ArrayLi st<String> ();
  293                    Iter ator<FlagS ensitiveIm ageUrn> it er = image Urns.itera tor();
  294                    
  295                    whil e (iter.ha sNext()) {
  296                             FlagSe nsitiveIma geUrn urn  = iter.nex t();
  297  
  298                             if (ur n.getImage Urn().toLo werCase(). startsWith ("urn:vap3 4image:"))
  299                             {
  300                                      errList. add(urn.ge tImageUrn( ));
  301                                      iter.rem ove();
  302                             }
  303                    }
  304                    
  305                    retu rn errList ;
  306           }
  307  
  308  
  309           pr ivate Map< String, St ring> MapF lagSensiti veImageUrn ByIen(List <FlagSensi tiveImageU rn> imageU rns) {
  310                    Map< String, St ring> resu lt = new H ashMap<Str ing, Strin g>();
  311                    for( int i = 0;  i < image Urns.size( ); i++)
  312                    {
  313                             result .put(     
  314                                               ViewerImag ingTransla tor.getIma geIen(imag eUrns.get( i).getImag eUrn()), 
  315                                               imageUrns. get(i).get ImageUrn() );
  316                    }
  317  
  318                    retu rn result;
  319           }
  320  
  321           @O verride
  322           pu blic Strin g getUserI nformation ByUserId(R outingToke n globalRo utingToken , String u serId)
  323           th rows Metho dException , Connecti onExceptio
  324           {
  325                    Vist aCommonUti lities.set DataSource MethodAndV ersion("ge tUserInfor mationByUs erId", get DataSource Version()) ;
  326                    Vist aSession v istaSessio n = null;
  327                    logg er.info("g etUserInfo rmationByU serId Tran sactionCon text (" +  Transactio nContextFa ctory.get( ).getTrans actionId()  + ").");
  328                    try
  329                    {
  330                             vistaS ession = g etVistaSes sion();
  331                             VistaQ uery query  = ViewerI magingQuer yFactory.c reateGetUs erInformat ionByUserI dQuery(use rId);
  332                             logger .info("Exe cuting que ry '" + qu ery.getRpc Name() + " '.");
  333                             String  rtn = vis taSession. call(query );
  334                             String [] userInf o = String Utils.Spli t(rtn,Stri ngUtils.CA RET);
  335                             return  userInfo[ 0] + Strin gUtils.CAR ET + userI nfo[1];
  336                    }
  337                    catc h(VistaMet hodExcepti on vmX)
  338                    {
  339                             throw  new Method Exception( vmX);
  340                    }
  341                    catc h(InvalidV istaCreden tialsExcep tion icX)
  342                    {
  343                             throw  new Invali dCredentia lsExceptio n(icX);
  344                    }
  345                    catc h(IOExcept ion ioX)
  346                    {
  347                             throw  new Connec tionExcept ion(ioX);
  348                    }
  349                    fina lly
  350                    {
  351                             try{vi staSession .close();}
  352                             catch( Throwable  t){}
  353                    }
  354  
  355           }
  356  
  357           @O verride
  358           pu blic List< LogAccessI mageUrnRes ult> logIm ageAccessB yUrns(
  359                             Routin gToken glo balRouting Token, 
  360                             String  patientIc n,
  361                             String  patientDf n,
  362                             List<L ogAccessIm ageUrn> im ageUrns)
  363           th rows Metho dException , Connecti onExceptio
  364           {
  365                    Vist aCommonUti lities.set DataSource MethodAndV ersion("lo gImageAcce ssByUrns",  getDataSo urceVersio n());
  366                    Vist aSession v istaSessio n = null;
  367                    getL ogger().in fo(
  368                                      "logImag eAccessByU rns imageU rns(" + im ageUrns +  ") " +
  369                                      "Transac tionContex t (" + Tra nsactionCo ntextFacto ry.get().g etTransact ionId() +  ").");
  370                    try
  371                    {
  372                             List<S tring> p34 ImageUrns  = getP34Im ageFromLog AccessImag eUrnList(i mageUrns);
  373                             List<L ogAccessIm ageUrnResu lt> logAcc essList =  null;
  374  
  375                             if ((i mageUrns ! = null) &&  (imageUrn s.size() >  0))
  376                             {
  377                                      vistaSes sion = get VistaSessi on();
  378                                      
  379                                      if ((pat ientDfn ==  null) ||  (patientDf n.isEmpty( )))
  380                                      {
  381                                               patientDfn  = VistaCo mmonUtilit ies.getPat ientDFN(vi staSession , patientI cn);
  382                                               if ((patie ntDfn == n ull) || (p atientDfn. isEmpty()) )
  383                                               {
  384                                                       re turn null;
  385                                               }
  386                                      }
  387  
  388                                      Map<Stri ng, String > imageUrn Map = MapL ogAccessIm ageUrnByIe n(imageUrn s);
  389                                      VistaQue ry query =  ViewerIma gingQueryF actory.cre ateLogAcce ssImagesQu ery(patien tDfn, imag eUrns);
  390                                      
  391                                      String r et = vista Session.ca ll(query);
  392  
  393                                      logAcces sList = Vi ewerImagin gTranslato r.translat eLogAccess ImagesResu lt(ret, im ageUrnMap) ;
  394                             }
  395                             
  396                             if ((p 34ImageUrn s == null)  || (p34Im ageUrns.si ze() == 0) )
  397                             {
  398                                      return l ogAccessLi st;
  399                             }
  400                             else
  401                             {
  402                                      return V iewerImagi ngTranslat or.mergeLo gAccessErr orResult(l ogAccessLi st, p34Ima geUrns);
  403                             }
  404                    }
  405                    catc h(VistaMet hodExcepti on vmX)
  406                    {
  407                             throw  new Method Exception( vmX);
  408                    }
  409                    catc h(InvalidV istaCreden tialsExcep tion icX)
  410                    {
  411                             throw  new Invali dCredentia lsExceptio n(icX);
  412                    }
  413                    catc h(IOExcept ion ioX)
  414                    {
  415                             throw  new Connec tionExcept ion(ioX);
  416                    }
  417                    fina lly
  418                    {
  419                             try{vi staSession .close();}
  420                             catch( Throwable  t){}
  421                    }
  422           }
  423  
  424           pr ivate List <String> g etP34Image FromLogAcc essImageUr nList(List <LogAccess ImageUrn>  imageUrns)  {
  425                    List <String> e rrList = n ew ArrayLi st<String> ();
  426                    Iter ator<LogAc cessImageU rn> iter =  imageUrns .iterator( );
  427                    
  428                    whil e (iter.ha sNext()) {
  429                             LogAcc essImageUr n urn = it er.next();
  430  
  431                             if (ur n.getImage Urn().toLo werCase(). startsWith ("urn:vap3 4image:"))
  432                             {
  433                                      errList. add(urn.ge tImageUrn( ));
  434                                      iter.rem ove();
  435                             }
  436                    }
  437  
  438                    retu rn errList ;
  439           }
  440  
  441           pr ivate Map< String, St ring> MapL ogAccessIm ageUrnByIe n(List<Log AccessImag eUrn> imag eUrns) {
  442                    Map< String, St ring> resu lt = new H ashMap<Str ing, Strin g>();
  443                    for( int i = 0;  i < image Urns.size( ); i++)
  444                    {
  445                             result .put(     
  446                                               ViewerImag ingTransla tor.getIma geIen(imag eUrns.get( i).getImag eUrn()), 
  447                                               imageUrns. get(i).get ImageUrn() );
  448                    }
  449  
  450                    retu rn result;
  451           }
  452  
  453           @O verride
  454           pu blic List< TreatingFa cilityResu lt> getTre atingFacil ities(
  455                             Routin gToken glo balRouting Token, 
  456                             String  patientIc n,
  457                             String  patientDf n) 
  458           th rows Metho dException , Connecti onExceptio n {
  459                    Pati entIdentif ier patien tIdentifie r = getPat ientIdenti fier(patie ntIcn, pat ientDfn);
  460  
  461                    Vist aCommonUti lities.set DataSource MethodAndV ersion("ge tTreatingF acilities" , getDataS ourceVersi on());
  462                    logg er.info("g etTreating Sites(" +  patientIde ntifier +  ") Transac tionContex t (" + Tra nsactionCo ntextFacto ry.get().g etDisplayI dentity()  + ").");
  463                    Vist aSession l ocalVistaS ession = n ull;
  464           tr y
  465           {
  466                    loca lVistaSess ion = getV istaSessio n(ImagingS ecurityCon textType.C PRS_CONTEX T);            
  467                    Stri ng dfn = V istaCommon Utilities. getPatient Dfn(
  468                                      localVis taSession,  
  469                                      patientI dentifier) ;
  470                    
  471                    Vist aQuery vm  = VistaCom monQueryFa ctory.crea teCprsGetT reatingSit esVistaQue ry(dfn);
  472                    Stri ng rtn = l ocalVistaS ession.cal l(vm);
  473                    retu rn ViewerI magingTran slator.con vertTreati ngFaciliti es(rtn);
  474           } 
  475           ca tch (Vista MethodExce ption e)
  476           {
  477                    logg er.error(" Error in g etTreating Facilities ", e);
  478                    thro w new Meth odExceptio n(e.getMes sage());
  479           } 
  480           ca tch (Inval idVistaCre dentialsEx ception e)
  481           {
  482                    logg er.error(" Error in g etTreating Facilities ", e);
  483                    thro w new Inva lidCredent ialsExcept ion(e.getM essage());
  484           }
  485           ca tch(Patien tNotFoundE xception p nfX)
  486           {
  487                    logg er.error(" Patient no t found ["  + patient Identifier  + "]", pn fX);
  488                    // J MW 12/14/2 010 - thro w the exce ption now
  489                    // n ecessary s o we can p rovide the  correct e rror for X CA request s
  490                    thro w pnfX;
  491                    // r eturn null ;
  492                    // J MW 9/22/20 09
  493                    // n ot really  sure about  this, was  returning  null but  that creat ing incons istencies
  494                    // w ith Federa tion which  would ret urn an emp ty array l ist since  the comman
  495                    // c onverts th e null to  the array  list, now  doing that  here inst ead to be 
  496                    // c onsistent.   Might wa nt to thro w exceptio n or retur n null and  handle 
  497                    // d ifferently  to allow  knowledge  of the pat ient not f ound versu s having n ow sites.
  498                    //re turn new A rrayList<S tring>(0);
  499           }
  500           ca tch(IOExce ption ioX)
  501           {
  502                    logg er.error(" Exception  getting Vi stA sessio n", ioX);
  503                    thro w new Conn ectionExce ption(ioX) ;
  504           }
  505           fi nally
  506           {
  507                    try{ localVista Session.cl ose();}cat ch(Throwab le t){}
  508           }
  509           }
  510  
  511           pr ivate Pati entIdentif ier getPat ientIdenti fier(Strin g patientI cn, String  patientDf n) 
  512           {
  513                    Pati entIdentif ier patien tIdentifie r = null;
  514                    if ( (patientIc n != null)  && (!pati entIcn.isE mpty()))
  515                    {
  516                             patien tIdentifie r = 
  517                                               PatientIde ntifier.ic nPatientId entifier(p atientIcn) ;
  518                    }
  519                    else  if ((pati entDfn !=  null) && ( !patientDf n.isEmpty( )))
  520                    {
  521                             patien tIdentifie r = 
  522                                               PatientIde ntifier.df nPatientId entifier(p atientDfn) ;
  523                    }
  524                    retu rn patient Identifier ;
  525           }
  526           
  527           @O verride
  528           pu blic List< CaptureUse rResult> g etCaptureU sers(
  529                             Routin gToken glo balRouting Token, 
  530                             String  appFlag,
  531                             String  fromDate,
  532                             String  throughDa te) 
  533           th rows Metho dException , Connecti onExceptio
  534           {
  535                    Vist aCommonUti lities.set DataSource MethodAndV ersion("ge tCaptureUs ers", getD ataSourceV ersion());
  536                    logg er.info("g etCaptureU sers(" + f romDate +  "," + thro ughDate +  ") Transac tionContex t (" + Tra nsactionCo ntextFacto ry.get().g etDisplayI dentity()  + ").");
  537                    Vist aSession l ocalVistaS ession = n ull;
  538           tr y
  539           {
  540                    loca lVistaSess ion = getV istaSessio n(ImagingS ecurityCon textType.M AG_WINDOWS );             
  541                    
  542                    Vist aQuery vm  = VistaCom monQueryFa ctory.crea teGetCaptu reUsersVis taQuery(ap pFlag, fro mDate, thr oughDate);
  543                    Stri ng rtn = l ocalVistaS ession.cal l(vm);
  544                    retu rn ViewerI magingTran slator.con vertCaptur eUsers(rtn );
  545           } 
  546           ca tch (Vista MethodExce ption e)
  547           {
  548                    logg er.error(" Error in g etCaptureU sers", e);
  549                    thro w new Meth odExceptio n(e.getMes sage());
  550           } 
  551           ca tch (Inval idVistaCre dentialsEx ception e)
  552           {
  553                    logg er.error(" Error in g etCaptureU sers", e);
  554                    thro w new Inva lidCredent ialsExcept ion(e.getM essage());
  555           }
  556           ca tch(IOExce ption ioX)
  557           {
  558                    logg er.error(" Exception  getting Vi stA sessio n", ioX);
  559                    thro w new Conn ectionExce ption(ioX) ;
  560           }
  561           fi nally
  562           {
  563                    try{ localVista Session.cl ose();}cat ch(Throwab le t){}
  564           }
  565           }
  566  
  567           
  568           @O verride
  569           pu blic List< ImageFilte rResult> g etImageFil ters(
  570                             Routin gToken glo balRouting Token, 
  571                             String  userId) 
  572           th rows Metho dException , Connecti onExceptio
  573           {
  574                    Vist aCommonUti lities.set DataSource MethodAndV ersion("ge tImageFilt ers", getD ataSourceV ersion());
  575                    logg er.info("g etImageFil ters(" + u serId + ")  Transacti onContext  (" + Trans actionCont extFactory .get().get DisplayIde ntity() +  ").");
  576                    Vist aSession l ocalVistaS ession = n ull;
  577           tr y
  578           {
  579                    loca lVistaSess ion = getV istaSessio n(ImagingS ecurityCon textType.M AG_WINDOWS );             
  580                    
  581                    Vist aQuery vm  = VistaCom monQueryFa ctory.crea teGetImage FiltersVis taQuery(us erId);
  582                    Stri ng rtn = l ocalVistaS ession.cal l(vm);
  583                    retu rn ViewerI magingTran slator.con vertImageF ilters(rtn );
  584           } 
  585           ca tch (Vista MethodExce ption e)
  586           {
  587                    logg er.error(" Error in l ocalVistaS ession", e );
  588                    thro w new Meth odExceptio n(e.getMes sage());
  589           } 
  590           ca tch (Inval idVistaCre dentialsEx ception e)
  591           {
  592                    logg er.error(" Error in l ocalVistaS ession", e );
  593                    thro w new Inva lidCredent ialsExcept ion(e.getM essage());
  594           }
  595           ca tch(IOExce ption ioX)
  596           {
  597                    logg er.error(" Exception  getting Vi stA sessio n", ioX);
  598                    thro w new Conn ectionExce ption(ioX) ;
  599           }
  600           fi nally
  601           {
  602                    try{ localVista Session.cl ose();}cat ch(Throwab le t){}
  603           }
  604           }
  605  
  606           
  607           @O verride
  608           pu blic List< ImageFilte rFieldValu e> getImag eFilterDet ail(
  609                             Routin gToken glo balRouting Token, 
  610                             String  filterIen ,
  611                             String  filterNam e,
  612                             String  userId
  613                             ) 
  614           th rows Metho dException , Connecti onExceptio
  615           {
  616                    Vist aCommonUti lities.set DataSource MethodAndV ersion("ge tImageFilt erDetail",  getDataSo urceVersio n());
  617                    logg er.info("g etImageFil terDetail( " + filter Ien + ","  + filterNa me + "," +  userId +  ") Transac tionContex t (" + Tra nsactionCo ntextFacto ry.get().g etDisplayI dentity()  + ").");
  618                    Vist aSession l ocalVistaS ession = n ull;
  619           tr y
  620           {
  621                    loca lVistaSess ion = getV istaSessio n(ImagingS ecurityCon textType.M AG_WINDOWS );             
  622                    
  623                    Vist aQuery vm  = VistaCom monQueryFa ctory.crea teGetImage FilterDeta ilVistaQue ry(filterI en, filter Name, user Id);
  624                    Stri ng rtn = l ocalVistaS ession.cal l(vm);
  625                    retu rn ViewerI magingTran slator.con vertImageF ilterDetai l(rtn);
  626           } 
  627           ca tch (Vista MethodExce ption e)
  628           {
  629                    logg er.error(" Error in l ocalVistaS ession", e );
  630                    thro w new Meth odExceptio n(e.getMes sage());
  631           } 
  632           ca tch (Inval idVistaCre dentialsEx ception e)
  633           {
  634                    logg er.error(" Error in l ocalVistaS ession", e );
  635                    thro w new Inva lidCredent ialsExcept ion(e.getM essage());
  636           }
  637           ca tch(IOExce ption ioX)
  638           {
  639                    logg er.error(" Exception  getting Vi stA sessio n", ioX);
  640                    thro w new Conn ectionExce ption(ioX) ;
  641           }
  642           fi nally
  643           {
  644                    try{ localVista Session.cl ose();}cat ch(Throwab le t){}
  645           }
  646           }
  647  
  648           @O verride
  649           pu blic Strin g saveImag eFilter(
  650                             Routin gToken glo balRouting Token, 
  651                             List<I mageFilter FieldValue > imageFil terFieldVa lues) 
  652           th rows Metho dException , Connecti onExceptio
  653           {
  654                    Vist aCommonUti lities.set DataSource MethodAndV ersion("sa veImageFil ter", getD ataSourceV ersion());
  655                    logg er.info("s aveImageFi lter(" + i mageFilter FieldValue s + ") Tra nsactionCo ntext (" +  Transacti onContextF actory.get ().getDisp layIdentit y() + ")." );
  656                    Vist aSession l ocalVistaS ession = n ull;
  657           tr y
  658           {
  659                    loca lVistaSess ion = getV istaSessio n(ImagingS ecurityCon textType.M AG_WINDOWS );             
  660                    Hash Map<String , String>  params = n ew HashMap <String, S tring>(17) ;
  661                    para ms.clear() ;
  662                    
  663                    int  i = 0;
  664                             for (I mageFilter FieldValue  imageFilt erFieldVal ue : image FilterFiel dValues)
  665                             {
  666                                      params.p ut(Integer .toString( ++i),image FilterFiel dValue.get FieldName( ) + "^" +  imageFilte rFieldValu e.getField Value());
  667                             }
  668                             
  669                    Vist aQuery vm  = VistaCom monQueryFa ctory.crea teSaveImag eFilterVis taQuery(pa rams);
  670                    retu rn localVi staSession .call(vm);
  671           } 
  672           ca tch (Vista MethodExce ption e)
  673           {
  674                    logg er.error(" Error in l ocalVistaS ession", e );
  675                    thro w new Meth odExceptio n(e.getMes sage());
  676           } 
  677           ca tch (Inval idVistaCre dentialsEx ception e)
  678           {
  679                    logg er.error(" Error in l ocalVistaS ession", e );
  680                    thro w new Inva lidCredent ialsExcept ion(e.getM essage());
  681           }
  682           ca tch(IOExce ption ioX)
  683           {
  684                    logg er.error(" Exception  getting Vi stA sessio n", ioX);
  685                    thro w new Conn ectionExce ption(ioX) ;
  686           }
  687           fi nally
  688           {
  689                    try{ localVista Session.cl ose();}cat ch(Throwab le t){}
  690           }
  691           }
  692  
  693           @O verride
  694           pu blic Strin g deleteIm ageFilter(
  695                             Routin gToken glo balRouting Token, 
  696                             String  filterIen
  697           th rows Metho dException , Connecti onExceptio
  698           {
  699                    Vist aCommonUti lities.set DataSource MethodAndV ersion("de leteImageF ilter", ge tDataSourc eVersion() );
  700                    logg er.info("d eleteImage Filter(" +  filterIen  + ") Tran sactionCon text (" +  Transactio nContextFa ctory.get( ).getDispl ayIdentity () + ").") ;
  701                    Vist aSession l ocalVistaS ession = n ull;
  702           tr y
  703           {
  704                    loca lVistaSess ion = getV istaSessio n(ImagingS ecurityCon textType.M AG_WINDOWS );             
  705                    
  706                    Vist aQuery vm  = VistaCom monQueryFa ctory.crea teDeleteIm ageFilterV istaQuery( filterIen) ;
  707                    retu rn localVi staSession .call(vm);
  708           } 
  709           ca tch (Vista MethodExce ption e)
  710           {
  711                    logg er.error(" Error in l ocalVistaS ession", e );
  712                    thro w new Meth odExceptio n(e.getMes sage());
  713           } 
  714           ca tch (Inval idVistaCre dentialsEx ception e)
  715           {
  716                    logg er.error(" Error in l ocalVistaS ession", e );
  717                    thro w new Inva lidCredent ialsExcept ion(e.getM essage());
  718           }
  719           ca tch(IOExce ption ioX)
  720           {
  721                    logg er.error(" Exception  getting Vi stA sessio n", ioX);
  722                    thro w new Conn ectionExce ption(ioX) ;
  723           }
  724           fi nally
  725           {
  726                    try{ localVista Session.cl ose();}cat ch(Throwab le t){}
  727           }
  728           }
  729  
  730           @O verride
  731           pu blic List< QAReviewRe portResult > getQARev iewReports (RoutingTo ken routin gToken, St ring userI d)
  732           th rows Metho dException , Connecti onExceptio
  733           {
  734                    Vist aCommonUti lities.set DataSource MethodAndV ersion("ge tQAReviewR eports", g etDataSour ceVersion( ));
  735                    logg er.info("g etQAReview Reports("  + userId +  ") Transa ctionConte xt (" + Tr ansactionC ontextFact ory.get(). getDisplay Identity()  + ").");
  736                    Vist aSession l ocalVistaS ession = n ull;
  737           tr y
  738           {
  739                    loca lVistaSess ion = getV istaSessio n(ImagingS ecurityCon textType.M AG_WINDOWS );             
  740                    
  741                    Vist aQuery vm  = VistaCom monQueryFa ctory.crea teGetQARev iewReports VistaQuery (userId);
  742                    Stri ng rtn = l ocalVistaS ession.cal l(vm);
  743                    retu rn ViewerI magingTran slator.con vertQARevi ewReports( rtn);
  744           } 
  745           ca tch (Vista MethodExce ption e)
  746           {
  747                    logg er.error(" Error in l ocalVistaS ession", e );
  748                    thro w new Meth odExceptio n(e.getMes sage());
  749           } 
  750           ca tch (Inval idVistaCre dentialsEx ception e)
  751           {
  752                    logg er.error(" Error in l ocalVistaS ession", e );
  753                    thro w new Inva lidCredent ialsExcept ion(e.getM essage());
  754           }
  755           ca tch(IOExce ption ioX)
  756           {
  757                    logg er.error(" Exception  getting Vi stA sessio n", ioX);
  758                    thro w new Conn ectionExce ption(ioX) ;
  759           }
  760           fi nally
  761           {
  762                    try{ localVista Session.cl ose();}cat ch(Throwab le t){}
  763           }
  764           }
  765  
  766           @O verride
  767           pu blic Strin g getQARev iewReportD ata(Routin gToken rou tingToken,  String fl ags, Strin g fromDate ,
  768                             String  throughDa te, String  mque) 
  769           th rows Metho dException , Connecti onExceptio
  770           {
  771                    Vist aCommonUti lities.set DataSource MethodAndV ersion("ge tQAReviewR eportData" , getDataS ourceVersi on());
  772                    logg er.info("g etQAReview ReportData (" + flags  + ", " +  fromDate +  ", " + th roughDate  + ", " + m que + ") T ransaction Context ("  + Transac tionContex tFactory.g et().getDi splayIdent ity() + ") .");
  773                    Vist aSession l ocalVistaS ession = n ull;
  774           tr y
  775           {
  776                    loca lVistaSess ion = getV istaSessio n(ImagingS ecurityCon textType.M AG_WINDOWS );             
  777                    
  778                    Vist aQuery vm  = VistaCom monQueryFa ctory.crea teGetQARev iewReportD ataVistaQu ery(flags,  fromDate,  throughDa te, mque);
  779                    retu rn localVi staSession .call(vm);
  780           } 
  781           ca tch (Vista MethodExce ption e)
  782           {
  783                    logg er.error(" Error in l ocalVistaS ession", e );
  784                    thro w new Meth odExceptio n(e.getMes sage());
  785           } 
  786           ca tch (Inval idVistaCre dentialsEx ception e)
  787           {
  788                    logg er.error(" Error in l ocalVistaS ession", e );
  789                    thro w new Inva lidCredent ialsExcept ion(e.getM essage());
  790           }
  791           ca tch(IOExce ption ioX)
  792           {
  793                    logg er.error(" Exception  getting Vi stA sessio n", ioX);
  794                    thro w new Conn ectionExce ption(ioX) ;
  795           }
  796           fi nally
  797           {
  798                    try{ localVista Session.cl ose();}cat ch(Throwab le t){}
  799           }
  800           }
  801  
  802           @O verride
  803           pu blic Strin g setImage Properties (RoutingTo ken routin gToken,
  804                             List<I mageProper ty> imageP roperties)  
  805           th rows Metho dException , Connecti onExceptio n {
  806                    Vist aCommonUti lities.set DataSource MethodAndV ersion("se tImageProp erties", g etDataSour ceVersion( ));
  807                    logg er.info("s etImagePro perties("  + imagePro perties +  ") Transac tionContex t (" + Tra nsactionCo ntextFacto ry.get().g etDisplayI dentity()  + ").");
  808                    Vist aSession l ocalVistaS ession = n ull;
  809           tr y
  810           {
  811                    loca lVistaSess ion = getV istaSessio n(ImagingS ecurityCon textType.M AG_WINDOWS );             
  812  
  813                    Hash Map<String , String>  parameters  = new Has hMap<Strin g, String> ();
  814                    
  815                    for( int i = 0;  i < image Properties .size(); i ++)
  816                    {
  817                             parame ters.put(" \"" + i +  "\"", 
  818                                               imagePrope rties.get( i).getIen( ) + "^" + 
  819                                               imagePrope rties.get( i).getName () + "^" +
  820                                               imagePrope rties.get( i).getValu e() + "^"  +
  821                                               imagePrope rties.get( i).getFlag s());
  822                    }
  823                    
  824                    Vist aQuery vm  = VistaCom monQueryFa ctory.crea teSetImage Properties VistaQuery (parameter s);
  825                    retu rn localVi staSession .call(vm);
  826           } 
  827           ca tch (Vista MethodExce ption e)
  828           {
  829                    logg er.error(" Error in l ocalVistaS ession", e );
  830                    thro w new Meth odExceptio n(e.getMes sage());
  831           } 
  832           ca tch (Inval idVistaCre dentialsEx ception e)
  833           {
  834                    logg er.error(" Error in l ocalVistaS ession", e );
  835                    thro w new Inva lidCredent ialsExcept ion(e.getM essage());
  836           }
  837           ca tch(IOExce ption ioX)
  838           {
  839                    logg er.error(" Exception  getting Vi stA sessio n", ioX);
  840                    thro w new Conn ectionExce ption(ioX) ;
  841           }
  842           fi nally
  843           {
  844                    try{ localVista Session.cl ose();}cat ch(Throwab le t){}
  845           }
  846           }
  847  
  848           @O verride
  849           pu blic List< ImagePrope rty> getIm agePropert ies(Routin gToken rou tingToken,  String im ageIEN, St ring props ,
  850                             String  flags) 
  851           th rows Metho dException , Connecti onExceptio
  852           {
  853                    Vist aCommonUti lities.set DataSource MethodAndV ersion("ge tImageProp erties", g etDataSour ceVersion( ));
  854                    logg er.info("g etImagePro perties("  + imageIEN  + "," + p rops + ","  + flags +  ") Transa ctionConte xt (" + Tr ansactionC ontextFact ory.get(). getDisplay Identity()  + ").");
  855                    Vist aSession l ocalVistaS ession = n ull;
  856           tr y
  857           {
  858                    loca lVistaSess ion = getV istaSessio n(ImagingS ecurityCon textType.M AG_WINDOWS );             
  859                    //Ha shMap<Stri ng, String > params =  new HashM ap<String,  String>() ;
  860                    
  861                    Vist aQuery vm  = VistaCom monQueryFa ctory.crea teGetImage Properties VistaQuery (imageIEN,  props, fl ags);
  862                    Stri ng rtn = l ocalVistaS ession.cal l(vm);
  863                    retu rn ViewerI magingTran slator.con vertImageP roperties( rtn);
  864           } 
  865           ca tch (Vista MethodExce ption e)
  866           {
  867                    logg er.error(" Error in l ocalVistaS ession", e );
  868                    thro w new Meth odExceptio n(e.getMes sage());
  869           } 
  870           ca tch (Inval idVistaCre dentialsEx ception e)
  871           {
  872                    logg er.error(" Error in l ocalVistaS ession", e );
  873                    thro w new Inva lidCredent ialsExcept ion(e.getM essage());
  874           }
  875           ca tch(IOExce ption ioX)
  876           {
  877                    logg er.error(" Exception  getting Vi stA sessio n", ioX);
  878                    thro w new Conn ectionExce ption(ioX) ;
  879           }
  880           fi nally
  881           {
  882                    try{ localVista Session.cl ose();}cat ch(Throwab le t){}
  883           }
  884           }
  885  
  886   }