156. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 12/13/2018 10:35:24 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.

156.1 Files compared

# Location File Last Modified
1 v12.5_iter_7_build 51.zip\TRM_Upgrade\src\main\java\gov\va\med\ccht\service\common\impl TerminologyServiceImpl.java Fri Dec 7 17:36:42 2018 UTC
2 v12.5_iter_7_build 51.zip\TRM_Upgrade\src\main\java\gov\va\med\ccht\service\common\impl TerminologyServiceImpl.java Thu Dec 13 14:58:42 2018 UTC

156.2 Comparison summary

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

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

156.4 Active regular expressions

No regular expressions were active.

156.5 Comparison detail

  1   /********* ********** ********** ********** ********** ********** *********
  2    * Copyrig ht � 2010  VHA. All r ights rese rved
  3    ********* ********** ********** ********** ********** ********** *********/
  4   package go v.va.med.c cht.servic e.common.i mpl;
  5  
  6   import jav a.util.Arr ays;
  7   import jav a.util.Col lection;
  8   import jav a.util.Has hMap;
  9   import jav a.util.Lis t;
  10   import jav a.util.Map ;
  11  
  12   import org .apache.co mmons.logg ing.LogFac tory;
  13   import org .springfra mework.bea ns.factory .annotatio n.Autowire d;
  14   import org .springfra mework.ste reotype.Se rvice;
  15  
  16   import gov .va.med.cc ht.persist ent.Termin ologyDAO;
  17   import gov .va.med.cc ht.service .common.Te rminologyE xception;
  18   import gov .va.med.cc ht.service .common.Te rminologyS ervice;
  19   import gov .va.med.fw .model.loo kup.Abstra ctLookup;
  20   import gov .va.med.fw .model.loo kup.Lookup ;
  21   import gov .va.med.fw .service.A bstractCom ponent;
  22   import gov .va.med.fw .util.Stop WatchLogge r;
  23  
  24   /**
  25    * IHTA IH TA_common  Jun 26, 20 10
  26    * 
  27    * @author   DN S
  28    */
  29   @Service
  30   public cla ss Termino logyServic eImpl exte nds Abstra ctComponen t implemen ts Termino logyServic e {
  31  
  32           @A utowired
  33           pr ivate Term inologyDAO  terminolo gyDAO;
  34  
  35           /*
  36            *  (non-Java doc)
  37            *  
  38            *  @see
  39            *  gov.va.me d.IHTA.ser vice.commo n.Terminol ogyService #findAll(j ava.lang.C lass
  40            *  )
  41            * /
  42           @S uppressWar nings("unc hecked")
  43           pu blic List  findAll(St ring termi nologyType ) throws T erminology Exception  {
  44                    /*
  45                     * F irst check  to see if  we are re questing a n enum cla ss that al so
  46                     * i mplements  Lookup - C PB
  47                     */
  48                    Clas s<?> clazz ;
  49                    try  {
  50                             clazz  = Class.fo rName(term inologyTyp e);
  51                             if (cl azz.isEnum () && Look up.class.i sAssignabl eFrom(claz z))
  52                                      return A rrays.asLi st(clazz.g etEnumCons tants());
  53                    } ca tch (Class NotFoundEx ception ig nored) {
  54                    }
  55  
  56                    /* O therwise,  return val ues from t he databas e */
  57                    try  {
  58                             return  terminolo gyDAO.find All(termin ologyType) ;
  59                    } ca tch (Excep tion ex) {
  60                             throw  new Termin ologyExcep tion("Erro r while lo oking up "  + termino logyType,  ex);
  61                    }
  62           }
  63  
  64           pu blic <T ex tends Look up> List<T > findAll( Class<T> t erminology Type) thro ws Termino logyExcept ion {
  65                    /*
  66                     * F irst check  to see if  we are re questing a n enum cla ss that al so
  67                     * i mplements  Lookup - C PB
  68                     */
  69                    if ( terminolog yType.isEn um() && Lo okup.class .isAssigna bleFrom(te rminologyT ype))
  70                             return  (List<T>)  Arrays.as List(termi nologyType .getEnumCo nstants()) ;
  71  
  72                    try  {
  73                             return  terminolo gyDAO.find All(termin ologyType) ;
  74                    } ca tch (Excep tion ex) {
  75                             throw  new Termin ologyExcep tion("Erro r while lo oking up "  + termino logyType,  ex);
  76                    }
  77           }
  78  
  79           /*
  80            *  (non-Java doc)
  81            *  
  82            *  @see
  83            *  gov.va.me d.IHTA.ser vice.commo n.Terminol ogyService #findAll(j ava.lang.C lass
  84            *  )
  85            * /
  86           pu blic <T ex tends Look up> List<T > findAllA ctive(Clas s<T> termi nologyType )
  87                             throws  Terminolo gyExceptio n {
  88                    /*
  89                     * F irst check  to see if  we are re questing a n enum cla ss that al so
  90                     * i mplements  Lookup - C PB
  91                     */
  92                    if ( terminolog yType.isEn um() && Lo okup.class .isAssigna bleFrom(te rminologyT ype))
  93                             return  (List<T>)  Arrays.as List(termi nologyType .getEnumCo nstants()) ;
  94  
  95                    try  {
  96                             return  terminolo gyDAO.find AllActive( terminolog yType);
  97                    } ca tch (Excep tion ex) {
  98                             throw  new Termin ologyExcep tion("Erro r while lo oking up "  + termino logyType.g etName(),
  99                                               ex);
  100                    }
  101           }
  102  
  103           /*
  104            *  (non-Java doc)
  105            *  
  106            *  @see
  107            *  gov.va.me d.IHTA.ser vice.commo n.Terminol ogyService #getByCode (java.lang
  108            *  .Class, j ava.lang.S tring)
  109            * /
  110           pu blic Looku p getByCod e(String t erminology Type, Stri ng code) t hrows Term inologyExc eption {
  111                    try  {
  112                             StopWa tchLogger  timer = ne w StopWatc hLogger("T erminology ServiceImp l.getByCod e for : "
  113                                               + terminol ogyType +  " " + code );
  114                             timer. start();
  115                             Lookup  result =  null;
  116  
  117                             /*
  118                              * Fir st check t o see if w e are requ esting an  enum class  that also
  119                              * imp lements Lo okup - CPB
  120                              */
  121                             Class< ?> clazz =  null;
  122  
  123                             try {
  124                                      clazz =  Class.forN ame(termin ologyType) ;
  125                             } catc h (ClassNo tFoundExce ption igno red) {
  126                             }
  127  
  128                             if (cl azz != nul l && clazz .isEnum()  && Lookup. class.isAs signableFr om(clazz))  {
  129                                      for (Obj ect o : cl azz.getEnu mConstants ()) {
  130                                               Lookup l =  (Lookup)  o;
  131  
  132                                               if (l.getC ode().equa ls(code))  {
  133                                                       re sult = l;
  134                                                       br eak;
  135                                               }
  136                                      }
  137                             } else  {
  138                                      result =  terminolo gyDAO.getB yCode(term inologyTyp e, code);
  139                             }
  140  
  141                             timer. stopAndLog ("done", L ogFactory. getLog(Sto pWatchLogg er.class)) ;
  142                             return  result;
  143                    } ca tch (Excep tion ex) {
  144                             throw  new Termin ologyExcep tion("Erro r while lo oking up "  + termino logyType
  145                                               + " for co de = " + c ode, ex);
  146                    }
  147           }
  148  
  149           pu blic <T ex tends Look up> Map<St ring, T> g etByCodes( Class<T> t erminology Type,
  150                             Collec tion<Strin g> codes)  throws Ter minologyEx ception {
  151                    Map< String, T>  results =  new HashM ap<String,  T>();
  152                    if ( terminolog yType.isEn um() && Lo okup.class .isAssigna bleFrom(te rminologyT ype)) {
  153                             for (T  l : termi nologyType .getEnumCo nstants())  {
  154                                      if (code s.contains (l.getCode ()))
  155                                               results.pu t(l.getCod e(), l);
  156                             }
  157                    } el se {
  158                             List<T > resultLi st = termi nologyDAO. getByCodes (terminolo gyType, co des);
  159                             for (T  e : resul tList)
  160                                      if (code s.contains (e.getCode ()))
  161                                               results.pu t(e.getCod e(), e);
  162                    }
  163  
  164                    retu rn results ;
  165           }
  166  
  167           /*
  168            *  (non-Java doc)
  169            *  
  170            *  @see
  171            *  gov.va.me d.IHTA.ser vice.commo n.Terminol ogyService #getByCode (java.lang
  172            *  .Class, j ava.lang.S tring)
  173            * /
  174           pu blic <T ex tends Look up> T getB yCode(Clas s<T> termi nologyType , String c ode)
  175                             throws  Terminolo gyExceptio n {
  176                    try  {
  177                             StopWa tchLogger  timer = ne w StopWatc hLogger("T erminology ServiceImp l.getByCod e for : "
  178                                               + terminol ogyType +  " " + code );
  179                             timer. start();
  180                             T resu lt = null;
  181  
  182                             if (te rminologyT ype.isEnum () && Look up.class.i sAssignabl eFrom(term inologyTyp e)) {
  183                                      for (T l  : termino logyType.g etEnumCons tants()) {
  184                                               if (l.getC ode().equa ls(code))  {
  185                                                       re sult = l;
  186                                                       br eak;
  187                                               }
  188                                      }
  189                             } else  {
  190                                      result =  terminolo gyDAO.getB yCode(term inologyTyp e, code);
  191                             }
  192  
  193                             timer. stopAndLog ("done", L ogFactory. getLog(Sto pWatchLogg er.class)) ;
  194                             return  result;
  195                    } ca tch (Excep tion ex) {
  196                             throw  new Termin ologyExcep tion("Erro r while lo oking up "  + termino logyType.g etName()
  197                                               + " for co de = " + c ode, ex);
  198                    }
  199           }
  200  
  201           /*
  202            *  (non-Java doc)
  203            *  
  204            *  @see
  205            *  gov.va.me d.IHTA.ser vice.commo n.Terminol ogyService #getByName (java.lang
  206            *  .Class, j ava.lang.S tring)
  207            * /
  208           pu blic <T ex tends Look up> T getB yName(Clas s<T> termi nologyType , String n ame)
  209                             throws  Terminolo gyExceptio n {
  210                    try  {
  211                             T resu lt = null;
  212  
  213                             if (te rminologyT ype.isEnum () && Look up.class.i sAssignabl eFrom(term inologyTyp e)) {
  214                                      for (T l  : termino logyType.g etEnumCons tants()) {
  215                                               if (l.getN ame().equa ls(name))  {
  216                                                       re sult = l;
  217                                                       br eak;
  218                                               }
  219                                      }
  220                             } else  {
  221                                      result =  terminolo gyDAO.getB yName(term inologyTyp e, name);
  222                             }
  223  
  224                             return  result;
  225                    } ca tch (Excep tion ex) {
  226                             throw  new Termin ologyExcep tion("Erro r while lo oking up "  + termino logyType.g etName()
  227                                               + " for co de = " + n ame, ex);
  228                    }
  229           }
  230  
  231           /*
  232            *  (non-Java doc)
  233            *  
  234            *  @see
  235            *  gov.va.me d.IHTA.ser vice.commo n.Terminol ogyService #getByName (java.lang
  236            *  .String,  java.lang. String)
  237            * /
  238           pu blic Looku p getByNam e(String t erminology Type, Stri ng name) t hrows Term inologyExc eption {
  239                    try  {
  240                             Lookup  result =  null;
  241  
  242                             /*
  243                              * Fir st check t o see if w e are requ esting an  enum class  that also
  244                              * imp lements Lo okup - CPB
  245                              */
  246                             Class< ?> clazz =  null;
  247  
  248                             try {
  249                                      clazz =  Class.forN ame(termin ologyType) ;
  250                             } catc h (ClassNo tFoundExce ption igno red) {
  251                             }
  252  
  253                             if (cl azz != nul l && clazz .isEnum()  && Lookup. class.isAs signableFr om(clazz))  {
  254                                      for (Obj ect o : cl azz.getEnu mConstants ()) {
  255                                               Lookup l =  (Lookup)  o;
  256  
  257                                               if (l.getN ame().equa ls(name))  {
  258                                                       re sult = l;
  259                                                       br eak;
  260                                               }
  261                                      }
  262                             } else  {
  263                                      result =  terminolo gyDAO.getB yName(term inologyTyp e, name);
  264                             }
  265  
  266                             return  result;
  267                    } ca tch (Excep tion ex) {
  268                             throw  new Termin ologyExcep tion("Erro r while lo oking up "  + termino logyType
  269                                               + " for co de = " + n ame, ex);
  270                    }
  271           }
  272  
  273           pu blic <T ex tends Look up> T getB yId(Class< T> termino logyType,  Long id)
  274                             throws  Terminolo gyExceptio n {
  275                    try  {
  276                             return  terminolo gyDAO.getB yId(termin ologyType,  id);
  277                    } ca tch (Excep tion e) {
  278                             throw  new Termin ologyExcep tion("Erro r while lo oking up "  + termino logyType
  279                                               + " for id  = " + id,  e);
  280                    }
  281           }
  282  
  283           pu blic Looku p getById( String ter minologyTy pe, Long i d) throws  Terminolog yException  {
  284                    try  {
  285                             return  terminolo gyDAO.getB yId(termin ologyType,  id);
  286                    } ca tch (Excep tion e) {
  287                             throw  new Termin ologyExcep tion("Erro r while lo oking up "  + termino logyType
  288                                               + " for id  = " + id,  e);
  289                    }
  290           }
  291           pu blic List< ? extends  Lookup> se archTerms( String ter minologyTy pe, String  searchCri teria) thr ows Termin ologyExcep tion
  292           {
  293                    try  {
  294                             return  terminolo gyDAO.sear chTerms(te rminologyT ype, searc hCriteria) ;
  295                    } ca tch (Excep tion e) {
  296                             throw  new Termin ologyExcep tion("Erro r while lo oking up "  + termino logyType
  297                                               + " for na me like =  " + search Criteria,  e);
  298                    }
  299           }
  300           pu blic void  save(Abstr actLookup  lookup) th rows Termi nologyExce ption {
  301                    try  {
  302                             termin ologyDAO.s ave(lookup );
  303                    } ca tch (Excep tion e) {
  304                             throw  new Termin ologyExcep tion("Erro r while sa ving refer ence data" ,e);
  305                    }
  306  
  307           }
  308  
  309  
  310   }