25. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 3/24/2017 5:17:18 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.

25.1 Files compared

# Location File Last Modified
1 MHV_2017.2.0.0 Code In Flight.zip\National Portal\mhv_rxrefill\mhv-rx-refill-portal-main\src\main\java\gov\va\med\domain\persistence\util FunctionLookup.java Wed May 25 17:23:34 2016 UTC
2 MHV_2017.2.0.0 Code In Flight.zip\National Portal\mhv_rxrefill\mhv-rx-refill-portal-main\src\main\java\gov\va\med\domain\persistence\util FunctionLookup.java Fri Mar 24 20:32:00 2017 UTC

25.2 Comparison summary

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

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

25.4 Active regular expressions

No regular expressions were active.

25.5 Comparison detail

  1   package go v.va.med.d omain.pers istence.ut il;
  2  
  3   import gov .va.med.mh v.rxrefill .data.mode l.Function ;
  4   import gov .va.med.mh v.rxrefill .data.repo sitory.Fun ctionRepos itory;
  5   import gov .va.med.mh v.rxrefill .exception .MHVRuntim eException ;
  6  
  7   import jav a.util.Arr ayList;
  8   import jav a.util.Col lection;
  9   import jav a.util.Has hMap;
  10   import jav a.util.Ite rator;
  11   import jav a.util.Lis t;
  12  
  13   import org .apache.lo gging.log4 j.LogManag er;
  14   import org .apache.lo gging.log4 j.Logger;
  15   import org .springfra mework.bea ns.factory .annotatio n.Autowire d;
  16   import org .springfra mework.ste reotype.Co mponent;
  17  
  18   /**
  19    * @author   PII
  20    * @versio n $Id: Fun ctionLooku p.java,v 1 .4 2005/08 /09 13:45: 25 ed.brun dage Exp $
  21    * @since  MHV 2.0 <b r>04/27/20 05
  22    */
  23   @Component
  24   public cla ss Functio nLookup {
  25  
  26           pr ivate stat ic Logger  log = LogM anager.get Logger(Fun ctionLooku p.class);
  27  
  28           pr ivate stat ic HashMap <String, F unction> m apById = n ew HashMap ();
  29           pr ivate stat ic Functio nLookup in stance = n ull;
  30           pr ivate stat ic long la stLoadTime ;
  31           pr ivate stat ic final l ong REFRES H_INTERVAL _MILLIS =  600000;
  32  
  33           @A utowired
  34           pr ivate Func tionReposi tory funct ionReposit ory;
  35  
  36           // loading Fu nctionLook up using S pring IOC
  37           /* protected  FunctionLo okup() {
  38                    supe r();
  39                    load ();
  40           }* /
  41  
  42           pu blic void  load() {
  43                    sync hronized(m apById) {
  44                             /*Func tionDAO da o = (Funct ionDAO)Obj ectFactory .getBean(M essagingCo nstants.FU NCTION_DAO _BEAN_NAME );
  45                             List l ist = dao. listAll();
  46                             Iterat or iter =  list.itera tor();
  47                             mapByI d = new Ha shMap();
  48                             while( iter.hasNe xt()) {
  49                                      Function  function  = (Functio n)iter.nex t();
  50                                      mapById. put(functi on.getFunc tionName() , function );
  51                             }*/
  52  
  53                             mapByI d = new Ha shMap<Stri ng, Functi on>();
  54  
  55                             List<g ov.va.med. mhv.rxrefi ll.data.mo del.Functi on> functi onList = n ull;
  56                             try {
  57                                      function List = fun ctionRepos itory.find All();
  58                             } catc h(Exceptio n e) {
  59                                      log.erro r("Error i n fetching  values fr om FUNCTIO NS table",  e);
  60                                      throw ne w MHVRunti meExceptio n("Error i n fetching  values fr om FUNCTIO NS table",  e);
  61                             }
  62  
  63                             if (nu ll != func tionList & & function List.size( ) > 0) {
  64                                      for(Func tion funct ion : func tionList)  {
  65                                               mapById.pu t(function .getFuncti onName(),  function);
  66                                      }
  67                             }
  68  
  69                             lastLo adTime = S ystem.curr entTimeMil lis();
  70                    }
  71           }
  72  
  73           pu blic stati c Function Lookup get Instance()  {
  74                    if(i nstance ==  null) {
  75                             instan ce = new F unctionLoo kup();
  76                    }
  77  
  78           //  Temporary  code unti l a better  way is fo und to ref resh witho ut bouncin g the serv er.
  79                synchron ized (Func tionLookup .class)
  80                {
  81                    if ( System.cur rentTimeMi llis() - l astLoadTim e > REFRES H_INTERVAL _MILLIS) {
  82                         instance.l oad();
  83                    }
  84                }
  85                    retu rn instanc e;
  86           }
  87  
  88           pu blic Funct ion getByI d(String f unctionNam e) {
  89                    retu rn (Functi on) mapByI d.get(func tionName);
  90           }
  91  
  92           pu blic Colle ction getA ll() {
  93                    retu rn mapById .values();
  94           }
  95  
  96           pu blic List  getByCateg oryId(Stri ng categor yId) {
  97                    Arra yList resu lt = new A rrayList() ;
  98                    Iter ator itera tor = getA ll().itera tor();
  99                    whil e(iterator .hasNext() ) {
  100                             Functi on tmp = ( Function)i terator.ne xt();
  101                             if(((S tring)tmp. getCategor yType().ge tId()).equ als(catego ryId))
  102                                      result.a dd(tmp);
  103                    }
  104                    retu rn result;
  105           }
  106  
  107           pu blic Long  getIdByFun ctionName( String fun ctionName)  {
  108                    Long  result =  null;
  109                    Iter ator itera tor = getA ll().itera tor();
  110                    whil e (iterato r.hasNext( )) {
  111                             Functi on tmp = ( Function)  iterator.n ext();
  112                             if(tmp .getFuncti onName().e quals(func tionName))
  113                                      if (tmp. getId() !=  null &&
  114                                      tmp.getI d() instan ceof Long)  {
  115                                               result = ( Long) tmp. getId();
  116                                               break;
  117                                      }
  118                    }
  119                    retu rn result;
  120           }
  121  
  122   }