Produced by Araxis Merge on 3/25/2019 8:58:07 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\VistaImagingDataSourceProvider\main\src\java\gov\va\med\imaging\vistaimagingdatasource | AbstractBaseVistaImagingStudyGraphService.java | Mon Mar 18 20:39:06 2019 UTC |
2 | C:\AraxisMergeCompare\Pri_re\IMAG_Source\VISA\Java\VistaImagingDataSourceProvider\main\src\java\gov\va\med\imaging\vistaimagingdatasource | AbstractBaseVistaImagingStudyGraphService.java | Tue Mar 19 12:04:22 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 3 | 658 |
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 | * | |
3 | Package: MAG - Vis tA Imaging | |
4 | WARNING: Per VHA D irective 2 004-038, t his routin e should n ot be modi fied. | |
5 | Date Cre ated: Jan 16, 2009 | |
6 | Site Nam e: Washin gton OI Fi eld Office , Silver S pring, MD | |
7 | Developer: DNS werfej | |
8 | Descript ion: | |
9 | ||
10 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
11 | ;; Property of the US Government . | |
12 | ;; No permis sion to co py or redi stribute t his softwa re is give n. | |
13 | ;; Use of un released v ersions of this soft ware requi res the us er | |
14 | ;; to execu te a writt en test ag reement wi th the Vis tA Imaging | |
15 | ;; Developm ent Office of the De partment o f Veterans Affairs, | |
16 | ;; telephon e (301) 73 4-0100. | |
17 | ;; | |
18 | ;; The Food and Drug A dministrat ion classi fies this software a s | |
19 | ;; a Class I I medical device. A s such, it may not b e changed | |
20 | ;; in any wa y. Modifi cations to this soft ware may r esult in a n | |
21 | ;; adulterat ed medical device un der 21CFR8 20, the us e of which | |
22 | ;; is consid ered to be a violati on of US F ederal Sta tutes. | |
23 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
24 | ||
25 | */ | |
26 | package go v.va.med.i maging.vis taimagingd atasource; | |
27 | ||
28 | import gov .va.med.Gl obalArtifa ctIdentifi er; | |
29 | import gov .va.med.Pa tientIdent ifier; | |
30 | import gov .va.med.Ro utingToken ; | |
31 | import gov .va.med.im aging.Stri ngUtil; | |
32 | import gov .va.med.im aging.Cprs Identifier .CprsIdent ifierType; | |
33 | import gov .va.med.im aging.arti factsource .ResolvedA rtifactSou rce; | |
34 | import gov .va.med.im aging.core .interface s.exceptio ns.*; | |
35 | import gov .va.med.im aging.core .interface s.exceptio ns.Securit yException ; | |
36 | import gov .va.med.im aging.data source.Stu dyGraphDat aSourceSpi ; | |
37 | import gov .va.med.im aging.data source.exc eptions.In validCrede ntialsExce ption; | |
38 | import gov .va.med.im aging.data source.exc eptions.Un supportedS erviceMeth odExceptio n; | |
39 | import gov .va.med.im aging.exce ptions.URN FormatExce ption; | |
40 | import gov .va.med.im aging.exch ange.busin ess.*; | |
41 | import gov .va.med.im aging.exch ange.enums .StudyLoad Level; | |
42 | import gov .va.med.im aging.prot ocol.vista .VistaImag ingTransla tor; | |
43 | import gov .va.med.im aging.tran sactioncon text.Trans actionCont extFactory ; | |
44 | import gov .va.med.im aging.url. vista.Stri ngUtils; | |
45 | import gov .va.med.im aging.url. vista.Vist aQuery; | |
46 | import gov .va.med.im aging.url. vista.exce ptions.Inv alidVistaC redentials Exception; | |
47 | import gov .va.med.im aging.url. vista.exce ptions.Vis taMethodEx ception; | |
48 | import gov .va.med.im aging.vist adatasourc e.common.V istaCommon Utilities; | |
49 | import gov .va.med.im aging.vist adatasourc e.session. VistaSessi on; | |
50 | import gov .va.med.im aging.vist aimagingda tasource.c ommon.Vist aImagingCo mmonUtilit ies; | |
51 | import gov .va.med.im aging.vist aobjects.V istaImage; | |
52 | ||
53 | import jav a.io.IOExc eption; | |
54 | import jav a.util.Lis t; | |
55 | ||
56 | import org .apache.lo gging.log4 j.LogManag er; | |
57 | import org .apache.lo gging.log4 j.Logger; | |
58 | ||
59 | /** | |
60 | * Abstrac t study gr aph servic e for Vist A. This i mplements some of th e common f unctions n eeded by t he version 0 and mai n | |
61 | * VistA s tudy graph service. This just eliminates some dupl icate code that was in both cl asses | |
62 | * | |
63 | * @author DNS werfej | |
64 | * | |
65 | */ | |
66 | public abs tract clas s Abstract BaseVistaI magingStud yGraphServ ice | |
67 | extends Ab stractVist aImagingDa taSourceSe rvice | |
68 | implements StudyGrap hDataSourc eSpi | |
69 | { | |
70 | pr ivate fina l Logger l ogger = Lo gManager.g etLogger(A bstractBas eVistaImag ingStudyGr aphService .class); | |
71 | ||
72 | /* * | |
73 | * Return th e required version o f VistA Im aging nece ssary to u se this se rvice | |
74 | * @return | |
75 | * / | |
76 | pr otected ab stract Str ing getReq uiredVista ImagingVer sion(); | |
77 | ||
78 | pr otected ab stract Str ing getDat aSourceVer sion(); | |
79 | ||
80 | ||
81 | /* * | |
82 | * @param re solvedArti factSource | |
83 | * @param pr otocol | |
84 | * / | |
85 | pu blic Abstr actBaseVis taImagingS tudyGraphS ervice(Res olvedArtif actSource resolvedAr tifactSour ce, String protocol) | |
86 | { | |
87 | supe r(resolved ArtifactSo urce, prot ocol); | |
88 | if(! (resolved ArtifactSo urce insta nceof Reso lvedSite) ) | |
89 | throw new Unsupp ortedOpera tionExcept ion("The a rtifact so urce must be an inst ance of Re solvedSite and it is a '" + re solvedArti factSource .getClass( ).getSimpl eName() + "'."); | |
90 | } | |
91 | ||
92 | /* * | |
93 | * The artif act source must be c hecked in the constr uctor to a ssure that it is an instance | |
94 | * of Resolv edSite. | |
95 | * | |
96 | * @return | |
97 | * / | |
98 | pr otected Re solvedSite getResolv edSite() | |
99 | { | |
100 | retu rn (Resolv edSite)get ResolvedAr tifactSour ce(); | |
101 | } | |
102 | ||
103 | pr otected Si te getSite () | |
104 | { | |
105 | retu rn getReso lvedSite() .getSite() ; | |
106 | } | |
107 | ||
108 | ||
109 | /* * | |
110 | * | |
111 | * @param pa tientDfn | |
112 | * @param Pa tientIcn | |
113 | * @return | |
114 | * @throws I OException | |
115 | * @throws V istaMethod Exception | |
116 | * @throws I nvalidVist aCredentia lsExceptio n | |
117 | * @throws V istaExcept ion | |
118 | * / | |
119 | pr otected Pa tientSensi tiveValue getPatient Sensitivit yLevel(Vis taSession vistaSessi on, String patientDf n) | |
120 | th rows IOExc eption, In validCrede ntialsExce ption, Met hodExcepti on | |
121 | { | |
122 | logg er.info("i sPatientRe stricted(" + patient Dfn + ", . ..) Transa ctionConte xt (" + Tr ansactionC ontextFact ory.get(). getDisplay Identity() + ")."); | |
123 | ||
124 | Pati entSensiti veValue va lue = Vist aCommonUti lities.get PatientSen sitivityVa lueFromDfn (vistaSess ion, patie ntDfn); | |
125 | retu rn value; | |
126 | } | |
127 | ||
128 | /* (non-Java doc) | |
129 | * @see gov. va.med.ima ging.datas ource.Stud yGraphData Source#isV ersionComp atible() | |
130 | * / | |
131 | @O verride | |
132 | pu blic boole an isVersi onCompatib le() | |
133 | th rows Secur ityExcepti on | |
134 | { | |
135 | logg er.info("i sVersionCo mpatible s earching f or version [" + getR equiredVis taImagingV ersion() + "], Trans actionCont ext (" + T ransaction ContextFac tory.get() .getDispla yIdentity( ) + ")."); | |
136 | Vist aSession l ocalVistaS ession = n ull; | |
137 | try | |
138 | { | |
139 | localV istaSessio n = getVis taSession( ); | |
140 | return VistaImag ingCommonU tilities.i sVersionCo mpatible(g etRequired VistaImagi ngVersion( ), localVi staSession ); | |
141 | } | |
142 | catc h(MethodEx ception mX ) | |
143 | { | |
144 | logger .error("Th ere was an error fin ding the i nstalled I maging ver sion from VistA", mX ); | |
145 | Transa ctionConte xtFactory. get().addD ebugInform ation("isV ersionComp atible() f ailed, " + (mX == nu ll ? "<nul l error>" : mX.getMe ssage())); | |
146 | } | |
147 | catc h(Security Credential sExpiredEx ception sc eX) | |
148 | { | |
149 | // cau ght here t o be sure it gets th rown as Se curityCred entialsExp iredExcept ion, not C onnectionE xception | |
150 | throw sceX; | |
151 | } | |
152 | catc h(Connecti onExceptio n cX) | |
153 | { | |
154 | logger .error("Th ere was an error fin ding the i nstalled I maging ver sion from VistA", cX ); | |
155 | Transa ctionConte xtFactory. get().addD ebugInform ation("isV ersionComp atible() f ailed, " + (cX == nu ll ? "<nul l error>" : cX.getMe ssage())); | |
156 | } | |
157 | catc h(IOExcept ion ioX) | |
158 | { | |
159 | logger .error("Th ere was an error fin ding the i nstalled I maging ver sion from VistA", io X); | |
160 | Transa ctionConte xtFactory. get().addD ebugInform ation("isV ersionComp atible() f ailed, " + (ioX == n ull ? "<nu ll error>" : ioX.get Message()) ); | |
161 | } | |
162 | fina lly | |
163 | { | |
164 | try{lo calVistaSe ssion.clos e();} | |
165 | catch( Throwable t){} | |
166 | } | |
167 | retu rn false; | |
168 | } | |
169 | ||
170 | pr otected Vi staSession getVistaS ession() | |
171 | throws IOExcepti on, Connec tionExcept ion, Metho dException , Security Credential sExpiredEx ception | |
172 | { | |
173 | return V istaSessio n.getOrCre ate(getMet adataUrl() , getSite( )); | |
174 | } | |
175 | ||
176 | /* * | |
177 | * | |
178 | * @param ie n Base32 e ncoded IEN of the im age to get the repor t for | |
179 | * @return | |
180 | * @throws M ethodExcep tion | |
181 | * @throws C onnectionE xception | |
182 | * @throws R pcExceptio n | |
183 | * / | |
184 | pr otected St ring getRe port(Vista Session vi staSession , String i en) | |
185 | th rows Vista MethodExce ption, Con nectionExc eption, Me thodExcept ion | |
186 | { | |
187 | logg er.info("g etReport(" + ien + " ) Transact ionContext (" + Tran sactionCon textFactor y.get().ge tDisplayId entity() + ")."); | |
188 | // C TB 29Nov20 09 | |
189 | //ie n = Base32 Conversion Utility.ba se32Decode (ien); | |
190 | ien += "^"; | |
191 | Vist aQuery vm = VistaIma gingQueryF actory.cre ateGetRepo rtVistaQue ry(ien); | |
192 | Stri ng rtn = n ull; | |
193 | try | |
194 | { | |
195 | rtn = vistaSessi on.call(vm ); | |
196 | logger .info(vm.g etRpcName( )+" RPC Re sults:"+St ringUtils. displayEnc odedChars( rtn)); | |
197 | ||
198 | return VistaImag ingCommonU tilities.e xtractInva lidCharact ersFromRep ort(rtn); | |
199 | } | |
200 | catc h (Excepti on ex) | |
201 | { | |
202 | logger .error(ex) ; | |
203 | throw new VistaM ethodExcep tion(ex); | |
204 | } | |
205 | } | |
206 | ||
207 | /* * | |
208 | * Det ermines if the patie nt is sens itive. If so then c ompares th at sensiti ve value t o the valu e | |
209 | * in the filter , if the f ilter cont ains a suf ficient se nsitive va lue, then logging is done (if necessary) | |
210 | * and the funct ion return s. If the filter doe s not prov ide suffic ient sensi tive level then an e xception | |
211 | * is thrown. | |
212 | * | |
213 | * @pa ram sessio n | |
214 | * @pa ram patien tDfn | |
215 | * @pa ram patien tIcn | |
216 | * @pa ram filter | |
217 | * @th rows IOExc eption | |
218 | * @th rows Metho dException | |
219 | * @th rows Conne ctionExcep tion | |
220 | */ | |
221 | protec ted void c heckPatien tSensitive (VistaSess ion sessio n, String patientDfn , | |
222 | Pati entIdentif ier patien tIdentifie r, StudyFi lter filte r) | |
223 | throws IOExcepti on, Method Exception, Connectio nException | |
224 | { | |
225 | Pa tientSensi tiveValue patientSen sitiveValu e = getPat ientSensit ivityLevel (session, | |
226 | patientD fn ); | |
227 | ||
228 | if(p atientSens itiveValue .getSensit iveLevel() .getCode() > getMaxi mumPatient Sensitivit yLevel(fil ter)) | |
229 | { | |
230 | // if patient is restricte d (has sen sitivity l evel 3) at this site , return a n empty li st (to not blow up w hen mergin g lists to gether) | |
231 | // fac t is logge d already (alternati vely could throw an exception) | |
232 | Insuff icientPati entSensiti vityExcept ion ipsX = | |
233 | Insuffic ientPatien tSensitivi tyExceptio n.createIn sufficient PatientSen sitivityEx ception( | |
234 | patientSen sitiveValu e, | |
235 | patientIde ntifier, f ilter.getM aximumAllo wedLevel() ); | |
236 | logger .info(ipsX .getMessag e()); | |
237 | throw ipsX; | |
238 | } | |
239 | if(p atientSens itiveValue .getSensit iveLevel() .isLogging Required() ) | |
240 | { | |
241 | VistaC ommonUtili ties.logRe strictedAc cess(sessi on, patien tDfn); | |
242 | } | |
243 | } | |
244 | ||
245 | /** | |
246 | * Return th e maximum permissibl e patient sensitivit y level | |
247 | * that will be includ ed in resu lts. Sens itivity le vels | |
248 | * range fro m: | |
249 | * 0 - least sensitive | |
250 | * - to - | |
251 | * 3 - most sensitive | |
252 | * | |
253 | * @return | |
254 | * / | |
255 | pr otected in t getMaxim umPatientS ensitivity Level(Stud yFilter fi lter) | |
256 | { | |
257 | retu rn filter. getMaximum AllowedLev el().getCo de(); | |
258 | } | |
259 | ||
260 | /* (non-Java doc) | |
261 | * @see gov. va.med.ima ging.datas ource.Stud yGraphData SourceSpi# getPatient Studies(go v.va.med.R outingToke n, java.la ng.String, gov.va.me d.imaging. exchange.b usiness.St udyFilter, gov.va.me d.imaging. exchange.e nums.Study LoadLevel) | |
262 | * / | |
263 | @O verride | |
264 | pu blic Study SetResult getPatient Studies(Ro utingToken globalRou tingToken, PatientId entifier p atientIden tifier, St udyFilter filter, | |
265 | Stud yLoadLevel studyLoad Level) thr ows Method Exception, Connectio nException | |
266 | { | |
267 | thro w new Unsu pportedSer viceMethod Exception( StudyGraph DataSource Spi.class, "getPatie ntStudies" ); | |
268 | } | |
269 | ||
270 | /* (non-Java doc) | |
271 | * @see gov. va.med.ima ging.datas ource.Stud yGraphData SourceSpi# getStudy(j ava.lang.S tring, gov .va.med.Gl obalArtifa ctIdentifi er) | |
272 | * / | |
273 | @O verride | |
274 | pu blic Study getStudy( PatientIde ntifier pa tientIdent ifier, Glo balArtifac tIdentifie r studyId) throws Me thodExcept ion, | |
275 | Conn ectionExce ption | |
276 | { | |
277 | thro w new Unsu pportedSer viceMethod Exception( StudyGraph DataSource Spi.class, "getStudy "); | |
278 | } | |
279 | ||
280 | /* (non-Java doc) | |
281 | * @see gov. va.med.ima ging.datas ource.Stud yGraphData SourceSpi# getStudyRe port(java. lang.Strin g, gov.va. med.Global ArtifactId entifier) | |
282 | * / | |
283 | @O verride | |
284 | pu blic Strin g getStudy Report(Pat ientIdenti fier patie ntIdentifi er, Global ArtifactId entifier s tudyId) th rows Metho dException , | |
285 | Conn ectionExce ption | |
286 | { | |
287 | thro w new Unsu pportedSer viceMethod Exception( StudyGraph DataSource Spi.class, "getStudy Report"); | |
288 | } | |
289 | ||
290 | @O verride | |
291 | pu blic List< StoredStud yFilter> g etStoredFi lters(Rout ingToken g lobalRouti ngToken) | |
292 | th rows Metho dException , Connecti onExceptio n | |
293 | { | |
294 | ||
295 | Vist aCommonUti lities.set DataSource MethodAndV ersion("ge tStudiesFr omCprsIden tifier", g etDataSour ceVersion( )); | |
296 | Vist aSession v istaSessio n = null; | |
297 | logg er.info("g etStoredFi lters(" + globalRout ingToken + | |
298 | ") Trans actionCont ext (" + T ransaction ContextFac tory.get() .getTransa ctionId() + ")."); | |
299 | ||
300 | try | |
301 | { | |
302 | vistaS ession = g etVistaSes sion(); | |
303 | String duz = Tra nsactionCo ntextFacto ry.get().g etDuz(); | |
304 | VistaQ uery vm = VistaImagi ngQueryFac tory.creat eGetFilter List(duz); | |
305 | String rtn = vis taSession. call(vm); | |
306 | ||
307 | return VistaImag ingTransla tor.transl ateFilters (rtn, glob alRoutingT oken); | |
308 | } | |
309 | catc h(VistaMet hodExcepti on vmX) | |
310 | { | |
311 | throw new Method Exception( vmX); | |
312 | } | |
313 | catc h(InvalidV istaCreden tialsExcep tion icX) | |
314 | { | |
315 | throw new Invali dCredentia lsExceptio n(icX); | |
316 | } | |
317 | catc h(IOExcept ion ioX) | |
318 | { | |
319 | throw new Connec tionExcept ion(ioX); | |
320 | } | |
321 | catc h(URNForma tException urnfX) | |
322 | { | |
323 | throw new Method Exception( urnfX); | |
324 | } | |
325 | fina lly | |
326 | { | |
327 | try{vi staSession .close();} | |
328 | catch( Throwable t){} | |
329 | } | |
330 | } | |
331 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.