108. EPMO Open Source Coordination Office Redaction File Detail Report

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

108.1 Files compared

# Location File Last Modified
1 C:\AraxisMergeCompare\Pri_un\IMAG_Source\VISA\Java\VistaImagingDataSourceProvider\main\src\java\gov\va\med\imaging\vistaimagingdatasource\common EntityDAO.java Mon Mar 18 20:39:10 2019 UTC
2 C:\AraxisMergeCompare\Pri_re\IMAG_Source\VISA\Java\VistaImagingDataSourceProvider\main\src\java\gov\va\med\imaging\vistaimagingdatasource\common EntityDAO.java Tue Mar 19 15:14:46 2019 UTC

108.2 Comparison summary

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

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

108.4 Active regular expressions

No regular expressions were active.

108.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: Nov,  2009
  6     Site Nam e:  Washin gton OI Fi eld Office , Silver S pring, MD
  7       Developer:     DNS     louthj
  8     Descript ion: DICOM  Study cac he manager . Maintain s the cach e of study  instances
  9                                and  expires o ld studies  after 15  minutes. 
  10  
  11           ;;  +-------- ---------- ---------- ---------- ---------- ---------- ---------- +
  12           ;;  Property  of the US  Government .
  13           ;;  No permis sion to co py or redi stribute t his softwa re is give n.
  14           ;;  Use of un released v ersions of  this soft ware requi res the us er
  15           ;;   to execu te a writt en test ag reement wi th the Vis tA Imaging
  16           ;;   Developm ent Office  of the De partment o f Veterans  Affairs,
  17           ;;   telephon e (301) 73 4-0100.
  18           ;;
  19           ;;  The Food  and Drug A dministrat ion classi fies this  software a s
  20           ;;  a Class I I medical  device.  A s such, it  may not b e changed
  21           ;;  in any wa y.  Modifi cations to  this soft ware may r esult in a n
  22           ;;  adulterat ed medical  device un der 21CFR8 20, the us e of which
  23           ;;  is consid ered to be  a violati on of US F ederal Sta tutes.
  24           ;;  +-------- ---------- ---------- ---------- ---------- ---------- ---------- +
  25  
  26    */
  27   package go v.va.med.i maging.vis taimagingd atasource. common;
  28  
  29   import gov .va.med.im aging.core .interface s.exceptio ns.Connect ionExcepti on;
  30   import gov .va.med.im aging.core .interface s.exceptio ns.Invalid UserCreden tialsExcep tion;
  31   import gov .va.med.im aging.core .interface s.exceptio ns.MethodE xception;
  32   import gov .va.med.im aging.data source.exc eptions.Da oMethodNot Implemente dException ;
  33   import gov .va.med.im aging.data source.exc eptions.In validCrede ntialsExce ption;
  34   import gov .va.med.im aging.exch ange.busin ess.Persis tentEntity ;
  35   import gov .va.med.im aging.exch ange.busin ess.storag e.exceptio ns.Creatio nException ;
  36   import gov .va.med.im aging.exch ange.busin ess.storag e.exceptio ns.Deletio nException ;
  37   import gov .va.med.im aging.exch ange.busin ess.storag e.exceptio ns.Retriev alExceptio n;
  38   import gov .va.med.im aging.exch ange.busin ess.storag e.exceptio ns.UpdateE xception;
  39   import gov .va.med.im aging.url. vista.Stri ngUtils;
  40   import gov .va.med.im aging.url. vista.Vist aQuery;
  41   import gov .va.med.im aging.url. vista.exce ptions.Inv alidVistaC redentials Exception;
  42   import gov .va.med.im aging.url. vista.exce ptions.Vis taMethodEx ception;
  43   import gov .va.med.im aging.vist adatasourc e.session. VistaSessi on;
  44  
  45   import jav a.io.IOExc eption;
  46   import jav a.util.Has hMap;
  47   import jav a.util.Lis t;
  48  
  49   import org .apache.lo gging.log4 j.LogManag er;
  50   import org .apache.lo gging.log4 j.Logger;
  51  
  52   public abs tract clas s EntityDA O<T extend s Persiste ntEntity>  {
  53           pr otected st atic final  String FI ELD_SEPARA TOR1 = Str ingUtils.T ILDE; // P 34 initial ization RP Cs result  separator
  54           pr otected st atic final  String FI ELD_SEPARA TOR2 = Str ingUtils.C OMMA; // p 34 initial ization RP Cs data se parator
  55   //      pr otected ch ar separat or = '~';
  56           pr otected ch ar dbSepar ator = '`' ; // Backt ick  -- P3 4 db input  name-valu e pair sep arator, an d output r esult
  57           pr otected st atic final  String DB _OUTPUT_SE PARATOR1 =  StringUti ls.BACKTIC K; // -- P 34 db outp ut result  pair separ ator
  58           pr otected st atic final  String DB _OUTPUT_SE PARATOR2 =  StringUti ls.STICK;;    // -- P 34 db outp ut name-va lue pair s eparator
  59           pr otected st atic final  String LI NE_SEPARAT OR = "\r\n ";
  60           pr otected st atic final  int MAX_M _STRING_LE NGTH = 240 ; // *** < -- 240 is  correct
  61  
  62           pr otected Vi staSession  session;
  63           pr otected Vi staSession Factory se ssionFacto ry;
  64  
  65           pr otected st atic final  Logger lo gger = Log Manager.ge tLogger(En tityDAO.cl ass);
  66  
  67           pr otected vo id setSess ionFactory (VistaSess ionFactory  sessionFa ctory) 
  68           {
  69                    this .sessionFa ctory = se ssionFacto ry;
  70           }
  71  
  72           pr otected Vi staSession  getVistaS ession() t hrows IOEx ception, C onnectionE xception,  MethodExce ption 
  73           {
  74                    if ( session ==  null) {
  75                             sessio n = sessio nFactory.g etVistaSes sion();
  76                    }
  77                    retu rn session ;
  78           }
  79           
  80  
  81           //
  82           //  Execute a n RPC
  83           //
  84           pu blic Strin g executeR PC(VistaQu ery vm) th rows Metho dException , Connecti onExceptio n {
  85                    Stri ng result  = null;
  86                    Vist aSession l ocalVistaS ession = n ull;
  87                    try 
  88                    {
  89                             logVis taQuery(vm );
  90                             localV istaSessio n = getVis taSession( );
  91                             result  = localVi staSession .call(vm);
  92                             logVis taQueryRes ults(vm, r esult);
  93                             
  94                    } ca tch (IOExc eption e)  {
  95                             throw  new Connec tionExcept ion(e);
  96                    } ca tch (Vista MethodExce ption e) {
  97                             throw  new Method Exception( e.getMessa ge());
  98                    } ca tch (Inval idVistaCre dentialsEx ception e)  {
  99                             throw  new Invali dCredentia lsExceptio n(e.getMes sage());
  100                    }
  101                    catc h(InvalidU serCredent ialsExcept ion icX)
  102                    {
  103                             throw  icX;
  104                    }
  105                    catc h (Excepti on e) {
  106                             throw  new Method Exception( e.getMessa ge());
  107                    } fi nally {
  108                             try {
  109                                      if(local VistaSessi on != null )
  110                                               localVista Session.cl ose();
  111                             } catc h (Throwab le x) {
  112                             }
  113                    }
  114  
  115                    // R eturn the  result
  116                    retu rn result;
  117  
  118           }
  119  
  120  
  121           //
  122           //  Create an d supporti ng methods
  123           //
  124           pu blic T cre ate(T t) t hrows Meth odExceptio n, Connect ionExcepti on 
  125           {
  126                    Vist aQuery vm  = generate CreateQuer y(t);
  127                    retu rn transla teCreate(t , executeR PC(vm));
  128           }
  129  
  130           pu blic Vista Query gene rateCreate Query(T t)  throws Me thodExcept ion
  131           {
  132                    thro w new DaoM ethodNotIm plementedE xception() ;
  133           }
  134  
  135           pu blic T tra nslateCrea te(T t, St ring retur nValue) th rows Metho dException , Creation Exception
  136           {
  137                    thro w new DaoM ethodNotIm plementedE xception() ;
  138           }
  139  
  140           //
  141           //  Get Entit y by Id an d supporti ng methods
  142           //
  143           pu blic T get EntityById (String id ) throws M ethodExcep tion, Conn ectionExce ption 
  144           {
  145                    Vist aQuery vm  = generate GetEntityB yIdQuery(i d);
  146                    retu rn transla teGetEntit yById(id,  executeRPC (vm));
  147           }
  148  
  149           pu blic Vista Query gene rateGetEnt ityByIdQue ry(String  id) throws  MethodExc eption
  150           {
  151                    thro w new DaoM ethodNotIm plementedE xception() ;
  152           }
  153  
  154           pu blic T tra nslateGetE ntityById( String id,  String re turnValue)  throws Me thodExcept ion, Retri evalExcept ion
  155           {
  156                    thro w new DaoM ethodNotIm plementedE xception() ;
  157           }
  158  
  159           //
  160           //  Get by Cr iteria and  supportin g methods
  161           //
  162           pu blic T get EntityByCr iteria(Obj ect criter ia) throws  MethodExc eption, Co nnectionEx ception 
  163           {
  164                    Vist aQuery vm  = generate GetEntityB yCriteriaQ uery(crite ria);
  165                    retu rn transla teGetEntit yByCriteri a(criteria , executeR PC(vm));
  166           }
  167  
  168           pu blic Vista Query gene rateGetEnt ityByCrite riaQuery(O bject crit eria) thro ws MethodE xception
  169           {
  170                    thro w new DaoM ethodNotIm plementedE xception() ;
  171           }
  172  
  173           pu blic T tra nslateGetE ntityByCri teria(Obje ct criteri a, String  returnValu e) throws  MethodExce ption, Ret rievalExce ption
  174           {
  175                    thro w new DaoM ethodNotIm plementedE xception() ;
  176           }
  177  
  178  
  179           //
  180           //  Get by Cr iteria and  supportin g methods
  181           //
  182           pu blic T get EntityByEx ample(T t)  throws Me thodExcept ion, Conne ctionExcep tion 
  183           {
  184                    Vist aQuery vm  = generate GetEntityB yExampleQu ery(t);
  185                    retu rn transla teGetEntit yByExample (t, execut eRPC(vm));
  186           }
  187  
  188           pu blic Vista Query gene rateGetEnt ityByExamp leQuery(T  t) throws  MethodExce ption
  189           {
  190                    thro w new DaoM ethodNotIm plementedE xception() ;
  191           }
  192  
  193           pu blic T tra nslateGetE ntityByExa mple(T t,  String ret urnValue)  throws Met hodExcepti on, Retrie valExcepti on
  194           {
  195                    thro w new DaoM ethodNotIm plementedE xception() ;
  196           }
  197  
  198           //
  199           //  Retrieve  by Example  and suppo rting meth ods
  200           //
  201           pu blic List< T> findByE xample(T t ) throws M ethodExcep tion, Conn ectionExce ption 
  202           {
  203                    Vist aQuery vm  = generate FindByExam pleQuery(t );
  204                    retu rn transla teFindByEx ample(t, e xecuteRPC( vm));
  205           }
  206  
  207           pu blic Vista Query gene rateFindBy ExampleQue ry(T t) th rows Metho dException
  208           {
  209                    thro w new DaoM ethodNotIm plementedE xception() ;
  210           }
  211  
  212           pu blic List< T> transla teFindByEx ample(T t,  String re turnValue)  throws Me thodExcept ion, Retri evalExcept ion
  213           {
  214                    thro w new DaoM ethodNotIm plementedE xception() ;
  215           }
  216  
  217           //
  218           //  Retrieve  by Criteri a and supp orting met hods
  219           //
  220           pu blic List< T> findByC riteria(Ob ject crite ria) throw s MethodEx ception, C onnectionE xception 
  221           {
  222                    Vist aQuery vm  = generate FindByCrit eriaQuery( criteria);
  223                    retu rn transla teFindByCr iteria(cri teria, exe cuteRPC(vm ));
  224           }
  225  
  226           pu blic Vista Query gene rateFindBy CriteriaQu ery(Object  criteria)  throws Me thodExcept ion
  227           {
  228                    thro w new DaoM ethodNotIm plementedE xception() ;
  229           }
  230  
  231           pu blic List< T> findByC pt(String  idType, St ring patie ntId, Stri ng cptCode )
  232           th rows Metho dException , Connecti onExceptio
  233           {
  234                    Vist aQuery vm  = generate FindByCptQ uery(idTyp e, patient Id, cptCod e);
  235                    retu rn transla teFindByCp t(null, ex ecuteRPC(v m));
  236           }
  237  
  238           pu blic Vista Query gene rateFindBy CptQuery(S tring idTy pe, String  patientId , String c ptCode) th rows Metho dException
  239           {
  240                    thro w new DaoM ethodNotIm plementedE xception() ;
  241           }
  242  
  243           pu blic List< T> transla teFindByCr iteria(Obj ect criter ia, String  returnVal ue) throws  MethodExc eption, Re trievalExc eption
  244           {
  245                    thro w new DaoM ethodNotIm plementedE xception() ;
  246           }
  247  
  248           pu blic List< T> transla teFindByCp t(Object c riteria, S tring retu rnValue) t hrows Meth odExceptio n, Retriev alExceptio n
  249           {
  250                    thro w new DaoM ethodNotIm plementedE xception() ;
  251           }
  252  
  253           //
  254           //  Retrieve  All and su pporting m ethods
  255           //
  256           pu blic List< T> findAll () throws  MethodExce ption, Con nectionExc eption 
  257           {
  258                    Vist aQuery vm  = generate FindAllQue ry();
  259                    retu rn transla teFindAll( executeRPC (vm));
  260           }
  261  
  262           pu blic Vista Query gene rateFindAl lQuery() t hrows Meth odExceptio n
  263           {
  264                    thro w new DaoM ethodNotIm plementedE xception() ;
  265           }
  266  
  267           pu blic List< T> transla teFindAll( String ret urnValue)  throws Met hodExcepti on, Retrie valExcepti on
  268           {
  269                    thro w new DaoM ethodNotIm plementedE xception() ;
  270           }
  271  
  272           //
  273           //  Update an d supporti ng methods
  274           //
  275           pu blic T upd ate(T t) t hrows Meth odExceptio n, Connect ionExcepti on 
  276           {
  277                    Vist aQuery vm  = generate UpdateQuer y(t);
  278                    retu rn transla teUpdate(t , executeR PC(vm));
  279           }
  280  
  281           pu blic Vista Query gene rateUpdate Query(T t)  throws Me thodExcept ion
  282           {
  283                    thro w new DaoM ethodNotIm plementedE xception() ;
  284           }
  285  
  286           pu blic T tra nslateUpda te(T t, St ring retur nValue) th rows Metho dException , UpdateEx ception
  287           {
  288                    thro w new DaoM ethodNotIm plementedE xception() ;
  289           }
  290  
  291  
  292           //
  293           //  Delete by  Example a nd delete  by id and  supporting  methods
  294           //
  295           pu blic void  delete(T t ) throws M ethodExcep tion, Conn ectionExce ption 
  296           {
  297                    Vist aQuery vm  = generate DeleteQuer y(t);
  298                    tran slateDelet e(executeR PC(vm));
  299           }
  300  
  301           pu blic void  delete(int  id) throw s MethodEx ception, C onnectionE xception 
  302           {
  303                    Vist aQuery vm  = generate DeleteQuer y(id);
  304                    tran slateDelet e(executeR PC(vm));
  305           }
  306  
  307           pu blic Vista Query gene rateDelete Query(T t)  throws Me thodExcept ion
  308           {
  309                    thro w new DaoM ethodNotIm plementedE xception() ;
  310           }
  311  
  312           pu blic Vista Query gene rateDelete Query(int  id) throws  MethodExc eption
  313           {
  314                    thro w new DaoM ethodNotIm plementedE xception() ;
  315           }
  316  
  317           pu blic void  translateD elete(Stri ng returnV alue) thro ws Deletio nException , MethodEx ception
  318           {
  319                    thro w new DaoM ethodNotIm plementedE xception() ;
  320           }
  321  
  322           
  323           //  Miscellan eous utili ty methods
  324           pr otected St ring trans lateNewEnt ityIEN(Str ing return Value, Boo lean doCre ate) throw s Creation Exception
  325           {
  326                    Stri ng[] resul ts = Strin gUtils.Spl it(returnV alue, DB_O UTPUT_SEPA RATOR1);
  327                    Stri ng ien = " -1";
  328                    
  329                    if ( results[0] .equals("0 ")) // Suc cessful op eration
  330                    {
  331                             ien =  results[2] ;
  332                    } 
  333                    else  if (doCre ate)
  334                             throw  new Creati onExceptio n("Could n ot create  record: "  + results[ 1]);
  335                    
  336                    retu rn ien;
  337           }
  338           
  339           //  --------- ---------- ----- priv ate transl ate utilit y -------- ---------- ---------- ---------- -
  340           pr otected Ha shMap <Str ing, Strin g> stringT oHashMap(S tring inSt r)
  341           {
  342                    Hash Map <Strin g, String>  hm = new  HashMap <S tring, Str ing>();
  343                    if ( inStr.leng th()>MAX_M _STRING_LE NGTH) {
  344                             int be gI, endI=0 ;
  345                             for(in t index=0;  endI<inSt r.length() ; ++index)
  346                             {
  347                                      begI=ind ex*MAX_M_S TRING_LENG TH;
  348                                      endI=(in dex+1)*MAX _M_STRING_ LENGTH;
  349                                      if (endI  >= inStr. length())
  350                                               endI = inS tr.length( );
  351                                      hm.put(S tring.valu eOf(index+ 1), inStr. substring( begI, endI ));
  352                             }
  353                    } el se
  354                             hm.put ("1", inSt r);
  355                    retu rn hm;
  356           }
  357  
  358  
  359           pr otected st atic void  stringToHa shMap2(Has hMap <Stri ng, String > hm, Stri ng prefix,  String in Str)
  360           {
  361                    if ( inStr.leng th()>MAX_M _STRING_LE NGTH) {
  362                             int be gI, endI=0 ;
  363                             for(in t index=0;  endI<inSt r.length() ; ++index)
  364                             {
  365                                      begI=ind ex*MAX_M_S TRING_LENG TH;
  366                                      endI=(in dex+1)*MAX _M_STRING_ LENGTH;
  367                                      if (endI  >= inStr. length())
  368                                               endI = inS tr.length( );
  369                                      String n um = Strin g.valueOf( index+1);
  370                                      for (int  i=num.len gth(); i<3 ; i++)
  371                                        num =" 0" + num;
  372                                      hm.put(p refix + nu m, inStr.s ubstring(b egI, endI) );
  373                             }
  374                    } el se
  375                             hm.put (prefix +  "001", inS tr);
  376           }
  377  
  378           pr ivate void  logVistaQ uery(Vista Query vm){
  379                    logg er.info("R PC Request : "+String Utils.disp layEncoded Chars(vm.t oString()) );
  380           }
  381           
  382           pr ivate void  logVistaQ ueryResult s(VistaQue ry vm, Str ing result s){ 
  383                    //WF P-change c ode to pus h the trun cation wor k into the  .displayE ncodedChar s() method .
  384                    if(r esults.len gth() > 32 0){
  385                             logger .info(vm.g etRpcName( )+" RPC Re sults:"+St ringUtils. displayEnc odedChars( results).s ubstring(0 , 320)
  386                                      + "...]( truncated) ");
  387                    }
  388                    else {
  389                             logger .info(vm.g etRpcName( )+" RPC Re sults:"+St ringUtils. displayEnc odedChars( results));                    
  390                    }
  391                    logg er.debug(v m.getRpcNa me()+" RPC  Results:" +StringUti ls.display EncodedCha rs(results ));
  392           }
  393  
  394   }