4113. EPMO Open Source Coordination Office Redaction File Detail Report

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

4113.1 Files compared

# Location File Last Modified
1 Fri Jun 9 19:51:17 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-consent-mgmt\src\main\java\gov\va\nvap\svc\consentmgmt\jpa FacilityJpaController.java Fri Apr 21 20:03:30 2017 UTC

4113.2 Comparison summary

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

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

4113.4 Active regular expressions

No regular expressions were active.

4113.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.consen tmgmt.jpa;
        6  
        7   import gov .va.nvap.s vc.consent mgmt.Facil ityControl lerInterfa ce;
        8   import gov .va.nvap.s vc.consent mgmt.jpa.e xceptions. Nonexisten tEntityExc eption;
        9   import gov .va.nvap.s vc.consent mgmt.jpa.e xceptions. Preexistin gEntityExc eption;
        10   import gov .va.nvap.s vc.consent mgmt.stub. data.Facil ity;
        11   import jav a.util.Col lection;
        12   import jav a.util.Lis t;
        13   import jav ax.persist ence.Entit yManager;
        14   import jav ax.persist ence.Entit yNotFoundE xception;
        15   import jav ax.persist ence.NoRes ultExcepti on;
        16   import jav ax.persist ence.Persi stenceCont ext;
        17   import jav ax.persist ence.Query ;
        18  
        19   /**
        20    *
        21    * @author  vhaislegb erb
        22    */
        23   public cla ss Facilit yJpaContro ller imple ments Faci lityContro llerInterf ace {
        24  
        25       @Persi stenceCont ext(name =  "VapEntit yManager")
        26       privat e EntityMa nager em;
        27  
        28       @Overr ide
        29       public  void crea te(final F acility fa cility)
        30           th rows Preex istingEnti tyExceptio n, Excepti on {
        31           tr y {
        32                this.em. persist(fa cility);
        33           }  catch (fin al Excepti on ex) {
        34                if (this .findFacil ity(facili ty.getFaci lityId())  != null) {
        35                    thro w new Pree xistingEnt ityExcepti on("Facili ty " + fac ility
        36                         + " alread y exists." , ex);
        37                }
        38                throw ex ;
        39           }
        40       }
        41  
        42       public  void dest roy(final  Long id) t hrows None xistentEnt ityExcepti on {
        43           th is.em.getT ransaction ().begin() ;
        44           Fa cility fac ility;
        45           tr y {
        46                facility  = this.em .getRefere nce(Facili ty.class,  id);
        47                facility .getFacili tyId();
        48           }  catch (fin al EntityN otFoundExc eption enf e) {
        49                throw ne w Nonexist entEntityE xception(" The facili ty with id  " + id
        50                    + "  no longer  exists.",  enfe);
        51           }
        52           th is.em.remo ve(facilit y);
        53           th is.em.getT ransaction ().commit( );
        54       }
        55  
        56       @Overr ide
        57       public  void edit (Facility  facility)  throws Non existentEn tityExcept ion,
        58           Ex ception {
        59           tr y {
        60                facility  = this.em .merge(fac ility);
        61           }  catch (fin al Excepti on ex) {
        62                final St ring msg =  ex.getLoc alizedMess age();
        63                if ((msg  == null)  || (msg.le ngth() ==  0)) {
        64                    fina l Long id  = facility .getFacili tyId();
        65                    if ( this.findF acility(id ) == null)  {
        66                         throw new  Nonexisten tEntityExc eption(
        67                             "The f acility wi th id " +  id + " no  longer exi sts.");
        68                    }
        69                }
        70                throw ex ;
        71           }
        72       }
        73  
        74       @Overr ide
        75       public  Collectio n<Facility > findAllo wedFacilit ies() {
        76           fi nal Query  q = this.e m.createNa medQuery(" Facility.f indByAllow ed");
        77           q. setParamet er("allowe d", true);
        78           re turn q.get ResultList ();
        79       }
        80  
        81       @Overr ide
        82       public  Facility  findFacili ty(final L ong id) {
        83           re turn this. em.find(Fa cility.cla ss, id);
        84       }
        85  
        86       @Overr ide
        87       public  Facility  findFacili tyByStatio n(final St ring stati onId) {
        88           fi nal Query  q = this.e m.createNa medQuery(" Facility.f indByFacil ityStation ");
        89           q. setParamet er("facili tyStation" , stationI d);
        90           Fa cility fac  = new Fac ility((gov .va.nvap.s vc.facilit y.data.Fac ility) q.g etSingleRe sult());
        91           re turn fac;
        92       }
        93  
        94       @Overr ide
        95       public  String fi ndFacility StationByN ame(final  String fac ilityName)  {
        96           fi nal Query  q = this.e m
        97                .createN amedQuery( "Facility. findByFaci lityName") ;
        98           q. setParamet er("facili tyName", f acilityNam e);
        99           tr y {
        100                return ( (String) q .getSingle Result());
        101           }  catch (NoR esultExcep tion e) {
        102                return n ull;
        103           }
        104       }
        105  
        106       @Overr ide
        107       public  List<Faci lity> find FacilityEn tities() {
        108           re turn this. findFacili tyEntities (true, -1,  -1);
        109       }
        110  
        111       privat e List<Fac ility> fin dFacilityE ntities(fi nal boolea n all,
        112           fi nal int ma xResults,  final int  firstResul t) {
        113           fi nal Query  q = this.e m
        114                .createQ uery("sele ct object( o) from Fa cility as  o");
        115           if  (!all) {
        116                q.setMax Results(ma xResults);
        117                q.setFir stResult(f irstResult );
        118           }
        119           re turn q.get ResultList ();
        120       }
        121  
        122       @Overr ide
        123       public  List<Faci lity> find FacilityEn tities(fin al int max Results,
        124           fi nal int fi rstResult)  {
        125           re turn this. findFacili tyEntities (false, ma xResults,  firstResul t);
        126       }
        127  
        128       @Overr ide
        129       public  Facility  findFacili tyByName(f inal Strin g facility Name) {
        130           // final Quer y q = this .em.create NamedQuery ("Facility .findFullB yFacilityN ame");
        131           fi nal Query  q = this.e m.createQu ery("SELEC T f FROM F acility f  WHERE lowe r(f.facili tyName) =  lower(:fac ilityName) ");
        132           q. setParamet er("facili tyName", f acilityNam e);
        133           tr y {
        134                return ( Facility)  q.getSingl eResult();
        135           }  catch (NoR esultExcep tion e) {
        136                return n ull;
        137           }
        138       }
        139  
        140       public  int getFa cilityCoun t() {
        141           fi nal Query  q = this.e m
        142                .createQ uery("sele ct count(o ) from Fac ility as o ");
        143           re turn ((Lon g) q.getSi ngleResult ()).intVal ue();
        144       }
        145  
        146       public  void setE ntityManag er(final E ntityManag er em) {
        147           th is.em = em ;
        148       }
        149   }