Produced by Araxis Merge on 4/5/2017 4:26:23 PM Central 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 | C:\working_scrub\Unredacted\VAP Code Base\VAP_Bld2_Source_Code_CIF_2017-02-14\nvap-server\src\main\java\gov\va\nvap\server\endpoint\pip | FacilityResolverImpl.java | Wed Feb 1 18:37:28 2017 UTC |
| 2 | eHX-CIF.zip\eHX-CIF\VAP Code Base\VAP_Bld2_Source_Code_CIF_2017-02-14\nvap-server\src\main\java\gov\va\nvap\server\endpoint\pip | FacilityResolverImpl.java | Mon Apr 3 14:06:48 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 376 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| 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. server.end point.pip; | |
| 2 | ||
| 3 | import gov .va.med.es r.webservi ces.jaxws. schemas.Ge tEESummary Request; | |
| 4 | import gov .va.med.es r.webservi ces.jaxws. schemas.Ge tEESummary Response; | |
| 5 | import gov .va.nvap.c ommon.vali dation.Nul lChecker; | |
| 6 | import gov .va.nvap.s ervice.esr .Enrollmen tService; | |
| 7 | import gov .va.nvap.s vc.consent mgmt.PIPIn terface; | |
| 8 | import gov .va.nvap.s vc.consent mgmt.stub. FacilityRe solver; | |
| 9 | import gov .va.nvap.s vc.consent mgmt.stub. data.Facil ity; | |
| 10 | import gov .va.nvap.s vc.consent mgmt.stub. data.Locat ion; | |
| 11 | ||
| 12 | import jav a.util.Loc ale; | |
| 13 | import jav a.util.Map ; | |
| 14 | ||
| 15 | import org .apache.co mmons.logg ing.Log; | |
| 16 | import org .apache.co mmons.logg ing.LogFac tory; | |
| 17 | import org .springfra mework.bea ns.factory .annotatio n.Required ; | |
| 18 | ||
| 19 | /** | |
| 20 | * Resolve Patient's Preferred Facility by calling the ESR w ebservice. | |
| 21 | * | |
| 22 | * @author Asha Amri traj | |
| 23 | * | |
| 24 | */ | |
| 25 | public cla ss Facilit yResolverI mpl implem ents Facil ityResolve r { | |
| 26 | ||
| 27 | pr ivate stat ic Log LOG = LogFact ory.getLog (FacilityR esolverImp l.class); | |
| 28 | ||
| 29 | pr ivate stat ic String extractLoc ationCode( String use rId) { | |
| 30 | // U serID form at for VHA User : | |
| 31 | // < VHA><3Char LocationCo de><First5 LastName>< First1Firs tName> | |
| 32 | // Ex:
|
|
| 33 | // I n other wo rds this m ethod shou ld extract character s between 3-6 from | |
| 34 | // t he string. -- Ugly a pproach | |
| 35 | ||
| 36 | if ( NullChecke r.isNullOr Empty(user Id)) { | |
| 37 | return ""; // em pty | |
| 38 | } | |
| 39 | // L ocation co des are st ored in UC in the DB | |
| 40 | user Id = userI d.trim().t oUpperCase (Locale.EN GLISH); | |
| 41 | // u serids are at-least 6 chars in length // Note: "VH A"<LOC> is 6 | |
| 42 | // c hars. | |
| 43 | if ( userId.sta rtsWith("V HA") && (u serId.leng th() >= 6) ) { | |
| 44 | return userId.su bstring(3, 6); | |
| 45 | } | |
| 46 | retu rn ""; | |
| 47 | } | |
| 48 | ||
| 49 | pr ivate Enro llmentServ ice enroll mentServic e; | |
| 50 | pr ivate PIPI nterface p ip; | |
| 51 | ||
| 52 | pr ivate Map< String, St ring> test UsersAndFa cilities; | |
| 53 | ||
| 54 | pr ivate GetE ESummaryRe quest buil dRequest(f inal Strin g patientI CN) { | |
| 55 | fina l GetEESum maryReques t request = new GetE ESummaryRe quest(); | |
| 56 | requ est.setKey (patientIC N); | |
| 57 | requ est.setKey Type("VPID "); | |
| 58 | requ est.setReq uestName(" preferredF acility"); | |
| 59 | retu rn request ; | |
| 60 | } | |
| 61 | ||
| 62 | pr ivate Stri ng extract PreferredF acility(fi nal GetEES ummaryResp onse respo nse) { | |
| 63 | Stri ng patient PreferredF acility = ""; | |
| 64 | ||
| 65 | if ( (response != null) & & (respons e.getSumma ry() != nu ll) | |
| 66 | && (resp onse.getSu mmary().ge tDemograph ics() != n ull)) { | |
| 67 | final String fac ilityStrin g = respon se.getSumm ary() | |
| 68 | .getDemogr aphics().g etPreferre dFacility( ); | |
| 69 | if (fa cilityStri ng == null ) { | |
| 70 | return p atientPref erredFacil ity; | |
| 71 | } | |
| 72 | final String[] f acilityTok ens = faci lityString .split("-" ); | |
| 73 | if ((f acilityTok ens != nul l) && (fac ilityToken s.length = = 2)) { | |
| 74 | patientP referredFa cility = f acilityTok ens[0].tri m(); | |
| 75 | } | |
| 76 | } | |
| 77 | retu rn patient PreferredF acility; | |
| 78 | } | |
| 79 | ||
| 80 | pu blic Strin g getFacil ity(final String pat ientIcn) { | |
| 81 | retu rn this.ge tFacilityI d(patientI cn); | |
| 82 | } | |
| 83 | ||
| 84 | pr ivate Faci lity getFa cilityByVH AUserId(fi nal String userId) { | |
| 85 | fina l String l ocationCod e = Facili tyResolver Impl | |
| 86 | .extract LocationCo de(userId) ; | |
| 87 | Faci lity fac = null; | |
| 88 | if ( !NullCheck er.isNullO rEmpty(loc ationCode) ) { | |
| 89 | Locati on loc = n ull; | |
| 90 | try { | |
| 91 | loc = th is.pip.get LocationBy Code(locat ionCode); | |
| 92 | } catc h (final E xception e ) { | |
| 93 | // Swall owing exce ption, but that is o k. We want a failure in | |
| 94 | // obtai ning Locat ion to be translated into a | |
| 95 | // null Location o bject. | |
| 96 | Facility ResolverIm pl.LOG | |
| 97 | .e rror("Exce ption thro wn trying to retriev e Location by Locati onCode[" | |
| 98 | + loca tionCode + "]. Setti ng Locatio n to null" ); | |
| 99 | } | |
| 100 | if (lo c != null) { | |
| 101 | fac = lo c.getFacil ity(); | |
| 102 | } | |
| 103 | } | |
| 104 | retu rn fac; | |
| 105 | } | |
| 106 | ||
| 107 | pr ivate Stri ng getFaci lityId(fin al String patientICN ) { | |
| 108 | fina l String f acilityId = this.get PatientPre ferredFaci lity(patie ntICN); | |
| 109 | if ( NullChecke r.isNullOr Empty(faci lityId)) { | |
| 110 | // go to MPI | |
| 111 | } | |
| 112 | retu rn facilit yId; | |
| 113 | } | |
| 114 | ||
| 115 | pr ivate Stri ng getFaci lityStatio nIdByVHAUs erId(final String us erId) { | |
| 116 | fina l Facility fac = thi s.getFacil ityByVHAUs erId(userI d); | |
| 117 | Stri ng facilit yStationId = ""; | |
| 118 | if ( fac != nul l) { | |
| 119 | facili tyStationI d = fac.ge tFacilityS tation(); | |
| 120 | } | |
| 121 | retu rn facilit yStationId ; | |
| 122 | } | |
| 123 | ||
| 124 | /* * | |
| 125 | * Returns F acility gi ven a User Id | |
| 126 | * / | |
| 127 | pu blic Strin g getFacil tyStationI dByUserId( final Stri ng userId) { | |
| 128 | if ( this.isTes tUser(user Id)) { | |
| 129 | if (Fa cilityReso lverImpl.L OG.isInfoE nabled()) { | |
| 130 | Facility ResolverIm pl.LOG | |
| 131 | .i nfo("UserI d[" | |
| 132 | + user Id | |
| 133 | + "], is a test user. Retr ieving sta tion id fr om facilit y-config.x ml file"); | |
| 134 | } | |
| 135 | return this.test UsersAndFa cilities.g et(userId) ; | |
| 136 | } | |
| 137 | if ( FacilityRe solverImpl .LOG.isInf oEnabled() ) { | |
| 138 | Facili tyResolver Impl.LOG.i nfo("UserI d[" + user Id | |
| 139 | + "], is a not a tes t user. Re trieving s tation id from DB"); | |
| 140 | } | |
| 141 | retu rn this.ge tFacilityS tationIdBy VHAUserId( userId); | |
| 142 | } | |
| 143 | ||
| 144 | @O verride | |
| 145 | pu blic Strin g getPatie ntPreferre dFacility( final Stri ng patient ICN) { | |
| 146 | Stri ng patient PreferredF acility = ""; | |
| 147 | // b uild Reque st | |
| 148 | fina l GetEESum maryReques t request = this.bui ldRequest( patientICN ); | |
| 149 | // i nvoke serv ice | |
| 150 | fina l GetEESum maryRespon se respons e = this.i nvokeWS(re quest); | |
| 151 | // G et patient 's preferr ed facilit y | |
| 152 | pati entPreferr edFacility = this.ex tractPrefe rredFacili ty(respons e); | |
| 153 | retu rn patient PreferredF acility; | |
| 154 | } | |
| 155 | ||
| 156 | @O verride | |
| 157 | pu blic Strin g getUserF acility(fi nal String userId) { | |
| 158 | retu rn this.ge tFaciltySt ationIdByU serId(user Id); | |
| 159 | } | |
| 160 | ||
| 161 | pr ivate GetE ESummaryRe sponse inv okeWS(fina l GetEESum maryReques t request) { | |
| 162 | fina l GetEESum maryRespon se respons e = this.e nrollmentS ervice | |
| 163 | .getEESu mmaryReque st(request ); | |
| 164 | retu rn respons e; | |
| 165 | } | |
| 166 | ||
| 167 | // private | |
| 168 | pr ivate bool ean isTest User(final String us erId) { | |
| 169 | retu rn !NullCh ecker.isNu llOrEmpty( userId) | |
| 170 | && (this .testUsers AndFacilit ies != nul l) | |
| 171 | && this. testUsersA ndFaciliti es.keySet( ).contains (userId); | |
| 172 | } | |
| 173 | ||
| 174 | @R equired | |
| 175 | pu blic void setEnrollm entService (final Enr ollmentSer vice enrol lmentServi ce) { | |
| 176 | this .enrollmen tService = enrollmen tService; | |
| 177 | } | |
| 178 | ||
| 179 | @R equired | |
| 180 | pu blic void setPip(fin al PIPInte rface pip) { | |
| 181 | this .pip = pip ; | |
| 182 | } | |
| 183 | ||
| 184 | @R equired | |
| 185 | pu blic void setTestUse rsAndFacil ities( | |
| 186 | final Map<String , String> testUsersA ndFaciliti es) { | |
| 187 | this .testUsers AndFacilit ies = test UsersAndFa cilities; | |
| 188 | } | |
| 189 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.