Produced by Araxis Merge on 3/25/2019 8:58:08 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 | VistaImagingExternalPackageDataSourceServiceV5.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 | VistaImagingExternalPackageDataSourceServiceV5.java | Tue Mar 19 12:04:24 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 612 |
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.i maging.vis taimagingd atasource; | |
5 | ||
6 | import gov .va.med.Pa tientIdent ifier; | |
7 | import gov .va.med.Ro utingToken ; | |
8 | import gov .va.med.im aging.Cprs Identifier ; | |
9 | import gov .va.med.im aging.Stri ngUtil; | |
10 | import gov .va.med.im aging.Cprs Identifier .CprsIdent ifierType; | |
11 | import gov .va.med.im aging.arti factsource .ResolvedA rtifactSou rce; | |
12 | import gov .va.med.im aging.core .interface s.exceptio ns.Connect ionExcepti on; | |
13 | import gov .va.med.im aging.core .interface s.exceptio ns.MethodE xception; | |
14 | import gov .va.med.im aging.data source.exc eptions.In validCrede ntialsExce ption; | |
15 | import gov .va.med.im aging.exce ptions.URN FormatExce ption; | |
16 | import gov .va.med.im aging.exch ange.busin ess.Image; | |
17 | import gov .va.med.im aging.exch ange.busin ess.Series ; | |
18 | import gov .va.med.im aging.exch ange.busin ess.Site; | |
19 | import gov .va.med.im aging.exch ange.busin ess.Study; | |
20 | import gov .va.med.im aging.exch ange.busin ess.StudyF ilter; | |
21 | import gov .va.med.im aging.exch ange.enums .StudyDele tedImageSt ate; | |
22 | import gov .va.med.im aging.exch ange.enums .StudyLoad Level; | |
23 | import gov .va.med.im aging.exch ange.trans lation.exc eptions.Tr anslationE xception; | |
24 | import gov .va.med.im aging.prot ocol.vista .VistaImag ingTransla tor; | |
25 | import gov .va.med.im aging.tran sactioncon text.Trans actionCont extFactory ; | |
26 | import gov .va.med.im aging.url. vista.Stri ngUtils; | |
27 | import gov .va.med.im aging.url. vista.Vist aQuery; | |
28 | import gov .va.med.im aging.url. vista.exce ptions.Inv alidVistaC redentials Exception; | |
29 | import gov .va.med.im aging.url. vista.exce ptions.Vis taMethodEx ception; | |
30 | import gov .va.med.im aging.vist adatasourc e.common.V istaCommon Utilities; | |
31 | import gov .va.med.im aging.vist adatasourc e.session. VistaSessi on; | |
32 | import gov .va.med.im aging.vist aimagingda tasource.c ommon.Vist aImagingCo mmonUtilit ies; | |
33 | import gov .va.med.im aging.vist aobjects.C prsIdentif ierImages; | |
34 | import gov .va.med.im aging.vist aobjects.V istaGroup; | |
35 | import gov .va.med.im aging.vist aobjects.V istaImage; | |
36 | ||
37 | import jav a.io.IOExc eption; | |
38 | import jav a.util.Arr ayList; | |
39 | import jav a.util.Has hMap; | |
40 | import jav a.util.Ite rator; | |
41 | import jav a.util.Lis t; | |
42 | import jav a.util.Map ; | |
43 | import jav a.util.Sor tedSet; | |
44 | import jav a.util.Tre eSet; | |
45 | ||
46 | /** | |
47 | * @author DNS tjahjb | |
48 | * | |
49 | */ | |
50 | //WFP-Need to add th is to appr opriate re source gat herer. | |
51 | public cla ss VistaIm agingExter nalPackage DataSource ServiceV5 | |
52 | extends Vi staImaging ExternalPa ckageDataS ourceServi ceV4 | |
53 | { | |
54 | ||
55 | pu blic final static St ring MAG_R EQUIRED_VE RSION = "3 .0P185"; | |
56 | ||
57 | /* * | |
58 | * @param re solvedArti factSource | |
59 | * @param pr otocol | |
60 | * / | |
61 | pu blic Vista ImagingExt ernalPacka geDataSour ceServiceV 5( | |
62 | Resolv edArtifact Source res olvedArtif actSource, String pr otocol) { | |
63 | supe r(resolved ArtifactSo urce, prot ocol); | |
64 | } | |
65 | ||
66 | /* (non-Java doc) | |
67 | * @see gov. va.med.ima ging.vista datasource .AbstractB aseVistaEx ternalPack ageDataSou rceService #getRequir edVistaIma gingVersio n() | |
68 | * / | |
69 | @O verride | |
70 | pr otected St ring getRe quiredVist aImagingVe rsion() | |
71 | { | |
72 | retu rn VistaIm agingCommo nUtilities .getVistaD ataSourceI magingVers ion( | |
73 | VistaIma gingDataSo urceProvid er.getVist aConfigura tion(), th is.getClas s(), | |
74 | MAG_REQU IRED_VERSI ON); | |
75 | } | |
76 | ||
77 | @O verride | |
78 | pr otected St ring getDa taSourceVe rsion() | |
79 | { | |
80 | retu rn "5"; | |
81 | } | |
82 | ||
83 | ||
84 | /* (non-Java doc) | |
85 | * @see gov. va.med.ima ging.datas ource.Exte rnalPackag eDataSourc eSpi#getVi ewerStudie sForQaRevi ewgov.va.m ed.Routing Token, gov .va.med.im aging.exch ange.busin ess.StudyF ilter) | |
86 | * / | |
87 | @O verride | |
88 | pu blic List< Study> pos tViewerStu diesForQaR eview( | |
89 | Routin gToken glo balRouting Token, | |
90 | StudyF ilter filt er) | |
91 | th rows Metho dException ,Connectio nException | |
92 | { | |
93 | getL ogger().de bug("...ex ecuting po stViewerSt udiesForQa Review met hod in V5. "); | |
94 | Vist aCommonUti lities.set DataSource MethodAndV ersion("po stViewerSt udiesForQa Review", g etDataSour ceVersion( )); | |
95 | Vist aSession v istaSessio n; | |
96 | try { | |
97 | vistaS ession = g etVistaSes sion(); | |
98 | } ca tch (IOExc eption e) { | |
99 | getLog ger().erro r("getVist aSession e rror: " + e.getMessa ge()); | |
100 | throw new Connec tionExcept ion(e.getM essage()); | |
101 | } | |
102 | ||
103 | // N ote: a Stu dy has 1.. Groups an d a Group can have 1 .. Series! | |
104 | Sort edSet<Vist aGroup> gr oups = get PatientGro ups(vistaS ession, ge tSite(), f ilter); | |
105 | getL ogger().in fo("Found " + groups .size() + " groups f or qarevie w"); | |
106 | // n o groups i s not an e xception s cenario bu t it does mean we do n't need t o bother g etting mor e | |
107 | // i nformation about eac h study | |
108 | if(g roups.size () == 0) | |
109 | return null; | |
110 | ||
111 | // J MW 12/17/2 008, call the filter to remove studies f rom the gr oups, this way | |
112 | // t he datasou rce doesn' t need to have knowl edge of th e filter d etails | |
113 | if(f ilter != n ull) | |
114 | filter .preFilter (groups); | |
115 | ||
116 | // i f we filte red everyt hing out r eturn now, and don't bother ma king the c all | |
117 | // t o populate the entir e Studies tree | |
118 | if(g roups.size () == 0) | |
119 | return null; | |
120 | ||
121 | getL ogger().in fo("Loadin g study gr aph data f or filtere d groups") ; | |
122 | ||
123 | //So rted by pa tient | |
124 | Map< PatientIde ntifier, S ortedSet<V istaGroup> > patientV istaGroupM ap = new H ashMap<Pat ientIdenti fier, Sort edSet<Vist aGroup>>() ; | |
125 | for( VistaGroup group : g roups) | |
126 | { | |
127 | Patien tIdentifie r pid = gr oup.getPat ientIdenti fier(); | |
128 | Sorted Set<VistaG roup> pati entGroups = patientV istaGroupM ap.get(pid ); | |
129 | if (pa tientGroup s == null) | |
130 | patientG roups = ne w TreeSet< VistaGroup >(); | |
131 | patien tGroups.ad d(group); | |
132 | patien tVistaGrou pMap.put(g roup.getPa tientIdent ifier(), p atientGrou ps); | |
133 | } | |
134 | ||
135 | List <Study> re sult = new ArrayList <Study>(); | |
136 | try | |
137 | { | |
138 | for(Pa tientIdent ifier pati entIdentif ier : pati entVistaGr oupMap.key Set()) | |
139 | { | |
140 | String d fn = Vista CommonUtil ities.getP atientDfn( | |
141 | vist aSession, | |
142 | pati entIdentif ier); | |
143 | SortedSe t<VistaGro up> pgroup s = patien tVistaGrou pMap.get(p atientIden tifier); | |
144 | List<Stu dy> studie s = getPat ientStudie s(vistaSes sion, dfn, pgroups, filter); | |
145 | if (stud ies != nul l) | |
146 | result.add All(studie s); | |
147 | } | |
148 | } | |
149 | catc h (IOExcep tion e) | |
150 | { | |
151 | getLog ger().erro r("getVist aSession e rror: " + e.getMessa ge()); | |
152 | throw new Method Exception( e.getMessa ge()); | |
153 | } | |
154 | ||
155 | retu rn result; | |
156 | } | |
157 | ||
158 | pr ivate List <Study> ge tPatientSt udies( | |
159 | VistaS ession vis taSession, | |
160 | String patientDf n, | |
161 | Sorted Set<VistaG roup> grou ps, | |
162 | StudyF ilter filt er) | |
163 | { | |
164 | // W arning: if this filt er (and st udyIen) is not null, reducedGr oup might truncate m ultiple gr oup studie s!!! | |
165 | Map< String, St ring> stud yMap = new HashMap<S tring, Str ing>(); | |
166 | ||
167 | // B uild a lis t of Study IEN | |
168 | // T he use of a Map is a n artifact of VistA, which nee ds an inde x of the l ist elemen ts. | |
169 | // T he Map end s up as so mething li ke {"0", " 662576753" },{"1", "7 61576512"} ... | |
170 | Stri ngBuilder groupMessa ge = new S tringBuild er(); | |
171 | grou pMessage.a ppend('{') ; | |
172 | for( VistaGroup group : g roups) | |
173 | { | |
174 | // CTB 29Nov2009 | |
175 | //stud yMap.put(" " + studyM ap.size(), Base32Con versionUti lity.base3 2Decode(gr oup.getIen ())); | |
176 | studyM ap.put( In teger.toSt ring(study Map.size() ), group.g etIen() ); | |
177 | ||
178 | if(gro upMessage. length() > 1) | |
179 | groupMes sage.appen d(','); | |
180 | groupM essage.app end(group. getIen()); | |
181 | } | |
182 | grou pMessage.a ppend('}') ; | |
183 | ||
184 | // | |
185 | bool ean includ esDeletedI mages = (f ilter == n ull ? fals e : filter .isInclude Deleted()) ; | |
186 | bool ean canInc ludeDelete dImages = canRetriev eDeletedIm ages(); // if this d ata source cannot su pport gett ing delete d images, then it is not an op tion | |
187 | Stud yDeletedIm ageState s tudyDelete dImageStat e = StudyD eletedImag eState.can notInclude DeletedIma ges; | |
188 | if(c anIncludeD eletedImag es) // if the DS sup ports gett ing delete d images, set approp riately ba sed on use r request | |
189 | studyD eletedImag eState = ( includesDe letedImage s ? StudyD eletedImag eState.inc ludesDelet edImages : StudyDele tedImageSt ate.doesNo tIncludeDe letedImage s); | |
190 | ||
191 | Sort edSet<Stud y> studies ; | |
192 | try { | |
193 | studie s = getPat ientStudyG raph(vista Session, s tudyMap, p atientDfn, | |
194 | StudyLoadL evel.STUDY _AND_IMAGE S, studyDe letedImage State); | |
195 | } ca tch (Metho dException e) { | |
196 | getLog ger().erro r("getPati entStudies Method Ex ception: " + e.getMe ssage()); | |
197 | return null; | |
198 | ||
199 | } ca tch (Conne ctionExcep tion e) { | |
200 | getLog ger().erro r("getPati entStudies Connectio n Exceptio n: " + e.g etMessage( )); | |
201 | return null; | |
202 | } | |
203 | getL ogger().in fo("getPat ientStudyG raph for s tudies " + groupMess age.toStri ng() + " r eturned " + studies. size() + " studies." ); | |
204 | ||
205 | Sort edSet<Stud y> result = | |
206 | VistaI magingComm onUtilitie s.mergeStu dyLists(vi staSession , studies, groups, S tudyLoadLe vel.STUDY_ AND_IMAGES ); | |
207 | getL ogger().in fo("Mergin g studies and groups results i n " + resu lt.size() + " studie s."); | |
208 | ||
209 | // J MW 12/17/2 008, call the filter to remove studies f rom the gr oups, this way | |
210 | // t he datasou rce doesn' t need to have knowl edge of th e filter d etails | |
211 | if(f ilter != n ull) | |
212 | { | |
213 | filter .postFilte r(result); | |
214 | } | |
215 | ||
216 | getL ogger().in fo("Comple ted getPat ientStudie s(), retur ning '" + result.siz e() + "' s tudies."); | |
217 | retu rn new Arr ayList<Stu dy>(result ); | |
218 | } | |
219 | ||
220 | ||
221 | pr ivate Sort edSet<Vist aGroup> ge tPatientGr oups( | |
222 | VistaS ession vis taSession, | |
223 | Site s ite, | |
224 | StudyF ilter filt er) | |
225 | th rows Metho dException | |
226 | { | |
227 | Stri ng rtn = n ull; | |
228 | try | |
229 | { | |
230 | VistaQ uery vm = VistaImagi ngQueryFac tory.creat eMagImageL istQuery(f ilter); | |
231 | rtn = vistaSessi on.call(vm ); | |
232 | getLog ger().info (vm.getRpc Name()+" R PC Results :"+StringU tils.displ ayEncodedC hars(rtn)) ; | |
233 | ||
234 | // che ck to be s ure first character is a 1 (me ans result is ok) | |
235 | // if no images for patien t, respons e is [0^No images fo r filter: All Images ] | |
236 | ||
237 | if(rtn .charAt(0) == '1') | |
238 | { | |
239 | boolean includesDe letedImage s = (filte r == null ? false : filter.isI ncludeDele ted()); | |
240 | boolean canInclude DeletedIma ges = canR etrieveDel etedImages (); // if this data source can not suppor t getting deleted im ages, then it is not an option | |
241 | StudyDel etedImageS tate study DeletedIma geState = StudyDelet edImageSta te.cannotI ncludeDele tedImages; | |
242 | if(canIn cludeDelet edImages) // if the DS support s getting deleted im ages, set appropriat ely based on user re quest | |
243 | studyDelet edImageSta te = (incl udesDelete dImages ? StudyDelet edImageSta te.include sDeletedIm ages : Stu dyDeletedI mageState. doesNotInc ludeDelete dImages); | |
244 | return V istaImagin gTranslato r.createGr oupsFromGr oupLines(g etSite(), rtn, study DeletedIma geState); | |
245 | } | |
246 | else i f(rtn.star tsWith("0^ No images for filter ")) | |
247 | { | |
248 | getLogge r().info(" 0 response from getP atientGrou psVistaQue ry() rpc, no images found, [" + rtn + "] "); | |
249 | throw ne w VistaMet hodExcepti on(rtn); | |
250 | } | |
251 | else i f(rtn.star tsWith("0^ No Such Pa tient:")) | |
252 | { | |
253 | getLogge r().info(" 0 response from getP atientGrou psVistaQue ry() rpc, [" + rtn + "]"); | |
254 | throw ne w VistaMet hodExcepti on(rtn); | |
255 | } | |
256 | else | |
257 | { | |
258 | getLogge r().info(" 0 response from getP atientGrou psVistaQue ry() rpc, [" + rtn + "]"); | |
259 | throw ne w VistaMet hodExcepti on(rtn); | |
260 | } | |
261 | } | |
262 | catc h (Excepti on ex) | |
263 | { | |
264 | getLog ger().erro r(ex); | |
265 | throw new Method Exception( ex); | |
266 | } | |
267 | } | |
268 | ||
269 | privat e SortedSe t<Study> g etPatientS tudyGraph( | |
270 | Vist aSession l ocalVistaS ession, | |
271 | Map< String, St ring> stud yMap, | |
272 | Stri ng patient Dfn, | |
273 | Stud yLoadLevel studyLoad Level, | |
274 | Stud yDeletedIm ageState s tudyDelete dImageStat e) | |
275 | throws MethodExc eption, Co nnectionEx ception | |
276 | { | |
277 | tr y | |
278 | { | |
279 | Vist aQuery que ry = getPa tientStudy GraphVista Query(stud yMap, pati entDfn, st udyLoadLev el, | |
280 | studyDel etedImageS tate); | |
281 | getL ogger().in fo("Retrie ving study graph for patient c ontaining '" + study Map.size() + "' grou ps"); | |
282 | String vistaResp onse = loc alVistaSes sion.call( query); | |
283 | getLog ger().info (query.get RpcName()+ " RPC Resu lts:"+Stri ngUtils.di splayEncod edChars(vi staRespons e)); | |
284 | getLog ger().info ("Complete d study gr aph RPC ca ll, parsin g response ..."); | |
285 | ||
286 | Sorted Set<Study> studies = VistaImag ingTransla tor.create StudiesFro mGraph(get Site(), | |
287 | vistaRespo nse, study LoadLevel, studyDele tedImageSt ate); | |
288 | getLog ger().info ("Converte d response into '" + ((studies == null) ? 0 : stud ies.size() ) + "' stu dies"); | |
289 | return studies; | |
290 | } | |
291 | catc h (Excepti on ex) | |
292 | { | |
293 | getLog ger().erro r(ex); | |
294 | throw new Method Exception( ex); | |
295 | } | |
296 | } | |
297 | ||
298 | pr ivate Vist aQuery get PatientStu dyGraphVis taQuery(Ma p<String, String> st udyMap, St ring patie ntDfn, | |
299 | StudyL oadLevel s tudyLoadLe vel, Study DeletedIma geState st udyDeleted ImageState ) | |
300 | { | |
301 | // t his versio n does use s the stud yDeletedIm ageState | |
302 | re turn Vista ImagingQue ryFactory. createGetS tudiesByIe nVistaQuer y(studyMap , | |
303 | patien tDfn, stud yLoadLevel , studyDel etedImageS tate); | |
304 | } | |
305 | ||
306 | ||
307 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.