Produced by Araxis Merge on 10/3/2017 11:15:17 AM 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 | ehmp.zip\ehmp\ehmp\product\production\MockServices\src\main\java\us\vistacore\mocks\resources | MockCDSResource.java | Tue Dec 15 14:05:16 2015 UTC |
| 2 | ehmp.zip\ehmp\ehmp\product\production\MockServices\src\main\java\us\vistacore\mocks\resources | MockCDSResource.java | Mon Oct 2 19:35:45 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 164 |
| 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 us .vistacore .mocks.res ources; | |
| 2 | ||
| 3 | import sta tic us.vis tacore.moc ks.util.Nu llChecker. isNotNulli sh; | |
| 4 | import sta tic us.vis tacore.moc ks.util.Nu llChecker. isNullish; | |
| 5 | ||
| 6 | import us. vistacore. mocks.weba pi.JsonRes ponseMessa ge; | |
| 7 | ||
| 8 | import com .google.co mmon.base. Charsets; | |
| 9 | import com .google.co mmon.io.Re sources; | |
| 10 | ||
| 11 | import jav a.io.IOExc eption; | |
| 12 | import jav a.util.Lis t; | |
| 13 | ||
| 14 | import jav ax.ws.rs.D efaultValu e; | |
| 15 | import jav ax.ws.rs.G ET; | |
| 16 | import jav ax.ws.rs.P ath; | |
| 17 | import jav ax.ws.rs.P athParam; | |
| 18 | import jav ax.ws.rs.Q ueryParam; | |
| 19 | import jav ax.ws.rs.c ore.MediaT ype; | |
| 20 | import jav ax.ws.rs.c ore.Respon se; | |
| 21 | ||
| 22 | import org .slf4j.Log ger; | |
| 23 | import org .slf4j.Log gerFactory ; | |
| 24 | ||
| 25 | @Path("rep ositories. URL ") | |
| 26 | public cla ss MockCDS Resource { | |
| 27 | ||
| 28 | privat e static L ogger logg er = Logge rFactory.g etLogger(M ockCDSReso urce.class ); | |
| 29 | ||
| 30 | privat e static f inal Strin g DATA_RES OURCE_PATH = "mockcd s/"; | |
| 31 | privat e static f inal Strin g DATA_RES OURCE_EXTE NSION = ". json"; | |
| 32 | ||
| 33 | protec ted static final Str ing EXPECT ED_TEMPLAT E = "Gener icObservat ionRead1"; | |
| 34 | protec ted static final Str ing EXPECT ED_FILTER = "GENERIC _VISTA_LIS T_DATA_FIL TER"; | |
| 35 | protec ted static final Str ing EXPECT ED_TYPE = "json"; | |
| 36 | ||
| 37 | @GET | |
| 38 | @Path( "/fpds/{do main}") | |
| 39 | public Response fpds(@Path Param("dom ain") Stri ng domain, | |
| 40 | @Quer yParam("cl ientName") String cl ientName, | |
| 41 | @Quer yParam("cl ientReques tInitiatio nTime") St ring clien tRequestIn itiationTi me, | |
| 42 | @Quer yParam("re questId") String req uestId, | |
| 43 | @Quer yParam("na tionalId") String na tionalId, // ICN | |
| 44 | @Quer yParam("ex cludeIdent ifier") Li st<String> excludeId entifier, | |
| 45 | @Quer yParam("re solvedIden tifier") L ist<String > resolved Identifier , // <dfn> -<assignin gFacility> -<assignin gAuthority > | |
| 46 | @Quer yParam("ma x") int ma x, | |
| 47 | @Defa ultValue(E XPECTED_TY PE) @Query Param("_ty pe") Strin g type, | |
| 48 | @Quer yParam("te mplateId") String te mplateId, | |
| 49 | @Quer yParam("fi lterId") S tring filt erId) { | |
| 50 | Re sponse.Sta tus status = Respons e.Status.I NTERNAL_SE RVER_ERROR ; | |
| 51 | St ring conte nt = ""; | |
| 52 | ||
| 53 | tr y { | |
| 54 | content = Resource s.toString (Resources .getResour ce(DATA_RE SOURCE_PAT H + domain + DATA_RE SOURCE_EXT ENSION), C harsets.UT F_8); | |
| 55 | status = Response. Status.OK; | |
| 56 | ||
| 57 | if (!EXP ECTED_TEMP LATE.equal sIgnoreCas e(template Id)) { | |
| 58 | stat us = Respo nse.Status .BAD_REQUE ST; | |
| 59 | cont ent = buil dJsonRespo nse(status , "Bad Tem plate Id: " + templa teId); | |
| 60 | } else i f (!EXPECT ED_FILTER. equalsIgno reCase(fil terId)) { | |
| 61 | stat us = Respo nse.Status .BAD_REQUE ST; | |
| 62 | cont ent = buil dJsonRespo nse(status , "Bad Fil ter Id: " + filterId ); | |
| 63 | } else i f (isNulli sh(clientN ame)) { | |
| 64 | stat us = Respo nse.Status .BAD_REQUE ST; | |
| 65 | cont ent = buil dJsonRespo nse(status , "Missing required parameter: clientNam e"); | |
| 66 | } else i f ((isNotN ullish(typ e)) && !EX PECTED_TYP E.equalsIg noreCase(t ype)) { | |
| 67 | stat us = Respo nse.Status .BAD_REQUE ST; | |
| 68 | cont ent = buil dJsonRespo nse(status , "Request ed datatyp e of " + t ype + " is not suppo rted."); | |
| 69 | } | |
| 70 | } catch (IOE xception | IllegalAr gumentExce ption e) { | |
| 71 | logger.w arn("MockC DSResource .fpds: Err or while r eading dat a file.", e); | |
| 72 | status = Response. Status.NO_ CONTENT; | |
| 73 | content = buildJso nResponse( status, "R equested d ata domain of " + do main + " i s not supp orted."); | |
| 74 | } | |
| 75 | ||
| 76 | re turn Respo nse.status (status).t ype(MediaT ype.APPLIC ATION_JSON ).entity(c ontent).bu ild(); | |
| 77 | } | |
| 78 | ||
| 79 | privat e String b uildJsonRe sponse(Res ponse.Stat us status, String co ntent) { | |
| 80 | re turn new J sonRespons eMessage(s tatus, con tent).toJs on(); | |
| 81 | } | |
| 82 | ||
| 83 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.