273. EPMO Open Source Coordination Office Redaction File Detail Report

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

273.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ImagingDicomDCFCommon\src\java\gov\va\med\imaging\dicom\dcftoolkit\common\mapping BusinessObjectToDicomObjectTranslator.java Mon Dec 4 21:35:26 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ImagingDicomDCFCommon\src\java\gov\va\med\imaging\dicom\dcftoolkit\common\mapping BusinessObjectToDicomObjectTranslator.java Mon Dec 4 22:02:24 2017 UTC

273.2 Comparison summary

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

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

273.4 Active regular expressions

No regular expressions were active.

273.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: Marc h 21, 2005
  6     Site Nam e:  Washin gton OI Fi eld Office , Silver S pring, MD
  7       Developer:          
TITTOC
  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   package go v.va.med.i maging.dic om.dcftool kit.common .mapping;
  26  
  27   // import  gov.va.med .imaging.d icom.Const ants;
  28   import gov .va.med.im aging.dico m.common.i nterfaces. IDicomData Set;
  29   import gov .va.med.im aging.exch ange.busin ess.dicom. DicomMap;
  30  
  31   import jav a.util.Has hMap;
  32   import jav a.util.Has hSet;
  33   import jav a.util.Ite rator;
  34  
  35   import org .apache.lo gging.log4 j.LogManag er;
  36   import org .apache.lo gging.log4 j.Logger;
  37  
  38   /**
  39    * @author  Csaba Tit ton
  40    */
  41   public cla ss Busines sObjectToD icomObject Translator  {
  42           
  43           pr ivate stat ic Logger  logger = L ogManager. getLogger( BusinessOb jectToDico mObjectTra nslator.cl ass);
  44           
  45   //      /* ********** ********** ********** ********** ********** ********** ********** ***
  46   //       *  Static me thods
  47   //       * ********** ********** ********** ********** ********** ********** ********** **/
  48   //      
  49   //      /*
  50   //       *  REENG Imp lement exi sting Data set patch  from busin ess object
  51   //       * /
  52   //
  53   //      pu blic stati c void upd ateDataSet FromBusine ssObject(C lass busin essObjectC lass, IDic omDataSet  dataSet, H ashSet map pingSet)
  54   //      {
  55   //               Obje ct busines sObject =  null;
  56   //               
  57   //               try
  58   //               {
  59   //                        // Cre ate an ins tance of t he busines s object c lass
  60   //                        busine ssObject =  businessO bjectClass .newInstan ce();
  61   //                        
  62   //                        // Get  the subst ring conta ining the  name of th e class, w ithout the  package n ame includ ed...
  63   //                        String  businessO bjectClass Name = bus inessObjec tClass.get Name().sub string(bus inessObjec tClass.get Name().las tIndexOf(" .") + 1);
  64   //                        
  65   //                        // for  each fiel d in the m apping for  this clas s, set the  appropria te field i n the busi ness objec t
  66   //                        Iterat or iter =  mappingSet .iterator( );
  67   //                        while  (iter.hasN ext())
  68   //                        {
  69   ////                               Business PropertyMa pping mapp ing = (Bus inessPrope rtyMapping )iter.next ();
  70   //                                 DicomMap  mapping =  (DicomMap )iter.next ();
  71   //                                 if (mapp ing.getIma gingEntity ().equals( businessOb jectClassN ame))
  72   //                                 {
  73   //                                          // This ma pped eleme nt belongs  in this b usiness ob ject. Map  it...
  74   //                                          updateDico mElement(b usinessObj ect, mappi ng, dataSe t);
  75   //                                 }
  76   //                        }
  77   //               }
  78   //               catc h (Instant iationExce ption ie){ }
  79   //               catc h (Illegal AccessExce ption iae) {}
  80   //      }
  81   //
  82   //      /* *
  83   //       *  @param bu sinessObje ct
  84   //       *  @param ma pping
  85   //       *  @param da taSet
  86   //       * /     
  87   //
  88   //   priva te static  void updat eDicomElem ent(Object  businessO bject, Dic omMap mapp ing, IDico mDataSet d ataSet) {
  89   //
  90   //               bool ean exists =true;
  91   //               Stri ng  strVal =null;
  92   //               try
  93   //               {
  94   //                        IDicom Element iD E = dataSe t.getDicom Element(ma pping.getT ag());
  95   //                        if (iD E == null)  // no suc h Dicom El ement in d ataset, Ad d new one  (option to  exit !!!)
  96   //                                 exists=f alse;
  97   //                        
  98   //                        // Che ck whether  the Dicom  Element w as be mapp ed to one  or multipl e business  object fi elds.
  99   //                        if (ma pping.getF ieldMultip licity() >  1) // no  date/time  and sequen ce embedde d tags ass umed here  !!!
  100   //                        {                
  101   //                                 strVal=" ";
  102   //                                 // gener ate field  names and  construct  a single D ICOM value
  103   //                                 for (int  i = 1; i  <= mapping .getFieldM ultiplicit y(); i++)
  104   //                                 {
  105   //
  106   //                                          if (iDE.vm () < i) //  not enoug h items in  dataset D icom Eleme nt array
  107   //                                                  re turn;
  108   //                                          if (i>1)
  109   //                                                  st rVal += "\ \";
  110   //                                          String fie ldName = m apping.get EntityFiel d() + Inte ger.toStri ng(i);
  111   //                                          // compose  new value
  112   //                                          strVal +=  getBusines sObjectFie ldValue(bu sinessObje ct, fieldN ame);
  113   //                                 }
  114   //                        }
  115   //                        else
  116   //                        {
  117   //                                 strVal =  getBusine ssObjectFi eldValue(b usinessObj ect, mappi ng.getEnti tyField()) ;
  118   //                                 // handl e data tim e switchin g here Che cking fiel dName and  tags
  119   //                                 if ((map ping.getTa g2()!=null ) && (mapp ing.getEnt ityField() .indexOf(" Date") > - 1)) {
  120   //                                          // Split v alue and s tore date  and time s eparatly
  121   //                                          dataSet.re moveDicomE lement(map ping.getTa g(), null) ;     // d ate
  122   //                                          dataSet.re moveDicomE lement(map ping.getTa g2(), null );// time
  123   //                                          dataSet.in sertDicomE lement(map ping.getTa g(), null,  strVal.su bstring(0,  8)); // d ate
  124   //                                          dataSet.in sertDicomE lement(map ping.getTa g2(), null , strVal.s ubstring(9 )); // tim e
  125   //                                          return;
  126   //                                 }
  127   //                        }
  128   //                        if (ex ists)
  129   //                                 dataSet. removeDico mElement(m apping.get Tag(), map ping.getTa g2());
  130   //
  131   //                        dataSe t.insertDi comElement (mapping.g etTag(), m apping.get Tag2(), st rVal);
  132   //               }
  133   //               catc h (DicomEx ception de )
  134   //               {
  135   //                        logger .warn("Dic om Element  '" + mapp ing.getTag () + "' wa s not pres ent in the  DataSet.  The field  '" + mappi ng.getImag ingEntity( ) + "." +  mapping.ge tEntityFie ld() + "'  was not ma pped");
  136   //               }
  137   //      }
  138   //    
  139   //      pr ivate stat ic String  getBusines sObjectFie ldValue(Ob ject busin essObject,  String fi eldName)
  140   //      {
  141   //               Stri ng stringV al=null;
  142   //
  143   //               try 
  144   //               {                         
  145   //                        // Fin d the retu rn type of  the gette r, so we c an retriev e the sett er correct ly
  146   //                        java.l ang.Class[ ] c=null;
  147   //                        Method  getter =  businessOb ject.getCl ass().getM ethod("get " + fieldN ame, c);
  148   //                        Class  outFieldTy pe = gette r.getRetur nType();
  149   //                                                  
  150   //                        // Str ing, Int,  Date, Time stamp and  Float type s in persi stence (Me taDB schem a)
  151   //                        java.l ang.Object [] obj={nu ll};
  152   //                        Object  o = gette r.invoke(b usinessObj ect, obj);  // get va lue from t he field i nto an obj ect
  153   //
  154   //                        if (ou tFieldType .equals(Da te.class))
  155   //                        {                                  
  156   //                                 java.sql .Date sd=( java.sql.D ate)o;
  157   //                                 String t mpString =  sd.toStri ng(); // y yyy-mm-dd   (JDBC dat e escape f ormat)
  158   //                                 stringVa l = (tmpSt ring.subst ring(0, 4)  + tmpStri ng.substri ng(5, 7) +  tmpString .substring (8));
  159   //                                 // strin gVal is in  'YYYYMMDD ' format,
  160   //                        }
  161   //                        else i f (outFiel dType.equa ls(Timesta mp.class))  // Date w ill do the  same!
  162   //                        {
  163   //                                 java.sql .Timestamp  sts=(java .sql.Times tamp)o;
  164   //                                 String t mpString =  sts.toStr ing(); //  yyyy-mm-dd  hh:mm:ss. fffffffff  (JDBC time stamp esca pe format)  
  165   //                                 stringVa l = (tmpSt ring.subst ring(0, 4)  + tmpStri ng.substri ng(5, 7) +  tmpString .substring (8, 13)
  166   //                                                        + tmpSt ring.subst ring(14, 1 6) + tmpSt ring.subst ring(17, 2 7));
  167   //                                 // strin gVal is in  'YYYYMMDD  HHMISS.ff ffff' form at
  168   //                        }
  169   //                        else
  170   //                                 stringVa l = o.toSt ring();                          // convert  field val ue into st ring: 
  171   //
  172   //                        return  stringVal ;
  173   //                        
  174   //               } ca tch (NoSuc hMethodExc eption e)  {
  175   //                        // TOD O Auto-gen erated cat ch block
  176   //                        e.prin tStackTrac e();
  177   //               }  c atch (Invo cationTarg etExceptio n e) {
  178   //                        // TOD O Auto-gen erated cat ch block
  179   //                        e.prin tStackTrac e();
  180   //               }  c atch (Ille galAccessE xception e ) {
  181   //                        // TOD O Auto-gen erated cat ch block
  182   //                        e.prin tStackTrac e();
  183   //               }
  184   //               retu rn stringV al;
  185   //      }
  186           
  187                    
  188   //      == ========== ========== ========== ======= Qu ery suppor t ======== ========== ========== ========== =
  189  
  190           /* *
  191            *  Converts  an DICOM q uery respo nse row to  a DICOM d ataSet. if  in legacy Mode, the  HashSet is  in
  192            *   ("gggg,e eee", stri ng value)  format, ot herwise in  (fieldnam e, string  value) for mat.
  193            *    1. for  DICOM date  and time  -- DA and  TM tags ar e individu al entries  in the Ha shMap!
  194            *    2. for  a tag in a  sequence  -- dicomEl ement is t he SQ tag  and dicomE lement2 is  the tag i n scope
  195            *  @param cR S -- the c achedRowSe tImpl inst ance
  196            *  @param ro wnumber --  the row ( 1..) to be  translate
  197            *  @param ma ppingSet - - list of  DICOM tags  applicabl e for conv ersion (ha s DICOM ta g as well  as fieldna me
  198            *                         for each  item) --  used for f ieldname t o tag conv ersion onl y (not in  legacy)
  199            *  @param da taSet -- t he dataSet  to be upd ated
  200            *  @throws
  201            * /     
  202  
  203           pu blic stati c void upd ateDataSet FromHISCha nges(IDico mDataSet d ataSet, Ha shMap<Stri ng, String > HISChang es, HashSe t<DicomMap > mappingS et)
  204           {
  205                    try 
  206                    {
  207                             if (da taSet==nul l) return;
  208                             
  209                             String  tag = "";
  210                             String  tag2 = "" ;
  211                                                                
  212                                      Iterator <DicomMap>  iter = ma ppingSet.i terator();
  213                                      while (i ter.hasNex t())
  214                                      {
  215                                               DicomMap m apping = ( DicomMap)i ter.next() ;
  216                                               tag = mapp ing.getTag ();
  217                                               tag2 = map ping.getTa g2();
  218                         if (!(tag. equals("") )){
  219                             
  220                             if(tag 2 == null) {
  221                                 St ring value  = "";
  222                                 va lue = (Str ing)HISCha nges.get(t ag);
  223                                 if (value !=  null){
  224                                      //FUTURE  We need t o fix this .  We are  calling th is from Di comDataSet
  225                                      //  obje ct then ca ll back to  the Dicom DataSet ob ject.  Mak e no sense .
  226                                      //  It w orks for n ow, so let  it go.
  227                                      dataSet. insertDico mElement(t ag, tag2,  value);
  228                                 }
  229                             }
  230                             else{
  231                                 St ringBuffer  sequenceT ag = new S tringBuffe r();
  232                                 se quenceTag. append(tag );
  233                                 se quenceTag. append(" " );
  234                                 se quenceTag. append(tag 2);
  235                                 St ring nuHas hKey = seq uenceTag.s ubstring(0 );
  236                                 St ring value  = (String )HISChange s.get(nuHa shKey);
  237                                 if  (value !=  null)
  238                                      dataSet. insertDico mElement(t ag, tag2,  value);
  239                             }
  240                         }
  241                                      }
  242                    }
  243                    catc h (Excepti on ex) {
  244                logger.e rror("Erro r: "+ex.ge tMessage() );
  245                logger.e rror("Fail ure while  updating D ataSet wit h HIS chan ges.");
  246                logger.e rror("Trac e:", ex);
  247                    }
  248           }
  249   }