Produced by Araxis Merge on 3/25/2019 8:58:06 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 | C:\AraxisMergeCompare\Pri_un\IMAG_Source\VISA\Java\ViewerImagingWebApp\main\src\java\gov\va\med\imaging\viewer\rest | ViewerImagingQAService.java | Mon Mar 18 20:39:08 2019 UTC |
2 | C:\AraxisMergeCompare\Pri_re\IMAG_Source\VISA\Java\ViewerImagingWebApp\main\src\java\gov\va\med\imaging\viewer\rest | ViewerImagingQAService.java | Tue Mar 19 12:04:14 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 3 | 514 |
Changed | 2 | 4 |
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 | * Date Cr eated: Apr 25, 2018 | |
3 | * Develop er: DNS tjahjb | |
4 | */ | |
5 | package go v.va.med.i maging.vie wer.rest; | |
6 | ||
7 | import gov .va.med.im aging.core .interface s.exceptio ns.Connect ionExcepti on; | |
8 | import gov .va.med.im aging.core .interface s.exceptio ns.MethodE xception; | |
9 | import gov .va.med.im aging.rest .types.Res tStringTyp e; | |
10 | import gov .va.med.im aging.tran sactioncon text.Trans actionCont extFactory ; | |
11 | import gov .va.med.im aging.tran sactioncon text.Trans actionCont extHttpHea ders; | |
12 | import gov .va.med.im aging.view er.ViewerI magingCont extHolder; | |
13 | import gov .va.med.im aging.view er.command s.DeleteIm agesComman d; | |
14 | import gov .va.med.im aging.view er.command s.FlagImag esAsSensit iveCommand ; | |
15 | import gov .va.med.im aging.view er.command s.GetCaptu reUsersCom mand; | |
16 | import gov .va.med.im aging.view er.command s.GetImage Properties Command; | |
17 | import gov .va.med.im aging.view er.command s.GetQARev iewReportD ataCommand ; | |
18 | import gov .va.med.im aging.view er.command s.GetQARev iewReports Command; | |
19 | import gov .va.med.im aging.view er.command s.SetImage Properties Command; | |
20 | import gov .va.med.im aging.view er.rest.en dpoints.Vi ewerImagin gRestUri; | |
21 | import gov .va.med.im aging.view er.rest.ty pes.Captur eUserResul tType; | |
22 | import gov .va.med.im aging.view er.rest.ty pes.Captur eUserResul tsType; | |
23 | import gov .va.med.im aging.view er.rest.ty pes.Delete ImageUrnsT ype; | |
24 | import gov .va.med.im aging.view er.rest.ty pes.ImageP ropertiesT ype; | |
25 | import gov .va.med.im aging.view er.rest.ty pes.QARevi ewReportRe sultsType; | |
26 | import gov .va.med.im aging.web. rest.excep tions.Abst ractRestSe rvice; | |
27 | ||
28 | import jav a.text.Par seExceptio n; | |
29 | import jav a.text.Sim pleDateFor mat; | |
30 | import jav a.util.Dat e; | |
31 | ||
32 | import jav ax.ws.rs.C onsumes; | |
33 | import jav ax.ws.rs.G ET; | |
34 | import jav ax.ws.rs.P OST; | |
35 | import jav ax.ws.rs.P ath; | |
36 | import jav ax.ws.rs.P roduces; | |
37 | import jav ax.ws.rs.Q ueryParam; | |
38 | import jav ax.ws.rs.c ore.MediaT ype; | |
39 | import jav ax.ws.rs.c ore.Respon se; | |
40 | import jav ax.ws.rs.c ore.Respon se.Status; | |
41 | ||
42 | /** | |
43 | * @author DNS tjahjb | |
44 | * | |
45 | */ | |
46 | @Path(View erImagingR estUri.vie werImaging QAServiceP ath) | |
47 | public cla ss ViewerI magingQASe rvice | |
48 | extends Ab stractRest Service | |
49 | { | |
50 | @GET | |
51 | @P ath(Viewer ImagingRes tUri.viewe rImagingGe tQAReviewR eports) | |
52 | @Produ ces(MediaT ype.APPLIC ATION_XML) | |
53 | pu blic Respo nse getQAR eviewRepor ts( | |
54 | @QueryPa ram("userI d") String userId) | |
55 | throws MethodExc eption, Co nnectionEx ception | |
56 | { | |
57 | if (userId = = null) | |
58 | user Id = ""; | |
59 | ||
60 | Ge tQAReviewR eportsComm and cmd = new GetQA ReviewRepo rtsCommand (userId, g etInterfac eVersion() ); | |
61 | QA ReviewRepo rtResultsT ype result = cmd.exe cute(); | |
62 | if (result = = null) | |
63 | { | |
64 | retu rn Respons e.status(S tatus.NOT_ FOUND).hea der(Transa ctionConte xtHttpHead ers.httpHe aderMachin eName, | |
65 | Transact ionContext Factory.ge t().getMac hineName() ).entity(" VistA Remo te Procedu re Error") .build(); | |
66 | } | |
67 | el se | |
68 | { | |
69 | retu rn wrapRes ultWithRes ponseHeade rs(result) ; | |
70 | } | |
71 | } | |
72 | ||
73 | @GET | |
74 | @P ath(Viewer ImagingRes tUri.viewe rImagingGe tQAReviewR eportData) | |
75 | @Produ ces(MediaT ype.APPLIC ATION_XML) | |
76 | pu blic Respo nse getQAR eviewRepor tData( | |
77 | @QueryPa ram("flags ") String flags, | |
78 | @QueryPa ram("fromD ate") Stri ng fromDat e, | |
79 | @QueryPa ram("throu ghDate") S tring thro ughDate, | |
80 | @QueryPa ram("mque" ) String m que | |
81 | ) | |
82 | throws MethodExc eption, Co nnectionEx ception | |
83 | { | |
84 | in t vistaFro mDate = In teger.pars eInt(fromD ate) - 170 00000; | |
85 | in t vistaThr oughDate = Integer.p arseInt(th roughDate) - 1700000 0; | |
86 | ||
87 | Ge tQAReviewR eportDataC ommand cmd = new Ge tQAReviewR eportDataC ommand(fla gs, Intege r.toString (vistaFrom Date), Int eger.toStr ing(vistaT hroughDate ), mque, g etInterfac eVersion() ); | |
88 | Re stStringTy pe result = cmd.exec ute(); | |
89 | if (result = = null) | |
90 | { | |
91 | retu rn Respons e.status(S tatus.INTE RNAL_SERVE R_ERROR).h eader(Tran sactionCon textHttpHe aders.http HeaderMach ineName, | |
92 | Transact ionContext Factory.ge t().getMac hineName() ).entity(" Unexpected internal error").bu ild(); | |
93 | } | |
94 | el se if (res ult.getVal ue().start sWith("0") ) | |
95 | { | |
96 | retu rn Respons e.status(S tatus.NOT_ ACCEPTABLE ).header(T ransaction ContextHtt pHeaders.h ttpHeaderM achineName , | |
97 | Transact ionContext Factory.ge t().getMac hineName() ).entity(" result").b uild(); | |
98 | ||
99 | } | |
100 | el se | |
101 | { | |
102 | retu rn wrapRes ultWithRes ponseHeade rs(result) ; | |
103 | } | |
104 | } | |
105 | ||
106 | @GET | |
107 | @P ath(Viewer ImagingRes tUri.viewe rImagingGe tCaptureUs ersMethodP ath) | |
108 | @Produ ces(MediaT ype.APPLIC ATION_XML) | |
109 | pu blic Respo nse getCap tureUsers( | |
110 | @QueryPa ram("appFl ag") Strin g appFlag, | |
111 | @Query Param("fro mDate") St ring fromD ate, | |
112 | @Query Param("thr oughDate") String th roughDate) | |
113 | throws MethodExc eption, Co nnectionEx ception | |
114 | { | |
115 | St ring err = validateC aptureUser sParams(ap pFlag, fro mDate, thr oughDate); | |
116 | ||
117 | if (err != n ull) | |
118 | { | |
119 | retu rn Respons e.status(S tatus.BAD_ REQUEST).h eader(Tran sactionCon textHttpHe aders.http HeaderMach ineName, | |
120 | Transact ionContext Factory.ge t().getMac hineName() ).entity(e rr).build( ); | |
121 | } | |
122 | ||
123 | in t vistaFro mDate = In teger.pars eInt(fromD ate) - 170 00000; | |
124 | in t vistaThr oughDate = Integer.p arseInt(th roughDate) - 1700000 0; | |
125 | ||
126 | Ge tCaptureUs ersCommand cmd = ne w GetCaptu reUsersCom mand(appFl ag, Intege r.toString (vistaFrom Date), Int eger.toStr ing(vistaT hroughDate ), getInte rfaceVersi on()); | |
127 | Ca ptureUserR esultsType result = cmd.execut e(); | |
128 | if (result = = null) | |
129 | { | |
130 | retu rn Respons e.status(S tatus.NOT_ FOUND).hea der(Transa ctionConte xtHttpHead ers.httpHe aderMachin eName, | |
131 | Transact ionContext Factory.ge t().getMac hineName() ).entity(r esult).bui ld(); | |
132 | } | |
133 | ||
134 | Ca ptureUserR esultType[ ] lst = re sult.getCa ptureUsers (); | |
135 | ||
136 | if (lst.leng th == 0) | |
137 | { | |
138 | retu rn Respons e.status(S tatus.NOT_ FOUND).hea der(Transa ctionConte xtHttpHead ers.httpHe aderMachin eName, | |
139 | Transact ionContext Factory.ge t().getMac hineName() ).entity(r esult).bui ld(); | |
140 | } | |
141 | el se | |
142 | { | |
143 | Capt ureUserRes ultType re sMsg = lst [0]; | |
144 | if ( resMsg.get UserId().e quals("0") ) | |
145 | { | |
146 | return Response. status(Sta tus.BAD_RE QUEST).hea der(Transa ctionConte xtHttpHead ers.httpHe aderMachin eName, | |
147 | Transactio nContextFa ctory.get( ).getMachi neName()). entity(res Msg.getUse rName()).b uild(); | |
148 | } | |
149 | else | |
150 | { | |
151 | retu rn wrapRes ultWithRes ponseHeade rs(result) ; | |
152 | ||
153 | } | |
154 | } | |
155 | } | |
156 | ||
157 | pr ivate Stri ng validat eCaptureUs ersParams( String app Flag, Stri ng fromDat e, String throughDat e) | |
158 | { | |
159 | if ( (appFlag = = null) || appFlag.i sEmpty()) | |
160 | { | |
161 | return "Applicat ion Flag i s required "; | |
162 | } | |
163 | ||
164 | if ( !(appFlag. equals("C" ) || appFl ag.equals( "I"))) | |
165 | { | |
166 | return "Applicat ion Flag m ust be 'C' for Captu re Worksta tion or 'I ' for Impr t API"; | |
167 | } | |
168 | ||
169 | if ( (fromDate == null) | | fromDate .isEmpty() ) | |
170 | { | |
171 | return "From Dat e is requi red"; | |
172 | } | |
173 | ||
174 | if ( (throughDa te == null ) || throu ghDate.isE mpty()) | |
175 | { | |
176 | return "Through Date is re quired"; | |
177 | } | |
178 | ||
179 | Date from = nu ll; | |
180 | Date tru = nul l; | |
181 | ||
182 | Simp leDateForm at formatt er = new S impleDateF ormat("yyy yMMdd"); | |
183 | try | |
184 | { | |
185 | from = formatter .parse(fro mDate); | |
186 | } | |
187 | catc h (ParseEx ception e) | |
188 | { | |
189 | return "From Dat e must be in yyyyMMd d format [ 20181231]. Error: " + e.getMes sage(); | |
190 | } | |
191 | ||
192 | try | |
193 | { | |
194 | tru = formatter. parse(thro ughDate); | |
195 | } | |
196 | catc h (ParseEx ception e) | |
197 | { | |
198 | return "Through Date must be in yyyy MMdd forma t [2018123 1]. Error: " + e.get Message(); | |
199 | } | |
200 | ||
201 | if ( tru.before (from)) | |
202 | { | |
203 | return "Through Date must be after F rom Date"; | |
204 | } | |
205 | ||
206 | retu rn null; | |
207 | } | |
208 | ||
209 | @P OST | |
210 | @P ath(Viewer ImagingRes tUri.viewe rImagingSe tImageProp ertiesMeth odPath) | |
211 | @P roduces(Me diaType.AP PLICATION_ XML) | |
212 | @C onsumes(Me diaType.AP PLICATION_ XML) | |
213 | pu blic Respo nse setIma geProperti es(ImagePr opertiesTy pe imagePr ops) | |
214 | th rows Metho dException , Connecti onExceptio n | |
215 | { | |
216 | retu rn wrapRes ultWithRes ponseHeade rs( | |
217 | new SetI mageProper tiesComman d( | |
218 | im ageProps, | |
219 | ge tInterface Version()) .execute() ); | |
220 | } | |
221 | ||
222 | @GET | |
223 | @P ath(Viewer ImagingRes tUri.viewe rImagingGe tImageProp ertiesMeth odPath) | |
224 | @Produ ces(MediaT ype.APPLIC ATION_XML) | |
225 | pu blic Respo nse getIma geProperti es( | |
226 | @Query Param("ima geIEN") St ring image IEN, | |
227 | @QueryPa ram("props ") String props, | |
228 | @QueryPa ram("flags ") String flags | |
229 | ) | |
230 | throws MethodExc eption, Co nnectionEx ception | |
231 | { | |
232 | Ge tImageProp ertiesComm and cmd = new GetIm agePropert iesCommand (imageIEN, props, fl ags, getIn terfaceVer sion()); | |
233 | Im agePropert iesType re sult = cmd .execute() ; | |
234 | if (result = = null) | |
235 | { | |
236 | retu rn Respons e.status(S tatus.INTE RNAL_SERVE R_ERROR).h eader(Tran sactionCon textHttpHe aders.http HeaderMach ineName, | |
237 | Transact ionContext Factory.ge t().getMac hineName() ).entity(" Unexpected internal error").bu ild(); | |
238 | } | |
239 | el se if (res ult.getIma geProperti es()[0].ge tName().st artsWith(" ERROR")) | |
240 | { | |
241 | retu rn Respons e.status(S tatus.BAD_ REQUEST).h eader(Tran sactionCon textHttpHe aders.http HeaderMach ineName, | |
242 | Transact ionContext Factory.ge t().getMac hineName() ).entity(r esult.getI mageProper ties()[0]. getValue() ).build(); | |
243 | } | |
244 | el se | |
245 | { | |
246 | retu rn wrapRes ultWithRes ponseHeade rs(result) ; | |
247 | } | |
248 | } | |
249 | ||
250 | pr otected St ring getIn terfaceVer sion() | |
251 | { | |
252 | retu rn "V1"; | |
253 | } | |
254 | ||
255 | pr otected St ring getLo calSiteNum ber() | |
256 | { | |
257 | retu rn ViewerI magingCont extHolder. getViewerI magingCont ext().getA ppConfigur ation().ge tLocalSite Number(); | |
258 | } | |
259 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.