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

148.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 DrugIngredientsNdfFileSyncProcessor.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 DrugIngredientsNdfFileSyncProcessor.java Wed Mar 7 01:52:16 2018 UTC

148.2 Comparison summary

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

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

148.4 Active regular expressions

No regular expressions were active.

148.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.Lin kedHashSet ;
  7   import jav a.util.Map ;
  8   import jav a.util.Set ;
  9  
  10   import org .apache.co mmons.lang 3.StringUt ils;
  11  
  12   import gov .va.med.ph armacy.pep s.common.u tility.Mum psConverte r;
  13   import gov .va.med.ph armacy.pep s.common.v ista.Vista File;
  14   import gov .va.med.ph armacy.pep s.common.v o.FieldKey ;
  15   import gov .va.med.ph armacy.pep s.common.v o.Ingredie ntVo;
  16   import gov .va.med.ph armacy.pep s.common.v o.ManagedI temVo;
  17   import gov .va.med.ph armacy.pep s.common.v o.RequestI temStatus;
  18   import gov .va.med.ph armacy.pep s.common.v o.UserVo;
  19   import gov .va.med.ph armacy.pep s.common.v o.VuidStat usHistoryV o;
  20   import gov .va.med.ph armacy.pep s.common.v o.diff.Dif ference;
  21   import gov .va.med.ph armacy.pep s.external .common.pr eencapsula tion.utili ty.update. item.DrugI ngredientC onverter;
  22   import gov .va.med.ph armacy.pep s.external .common.vo .outbound. common.Ite mAction;
  23   import gov .va.med.ph armacy.pep s.service. common.cap ability.Nd fFileSyncC apability;
  24   import gov .va.med.ph armacy.pep s.service. common.upd ate.NdfFil eSyncProce ssor;
  25  
  26  
  27   /**
  28    * This cl ass implem ents metho ds which p opulate th e new NDF  outgoing d ifference  table usin g the exis ting 
  29    * vaDispe nseUnitSyn cRequest o bject for  vista file  50.416 de finition a nd KID bui ld output  for adds a nd modific ations of 
  30    * PPS VA  drug Ingre dients dat a.
  31    * 
  32    * @author        DNS
  33    * @versio n 1.0
  34    */
  35   public cla ss DrugIng redientsNd fFileSyncP rocessor e xtends Abs tractSimpl eNdfFileSy ncProcesso r implemen ts NdfFile SyncProces sor {
  36      
  37       /** Th e logger.  */
  38       privat e static f inal org.a pache.logg ing.log4j. Logger LOG  = org.apa che.loggin g.log4j.Lo gManager.g etLogger(
  39           Dr ugIngredie ntsNdfFile SyncProces sor.class) ;
  40       
  41       privat e static f inal Strin g MASTER_V UID_FIELD_ NUMBER = " 99.98";
  42       privat e static f inal Strin g VUID_FIE LD_NUMBER  = "99.99";
  43       privat e static f inal Strin g VUID_STA TUS_EFFECT IVE_DATE_F IELD_NUMBE R = "99.99 1,.01";
  44       privat e static f inal Strin g VUID_STA TUS_FIELD_ NUMBER = " 99.991,.02 ";
  45       privat e static f inal Strin g PRIMARY_ INGREDIENT  = "2";
  46       privat e static f inal Strin g INACTIVA TION_DATE  = "3";
  47       
  48       /** Fi eldKeys of  the field s that, if  modified,  would be  processed  by the mod ification  logic of t his proces sor. */
  49       public  static fi nal Set<Fi eldKey> FI ELDS = Col lections.u nmodifiabl eSet(new L inkedHashS et<FieldKe y>(Arrays
  50       .asLis t(
  51           // TODO: Need  to test i f CODE is  actually r elevent, o r if we sh ould be lo oking for  VALUE
  52           Fi eldKey.COD E, 
  53           Fi eldKey.INA CTIVATION_ DATE, 
  54           Fi eldKey.PRI MARY_INGRE DIENT,
  55           Fi eldKey.MAS TER_ENTRY_ FOR_VUID, 
  56           Fi eldKey.ITE M_STATUS
  57           )) );
  58       
  59       privat e static f inal Strin g FILE_NUM BER = "50. 416";
  60       privat e static f inal Strin g DRUG_ING REDIENT_IE N_FIELD_NU MBER = ".0 1";
  61  
  62       /**
  63        * Ins tantiates  a new Drug Ingredient sNdfFileSy ncProcesso r.
  64        *
  65        * @pa ram pNdfFi leSyncCapa bility the  ndf file  sync capab ility
  66        * @se e Abstract SimpleNdfF ileSyncPro cessor#Abs tractSimpl eNdfFileSy ncProcesso r(Set, Str ing, Strin g)
  67        */
  68       public  DrugIngre dientsNdfF ileSyncPro cessor(Ndf FileSyncCa pability p NdfFileSyn cCapabilit y) {
  69           su per(FIELDS , FILE_NUM BER, DRUG_ INGREDIENT _IEN_FIELD _NUMBER, p NdfFileSyn cCapabilit y);
  70        }
  71  
  72       @Overr ide
  73       public  void proc essNew(Man agedItemVo  managedIt em, UserVo  user) {
  74           //  Inserts n ew record  into EplNd fOutgoingD ifferences  table.
  75          
  76           In gredientVo  drugIngre dients = ( Ingredient Vo) manage dItem;
  77           
  78           St ring userN ame  = use r.getUsern ame();
  79             
  80           St ring vUID  = StringUt ils.isNotB lank(drugI ngredients .getVuid() ) ? drugIn gredients. getVuid()  : VistaFil e.BLANK;
  81           St ring maste rEntryForV UID = drug Ingredient s.getMaste rEntryForV uid() ? "1 " : "0";
  82           
  83           if  ((StringU tils.isNot Empty(drug Ingredient s.getValue ())) 
  84                && (Requ estItemSta tus.APPROV ED.equals( drugIngred ients.getR equestItem Status())  )) {
  85                                
  86                insertNe wElement(d rugIngredi ents.getNd fIngredien tIen(), dr ugIngredie nts.getVal ue(), user Name);
  87                
  88                //primar y ingredie nt
  89                if(drugI ngredients .getPrimar yIngredien t() != nul l)
  90                    inse rtNewChild Element(dr ugIngredie nts.getNdf Ingredient Ien(), 
  91                         drugIngred ients.getP rimaryIngr edient().g etNdfIngre dientIen() , userName , PRIMARY_ INGREDIENT );
  92                
  93                // Maste r entry fo r vuid
  94                insertNe wChildElem ent(drugIn gredients. getNdfIngr edientIen( ), masterE ntryForVUI D, userNam e, 
  95                    MAST ER_VUID_FI ELD_NUMBER );
  96                
  97                //VUID e ntry
  98                insertNe wChildElem ent(drugIn gredients. getNdfIngr edientIen( ), vUID, u serName, V UID_FIELD_ NUMBER);
  99                
  100                //Effect ive Date
  101                if (null  != drugIn gredients. getEffecti veDates()  && drugIng redients.g etEffectiv eDates().s ize()>0) {
  102                    
  103                    int  counter =  0;
  104                    
  105                    Stri ngBuffer s Buf = new  StringBuff er();
  106  
  107                    for  (VuidStatu sHistoryVo  effective Date : dru gIngredien ts.getEffe ctiveDates ()) {
  108                        
  109                         counter +=  1;
  110                        
  111                         String vis taIENChild  = sBuf.ap pend(drugI ngredients .getNdfIng redientIen ()).append (",")
  112                             .appen d(counter) .toString( );
  113  
  114                         insertNewC hildElemen t(vistaIEN Child, Mum psConverte r.convertD ate(effect iveDate.ge tEffective DateTime() ), 
  115                             userNa me, VUID_S TATUS_EFFE CTIVE_DATE _FIELD_NUM BER);
  116                        
  117                         insertNewC hildElemen t(vistaIEN Child, eff ectiveDate .getItemSt atus().isA ctive() ?  "1" : "0",  userName,  
  118                             VUID_S TATUS_FIEL D_NUMBER);
  119                    }
  120                   } els e {     
  121                     //T ODO: Need  to throw a n exceptio n and disp lay an err or to the  user.
  122                    LOG. error("Dru g Ingredie nts Effect ive Date C annot be N ull. " 
  123                         + "This fi eld should  be popula ted as it' s a requir ed Field." );
  124                }          
  125           }
  126       }
  127  
  128      
  129       @Overr ide
  130       public  void proc essModifie d(ManagedI temVo mana gedItem, U serVo user , Collecti on<Differe nce> diffe rences) {
  131  
  132           //  Inserts e ither new  record or  updates ol der one in  the EplNd fOutgoingD ifferences  table.
  133  
  134           Ma p<FieldKey , Differen ce> setDif ference =  Difference .toDiffere nceMap(dif ferences);
  135  
  136           bo olean hasD ifferences  = DrugIng redientCon verter.has NewOrModif iedFields( FIELDS, se tDifferenc e, ItemAct ion.MODIFY );
  137           if  (hasDiffe rences) {                   
  138  
  139                Ingredie ntVo drugI ngredients  = (Ingred ientVo) ma nagedItem;
  140  
  141                if ((Str ingUtils.i sNotEmpty( drugIngred ients.getV alue())) 
  142                    && ( RequestIte mStatus.AP PROVED.equ als(drugIn gredients. getRequest ItemStatus ()) )) {
  143  
  144                   //dif f object u ses item s tatus when  modificat ion is for  activatio n/inactiva tion  
  145                    if(D rugIngredi entConvert er.fieldWa sModified( FieldKey.I TEM_STATUS , differen ces)){
  146                         if(drugIng redients.g etInactiva tionDate()  != null){
  147                             insert ModifiedEl ement(drug Ingredient s.getNdfIn gredientIe n(),
  148                                 Mu mpsConvert er.convert Date(drugI ngredients .getInacti vationDate ()), 
  149                                 us er.getUser name(),INA CTIVATION_ DATE,null) ;
  150                         }else{
  151                             insert ModifiedEl ement(drug Ingredient s.getNdfIn gredientIe n(),VistaF ile.BLANK,  
  152                                 us er.getUser name(),INA CTIVATION_ DATE,null) ;
  153                         }
  154                    }
  155                    
  156                    if(D rugIngredi entConvert er.fieldWa sModified( FieldKey.P RIMARY_ING REDIENT,di fferences) ){
  157                         if(drugIng redients.g etPrimaryI ngredient( ) != null) {
  158                             insert ModifiedEl ement(drug Ingredient s.getNdfIn gredientIe n(),
  159                                 dr ugIngredie nts.getPri maryIngred ient().get NdfIngredi entIen(), 
  160                                 us er.getUser name(),PRI MARY_INGRE DIENT,null );
  161                         }else{
  162                             insert ModifiedEl ement(drug Ingredient s.getNdfIn gredientIe n(),VistaF ile.BLANK,  
  163                                 us er.getUser name(),PRI MARY_INGRE DIENT,null );
  164                         }
  165                    }
  166                    
  167                    if(D rugIngredi entConvert er.fieldWa sModified( FieldKey.M ASTER_ENTR Y_FOR_VUID ,differenc es)){
  168                         insertModi fiedElemen t(drugIngr edients.ge tNdfIngred ientIen(),
  169                             drugIn gredients. getMasterE ntryForVui d() ? "1"  : "0", use r.getUsern ame(),MAST ER_VUID_FI ELD_NUMBER ,null);
  170                    }
  171                }
  172           }
  173       } 
  174   }