3210. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 6/9/2017 3:49:57 PM Eastern 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.

3210.1 Files compared

# Location File Last Modified
1 Fri Jun 9 19:49:57 2017 UTC
2 eHealth_Exch (eHealth Exchange Enhancements) Build 3 docs & code_May_2017.zip\VAP_CIF_CODE0502.zip\VAP_CIF_CODE0502\VAP_CIF_CODE0502\nvap-common\src\main\java\gov\va\nvap\common\splitter\regex RegExToMapSplitter.java Fri Apr 21 20:03:26 2017 UTC

3210.2 Comparison summary

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

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

3210.4 Active regular expressions

No regular expressions were active.

3210.5 Comparison detail

        1   package go v.va.nvap. common.spl itter.rege x;
        2  
        3   import gov .va.nvap.c ommon.spli tter.Split ter;
        4   import gov .va.nvap.c ommon.spli tter.Split terExcepti on;
        5   import gov .va.nvap.c ommon.vali dation.Nul lChecker;
        6   import gov .va.nvap.c ommon.date .DateUtil;
        7  
        8   import jav a.util.Arr ayList;
        9   import jav a.util.Dat e;
        10   import jav a.util.Has hMap;
        11   import jav a.util.Map ;
        12   import jav a.util.reg ex.Matcher ;
        13   import jav a.util.reg ex.Pattern ;
        14  
        15   import org .springfra mework.bea ns.factory .annotatio n.Required ;
        16  
        17   /**
        18    * Split t he string  into key/v alue pair  based on p osition.
        19    * 
        20    * @author  Asha Amri traj
        21    */
        22   public cla ss RegExTo MapSplitte r implemen ts
        23                    Spli tter<Strin g, Map<Str ing, Strin g>> {
        24  
        25           pr ivate Patt ern expres sion;
        26           pr ivate Patt ern facili tyIDExpres sion;
        27           pr ivate Patt ern correl ationDateE xpression;
        28           pr ivate int  matchGroup KeyPositio n;
        29           pr ivate int  matchGroup ValuePosit ion;
        30  
        31           @R equired
        32           pu blic void  setExpress ion(final  String exp ression) {
        33                    this .expressio n = Patter n.compile( expression , Pattern. DOTALL
        34                                      | Patter n.MULTILIN E);
        35           }
        36           
        37           @R equired
        38           pu blic void  setfacilit yIDExpress ion(final  String exp ression) {
        39                    this .facilityI DExpressio n = Patter n.compile( expression , Pattern. DOTALL
        40                                      | Patter n.MULTILIN E);
        41           }
        42           
        43           @R equired
        44           pu blic void  setcorrela tionDateEx pression(f inal Strin g expressi on) {
        45                    this .correlati onDateExpr ession = P attern.com pile(expre ssion, Pat tern.DOTAL L
        46                                      | Patter n.MULTILIN E);
        47           }
        48  
        49           @R equired
        50           pu blic void  setMatchGr oupKeyPosi tion(final  int match GroupKeyPo sition) {
        51                    this .matchGrou pKeyPositi on = match GroupKeyPo sition;
        52           }
        53  
        54           @R equired
        55           pu blic void  setMatchGr oupValuePo sition(fin al int mat chGroupVal uePosition ) {
        56                    this .matchGrou pValuePosi tion = mat chGroupVal uePosition ;
        57           }
        58  
        59           @O verride
        60           pu blic Map<S tring, Str ing> split (final Str ing src) t hrows Spli tterExcept ion {
        61                    if ( NullChecke r.isEmpty( src)) {
        62                             return  null;
        63                    }
        64                    fina l Map<Stri ng, String > property Map = new  HashMap<St ring, Stri ng>();
        65  
        66                    fina l Matcher  matcher =  this.expre ssion.matc her(src);
        67                    whil e (matcher .find()) {
        68                             final  String key  = matcher .group(thi s.matchGro upKeyPosit ion);
        69                             final  String val ue = match er.group(t his.matchG roupValueP osition);
        70                             if (Nu llChecker. isNotEmpty (key) && N ullChecker .isNotEmpt y(value))  {
        71                                      property Map.put(ke y, value);
        72                             }
        73                    }
        74                    retu rn propert yMap;
        75           }
        76           
        77           @O verride
        78           pu blic Map<S tring, Str ing> split AndFilter( final Stri ng src) th rows Split terExcepti on {
        79                    if ( NullChecke r.isEmpty( src)) {
        80                             return  null;
        81                    }
        82                    fina l Map<Stri ng, String > property Map = new  HashMap<St ring, Stri ng>();
        83                    
        84                    fina l Matcher  matcher =  this.expre ssion.matc her(src);
        85                    
        86                    // l oop throug h each fac ility
        87                    whil e (matcher .find()) {
        88                             final  String key  = matcher .group(thi s.matchGro upKeyPosit ion);
        89                             String  facilityR esponse =  matcher.gr oup(this.m atchGroupV aluePositi on);
        90                             
        91                             //get  the index  of the beg inning of  each separ ate respon se
        92                             ArrayL ist<Intege r> indexLi st = new A rrayList<I nteger>();
        93                             final  Matcher fa cilityMatc her = this .facilityI DExpressio n.matcher( facilityRe sponse);
        94                             
        95                             while( facilityMa tcher.find ()) {
        96                                      indexLis t.add(faci lityMatche r.start()  - key.leng th() - 1);
        97                             }
        98                             
        99                             //spli t the resp onse into  separate r esponses f or each up date
        100                             if(ind exList.siz e() > 1)
        101                             {
        102                                      String l atestRespo nse = null ;
        103                                      Date lat estDate =  null;
        104                                      
        105                                      for (int  i = 0; i  < indexLis t.size();  i++)
        106                                      {
        107                                               String cur rentRespon se = null;
        108                                               if(i == in dexList.si ze() - 1)
        109                                               {
        110                                                       cu rrentRespo nse = faci lityRespon se.substri ng(indexLi st.get(i),  facilityR esponse.le ngth());
        111                                               }
        112                                               else
        113                                               {
        114                                                       cu rrentRespo nse = faci lityRespon se.substri ng(indexLi st.get(i),  indexList .get(i+1)) ;
        115                                               }
        116                                              
        117                                               // find th e correlat ion date i n each sep arate resp onse
        118                                               final Matc her correl ationDateM atcher = t his.correl ationDateE xpression. matcher(cu rrentRespo nse);
        119                                               Date curre ntCorrelat ionDate =  null;
        120                                               if(correla tionDateMa tcher.find ()){
        121                                                       St ring dateS tring = co rrelationD ateMatcher .group(thi s.matchGro upValuePos ition);//. replace('@ ', ' ');
        122                                                       
        123                                                       cu rrentCorre lationDate  = DateUti l.dateFrom String(dat eString);
        124                                               }
        125                                              
        126                                               // compare  correlati on date an d store th e latest c orrelation
        127                                               // date wi th the sep arate resp onse
        128                                               if(latestD ate == nul l)
        129                                               {
        130                                                       la testDate =  currentCo rrelationD ate;
        131                                                       la testRespon se = curre ntResponse ;
        132                                               }
        133                                               else
        134                                               {
        135                                                       if (latestDat e.before(c urrentCorr elationDat e))
        136                                                       {
        137                                                                late stDate = c urrentCorr elationDat e;
        138                                                                late stResponse  = current Response;
        139                                                       }
        140                                               }
        141                                      }
        142                                      
        143                                      // add t he respons e with the  latest co rrelation  date to th e property Map
        144                                      final St ring value  = latestR esponse;
        145                                      if (Null Checker.is NotEmpty(k ey) && Nul lChecker.i sNotEmpty( value)) {
        146                                               propertyMa p.put(key,  value);
        147                                      }
        148                             }
        149                             else
        150                             {
        151                                      final St ring value  = matcher .group(thi s.matchGro upValuePos ition);
        152                                      if (Null Checker.is NotEmpty(k ey) && Nul lChecker.i sNotEmpty( value)) {
        153                                               propertyMa p.put(key,  value);
        154                                      }
        155                             }
        156  
        157                    }
        158                    retu rn propert yMap;
        159           }
        160   }