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

152.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 VADrugClassNdfFileSyncProcessor.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 VADrugClassNdfFileSyncProcessor.java Wed Mar 7 01:56:59 2018 UTC

152.2 Comparison summary

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

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

152.4 Active regular expressions

No regular expressions were active.

152.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.DrugClas sVo;
  15   import gov .va.med.ph armacy.pep s.common.v o.FieldKey ;
  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.DrugC lassConver ter;
  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.605 de finition a nd KID bui ld output  for adds a nd modific ations of 
  30    * PPS VA  drug class  data.
  31    *
  32    * @author       DNS
  33    * @versio n 1.0
  34    */
  35   public cla ss VADrugC lassNdfFil eSyncProce ssor exten ds Abstrac tSimpleNdf FileSyncPr ocessor im plements N dfFileSync Processor  {
  36  
  37       privat e static f inal org.a pache.logg ing.log4j. Logger LOG  = org.apa che.loggin g.log4j.Lo gManager.g etLogger(
  38           VA DrugClassN dfFileSync Processor. class);
  39  
  40       privat e static f inal Strin g FILE_NUM BER = "50. 605";
  41       privat e static f inal Strin g DRUG_CLA SS_IEN_FIE LD_NUMBER  = ".01";     
  42       
  43       privat e static f inal Strin g MASTER_V UID_FIELD_ NUMBER = " 99.98";
  44       privat e static f inal Strin g VUID_FIE LD_NUMBER  = "99.99";
  45       privat e static f inal Strin g EFFECTIV E_DATE_TIM E_FIELD_NU MBER = "99 .991,.01";
  46       privat e static f inal Strin g EFFECTIV E_DATE_STA TUS_FIELD_ NUMBER = " 99.991,.02 ";
  47       privat e static f inal Strin g CLASSIFI CATION_FIE LD_NUMBER  = "1";
  48       privat e static f inal Strin g PARENT_C LASS_FIELD _NUMBER =  "2";
  49       privat e static f inal Strin g TYPE_FIE LD_NUMBER  = "3";
  50       
  51       /**
  52        * The  field num ber for th e VA Drug  Class Desc ription fi eld.
  53        */
  54       public  static fi nal String  DESCRIPTI ON_FIELD_N UMBER = "4 ";
  55  
  56       /** Th e Set of r elevant fi elds from  DrugClassV o. */
  57       public  static fi nal Set<Fi eldKey> FI ELDS = Col lections.u nmodifiabl eSet(new L inkedHashS et<FieldKe y>(Arrays
  58       .asLis t(
  59           Fi eldKey.COD E, 
  60           Fi eldKey.CLA SSIFICATIO N, 
  61           Fi eldKey.PAR ENT_DRUG_C LASS,
  62           Fi eldKey.CLA SSIFICATIO N_TYPE,
  63           Fi eldKey.DES CRIPTION, 
  64           Fi eldKey.ITE M_STATUS
  65           )) );
  66  
  67       /**
  68        * Ins tantiates  a new VADr ugClassNdf FileSyncPr ocessor.
  69        *
  70        * @pa ram pNdfFi leSyncCapa bility the  ndf file  sync capab ility
  71        * @se e Abstract SimpleNdfF ileSyncPro cessor#Abs tractSimpl eNdfFileSy ncProcesso r(Set, Str ing, Strin g)
  72        */
  73       public  VADrugCla ssNdfFileS yncProcess or(NdfFile SyncCapabi lity pNdfF ileSyncCap ability) {
  74           su per(FIELDS , FILE_NUM BER, DRUG_ CLASS_IEN_ FIELD_NUMB ER, pNdfFi leSyncCapa bility);
  75       }
  76  
  77       @Overr ide
  78       public  void proc essNew(Man agedItemVo  managedIt em, UserVo  user) {
  79           //  Inserts n ew record  into EplNd fOutgoingD ifferences  table.
  80  
  81           St ring userN ame = null ;
  82           St ring vUID  = null;
  83           St ring maste rEntryForV UID = null ;
  84  
  85           Dr ugClassVo  vaDrugClas s = (DrugC lassVo) ma nagedItem;
  86  
  87           us erName  =  user.getUs ername();
  88  
  89           vU ID = Strin gUtils.isN otBlank(va DrugClass. getVuid())  ? vaDrugC lass.getVu id() : Vis taFile.BLA NK;
  90  
  91           ma sterEntryF orVUID = v aDrugClass .isMasterE ntryForVui d() ? "1"  : "0";
  92  
  93           if  ((StringU tils.isNot Empty(vaDr ugClass.ge tValue()))  
  94                && (Requ estItemSta tus.APPROV ED.equals( vaDrugClas s.getReque stItemStat us()) )) {
  95  
  96                //code
  97                insertNe wElement(v aDrugClass .getDrugCl assIen(),  vaDrugClas s.getCode( ), userNam e);
  98  
  99                //classi fication -  required
  100                insertNe wChildElem ent(vaDrug Class.getD rugClassIe n(), vaDru gClass.get Classifica tion(), 
  101                    user Name, CLAS SIFICATION _FIELD_NUM BER);
  102  
  103                //parent  drug clas s
  104                if (vaDr ugClass.ge tParentDru gClass() ! = null) {
  105                    inse rtNewChild Element(va DrugClass. getDrugCla ssIen(), v aDrugClass .getParent DrugClass( ).getDrugC lassIen(),  
  106                         userName,  PARENT_CLA SS_FIELD_N UMBER);
  107                }
  108  
  109                //type -  required
  110                insertNe wChildElem ent(vaDrug Class.getD rugClassIe n(), Strin g.valueOf( vaDrugClas s.getClass ificationT ype().getC ode()),
  111                         userName,  TYPE_FIELD _NUMBER);
  112  
  113                //descri ption
  114                if(vaDru gClass.get Descriptio n() != nul l) {
  115                    inse rtNewChild Element(va DrugClass. getDrugCla ssIen(), v aDrugClass .getDescri ption(), 
  116                         userName,  DESCRIPTIO N_FIELD_NU MBER);
  117                }
  118  
  119                // Maste r entry fo r vuid
  120                //TODO c heck if th is is corr ect
  121                insertNe wChildElem ent(vaDrug Class.getD rugClassIe n(), maste rEntryForV UID, userN ame, MASTE R_VUID_FIE LD_NUMBER) ;
  122  
  123                //VUID e ntry
  124                insertNe wChildElem ent(vaDrug Class.getD rugClassIe n(), vUID,  userName,  VUID_FIEL D_NUMBER);
  125  
  126                //Effect ive Date
  127                if ((nul l != vaDru gClass.get EffectiveD ates()) &&  (vaDrugCl ass.getEff ectiveDate s().size() >0)) {
  128  
  129                    int  counter =  0;
  130  
  131                    Stri ngBuffer s Buf = new  StringBuff er();
  132  
  133                    for  (VuidStatu sHistoryVo  effective Date : vaD rugClass.g etEffectiv eDates())  {
  134  
  135                         counter +=  1;
  136  
  137                         String vis taIENChild  = sBuf.ap pend(vaDru gClass.get DrugClassI en()).appe nd(",").ap pend(count er).toStri ng();
  138  
  139                         insertNewC hildElemen t(vistaIEN Child, Mum psConverte r.convertD ate(effect iveDate.ge tEffective DateTime() ), 
  140                             userNa me, EFFECT IVE_DATE_T IME_FIELD_ NUMBER);
  141                         //required
  142                         insertNewC hildElemen t(vistaIEN Child, eff ectiveDate .getItemSt atus().isA ctive() ?  "1" : "0",  
  143                             userNa me, EFFECT IVE_DATE_S TATUS_FIEL D_NUMBER);
  144                    }
  145                } else {
  146                    LOG. error("Dru g Class Ef fective Da te Cannot  be Null. T his field  should be  populated  as it's a  required F ield.");
  147                }
  148           }
  149        }
  150  
  151  
  152       @Overr ide
  153       public  void proc essModifie d(ManagedI temVo mana gedItem, U serVo user , Collecti on<Differe nce> diffe rences) {
  154  
  155           //  Inserts e ither new  record or  updates ol der one in  the EplNd fOutgoingD ifferences  table.
  156  
  157           Ma p<FieldKey , Differen ce> setDif ference =  Difference .toDiffere nceMap(dif ferences);
  158  
  159           bo olean hasD ifferences  = DrugCla ssConverte r.hasNewOr ModifiedFi elds(FIELD S, setDiff erence, It emAction.M ODIFY);
  160           if  (hasDiffe rences) {
  161  
  162                DrugClas sVo vaDrug Class = (D rugClassVo ) managedI tem;
  163  
  164                if ( (St ringUtils. isNotEmpty (vaDrugCla ss.getValu e())) 
  165                    && ( RequestIte mStatus.AP PROVED.equ als(vaDrug Class.getR equestItem Status())  )) {
  166  
  167                    //pa rent drug  class
  168                    if ( DrugClassC onverter.f ieldWasMod ified(Fiel dKey.PAREN T_DRUG_CLA SS,differe nces)){
  169                         if(vaDrugC lass.getPa rentDrugCl ass() != n ull){
  170                             insert ModifiedEl ement(vaDr ugClass.ge tDrugClass Ien(), vaD rugClass.g etParentDr ugClass(). getDrugCla ssIen(),
  171                                                     user .getUserna me(), PARE NT_CLASS_F IELD_NUMBE R, null);
  172                         }else{
  173                             insert ModifiedEl ement(vaDr ugClass.ge tDrugClass Ien(), Vis taFile.BLA NK, 
  174                                 us er.getUser name(), PA RENT_CLASS _FIELD_NUM BER, null) ;
  175                         }
  176                    }
  177  
  178                    //ty pe - requi red
  179                    if ( DrugClassC onverter.f ieldWasMod ified(Fiel dKey.CLASS IFICATION_ TYPE, diff erences))  {
  180                         insertModi fiedElemen t(vaDrugCl ass.getDru gClassIen( ), 
  181                             String .valueOf(v aDrugClass .getClassi ficationTy pe().getCo de()), use r.getUsern ame(), 
  182                             TYPE_F IELD_NUMBE R, null);
  183                    }
  184  
  185                    //de scription
  186                    if(D rugClassCo nverter.fi eldWasModi fied(Field Key.DESCRI PTION, dif ferences)) {
  187                         if(vaDrugC lass.getDe scription( ) != null) {
  188                             insert ModifiedEl ement(vaDr ugClass.ge tDrugClass Ien(), vaD rugClass.g etDescript ion(), 
  189                                 us er.getUser name(), DE SCRIPTION_ FIELD_NUMB ER, null);
  190                         }else{
  191                             insert ModifiedEl ement(vaDr ugClass.ge tDrugClass Ien(), Vis taFile.BLA NK, 
  192                                 us er.getUser name(), DE SCRIPTION_ FIELD_NUMB ER, null);
  193                         }
  194                    }
  195                }
  196           }
  197       }
  198   }