Produced by Araxis Merge on 4/2/2019 1:06:54 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:\AraxisMergeCompare\Pri_un\ARS_Backend\ars_app\src\main\java\gov\va\med\ars\controller | CodeAndModifiersController.java | Wed Mar 27 19:21:10 2019 UTC |
2 | C:\AraxisMergeCompare\Pri_re\ARS_Backend\ars_app\src\main\java\gov\va\med\ars\controller | CodeAndModifiersController.java | Fri Mar 29 17:19:32 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 344 |
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 | * | |
3 | */ | |
4 | package go v.va.med.a rs.control ler; | |
5 | ||
6 | import jav a.util.Arr ayList; | |
7 | import jav a.util.Col lection; | |
8 | import jav a.util.Has hSet; | |
9 | import jav a.util.Lis t; | |
10 | ||
11 | import jav ax.servlet .http.Http ServletReq uest; | |
12 | import jav ax.validat ion.Valid; | |
13 | import org .apache.lo gging.log4 j.LogManag er; | |
14 | import org .apache.lo gging.log4 j.Logger; | |
15 | import org .springfra mework.bea ns.factory .annotatio n.Autowire d; | |
16 | import org .springfra mework.htt p.HttpStat us; | |
17 | import org .springfra mework.htt p.Response Entity; | |
18 | import org .springfra mework.web .bind.anno tation.Get Mapping; | |
19 | import org .springfra mework.web .bind.anno tation.Pos tMapping; | |
20 | import org .springfra mework.web .bind.anno tation.Req uestBody; | |
21 | import org .springfra mework.web .bind.anno tation.Req uestMappin g; | |
22 | import org .springfra mework.web .bind.anno tation.Req uestMethod ; | |
23 | import org .springfra mework.web .bind.anno tation.Res tControlle r; | |
24 | ||
25 | import gov .va.med.ar s.exceptio ns.Generic Exception; | |
26 | import gov .va.med.ar s.model.re quest.Gene ricRequest ; | |
27 | import gov .va.med.ar s.model.re quest.Json ArrayModel ; | |
28 | import gov .va.med.ar s.model.re sponse.Gen ericJsonRe sponse; | |
29 | import gov .va.med.ar s.service. ICodeAndMo difierServ ice; | |
30 | import gov .va.med.do main.fee.P ayerInfo; | |
31 | import net .minidev.j son.JSONOb ject; | |
32 | ||
33 | /** | |
34 | * @author
|
|
35 | * | |
36 | */ | |
37 | @RestContr oller | |
38 | @RequestMa pping("api /v1/popula te") | |
39 | public cla ss CodeAnd ModifiersC ontroller { | |
40 | ||
41 | pr ivate stat ic final L ogger logg er = LogMa nager.getL ogger(Code AndModifie rsControll er.class); | |
42 | ||
43 | @A utowired | |
44 | IC odeAndModi fierServic e codeAndM odiferServ ice; | |
45 | ||
46 | /* * | |
47 | * | |
48 | * / | |
49 | @P ostMapping (value = { "/loinc", "/loincMo d", "/hccs " }) | |
50 | pu blic Respo nseEntity< ?> getCode s(@Request Body JsonA rrayModel acceptedVa lues, Http ServletReq uest reque st) | |
51 | throws GenericEx ception { | |
52 | JSON Object res ponse = nu ll; | |
53 | Stri ng current Url = requ est.getReq uestURI(). toString() ; | |
54 | try { | |
55 | if (ac ceptedValu es.getAcce ptedValues ().size() > 0) { | |
56 | List<?> returnedRe sponse = c odeAndModi ferService .getCodeAn dModifier( currentUrl , | |
57 | ac ceptedValu es.getAcce ptedValues ()); | |
58 | if (retu rnedRespon se.size() > 0) { | |
59 | return new ResponseE ntity<>(re turnedResp onse, Http Status.OK) ; | |
60 | } else { | |
61 | response = new JSONO bject(); | |
62 | logger.war n("getCode s : wrong input "); | |
63 | response.p ut("errorC ode", "Un- Authorized "); | |
64 | response.p ut("messag e", "The e ntered use r has give n wrong in put to the applicati on"); | |
65 | return new ResponseE ntity<>(re sponse, Ht tpStatus.N OT_FOUND); | |
66 | } | |
67 | } else { | |
68 | response = new JSO NObject(); | |
69 | logger.w arn("getCo des : wron g input ") ; | |
70 | response .put("erro rCode", "U n-Authoriz ed"); | |
71 | response .put("mess age", "The entered u ser has gi ven wrong input to t he applica tion"); | |
72 | return n ew Respons eEntity<>( response, HttpStatus .NOT_FOUND ); | |
73 | } | |
74 | ||
75 | } ca tch (Excep tion e) { | |
76 | logger .error("Po pulateCode AndModifie rsControll er:getCode s() except ion occure d for clai m index : " | |
77 | + e.getMes sage()); | |
78 | throw e; | |
79 | } | |
80 | } | |
81 | ||
82 | @R equestMapp ing(value = { "/add" }, method = { Reque stMethod.P OST, Reque stMethod.P UT }) | |
83 | pu blic Respo nseEntity< ?> addOrMo difyCodes( @Valid @Re questBody GenericReq uest codeA ndModifier Request, | |
84 | HttpSe rvletReque st request ) throws G enericExce ption { | |
85 | JSON Object jso nResponse = null; | |
86 | Gene ricJsonRes ponse gene ricJsonRes ponse = nu ll; | |
87 | try { | |
88 | if (co deAndModif ierRequest != null) { | |
89 | List<Str ing> dupli cateCheck = codeAndM odiferServ ice | |
90 | .c heckSubmit tedModific ationsForD upes(codeA ndModifier Request); | |
91 | if (!dup licateChec k.isEmpty( )) { | |
92 | logger.war n("Found D uplicates in Request "); | |
93 | JSONObject entity = new JSONOb ject(); | |
94 | entity.put ("errorCod e", "Updat e Codes No t Complete : Duplicat es Found") ; | |
95 | entity.put ("message" , duplicat eCheck); | |
96 | return new ResponseE ntity<>(en tity, Http Status.BAD _REQUEST); | |
97 | } | |
98 | ||
99 | List<Str ing> redun dantCodes = codeAndM odiferServ ice.getArc hivedCodes (codeAndMo difierRequ est); | |
100 | HashSet< Object> se en = new H ashSet<>() ; | |
101 | ||
102 | if (redu ndantCodes .size() > 0) { | |
103 | if (codeAn dModifierR equest.get HccList() != null && !codeAndM odifierReq uest.getHc cList().is Empty()) { | |
104 | co deAndModif ierRequest .getHccLis t().remove If(e -> !s een.add(re dundantCod es)); | |
105 | } | |
106 | ||
107 | if (codeAn dModifierR equest.get LoincList( ) != null | |
108 | && ! codeAndMod ifierReque st.getLoin cList().is Empty()) { | |
109 | co deAndModif ierRequest .getLoincL ist().remo veIf(e -> !seen.add( redundantC odes)); | |
110 | } | |
111 | ||
112 | if (codeAn dModifierR equest.get LoincList( ) != null | |
113 | && ! codeAndMod ifierReque st.getLoin cModList() .isEmpty() ) { | |
114 | co deAndModif ierRequest .getLoincM odList().r emoveIf(e -> !seen.a dd(redunda ntCodes)); | |
115 | } | |
116 | } | |
117 | ||
118 | boolean response = codeAndMo diferServi ce.addOrMo difyCodeAn dModifier( codeAndMod ifierReque st); | |
119 | genericJ sonRespons e = new Ge nericJsonR esponse(); | |
120 | genericJ sonRespons e.setResul t(response ); | |
121 | genericJ sonRespons e.setAlrea dyArchived Codes(redu ndantCodes ); | |
122 | return n ew Respons eEntity<>( genericJso nResponse, HttpStatu s.OK); | |
123 | } else { | |
124 | jsonResp onse = new JSONObjec t(); | |
125 | logger.w arn("getCl aim : no i nformation was passe d"); | |
126 | jsonResp onse.put(" errorCode" , "Un-Auth orized"); | |
127 | jsonResp onse.put(" message", "The enter ed user ha s no acces s to the a dd the cod es"); | |
128 | return n ew Respons eEntity<>( jsonRespon se, HttpSt atus.NOT_F OUND); | |
129 | } | |
130 | ||
131 | } ca tch (Excep tion e) { | |
132 | logger .error("Po pulateCode AndModifie rsControll er:getCode s() except ion occure d for clai m index : " | |
133 | + e.getMes sage()); | |
134 | throw e; | |
135 | } | |
136 | } | |
137 | ||
138 | @R equestMapp ing(value = { "/arch ive" }, me thod = { R equestMeth od.POST, R equestMeth od.PUT }) | |
139 | pu blic Respo nseEntity< ?> archive Codes(@Val id @Reques tBody Gene ricRequest codeAndMo difierRequ est, | |
140 | HttpSe rvletReque st request ) throws G enericExce ption { | |
141 | JSON Object jso nResponse = null; | |
142 | try { | |
143 | if (co deAndModif ierRequest != null) { | |
144 | List<Str ing> dupli cateCheck = codeAndM odiferServ ice | |
145 | .c heckSubmit tedModific ationsForD upes(codeA ndModifier Request); | |
146 | if (!dup licateChec k.isEmpty( )) { | |
147 | logger.war n("Found D uplicates in Request "); | |
148 | JSONObject entity = new JSONOb ject(); | |
149 | entity.put ("errorCod e", "Updat e Codes No t Complete : Duplicat es Found") ; | |
150 | entity.put ("message" , duplicat eCheck); | |
151 | return new ResponseE ntity<>(en tity, Http Status.BAD _REQUEST); | |
152 | } | |
153 | boolean response = codeAndMo diferServi ce.addOrMo difyCodeAn dModifier( codeAndMod ifierReque st); | |
154 | JSONObje ct entity = new JSON Object(); | |
155 | entity.p ut("result ", respons e); | |
156 | return n ew Respons eEntity<>( entity, Ht tpStatus.O K); | |
157 | } else { | |
158 | jsonResp onse = new JSONObjec t(); | |
159 | logger.w arn("getCl aim : no i nformation was passe d"); | |
160 | jsonResp onse.put(" errorCode" , "Un-Auth orized"); | |
161 | jsonResp onse.put(" message", "The enter ed user ha s no acces s to the a dd the cod es"); | |
162 | return n ew Respons eEntity<>( jsonRespon se, HttpSt atus.NOT_F OUND); | |
163 | } | |
164 | ||
165 | } ca tch (Excep tion e) { | |
166 | logger .error("Po pulateCode AndModifie rsControll er:getCode s() except ion occure d for clai m index : " | |
167 | + e.getMes sage()); | |
168 | throw e; | |
169 | } | |
170 | } | |
171 | ||
172 | ||
173 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.