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

4215.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\jpa\impl LocationJpaController.java Fri Apr 21 20:03:30 2017 UTC

4215.2 Comparison summary

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

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

4215.4 Active regular expressions

No regular expressions were active.

4215.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.jpa.imp l;
        6  
        7   import gov .va.nvap.s vc.facilit y.data.Fac ility;
        8   import gov .va.nvap.s vc.facilit y.data.Loc ation;
        9   import gov .va.nvap.s vc.facilit y.intf.Ent ityDoesNot ExistExcep tion;
        10   import gov .va.nvap.s vc.facilit y.intf.Pre existingEn tityExcept ion;
        11   import gov .va.nvap.s vc.facilit y.jpa.intf .LocationC ontrollerI nterface;
        12  
        13   import jav a.util.Col lection;
        14   import jav a.util.Lis t;
        15  
        16   import jav ax.persist ence.Entit yManager;
        17   import jav ax.persist ence.Entit yNotFoundE xception;
        18   import jav ax.persist ence.Persi stenceCont ext;
        19   import jav ax.persist ence.Query ;
        20  
        21   /**
        22    * 
        23    * @author  Anand Sas try
        24    * 
        25    */
        26   public cla ss Locatio nJpaContro ller imple ments Loca tionContro llerInterf ace {
        27  
        28           @P ersistence Context(na me = "VapE ntityManag er")
        29           pr ivate Enti tyManager  entityMana ger;
        30  
        31           @O verride
        32           pu blic void  create(fin al Locatio n location )
        33                             throws  Preexisti ngEntityEx ception, E xception {
        34                    try  {
        35                             this.e ntityManag er.persist (location) ;
        36                    } ca tch (final  Exception  ex) {
        37                             if (th is.findLoc ation(loca tion.getLo cationId() ) != null)  {
        38                                      throw ne w Preexist ingEntityE xception(" Location "  + locatio n
        39                                                       +  " already  exists.",  ex);
        40                             }
        41                             throw  ex;
        42                    }
        43           }
        44  
        45           pu blic void  destroy(fi nal Long i d) throws  EntityDoes NotExistEx ception {
        46                    this .entityMan ager.getTr ansaction( ).begin();
        47                    Loca tion locat ion;
        48                    try  {
        49                             locati on = this. entityMana ger.getRef erence(Loc ation.clas s, id);
        50                             locati on.getLoca tionId();
        51                    } ca tch (final  EntityNot FoundExcep tion enfe)  {
        52                             throw  new Entity DoesNotExi stExceptio n("The loc ation with  id " + id
        53                                               + " no lon ger exists .", enfe);
        54                    }
        55                    this .entityMan ager.remov e(location );
        56                    this .entityMan ager.getTr ansaction( ).commit() ;
        57           }
        58  
        59           @O verride
        60           pu blic void  edit(Locat ion locati on) throws  EntityDoe sNotExistE xception,
        61                             Except ion {
        62                    try  {
        63                             locati on = this. entityMana ger.merge( location);
        64                    } ca tch (final  Exception  ex) {
        65                             final  String msg  = ex.getL ocalizedMe ssage();
        66                             if ((m sg == null ) || (msg. length() = = 0)) {
        67                                      final Lo ng id = lo cation.get LocationId ();
        68                                      if (this .findLocat ion(id) ==  null) {
        69                                               throw new  EntityDoes NotExistEx ception(
        70                                                                "The  location  with id "  + id + " n o longer e xists.");
        71                                      }
        72                             }
        73                             throw  ex;
        74                    }
        75           }
        76  
        77           @O verride
        78           pu blic Colle ction<Loca tion> find ActiveLoca tions() {
        79                    fina l Query q  = this.ent ityManager
        80                                      .createN amedQuery( "Location. findByActi ve");
        81                    q.se tParameter ("active",  'Y');
        82                    retu rn q.getRe sultList() ;
        83           }
        84  
        85           @O verride
        86           pu blic Colle ction<Loca tion> find ByFacility (final Fac ility faci lity)
        87                             throws  EntityDoe sNotExistE xception {
        88                    try  {
        89                             final  Query q =  this.entit yManager
        90                                               .createNam edQuery("L ocation.fi ndByFacili ty");
        91                             q.setP arameter(" facility",  facility) ;
        92                             return  q.getResu ltList();
        93                    } ca tch (Excep tion e) {
        94                             String  facilityS tation = ( facility ! = null) ?  facility
        95                                               .getFacili tyStation( ) : "null" ;
        96                             throw  new Entity DoesNotExi stExceptio n(
        97                                               "Cannot fi nd Locatio n for faci lity [" +  facilitySt ation
        98                                                                + "] . ", e);
        99                    }
        100  
        101           }
        102  
        103           @O verride
        104           pu blic Locat ion findBy LocationCo de(final S tring loca tionCode)
        105                             throws  EntityDoe sNotExistE xception {
        106                    try  {
        107                             final  Query q =  this.entit yManager
        108                                               .createNam edQuery("L ocation.fi ndByLocati onCode");
        109                             q.setP arameter(" locationCo de", locat ionCode);
        110                             return  (Location ) q.getSin gleResult( );
        111                    } ca tch (Excep tion e) {
        112                             throw  new Entity DoesNotExi stExceptio n(
        113                                               "Cannot fi nd Locatio n for loca tionCode [ " + locati onCode
        114                                                                + "] . ", e);
        115                    }
        116  
        117           }
        118  
        119           @O verride
        120           pu blic Locat ion findLo cation(fin al Long id ) {
        121                    retu rn this.en tityManage r.find(Loc ation.clas s, id);
        122           }
        123  
        124           @O verride
        125           pu blic List< Location>  findLocati onEntities () {
        126                    retu rn this.fi ndLocation Entities(t rue, -1, - 1);
        127           }
        128  
        129           pr ivate List <Location>  findLocat ionEntitie s(final bo olean all,
        130                             final  int maxRes ults, fina l int firs tResult) {
        131                    fina l Query q  = this.ent ityManager
        132                                      .createQ uery("sele ct object( o) from Lo cation as  o");
        133                    if ( !all) {
        134                             q.setM axResults( maxResults );
        135                             q.setF irstResult (firstResu lt);
        136                    }
        137                    retu rn q.getRe sultList() ;
        138           }
        139  
        140           @O verride
        141           pu blic List< Location>  findLocati onEntities (final int  maxResult s,
        142                             final  int firstR esult) {
        143                    retu rn this.fi ndLocation Entities(f alse, maxR esults, fi rstResult) ;
        144           }
        145  
        146           pu blic int g etLocation Count() {
        147                    fina l Query q  = this.ent ityManager
        148                                      .createQ uery("sele ct count(o ) from Loc ation as o ");
        149                    retu rn ((Long)  q.getSing leResult() ).intValue ();
        150           }
        151  
        152           pu blic void  setEntityM anager(fin al EntityM anager ent ityManager ) {
        153                    this .entityMan ager = ent ityManager ;
        154           }
        155   }