Produced by Araxis Merge on 10/18/2018 2:02:19 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 | VIX_SIV_v3_0_patch_201_build_8.zip\v3.0_patch_201_build_8\VISA\Java\ImagingDicomRouter\main\src\java\gov\va\med\imaging\core\router\commands | PostCFindResultsCommandImpl.java | Thu Oct 11 13:30:16 2018 UTC |
2 | VIX_SIV_v3_0_patch_201_build_8.zip\v3.0_patch_201_build_8\VISA\Java\ImagingDicomRouter\main\src\java\gov\va\med\imaging\core\router\commands | PostCFindResultsCommandImpl.java | Wed Oct 17 18:54:50 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 3 | 428 |
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: | |
6 | Site Nam e: Washin gton OI Fi eld Office , Silver S pring, MD | |
7 | Developer: PII | |
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 | ||
27 | package go v.va.med.i maging.cor e.router.c ommands; | |
28 | ||
29 | import gov .va.med.im aging.core .annotatio ns.routerf acade.Rout erCommandE xecution; | |
30 | import gov .va.med.im aging.core .interface s.exceptio ns.Connect ionExcepti on; | |
31 | import gov .va.med.im aging.core .interface s.exceptio ns.MethodE xception; | |
32 | import gov .va.med.im aging.dico m.common.i nterfaces. IDicomData Set; | |
33 | import gov .va.med.im aging.dico m.common.s pring.Spri ngContext; | |
34 | import gov .va.med.im aging.dico m.dcftoolk it.common. mapping.Bu sinessObje ctToDicomT ranslator; | |
35 | import gov .va.med.im aging.exch ange.busin ess.dicom. CFindResul ts; | |
36 | import gov .va.med.im aging.exch ange.busin ess.dicom. DicomAE; | |
37 | import gov .va.med.im aging.exch ange.busin ess.dicom. DicomMap; | |
38 | import gov .va.med.im aging.exch ange.busin ess.dicom. exceptions .DicomExce ption; | |
39 | import gov .va.med.im aging.exch ange.busin ess.dicom. exceptions .ValidateV RException ; | |
40 | ||
41 | import jav a.sql.Resu ltSet; | |
42 | import jav a.sql.SQLE xception; | |
43 | import jav a.util.Arr ayList; | |
44 | import jav a.util.Has hSet; | |
45 | import jav a.util.con current.Li nkedBlocki ngQueue; | |
46 | ||
47 | import org .apache.lo gging.log4 j.LogManag er; | |
48 | import org .apache.lo gging.log4 j.Logger; | |
49 | ||
50 | /** | |
51 | * This Ro uter commm and takes the C-Find Results a nd builds a VI DICOM Dataset f or each | |
52 | * result and are co llected in to a Queue for later processin g. | |
53 | * | |
54 | * @author PII | |
55 | * | |
56 | */ | |
57 | @RouterCom mandExecut ion(asynch ronous = t rue, distr ibutable = false) | |
58 | public cla ss PostCFi ndResultsC ommandImpl | |
59 | extends Ab stractDico mCommandIm pl<Void>{ | |
60 | ||
61 | privat e static f inal long serialVers ionUID = 4 9237847273 43L; | |
62 | pr ivate Logg er logger = LogManag er.getLogg er(PostCFi ndResultsC ommandImpl .class); | |
63 | privat e static L ogger summ aryLogger = LogManag er.getLogg er("Summar y"); | |
64 | privat e CFindRes ults resul ts = null; | |
65 | privat e DicomAE dicomAE = null; | |
66 | privat e HashSet< DicomMap> mappingSet = null; | |
67 | privat e LinkedBl ockingQueu e<IDicomDa taSet> res ponseQueue = null; | |
68 | privat e ArrayLis t<String> studyUIDs = null; | |
69 | privat e IDicomDa taSet LAST BAG; | |
70 | ||
71 | ||
72 | pu blic PostC FindResult sCommandIm pl(CFindRe sults resu lts, Dicom AE dicomAE , HashSet< DicomMap> mappingSet , | |
73 | Li nkedBlocki ngQueue<ID icomDataSe t> queue, IDicomData Set lastBa g) { | |
74 | this .results = results; | |
75 | this .dicomAE = dicomAE; | |
76 | this .mappingSe t = mappin gSet; | |
77 | this .responseQ ueue = que ue; | |
78 | this .LASTBAG = lastBag; | |
79 | th is.studyUI Ds = new A rrayList<S tring>(); | |
80 | } | |
81 | ||
82 | @O verride | |
83 | pu blic Void callSynchr onouslyInT ransaction Context() | |
84 | throws MethodExc eption, Co nnectionEx ception { | |
85 | ||
86 | int rowN umber = 0; | |
87 | in t totalRes ults = 0; | |
88 | St ring moveS CPAETitle = null; | |
89 | tr y{ | |
90 | IDic omDataSet responseDD S = null; | |
91 | ||
92 | moveSCPA ETitle = t his.dicomA E.getLocal AETitle(); | |
93 | ||
94 | //Th e followin g two line s are for informatio nal purpos es only. | |
95 | this.res ults.last( ); | |
96 | totalRes ults = thi s.results. getRow(); | |
97 | logger.d ebug("Numb er of CFin d results from Data Source: " + totalRes ults); | |
98 | ||
99 | this.res ults.befor eFirst(); | |
100 | this.res ults.setFe tchDirecti on(ResultS et.FETCH_F ORWARD); | |
101 | this.res ults.setFe tchSize(1) ; | |
102 | ||
103 | while(th is.results .next()){ | |
104 | rowNum ber = this .results.g etRow(); | |
105 | logger .info(this .getClass( ).getName( )+": Conve rting CFin d result r ow "+rowNu mber+" to a Dicom Da taset."); | |
106 | respon seDDS = (I DicomDataS et)SpringC ontext.get Context(). getBean("D icomDataSe t"); | |
107 | Busine ssObjectTo DicomTrans lator.getR esponseDat aSetFromRo w(this.res ults, rowN umber, thi s.mappingS et, | |
108 | respon seDDS, mov eSCPAETitl e); | |
109 | ||
110 | try { | |
111 | this.che ckDDS(resp onseDDS); | |
112 | ||
113 | this.res ponseQueue .put(respo nseDDS); | |
114 | } | |
115 | catc h (Validat eVRExcepti on validat eX){ | |
116 | logger.err or(validat eX.getMess age()); | |
117 | logger.err or(this.ge tClass().g etName()+" : Exceptio n thrown v alidating Query Resp onse."); | |
118 | summaryLog ger.error( "C-Find Re sponse fai led messag e validati on. The r esult is a ll C-Find Responses may not ha ve been se nt to the C-Find SCU .\n" + | |
119 | "Refer to other logs for m ore detail ."); | |
120 | } | |
121 | catc h (Interru ptedExcept ion iX) { | |
122 | logger .error(iX. getMessage ()); | |
123 | logger .error(thi s.getClass ().getName ()+": Exce ption thro wn putting CFind Res ponse into Queue."); | |
124 | summaryLog ger.error( "C-Find Re sponse fai led to be added to t he Respons e Queue. The result is all C- Find Respo nses may n ot have be en sent to the C-Fin d SCU.\n" + | |
125 | "Refer to other logs for m ore detail ."); | |
126 | ||
127 | } | |
128 | } | |
129 | try{ | |
130 | this .responseQ ueue.put(t his.LASTBA G); | |
131 | } | |
132 | catch(In terruptedE xception i X){ | |
133 | //ig nore | |
134 | } | |
135 | } | |
136 | ca tch (SQLEx ception sq le){ | |
137 | logger.e rror(sqle. getMessage ()); | |
138 | logger.e rror(this. getClass() .getName() +": Except ion thrown while con verting ro w "+rowNum ber+ | |
139 | " to CFind Response. "); | |
140 | summaryL ogger.erro r("Failed to convert C-Find Re sponse to a DICOM me ssage. Th e result i s all C-Fi nd Respons es may not have been sent.\n" + | |
141 | "Ref er to othe r logs for more deta il."); | |
142 | ||
143 | try{ | |
144 | this .responseQ ueue.put(t his.LASTBA G); | |
145 | } | |
146 | catch(In terruptedE xception i X){ | |
147 | //ig nore | |
148 | } | |
149 | throw ne w MethodEx ception(); | |
150 | } | |
151 | re turn null; | |
152 | } | |
153 | ||
154 | ||
155 | @O verride | |
156 | pu blic boole an equals( Object obj ) { | |
157 | retu rn false; | |
158 | } | |
159 | ||
160 | @O verride | |
161 | pr otected St ring param eterToStri ng() { | |
162 | retu rn ""; | |
163 | } | |
164 | ||
165 | @O verride | |
166 | pr otected bo olean areC lassSpecif icFieldsEq ual(Object obj) { | |
167 | // T ODO Auto-g enerated m ethod stub | |
168 | retu rn false; | |
169 | } | |
170 | ||
171 | ||
172 | privat e void che ckDDS(IDic omDataSet dds) throw s Validate VRExceptio n{ | |
173 | ||
174 | tr y{ | |
175 | if(d ds.contain sDicomElem ent("0020, 000D", nul l)){ | |
176 | String uid = dds .getStudyI nstanceUID (); | |
177 | ||
178 | if(uid == null | | uid.equa ls("")){ | |
179 | throw ne w Validate VRExceptio n("Missing Study Ins tance UID. "); | |
180 | } | |
181 | ||
182 | if(thi s.studyUID s.contains (uid)){ | |
183 | throw ne w Validate VRExceptio n("Duplica te Study I nstance UI D."); | |
184 | } | |
185 | this.s tudyUIDs.a dd(uid); | |
186 | } | |
187 | ||
188 | if(d ds.contain sDicomElem ent("0008, 0052", nul l)){ | |
189 | String level = d ds.getQuer yRetrieveL evel(); | |
190 | //FUTU RE Check a gainst the C-Find-Rq Level. | |
191 | if((le vel == nul l) || ((!l evel.toUpp erCase().e quals("STU DY")))){ | |
192 | throw ne w Validate VRExceptio n("Wrong L evel"); | |
193 | } | |
194 | } | |
195 | else { | |
196 | throw new Valida teVRExcept ion("Level attribute does not exist."); | |
197 | } | |
198 | ||
199 | if(d ds.contain sDicomElem ent("0008, 0054", nul l)){ | |
200 | String destinati on = dds.g etDicomEle ment("0008 ,0054").ge tStringVal ue(); | |
201 | if(des tination = = null || destinatio n.equals(" ")){ | |
202 | throw ne w Validate VRExceptio n("Missing Retrieve AETitle,") ; | |
203 | } | |
204 | } | |
205 | else { | |
206 | throw new Valida teVRExcept ion("Retri eve AETitl e Attribut e does not exist."); | |
207 | } | |
208 | } | |
209 | ca tch(DicomE xception d csX){ | |
210 | logger.e rror(dcsX. getMessage ()); | |
211 | logger.e rror(this. getClass() .getName() +": Except ion thrown while che cking vali dation."); | |
212 | thro w new Vali dateVRExce ption(dcsX .getMessag e()); | |
213 | } | |
214 | ||
215 | } | |
216 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.