147. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 3/8/2018 10:11:37 AM Eastern 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.

147.1 Files compared

# Location File Last Modified
1 PRE_PPS-N_v3.0.1.zip\PS_PPS_domain\src\main\java\gov\va\med\pharmacy\peps\service\common\update\impl DrugDrugInteractionNdfFileSyncProcessor.java Fri Jan 12 15:42:32 2018 UTC
2 PRE_PPS-N_v3.0.1.zip\PS_PPS_domain\src\main\java\gov\va\med\pharmacy\peps\service\common\update\impl DrugDrugInteractionNdfFileSyncProcessor.java Wed Mar 7 01:52:02 2018 UTC

147.2 Comparison summary

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

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

147.4 Active regular expressions

No regular expressions were active.

147.5 Comparison detail

  1   package go v.va.med.p harmacy.pe ps.service .common.up date.impl;
  2  
  3   import jav a.util.Arr ays;
  4   import jav a.util.Col lection;
  5   import jav a.util.Col lections;
  6   import jav a.util.Dat e;
  7   import jav a.util.Lin kedHashMap ;
  8   import jav a.util.Lin kedHashSet ;
  9   import jav a.util.Map ;
  10   import jav a.util.Set ;
  11  
  12   import org .apache.co mmons.lang 3.StringUt ils;
  13  
  14   import gov .va.med.ph armacy.pep s.common.u tility.Mum psConverte r;
  15   import gov .va.med.ph armacy.pep s.common.v ista.Vista File;
  16   import gov .va.med.ph armacy.pep s.common.v o.DrugDrug Interactio nVo;
  17   import gov .va.med.ph armacy.pep s.common.v o.FieldKey ;
  18   import gov .va.med.ph armacy.pep s.common.v o.ItemStat us;
  19   import gov .va.med.ph armacy.pep s.common.v o.ManagedI temVo;
  20   import gov .va.med.ph armacy.pep s.common.v o.RequestI temStatus;
  21   import gov .va.med.ph armacy.pep s.common.v o.UserVo;
  22   import gov .va.med.ph armacy.pep s.common.v o.diff.Dif ference;
  23   import gov .va.med.ph armacy.pep s.domain.c ommon.capa bility.Dru gSeverityD omainCapab ility;
  24   import gov .va.med.ph armacy.pep s.domain.c ommon.mode l.EplNdfOu tgoingDiff erences;
  25   import gov .va.med.ph armacy.pep s.domain.c ommon.util ity.conver ter.DrugDr ugInteract ionConvert er;
  26   import gov .va.med.ph armacy.pep s.external .common.ut ility.Abst ractConver ter;
  27   import gov .va.med.ph armacy.pep s.external .common.vo .outbound. common.Ite mAction;
  28   import gov .va.med.ph armacy.pep s.service. common.cap ability.Nd fFileSyncC apability;
  29   import gov .va.med.ph armacy.pep s.service. common.upd ate.NdfFil eSyncProce ssor;
  30  
  31   /**
  32    * This cl ass implem ents metho ds which p opulate th e new NDF  outgoing d ifference  table usin g the exis ting DrugD rugInterac tionVo
  33    * object  for vista  file 56 de finition a nd KID bui ld output  for adds a nd modific ations of  PPS VA dru g drug int eraction d ata.
  34    * 
  35    * @author        DNS
  36    * @versio n 1.0
  37    */
  38   public cla ss DrugDru gInteracti onNdfFileS yncProcess or extends  AbstractS impleNdfFi leSyncProc essor
  39       implem ents NdfFi leSyncProc essor {
  40  
  41       privat e DrugSeve rityDomain Capability  drugSever ityDomainC apability;
  42  
  43       privat e static f inal org.a pache.logg ing.log4j. Logger LOG  = org.apa che.loggin g.log4j.Lo gManager
  44           .g etLogger(D rugDrugInt eractionNd fFileSyncP rocessor.c lass);
  45  
  46       privat e static f inal Strin g FILE_NUM BER = "56" ;
  47       privat e static f inal Strin g DRUG_INT ERACTION_I EN_FIELD_N UMBER = ". 01";
  48  
  49       privat e static f inal Strin g INGREDIE NT1_FIELD_ NUMBER = " 1";
  50       privat e static f inal Strin g INGREDIE NT2_FIELD_ NUMBER = " 2";
  51       privat e static f inal Strin g SEVERITY _FIELD_NUM BER = "3";
  52       privat e static f inal Strin g NATIONAL LY_ENTERED _FIELD_NUM BER = "4";
  53       // pri vate stati c final St ring TOTAL _INDEXES_E NTERED_FIE LD_NUMBER  = "5";
  54       // pri vate stati c final St ring LOCAL LY_EDITED_ FIELD_NUMB ER = "6";
  55       privat e static f inal Strin g INACTIVA TION_DATE_ FIELD_NUMB ER = "7";
  56  
  57       /** Fi eldKeys of  the field s that, if  modified,  would be  processed  by the mod ification  logic of t his proces sor. */
  58       public  static fi nal Set<Fi eldKey> FI ELDS = Col lections.u nmodifiabl eSet(new L inkedHashS et<FieldKe y>(
  59           Ar rays.asLis t(FieldKey .VALUE, Fi eldKey.SEV ERITY, Fie ldKey.INAC TIVATION_D ATE, Field Key.ITEM_S TATUS)));
  60  
  61       /**
  62        * Ins tantiates  a new Drug DrugIntera ctionNdfFi leSyncProc essor.
  63        *
  64        * @pa ram pNdfFi leSyncCapa bility the  ndf file  sync capab ility
  65        * @pa ram pDrugS everityDom ainCapabil ity the dr ug severit y domain c apability
  66        * @se e Abstract SimpleNdfF ileSyncPro cessor#Abs tractSimpl eNdfFileSy ncProcesso r(Set, Str ing, Strin g)
  67        */
  68       public  DrugDrugI nteraction NdfFileSyn cProcessor (NdfFileSy ncCapabili ty pNdfFil eSyncCapab ility,
  69           Dr ugSeverity DomainCapa bility pDr ugSeverity DomainCapa bility) {
  70           su per(FIELDS , FILE_NUM BER, DRUG_ INTERACTIO N_IEN_FIEL D_NUMBER,  pNdfFileSy ncCapabili ty);
  71           dr ugSeverity DomainCapa bility = p DrugSeveri tyDomainCa pability;
  72       }
  73  
  74       @Overr ide
  75       public  void proc essNew(Man agedItemVo  managedIt em, UserVo  user) {
  76           //  Inserts n ew record  into EplNd fOutgoingD ifferences  table.
  77  
  78           //  parse out  the data  and popula te the Epl NdfOutgoin gDifferenc es obj for  persisten ce.
  79  
  80           St ring userN ame = null ;
  81           Dr ugDrugInte ractionVo  drugIntera ction = (D rugDrugInt eractionVo ) managedI tem;
  82           us erName = S tringUtils .isNotEmpt y(user.get Username() ) ? user.g etUsername () : "360" ;
  83  
  84           if  ((StringU tils.isNot Empty(drug Interactio n.getValue ()))
  85                && (Requ estItemSta tus.APPROV ED.equals( drugIntera ction.getR equestItem Status())) ) {
  86  
  87                EplNdfOu tgoingDiff erences di fferencesO bj = new E plNdfOutgo ingDiffere nces();
  88                differen cesObj.set NewValue(d rugInterac tion.getVa lue());
  89  
  90                // need  to check w hat might  go in the  else claus e.
  91                if (Stri ngUtils.is NotEmpty(d rugInterac tion.getDr ugDrugInte ractionIen ())) {
  92  
  93                    diff erencesObj .setVistaI en(drugInt eraction.g etDrugDrug Interactio nIen());
  94                } else {
  95                    LOG. error("Dru g interact ion IEN ca n't be nul l.");
  96                }
  97  
  98                differen cesObj.set CreatedBy( userName);
  99                insertNe wElement(d rugInterac tion.getDr ugDrugInte ractionIen (), drugIn teraction. getValue() , userName );
  100  
  101                // Ingre dient 1
  102                insertNe wChildElem ent(drugIn teraction. getDrugDru gInteracti onIen(),
  103                    drug Interactio n.getIngre dient1().g etNdfIngre dientIen() , userName , INGREDIE NT1_FIELD_ NUMBER);
  104  
  105                // Ingre dient 2
  106                insertNe wChildElem ent(drugIn teraction. getDrugDru gInteracti onIen(),
  107                    drug Interactio n.getIngre dient2().g etNdfIngre dientIen() , userName , INGREDIE NT2_FIELD_ NUMBER);
  108  
  109                // Sever ity
  110                insertNe wChildElem ent(drugIn teraction. getDrugDru gInteracti onIen(), d rugInterac tion.getDr ugSeverity ().getId() ,
  111                    user Name, SEVE RITY_FIELD _NUMBER);
  112  
  113                // natur ally enter ed
  114                insertNe wChildElem ent(drugIn teraction. getDrugDru gInteracti onIen(), d rugInterac tion.getNa tionallyEn tered(), u serName,
  115                    NATI ONALLY_ENT ERED_FIELD _NUMBER);
  116  
  117                // total  indexed -  Current n ot needed
  118                // inser tNewChildE lement(dru gInteracti on.getDrug DrugIntera ctionIen() ,
  119                // drugI nteraction .getTotalI ndexes(),  userName,  TOTAL_INDE XES_ENTERE D_FIELD_NU MBER);
  120  
  121                // total  indexed -  Current n ot needed
  122                // inser tNewChildE lement(dru gInteracti on.getDrug DrugIntera ctionIen() ,
  123                // drugI nteraction .getLocall yEdited(),  userName,  LOCALLY_E DITED_FIEL D_NUMBER);
  124           }
  125       }
  126  
  127       @Overr ide
  128       public  void proc essModifie d(ManagedI temVo mana gedItem, U serVo user , Collecti on<Differe nce> diffe rences) {
  129  
  130           //  Inserts e ither new  record or  updates ol der one in  the EplNd fOutgoingD ifferences  table.
  131  
  132           St ring userN ame = null ;
  133  
  134           us erName = S tringUtils .isNotEmpt y(user.get Username() ) ? user.g etUsername () : "360" ;
  135  
  136           Ma p<FieldKey , Differen ce> setDif ference =  Difference .toDiffere nceMap(dif ferences);
  137  
  138           if  (ItemStat us.INACTIV E.equals(A bstractCon verter.get OldValue(F ieldKey.IT EM_STATUS,  setDiffer ence))
  139                && ItemS tatus.ACTI VE.equals( AbstractCo nverter.ge tNewValue( FieldKey.I TEM_STATUS , setDiffe rence))) {  // reacti vate
  140  
  141                setDiffe rence.put( FieldKey.I NACTIVATIO N_DATE, ne w Differen ce(FieldKe y.INACTIVA TION_DATE,  new Date( ), null));
  142           }
  143  
  144           bo olean hasD ifferences  = DrugDru gInteracti onConverte r.hasNewOr ModifiedFi elds(getFi elds(), se tDifferenc e,
  145                ItemActi on.MODIFY) ;
  146  
  147           if  (hasDiffe rences) {
  148  
  149                DrugDrug Interactio nVo drugIn teraction  = (DrugDru gInteracti onVo) mana gedItem;
  150  
  151                if (Requ estItemSta tus.APPROV ED.equals( drugIntera ction.getR equestItem Status()))  {
  152  
  153                    // c heck sever ity change .
  154  
  155                    if ( Difference .didThisFi eldChange( difference s, FieldKe y.SEVERITY )) {
  156  
  157                         LinkedHash Map<String , String>  severityMa p = drugSe verityDoma inCapabili ty.getSeve rityMap();
  158  
  159                         Difference  diff = se tDifferenc e.get(Fiel dKey.SEVER ITY);
  160  
  161                         String new Value = se verityMap. get(diff.g etNewValue ShortStrin g());
  162  
  163                         String old Value = se verityMap. get(diff.g etOldValue ShortStrin g());
  164  
  165                         insertModi fiedElemen t(drugInte raction.ge tDrugDrugI nteraction Ien(), new Value, use rName,
  166                             SEVERI TY_FIELD_N UMBER, old Value);
  167                    }
  168  
  169                    else  if (Diffe rence.didT hisFieldCh ange(diffe rences, Fi eldKey.ITE M_STATUS))  {
  170  
  171                         Difference  diff = se tDifferenc e.get(Fiel dKey.INACT IVATION_DA TE);
  172  
  173                         String pri orInactiva tedDate =  convertPri orInactiva tionDate(d iff);
  174  
  175                         String ina ctivatedDa te = conve rtInactiva tionDate(d iff, drugI nteraction );
  176  
  177                         insertModi fiedElemen t(drugInte raction.ge tDrugDrugI nteraction Ien(), ina ctivatedDa te, userNa me,
  178                             INACTI VATION_DAT E_FIELD_NU MBER, prio rInactivat edDate);
  179                    }
  180                }
  181           }
  182       }
  183  
  184       privat e String c onvertPrio rInactivat ionDate(Di fference d iff) {
  185  
  186           re turn diff  != null ?  MumpsConve rter.conve rtDate((Da te) diff.g etOldValue ()) : null ;
  187  
  188       }
  189  
  190       privat e String c onvertInac tivationDa te(Differe nce diff,  DrugDrugIn teractionV o drugInte ractionVo)  {
  191  
  192           re turn diff  == null ?  MumpsConve rter.conve rtDate(dru gInteracti onVo.getIn activation Date()) :  VistaFile. BLANK;
  193  
  194       }
  195  
  196   }