52. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 4/23/2019 12:14:44 PM Central 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.

52.1 Files compared

# Location File Last Modified
1 C:\AraxisMergeCompare\Pri_un\CCRS\CCRS-BUSRULES-v6.3\CCRS-BUSRULES-v6.3\brengine\src\main\java\gov\va\ccrs\brengine\seoc SeocRepositoryClient.java Wed Mar 27 19:38:08 2019 UTC
2 C:\AraxisMergeCompare\Pri_re\CCRS\CCRS-BUSRULES-v6.3\CCRS-BUSRULES-v6.3\brengine\src\main\java\gov\va\ccrs\brengine\seoc SeocRepositoryClient.java Wed Apr 17 02:39:10 2019 UTC

52.2 Comparison summary

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

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

52.4 Active regular expressions

No regular expressions were active.

52.5 Comparison detail

  1   package go v.va.ccrs. brengine.s eoc;
  2  
  3   import jav a.util.Arr ayList;
  4   import jav a.util.Has hSet;
  5   import jav a.util.Map ;
  6   import jav a.util.Set ;
  7   import jav a.util.str eam.Collec tors;
  8  
  9   import org .slf4j.Log ger;
  10   import org .slf4j.Log gerFactory ;
  11   import org .springfra mework.bea ns.factory .annotatio n.Autowire d;
  12   import org .springfra mework.bea ns.factory .annotatio n.Value;
  13   import org .springfra mework.con text.annot ation.Bean ;
  14   import org .springfra mework.sch eduling.an notation.S cheduled;
  15   import org .springfra mework.ste reotype.Co mponent;
  16   import org .springfra mework.web .client.Re stTemplate ;
  17  
  18   import com .fasterxml .jackson.c ore.type.T ypeReferen ce;
  19   import com .fasterxml .jackson.d atabind.Ma pperFeatur e;
  20   import com .fasterxml .jackson.d atabind.Ob jectMapper ;
  21   import com .fasterxml .jackson.d atatype.js r310.JavaT imeModule;
  22  
  23   import gov .va.ccrs.b rengine.se oc.dao.Seo cDao;
  24   import gov .va.ccrs.b rengine.se oc.dao.Seo cProcedure CodeDao;
  25  
  26   @Component
  27   public cla ss SeocRep ositoryCli ent {
  28  
  29       privat e final Lo gger logge r = Logger Factory.ge tLogger(ge tClass());
  30  
  31       // Met hod:GET--h eader'Acce pt:applica tion/json'
  32       // Req uest URLs:
  33         // Base UR L:'https:/ / <hostnam e>:<port>.  (e.g. htt ps:// DNS  .seocapi. DOMAIN . EXT )
  34       // All  SEOCs:/v1 /seoc
  35       // Act ive SEOCs: /v1/seoc/a ctive
  36       // SEO C by Name: /v1/seoc/n ame/{name}
  37       // SEO C by ID:/v 1/seoc/{id }
  38  
  39       @Value ("${seoc.r epository. webservice .url}")
  40       privat e String u rl;
  41  
  42       @Autow ired
  43       privat e ObjectMa pper objec tMapper;
  44  
  45       @Autow ired
  46       privat e SeocDao  seocDao;
  47  
  48       @Autow ired
  49       privat e SeocProc edureCodeD ao seocPro cedureCode Dao;
  50  
  51       privat e TypeRefe rence<?> m apTypeRef  = new Type Reference< Map<Object , Object>> () {
  52       };
  53  
  54       privat e TypeRefe rence<?> s eocRespons eMapTypeRe f = new Ty peReferenc e<ArrayLis t<Map<Obje ct, Map<Ob ject, Obje ct>>>>() {
  55       };
  56  
  57       privat e TypeRefe rence<?> s eocRespons eTypeRef =  new TypeR eference<A rrayList<M ap<Object,  Seoc>>>()  {
  58       };
  59  
  60       @Sched uled(cron  = "${seoc. repository .check.cro n}")
  61       public  void upda teActiveSe ocs() {
  62           va r seocObjs  = fetchSe ocsFromRep o("active" );
  63           va r seocName s = fetchS eocNames(s eocObjs);
  64  
  65           se ocNames.fo rEach(seoc Name -> {
  66                processS eocByName( seocName);
  67  
  68           }) ;
  69  
  70           lo gger.info( "SEOC Proc essing/Upd ating comp leted.");
  71       }
  72  
  73       public  void proc essSeocByN ame(String  seocName)  {
  74           tr y {
  75                var seoc Objs = fet chSeocsFro mRepo("nam e/" + seoc Name);
  76                seocObjs .forEach(s eocObj ->  {
  77                    var  seoc = fet chSeoc(seo cObj);
  78                    var  seocServic es = fetch Services(s eocObj);
  79                    proc essSeoc(se oc, seocSe rvices);
  80                });
  81           }  catch (Exc eption e)  {
  82                logger.e rror(e.get Message()  + " while  processing  " + seocN ame, e);
  83           }
  84       }
  85  
  86       privat e Set<Stri ng> fetchS eocNames(A rrayList<M ap<Object,  Map<Objec t, Object> >> seocObj s) {
  87           Ar rayList<Ma p<Object,  Seoc>> seo cList = ob jectMapper .convertVa lue(seocOb js, seocRe sponseType Ref);
  88           va r seocSet  = seocList .stream(). map(s -> s .get("Seoc ")).collec t(Collecto rs.toList( ));
  89           va r seocName s = seocSe t.stream() .map(Seoc: :name).col lect(Colle ctors.toSe t());
  90           re turn seocN ames;
  91       }
  92  
  93       privat e SeocServ ices[] fet chServices (Map<Objec t, Map<Obj ect, Objec t>> seocOb j) {
  94           Ma p<Object,  Object> se ocMap = ob jectMapper .convertVa lue(seocOb j.get("Seo c"), mapTy peRef);
  95           va r seocServ ices = obj ectMapper. convertVal ue(seocMap .get("serv ices"), Se ocServices [].class);
  96           re turn seocS ervices;
  97       }
  98  
  99       privat e Seoc fet chSeoc(Map <Object, M ap<Object,  Object>>  seocObj) {
  100           Se oc seoc =  objectMapp er.convert Value(seoc Obj.get("S eoc"), Seo c.class);
  101           re turn seoc;
  102       }
  103  
  104       privat e ArrayLis t<Map<Obje ct, Map<Ob ject, Obje ct>>> fetc hSeocsFrom Repo(Strin g endpoint ) {
  105           lo gger.info( "Checking  Seoc repos itory for  updates vi a: " + url  + "/" + e ndpoint);
  106           va r restTemp late = new  RestTempl ate();
  107           Ma p<Object,  Object> re sponse = o bjectMappe r.convertV alue(restT emplate.ge tForObject (url + "/"  + endpoin t, Object. class), ma pTypeRef);
  108           re turn objec tMapper.co nvertValue (response. get("Seocs "), seocRe sponseMapT ypeRef);
  109       }
  110  
  111       privat e void pro cessSeoc(S eoc seoc,  SeocServic es[] servi ces) {
  112           lo gger.info( "Processin g Seoc: "  + seoc.seo cId());
  113           if  (!seocExi sts(seoc))  {
  114                seoc = s eocDao.sav eAndFlush( seoc);
  115                processS eocService s(seoc, se rvices);
  116                logger.i nfo("Proce ssed SEOC:  " + seoc. seocId());
  117           }  else {
  118                logger.i nfo("SEOC  already ex ists, proc essing wil l be stopp ed: " + se oc.seocId( ));
  119           }
  120       }
  121  
  122       privat e void pro cessSeocSe rvices(Seo c seoc, Se ocServices [] service s) {
  123           va r stringSe t = new Ha shSet<Stri ng>();
  124           fo r (var ser vice : ser vices) {
  125                for (var  billingCo de : servi ce.billing Codes()) {
  126                    stri ngSet.add( billingCod e.billingC ode());
  127                    logg er.info("P rocessed b illing cod e: " + bil lingCode.b illingCode ());
  128                }
  129           }
  130  
  131           va r codeList  = stringS et.stream( ).map(s ->  new SeocP rocedureCo de(seoc, s )).collect (Collector s.toList() );
  132           se ocProcedur eCodeDao.s aveAll(cod eList);
  133       }
  134  
  135       privat e boolean  seocExists (Seoc seoc ) {
  136           va r testSeoc  = seocDao .findBySeo cSourceKey AndSeocId( seoc.seocS ourceKey() , seoc.seo cId());
  137           re turn testS eoc != nul l;
  138       }
  139  
  140       @Bean
  141       public  ObjectMap per object Mapper() {
  142           va r objectMa pper = new  ObjectMap per();
  143           ob jectMapper .registerM odule(new  JavaTimeMo dule());
  144           ob jectMapper .configure (MapperFea ture.ACCEP T_CASE_INS ENSITIVE_P ROPERTIES,  true);
  145           re turn objec tMapper;
  146       }
  147   }