Produced by Araxis Merge on 1/4/2018 4:54:41 PM Eastern Standard 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 | CHAMPVA_Benefit_Eligibility_v1.0.0.zip\webservice\champvapay-service\src\main\java\gov\va\med\mbcp\champva\rest | ChampVAResource.java | Thu Dec 21 19:52:28 2017 UTC |
| 2 | CHAMPVA_Benefit_Eligibility_v1.0.0.zip\webservice\champvapay-service\src\main\java\gov\va\med\mbcp\champva\rest | ChampVAResource.java | Thu Jan 4 21:00:51 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 272 |
| 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 | * The pac kage gov.v a.med.mbcp .champva.r est contai ns the RES Tful Web A pplication & Resourc e classes for | |
| 3 | * retriev al of Code Results f rom the ta rget VistA instance. | |
| 4 | * | |
| 5 | */ | |
| 6 | package go v.va.med.m bcp.champv a.rest; | |
| 7 | ||
| 8 | import jav ax.servlet .http.Http ServletReq uest; | |
| 9 | import jav ax.ws.rs.G ET; | |
| 10 | import jav ax.ws.rs.P ath; | |
| 11 | import jav ax.ws.rs.P athParam; | |
| 12 | import jav ax.ws.rs.P roduces; | |
| 13 | import jav ax.ws.rs.c ore.Contex t; | |
| 14 | import jav ax.ws.rs.c ore.MediaT ype; | |
| 15 | import jav ax.ws.rs.c ore.Respon se; | |
| 16 | ||
| 17 | import org .apache.lo g4j.Logger ; | |
| 18 | import org .springfra mework.con text.suppo rt.ClassPa thXmlAppli cationCont ext; | |
| 19 | ||
| 20 | import com .fasterxml .jackson.c ore.JsonPr ocessingEx ception; | |
| 21 | import com .fasterxml .jackson.d atabind.Ob jectMapper ; | |
| 22 | ||
| 23 | import gov .va.med.mb cp.champva .dao.commo n.IChampVA PayDAO; | |
| 24 | import gov .va.med.mb cp.champva .dao.impl. ChampVAPay DAO; | |
| 25 | import gov .va.med.mb cp.champva .domain.co mmon.ICode Result; | |
| 26 | import gov .va.med.mb cp.champva .domain.im pl.ChampVA Exception; | |
| 27 | import gov .va.med.mb cp.champva .domain.im pl.ChampVA JsonExcept ion; | |
| 28 | ||
| 29 | /** | |
| 30 | * The Cha mpVAResour ce Class i mplements the resour ce endpoin t for retr ieval of | |
| 31 | * the Cod e Result f or a given Diagnosis , Procedur e, or Nati onal Drug Code from | |
| 32 | * the Vis tA system at the Hea lth Admini stration C enter (HAC ) in Denve r | |
| 33 | * | |
| 34 | * @author PII | |
| 35 | * @versio n 1.0.0 | |
| 36 | */ | |
| 37 | @Path("/co de-systems /{code-sys tem}") | |
| 38 | public cla ss ChampVA Resource { | |
| 39 | ||
| 40 | /** A reference to the HTT P request sent from the client applicati on */ | |
| 41 | @Conte xt | |
| 42 | HttpSe rvletReque st request ; | |
| 43 | ||
| 44 | /** Th e Code Sys tem for th e Request. */ | |
| 45 | @PathP aram("code -system") | |
| 46 | String codeSyste m; | |
| 47 | ||
| 48 | /** | |
| 49 | * An instance o f the Pers onDAO clas s which co mmunicates with Vist A through | |
| 50 | * Vis tALink | |
| 51 | */ | |
| 52 | privat e IChampVA PayDAO cha mpVAPayDAO ; | |
| 53 | ||
| 54 | /** An instance of the Jac kson parse r */ | |
| 55 | privat e ObjectMa pper mappe r; | |
| 56 | ||
| 57 | /** An instance of Logger utility */ | |
| 58 | privat e final st atic Logge r LOGGER = Logger.ge tLogger(Ch ampVAResou rce.class) ; | |
| 59 | ||
| 60 | privat e ClassPat hXmlApplic ationConte xt appCont ext; | |
| 61 | ||
| 62 | /** | |
| 63 | * Def ault Const ructor for the Champ VAResource class. Co nstruction is | |
| 64 | * han dled by th e JAX-RS c ontainer. The constr uctor will then crea te a | |
| 65 | * Spr ing Applic ation Cont ext which will manag e the lazy instantia tion of | |
| 66 | * the DAO and i ts depende nt classes as define d in the | |
| 67 | * src /main/reso urces/cham pvaBeans.x ml file. | |
| 68 | */ | |
| 69 | public ChampVARe source() { | |
| 70 | su per(); | |
| 71 | ||
| 72 | th is.appCont ext = new ClassPathX mlApplicat ionContext ("/champva Beans.xml" ); | |
| 73 | th is.champVA PayDAO = ( ChampVAPay DAO) appCo ntext.getB ean("champ VAPayDAO") ; | |
| 74 | th is.mapper = (ObjectM apper) app Context.ge tBean("obj ectMapper" ); | |
| 75 | th is.appCont ext.close( ); | |
| 76 | } | |
| 77 | ||
| 78 | /** | |
| 79 | * Thi s is the H TTP GET me thod for t he Web Ser vice. The fully-spec ified URI | |
| 80 | * is: GET /cham pva/v1/cod e-systems/ {code-syst em}/codes/ {code} | |
| 81 | * | |
| 82 | * @pa ram code - String th e code to be evaluat ed. | |
| 83 | * @re turn an HT TP Respons e | |
| 84 | */ | |
| 85 | @GET | |
| 86 | @Path( "/codes/{c ode}") | |
| 87 | @Produ ces(MediaT ype.APPLIC ATION_JSON ) | |
| 88 | public Response getCodeRes ult(@PathP aram("code ") String code) { | |
| 89 | ||
| 90 | IC odeResult codeResult ; | |
| 91 | St ring json; | |
| 92 | ||
| 93 | LO GGER.debug ("entered getCodeRes ult(" + th is.codeSys tem + ", " + code + ")"); | |
| 94 | ||
| 95 | tr y { | |
| 96 | ||
| 97 | codeResu lt = champ VAPayDAO.g etCodeResu lt(this.co deSystem, code); | |
| 98 | ||
| 99 | // Forma t the resp onse and s end to the resource server | |
| 100 | json = m apper.writ eValueAsSt ring(codeR esult); | |
| 101 | ||
| 102 | LOGGER.d ebug("getU serPropert ies() resp onse: " + json); | |
| 103 | ||
| 104 | return R esponse.st atus(Respo nse.Status .OK).entit y(json).bu ild(); | |
| 105 | ||
| 106 | } catch (Jso nProcessin gException jpe) { | |
| 107 | ChampVAE xception c e = new Ch ampVAJsonE xception(j pe); | |
| 108 | return R esponse.st atus(Respo nse.Status .INTERNAL_ SERVER_ERR OR).header ("Exceptio n", ce.get ErrorCode( )) | |
| 109 | .build(); | |
| 110 | } catch (Cha mpVAExcept ion ce) { | |
| 111 | return R esponse.st atus(Respo nse.Status .INTERNAL_ SERVER_ERR OR).header ("Exceptio n", ce.get ErrorCode( )) | |
| 112 | .build(); | |
| 113 | } | |
| 114 | ||
| 115 | } | |
| 116 | ||
| 117 | /** | |
| 118 | * Set ter for th e champVAP ayDAO fiel d. | |
| 119 | * | |
| 120 | * @pa ram champV APayDAO | |
| 121 | * th e champVAP ayDAO to s et | |
| 122 | */ | |
| 123 | void s etChampVAP ayDAO(ICha mpVAPayDAO champVAPa yDAO) { | |
| 124 | th is.champVA PayDAO = c hampVAPayD AO; | |
| 125 | } | |
| 126 | ||
| 127 | /** | |
| 128 | * Set ter for th e mapper f ield. | |
| 129 | * | |
| 130 | * @pa ram mapper | |
| 131 | * th e mapper t o set | |
| 132 | */ | |
| 133 | void s etMapper(O bjectMappe r mapper) { | |
| 134 | th is.mapper = mapper; | |
| 135 | } | |
| 136 | ||
| 137 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.