Produced by Araxis Merge on 6/9/2017 3:51:27 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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Fri Jun 9 19:51:27 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-web\src\main\java\gov\va\nvap\web\patient | SetDefaultFacility.java | Fri Apr 21 20:15:58 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 159 |
| Removed | 0 | 0 |
| 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 |
No regular expressions were active.
| 1 | package go v.va.nvap. web.patien t; | |||||
| 2 | ||||||
| 3 | import gov .va.nvap.c ommon.vali dation.Nul lChecker; | |||||
| 4 | import gov .va.nvap.s vc.facilit y.data.Fac ility; | |||||
| 5 | import gov .va.nvap.w eb.helper. facility.F acilityHel per; | |||||
| 6 | import gov .va.nvap.w eb.user.Us erHelper; | |||||
| 7 | ||||||
| 8 | import jav a.io.IOExc eption; | |||||
| 9 | ||||||
| 10 | import jav ax.servlet .ServletEx ception; | |||||
| 11 | import jav ax.servlet .http.Cook ie; | |||||
| 12 | import jav ax.servlet .http.Http ServletReq uest; | |||||
| 13 | import jav ax.servlet .http.Http ServletRes ponse; | |||||
| 14 | import jav ax.servlet .http.Http Session; | |||||
| 15 | ||||||
| 16 | import org .apache.co mmons.logg ing.Log; | |||||
| 17 | import org .apache.co mmons.logg ing.LogFac tory; | |||||
| 18 | ||||||
| 19 | /** | |||||
| 20 | * @author Stephen M iller | |||||
| 21 | */ | |||||
| 22 | public cla ss SetDefa ultFacilit y extends gov.va.nva p.web.app. ResponseDi spatcherHt tpServlet { | |||||
| 23 | st atic priva te final L og LOG = L ogFactory. getLog(Set DefaultFac ility.clas s); | |||||
| 24 | /* * | |||||
| 25 | * Serial UI D. | |||||
| 26 | * / | |||||
| 27 | pr ivate stat ic final l ong serial VersionUID = 5356729 7166466832 18L; | |||||
| 28 | ||||||
| 29 | pu blic void setManualF acility(fi nal HttpSe rvletReque st request , | |||||
| 30 | final HttpServle tResponse response) throws Ser vletExcept ion, | |||||
| 31 | IOExce ption { | |||||
| 32 | ||||||
| 33 | if ( this.valid ate(reques t, respons e)) { | |||||
| 34 | final HttpSessio n session = request. getSession (false); | |||||
| 35 | ||||||
| 36 | final String new Facility = request.g etParamete r("facilit y"); | |||||
| 37 | sessio n.setAttri bute("defa ultUserFac ility", ne wFacility) ; | |||||
| 38 | respon se.addCook ie(setFaci lityCookie (newFacili ty)); | |||||
| 39 | this.f orward(req uest, resp onse, "suc cess"); | |||||
| 40 | }els e { | |||||
| 41 | this.f orward(req uest, resp onse, "val idate"); | |||||
| 42 | return ; | |||||
| 43 | } | |||||
| 44 | } | |||||
| 45 | ||||||
| 46 | pu blic void removeManu alFacility (final Htt pServletRe quest requ est, | |||||
| 47 | final HttpServle tResponse response) throws Ser vletExcept ion, | |||||
| 48 | IOExce ption { | |||||
| 49 | if ( this.valid ate(reques t, respons e)) { | |||||
| 50 | final HttpSessio n session = request. getSession (false); | |||||
| 51 | gov.va .nvap.svc. facility.d ata.Facili ty default AutoUserFa cility = t his.getFac ilityHelpe r().getFac ilityStati onByVHAUse rId( | |||||
| 52 | UserHelper .getUserNa me(request )); | |||||
| 53 | if(!Nu llChecker. isNullOrEm pty(defaul tAutoUserF acility)){ //there is an automa tic | |||||
| 54 | session. setAttribu te("defaul tUserFacil ity", defa ultAutoUse rFacility) ; | |||||
| 55 | }else{ // there i s no autom atic or ma nual | |||||
| 56 | session. removeAttr ibute("def aultUserFa cility"); | |||||
| 57 | } | |||||
| 58 | respon se.addCook ie(removeF acilityCoo kie()); | |||||
| 59 | this.f orward(req uest, resp onse, "suc cess"); | |||||
| 60 | }els e { | |||||
| 61 | this.f orward(req uest, resp onse, "val idate"); | |||||
| 62 | return ; | |||||
| 63 | } | |||||
| 64 | } | |||||
| 65 | ||||||
| 66 | pr ivate Cook ie removeF acilityCoo kie() { | |||||
| 67 | Cook ie vapCook ie = null; | |||||
| 68 | vapC ookie = ne w Cookie(" facility", ""); | |||||
| 69 | vapC ookie.setM axAge(0); | |||||
| 70 | retu rn vapCook ie; | |||||
| 71 | } | |||||
| 72 | ||||||
| 73 | privat e boolean isAlphaNum eric(Strin g s){ | |||||
| 74 | St ring patte rn= "^[a-z A-Z0-9]*$" ; | |||||
| 75 | ||||||
| 76 | re turn s.mat ches(patte rn); | |||||
| 77 | } | |||||
| 78 | ||||||
| 79 | pr ivate Cook ie setFaci lityCookie (final Str ing setFac ility) { | |||||
| 80 | ||||||
| 81 | Cook ie vapCook ie = null; | |||||
| 82 | // Create the facility object and lookup th e facility by the st ation numb er sent in the reque st. | |||||
| 83 | Fa cility new DefaultFac ility; | |||||
| 84 | ne wDefaultFa cility = t his.getFac ilityHelpe r().getFac ilityBySta tionId(set Facility); | |||||
| 85 | if ( newDefault Facility ! = null) { | |||||
| 86 | if (ne wDefaultFa cility.get FacilitySt ation().eq uals("")) { | |||||
| 87 | vapCooki e = new Co okie("faci lity", "") ; | |||||
| 88 | vapCooki e.setMaxAg e(0); | |||||
| 89 | } else if (isAlp haNumeric( newDefault Facility.g etFacility Station()) ) { | |||||
| 90 | vapCooki e = new Co okie("faci lity", new DefaultFac ility.getF acilitySta tion()); | |||||
| 91 | vapCooki e.setMaxAg e(5 * 365 * 24 * 60 * 60); | |||||
| 92 | } | |||||
| 93 | } | |||||
| 94 | retu rn vapCook ie; | |||||
| 95 | } | |||||
| 96 | ||||||
| 97 | /* * | |||||
| 98 | * Get the f acility he lper from Spring. | |||||
| 99 | * / | |||||
| 100 | pu blic Facil ityHelper getFacilit yHelper() { | |||||
| 101 | fina l Facility Helper fac ilityHelpe r = this.g etBean("fa cilityHelp er", | |||||
| 102 | Facility Helper.cla ss); | |||||
| 103 | retu rn facilit yHelper; | |||||
| 104 | } | |||||
| 105 | ||||||
| 106 | @O verride | |||||
| 107 | pr otected vo id unspeci fied(final HttpServl etRequest request, | |||||
| 108 | final HttpServle tResponse response) throws Ser vletExcept ion, | |||||
| 109 | IOExce ption { | |||||
| 110 | fina l HttpSess ion sessio n = reques t.getSessi on(false); | |||||
| 111 | ||||||
| 112 | requ est.setAtt ribute("fa cilities", this.getF acilityHel per() | |||||
| 113 | .getAllV istAFacili ties()); | |||||
| 114 | ||||||
| 115 | Stri ng facilit yName = "" ; | |||||
| 116 | Stri ng facilit yStation = ""; | |||||
| 117 | ||||||
| 118 | Cook ie[] vapCo okies = re quest.getC ookies(); | |||||
| 119 | gov. va.nvap.sv c.facility .data.Faci lity defau ltUserFaci lity = nul l; | |||||
| 120 | if ( vapCookies != null){ | |||||
| 121 | for (C ookie vapC ookie : va pCookies){ | |||||
| 122 | if (vapC ookie.getN ame().equa ls("facili ty")){ | |||||
| 123 | if (NullCh ecker.isNo tEmpty(vap Cookie.get Value())) { | |||||
| 124 | de faultUserF acility = new Facili ty(); | |||||
| 125 | try { | |||||
| 126 | Fa cility fac ility = th is.getFaci lityHelper ().getFaci lityByStat ionId(vapC ookie.getV alue()); | |||||
| 127 | if (facility != null) { | |||||
| 128 | defaultU serFacilit y.setFacil ityStation (facility. getFacilit yStation() ); | |||||
| 129 | defaultU serFacilit y.setFacil ityName(fa cility.get FacilityNa me()); | |||||
| 130 | defaultU serFacilit y.setVisnI d(facility .getVisnId ()); | |||||
| 131 | session. setAttribu te("defaul tUserFacil ity", defa ultUserFac ility); | |||||
| 132 | request. setAttribu te("visual DefaultUse rFacility" , facility .getFacili tyName()+" ("+facili ty.getFaci lityStatio n()+")"); | |||||
| 133 | request. setAttribu te("facili tyState", "manual"); | |||||
| 134 | } | |||||
| 135 | } catc h (Excepti on e) { | |||||
| 136 | // TODO: cou ldn't set the defaul t facility ... | |||||
| 137 | } | |||||
| 138 | } | |||||
| 139 | } | |||||
| 140 | } | |||||
| 141 | } | |||||
| 142 | ||||||
| 143 | if(N ullChecker .isNullOrE mpty(defau ltUserFaci lity)){ | |||||
| 144 | final gov.va.nva p.svc.faci lity.data. Facility d efaultAuto UserFacili ty = this | |||||
| 145 | .getFacili tyHelper() .getFacili tyStationB yVHAUserId ( | |||||
| 146 | User Helper.get UserName(r equest)); | |||||
| 147 | if (!( NullChecke r.isNullOr Empty(defa ultAutoUse rFacility) )) { | |||||
| 148 | facility Name = def aultAutoUs erFacility .getFacili tyName(); | |||||
| 149 | facility Station = defaultAut oUserFacil ity.getFac ilityStati on(); | |||||
| 150 | request. setAttribu te("visual DefaultUse rFacility" , facility Name+" ("+ facilitySt ation+")") ; | |||||
| 151 | request. setAttribu te("facili tyState", "auto"); | |||||
| 152 | }else{ | |||||
| 153 | request. setAttribu te("facili tyState", "none"); | |||||
| 154 | } | |||||
| 155 | } | |||||
| 156 | ||||||
| 157 | this .forward(r equest, re sponse, "s how"); | |||||
| 158 | } | |||||
| 159 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.