Produced by Araxis Merge on 7/6/2017 8:23:35 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 | OSCIF_CTT_v4_build 1.zip\VUID-rest\src\main\java\gov\vha\vuid\rest\session | PrismeServiceUtils.java | Wed May 31 03:59:14 2017 UTC |
| 2 | OSCIF_CTT_v4_build 1.zip\VUID-rest\src\main\java\gov\vha\vuid\rest\session | PrismeServiceUtils.java | Mon Jul 3 23:41:12 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 196 |
| 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 | /** | |
| 2 | * Copyrig ht Notice | |
| 3 | * | |
| 4 | * This is a work of the U.S. Government and is no t subject to copyrig ht | |
| 5 | * protect ion in the United St ates. Fore ign copyri ghts may a pply. | |
| 6 | * | |
| 7 | * License d under th e Apache L icense, Ve rsion 2.0 (the "Lice nse"); | |
| 8 | * you may not use t his file e xcept in c ompliance with the L icense. | |
| 9 | * You may obtain a copy of th e License at | |
| 10 | * | |
| 11 | * http:// www.apache .org/licen ses/LICENS E-2.0 | |
| 12 | * | |
| 13 | * Unless required b y applicab le law or agreed to in writing , software | |
| 14 | * distrib uted under the Licen se is dist ributed on an "AS IS " BASIS, | |
| 15 | * WITHOUT WARRANTIE S OR CONDI TIONS OF A NY KIND, e ither expr ess or imp lied. | |
| 16 | * See the License f or the spe cific lang uage gover ning permi ssions and | |
| 17 | * limitat ions under the Licen se. | |
| 18 | */ | |
| 19 | ||
| 20 | package go v.vha.vuid .rest.sess ion; | |
| 21 | ||
| 22 | import jav a.net.URL; | |
| 23 | import jav a.util.Map ; | |
| 24 | import jav ax.ws.rs.c lient.Enti ty; | |
| 25 | import jav ax.ws.rs.c lient.WebT arget; | |
| 26 | import jav ax.ws.rs.c ore.Respon se; | |
| 27 | import gov .vha.isaac .ochre.api .LookupSer vice; | |
| 28 | import gov .vha.vuid. rest.Appli cationConf ig; | |
| 29 | ||
| 30 | /** | |
| 31 | * | |
| 32 | * {@link PrismeServ iceUtils} | |
| 33 | * | |
| 34 | * @author <a href=" mailto:joe l.kniaz.li st@gmail.c om">Joel K niaz</a> | |
| 35 | * | |
| 36 | */ | |
| 37 | public cla ss PrismeS erviceUtil s { | |
| 38 | ||
| 39 | pr ivate Pris meServiceU tils() {} | |
| 40 | ||
| 41 | pr otected st atic Strin g getConfi gProperty( String pro pertyName) | |
| 42 | { | |
| 43 | swit ch(propert yName) | |
| 44 | { | |
| 45 | //http s://DNS :PORT | |
| 46 | case " prisme_rol es_by_toke n_url" : | |
| 47 | return " https://" + Applicat ionConfig. getInstanc e().getHos tname() + ":" + Appl icationCon fig.getIns tance().ge tPort() | |
| 48 | + "/rails_pr isme/roles /get_roles _by_token. json"; | |
| 49 | defaul t: | |
| 50 | throw ne w RuntimeE xception(" Unknown pr operty Nam e '" + pro pertyName + "'"); | |
| 51 | } | |
| 52 | } | |
| 53 | ||
| 54 | ||
| 55 | pu blic stati c String g etTargetFr omUrl(URL url) { | |
| 56 | Stri ngBuilder target = n ew StringB uilder(); | |
| 57 | targ et.append( url.getPro tocol()); | |
| 58 | targ et.append( "://"); | |
| 59 | targ et.append( url.getHos t()); | |
| 60 | if ( url.getPor t() > 0) { | |
| 61 | target .append(": " + url.ge tPort()); | |
| 62 | } | |
| 63 | ||
| 64 | retu rn target. toString() ; | |
| 65 | } | |
| 66 | ||
| 67 | st atic Strin g postJson ToPrisme(W ebTarget t argetWithP ath, Strin g json, Ma p<String, String> pa rams) { | |
| 68 | if ( params != null) { | |
| 69 | for (M ap.Entry<S tring, Str ing> entry : params. entrySet() ) { | |
| 70 | targetWi thPath = t argetWithP ath.queryP aram(entry .getKey(), entry.get Value()); | |
| 71 | } | |
| 72 | } | |
| 73 | Resp onse respo nse = targ etWithPath .request() .post(Enti ty.json(js on)); | |
| 74 | ||
| 75 | Stri ng respons eJson = re sponse.rea dEntity(St ring.class ); | |
| 76 | ||
| 77 | retu rn respons eJson; | |
| 78 | } | |
| 79 | ||
| 80 | st atic Strin g getResul tJsonFromP risme(WebT arget targ etWithPath , Map<Stri ng, String > params) { | |
| 81 | for (Map.Entry <String, S tring> ent ry : param s.entrySet ()) { | |
| 82 | target WithPath = targetWit hPath.quer yParam(ent ry.getKey( ), entry.g etValue()) ; | |
| 83 | } | |
| 84 | ||
| 85 | Resp onse respo nse = targ etWithPath .request() .get(); | |
| 86 | ||
| 87 | Stri ng respons eJson = re sponse.rea dEntity(St ring.class ); | |
| 88 | ||
| 89 | retu rn respons eJson; | |
| 90 | } | |
| 91 | ||
| 92 | st atic Strin g getResul tJsonFromP risme(Stri ng targetS tr, String pathStr, Map<String , String> params) { | |
| 93 | Clie ntService clientServ ice = Look upService. getService (ClientSer vice.class ); | |
| 94 | WebT arget targ et = clien tService.g etClient() .target(ta rgetStr); | |
| 95 | targ et = targe t.path(pat hStr); | |
| 96 | ||
| 97 | retu rn getResu ltJsonFrom Prisme(tar get, param s); | |
| 98 | } | |
| 99 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.