4208. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 6/9/2017 3:51:23 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.

4208.1 Files compared

# Location File Last Modified
1 Fri Jun 9 19:51:23 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-svc-facility\src\main\java\gov\va\nvap\svc\facility\impl FacilityServiceImpl.java Mon Jun 5 03:34:48 2017 UTC

4208.2 Comparison summary

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

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

4208.4 Active regular expressions

No regular expressions were active.

4208.5 Comparison detail

        1   /*
        2    * To chan ge this te mplate, ch oose Tools  | Templat es
        3    * and ope n the temp late in th e editor.
        4    */
        5   package go v.va.nvap. svc.facili ty.impl;
        6  
        7   import gov .va.nvap.c ommon.vali dation.Nul lChecker;
        8   import gov .va.nvap.s vc.facilit y.data.Fac ility;
        9   import gov .va.nvap.s vc.facilit y.data.Loc ation;
        10   import gov .va.nvap.s vc.facilit y.intf.Ent ityDoesNot ExistExcep tion;
        11   import gov .va.nvap.s vc.facilit y.intf.Fac ilityServi ceExceptio n;
        12   import gov .va.nvap.s vc.facilit y.intf.Fac ilityServi ce;
        13   import gov .va.nvap.s vc.facilit y.jpa.impl .FacilityJ paControll er;
        14   import gov .va.nvap.s vc.facilit y.jpa.impl .LocationJ paControll er;
        15   import gov .va.nvap.s vc.facilit y.jpa.intf .FacilityC ontrollerI nterface;
        16   import gov .va.nvap.s vc.facilit y.jpa.intf .LocationC ontrollerI nterface;
        17  
        18   import jav a.util.Col lection;
        19   import jav a.util.Loc ale;
        20   import jav a.util.Map ;
        21   import jav a.util.log ging.Level ;
        22   import jav a.util.log ging.Logge r;
        23  
        24   import org .springfra mework.bea ns.factory .annotatio n.Required ;
        25  
        26   /**
        27    * 
        28    * @author  Anand Sas try
        29    */
        30   public cla ss Facilit yServiceIm pl impleme nts Facili tyService  {
        31  
        32           pr ivate stat ic final L ogger logg er = Logge r.getLogge r(Facility Service.cl ass
        33                             .getNa me());
        34  
        35           pr ivate Faci lityContro llerInterf ace facili tyControll er;
        36           pr ivate Loca tionContro llerInterf ace locati onControll er;
        37           pr ivate Map< String, St ring> test UsersAndFa cilities;
        38  
        39           @O verride
        40           pu blic Colle ction<Faci lity> getA llowedVist AFacilitie s() {
        41                    retu rn this.fa cilityCont roller.fin dAllowedFa cilities() ;
        42           }
        43  
        44           @O verride
        45           // public Fac ility getF acilityByS tationId(f inal Strin g id)
        46           pu blic Facil ity getFac ilityBySta tionNumber (final Str ing statio nNumber) t hrows Enti tyDoesNotE xistExcept ion, Illeg alArgument Exception  {
        47                    if ( NullChecke r.isNullOr Empty(stat ionNumber) ) {
        48                             throw  new Illega lArgumentE xception(" Cannot fin d Facility  by Null O r Empty St ation Numb er");
        49                    }
        50                    retu rn this.fa cilityCont roller.fin dFacilityB yStationNu mber(stati onNumber);
        51           }
        52  
        53           @O verride
        54           pu blic Locat ion getLoc ationByCod e(final St ring locat ionCode) t hrows Enti tyDoesNotE xistExcept ion, Illeg alArgument Exception  {
        55                    if ( NullChecke r.isNullOr Empty(loca tionCode))  {
        56                             throw  new Illega lArgumentE xception(" Cannot fin d Location  by Null O r Empty Lo cation Cod e");
        57                    }
        58                    retu rn this.lo cationCont roller.fin dByLocatio nCode(loca tionCode);
        59           }
        60  
        61           @O verride
        62           pu blic Colle ction<Faci lity> getA llVistAFac ilities()  {
        63                    retu rn this.fa cilityCont roller.fin dFacilityE ntities();
        64           }
        65  
        66           @O verride
        67           //  public St ring getUs erFacility (String us erId) {
        68           pu blic Facil ity getVHA UserFacili ty(String  vhaUserId)  throws En tityDoesNo tExistExce ption {
        69                    if ( NullChecke r.isNullOr Empty(vhaU serId)) {
        70                             throw  new Illega lArgumentE xception(" Cannot fin d Facility  by Null O r Empty Us er Id");
        71                    }
        72                    if ( this.isTes tUser(vhaU serId)) {
        73                             if (lo gger.isLog gable(Leve l.INFO)) {
        74                             //       logger.i nfo("UserI d["
        75                             //                                          + vhaU serId
        76                             //                                          + "],  is a test  user. Retr ieving Fac ility from  Spring co nfiguratio n file");
        77                             }
        78                             return  getFacili tyByStatio nNumber(te stUsersAnd Facilities .get(vhaUs erId));
        79                    }
        80                    fina l String l ocationCod e = extrac tLocationC ode(vhaUse rId);
        81                    try   {
        82                             Locati on loc = g etLocation ByCode(loc ationCode) ;
        83                             return  loc.getFa cility();
        84                    } ca tch (Excep tion e) {
        85                             throw  new Entity DoesNotExi stExceptio n(
        86                                               "Cannot fi nd facilit y for User  Id [" + v haUserId +  "]. ",
        87                                               e);
        88                    }
        89  
        90           }
        91  
        92           //  Initializ ers
        93           //  Initializ e Facility  Controlle r
        94           @R equired
        95           pu blic void  setFacilit yControlle r(
        96                             final  FacilityJp aControlle r facility Controller ) {
        97                    this .facilityC ontroller  = facility Controller ;
        98           }
        99           
        100           @R equired
        101           //  Initializ e Location  Controlle r
        102           pu blic void  setLocatio nControlle r(
        103                             final  LocationJp aControlle r location Controller ) {
        104                    this .locationC ontroller  = location Controller ;
        105           }
        106           
        107           @R equired
        108           pu blic void  setTestUse rsAndFacil ities(
        109                             final  Map<String , String>  testUsersA ndFaciliti es) {
        110                    this .testUsers AndFacilit ies = test UsersAndFa cilities;
        111           }
        112  
        113           //  Private m ethods
        114  
        115           pr ivate stat ic String  extractLoc ationCode( String use rId) {
        116                    // U serID form at for VHA  User :
        117                    // < VHA><3Char LocationCo de><First5 LastName>< First1Firs tName>
        118                    // E x:         - 3 Char L ocation co de is ISW,  for one,  M Jordan ! !
        119                    // I n other wo rds this m ethod shou ld extract  character s between  3-6 from
        120                    // t he string.  -- Ugly a pproach
        121  
        122                    if ( NullChecke r.isNullOr Empty(user Id)) {
        123                             return  ""; // em pty
        124                    }
        125                    // L ocation co des are st ored in UC  in the DB
        126                    user Id = userI d.trim().t oUpperCase (Locale.EN GLISH);
        127                    // u serids are  at-least  6 chars in  length //  Note: "VH A"<LOC> is  6
        128                    // c hars.
        129                    if ( userId.sta rtsWith("V HA") && (u serId.leng th() >= 6) ) {
        130                             return  userId.su bstring(3,  6);
        131                    }
        132                    retu rn "";
        133           }
        134           
        135           pr ivate bool ean isTest User(final  String us erId) {
        136                    retu rn !NullCh ecker.isNu llOrEmpty( userId)
        137                                      && (this .testUsers AndFacilit ies != nul l)
        138                                      && this. testUsersA ndFaciliti es.keySet( ).contains (userId);
        139           }
        140   }