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 | GetDicomDataSetCommandImpl.java | Thu Oct 11 13:30:18 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 | GetDicomDataSetCommandImpl.java | Wed Oct 17 18:54:40 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 3 | 488 |
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 | package go v.va.med.i maging.cor e.router.c ommands; | |
27 | ||
28 | import gov .va.med.im aging.Size dInputStre am; | |
29 | import gov .va.med.im aging.core .interface s.exceptio ns.Connect ionExcepti on; | |
30 | import gov .va.med.im aging.core .interface s.exceptio ns.MethodE xception; | |
31 | import gov .va.med.im aging.core .router.st orage.Stor ageBusines sRouter; | |
32 | import gov .va.med.im aging.core .router.st orage.Stor ageContext ; | |
33 | import gov .va.med.im aging.core .router.st orage.Stor ageDataSou rceRouter; | |
34 | import gov .va.med.im aging.dico m.common.i nterfaces. IDicomData Set; | |
35 | import gov .va.med.im aging.dico m.common.s pring.Spri ngContext; | |
36 | import gov .va.med.im aging.dico m.router.f acade.Inte rnalDicomC ontext; | |
37 | import gov .va.med.im aging.dico m.router.f acade.Inte rnalDicomR outer; | |
38 | import gov .va.med.im aging.dico m.utilitie s.exceptio ns.Generic DicomRecon stitutionE xception; | |
39 | import gov .va.med.im aging.dico m.utilitie s.exceptio ns.Generic DicomUtili tiesTGAFil eException ; | |
40 | import gov .va.med.im aging.dico m.utilitie s.exceptio ns.Generic DicomUtili tiesTextFi leExceptio n; | |
41 | import gov .va.med.im aging.dico m.utilitie s.exceptio ns.Generic DicomUtili tiesTextFi leExtracti onExceptio n; | |
42 | import gov .va.med.im aging.dico m.utilitie s.reconsti tution.int erfaces.ID icomRecons titution; | |
43 | import gov .va.med.im aging.exch ange.busin ess.dicom. DicomInsta nceUpdateI nfo; | |
44 | import gov .va.med.im aging.exch ange.busin ess.dicom. InstanceSt orageInfo; | |
45 | import gov .va.med.im aging.exch ange.busin ess.storag e.Artifact SourceInfo ; | |
46 | import gov .va.med.im aging.exch ange.busin ess.storag e.NetworkL ocationInf o; | |
47 | ||
48 | import jav a.io.IOExc eption; | |
49 | import jav a.io.Input Stream; | |
50 | ||
51 | import org .apache.lo gging.log4 j.LogManag er; | |
52 | import org .apache.lo gging.log4 j.Logger; | |
53 | ||
54 | /** | |
55 | * This Ro uter comma nd creates a VistA I maging Dic om Dataset object. The VistA HIS update s, contain ing | |
56 | * changes to the Pa tient/Stud y informat ion is fet ched from the Data S ource. Th e necessar y DICOM ob jects | |
57 | * are fet ched via s treams. | |
58 | * | |
59 | * If the object is saved as a DICOM Obj ect Part10 file, a V I DICOM Da taset obje ct is crea ted and | |
60 | * the Pat ient/Study informati on is upda te in the VI DICOM D ataset obj ect. | |
61 | * | |
62 | * If the object is saved as a .TGA file , the .tga and .txt files are reconstitu ted togeth er to recr eate | |
63 | * a VI DI COM Datase t object. The VI DI COM Datase t object i s updated with the P atient/Stu dy informa tion. | |
64 | * | |
65 | * | |
66 | * @author PII | |
67 | * | |
68 | */ | |
69 | public cla ss GetDico mDataSetCo mmandImpl | |
70 | extends Ab stractDico mCommandIm pl<IDicomD ataSet> { | |
71 | ||
72 | pr ivate stat ic final l ong serial VersionUID = -114221 3180361233 430L; | |
73 | pr ivate stat ic Logger logger = L ogManager. getLogger( GetDicomDa taSetComma ndImpl.cla ss); | |
74 | privat e static f inal Inter nalDicomRo uter inter nalrouter = Internal DicomConte xt.getRout er(); | |
75 | ||
76 | pr ivate Inst anceStorag eInfo inst anceInfo = null; | |
77 | ||
78 | ||
79 | pu blic GetDi comDataSet CommandImp l(Instance StorageInf o instance ){ | |
80 | ||
81 | this .instanceI nfo = inst ance; | |
82 | } | |
83 | ||
84 | @O verride | |
85 | pu blic IDico mDataSet c allSynchro nouslyInTr ansactionC ontext() | |
86 | throws Connectio nException , MethodEx ception { | |
87 | logg er.debug(T hread.curr entThread( ).getId()+ ": Executi ng Router Command "+ this.getCl ass().getN ame()); | |
88 | ||
89 | IDic omDataSet dds = null ; | |
90 | IDic omReconsti tution rec onstitutor = | |
91 | (IDico mReconstit ution)Spri ngContext. getContext ().getBean ("Reconsti tution"); | |
92 | Stor ageBusines sRouter st orageRoute r = Storag eContext.g etBusiness Router(); | |
93 | //Us ing the ob jectIndent ifier, cal l GetDicom InstanceUp dateInfo r outer comm and. | |
94 | // This w ill return various t ags with u pdated inf ormation f rom VistA HIS. | |
95 | Dico mInstanceU pdateInfo hisChanges = interna lrouter.ge tDicomInst anceUpdate Info(this. instanceIn fo); | |
96 | ||
97 | //De termine if Instance is .tga or .dcm. | |
98 | //IF .dcm, req uest it fr om Storage API to ge t stream. Take the stream and | |
99 | // create a IDicomD ataSet obj ect to ret urn. | |
100 | Stri ng type = this.insta nceInfo.ge tType(); | |
101 | Stri ng identif ier= null; | |
102 | if(t ype.equals ("NEW")){ | |
103 | //Get the one st ream neces sary. | |
104 | identi fier = thi s.instance Info.getAr tifactKey( ); | |
105 | Artifa ctSourceIn fo artifac t = new Ar tifactSour ceInfo(typ e, identif ier, | |
106 | this.insta nceInfo.ge tNetworkIE NUsername( ), | |
107 | this.insta nceInfo.ge tNetworkIE NPassword( )); | |
108 | InputS tream dcmS tream = st orageRoute r.getResol vedArtifac tStream(ar tifact); | |
109 | SizedI nputStream sizedDCMS tream; | |
110 | try{ | |
111 | sizedDCM Stream = n ew SizedIn putStream( dcmStream, dcmStream .available ()); | |
112 | } | |
113 | catch( IOExceptio n ioX){ | |
114 | logger.e rror(this. getClass() .getName() +": Failed to get DC M stream l ength.\n"+ | |
115 | io X.getMessa ge()); | |
116 | return n ull; | |
117 | } | |
118 | try { | |
119 | dds = re constituto r.updateDi comObject( sizedDCMSt ream, hisC hanges); | |
120 | dds.setN ame(identi fier); | |
121 | } | |
122 | catch (GenericDi comReconst itutionExc eption gdr X){ | |
123 | logger.err or(gdrX.ge tMessage() ); | |
124 | logger.err or(this.ge tClass().g etName()+" : Exceptio n thrown u pdating DI COM Object with " + | |
125 | "HIS cha nges."); | |
126 | throw new MethodExce ption(gdrX ); | |
127 | } | |
128 | } | |
129 | else if(type.e quals("OLD ")){ | |
130 | //I ha d to add t his becaus e the M RP C was not getting th e correct/ valid info rmation. Username a nd Passwor d | |
131 | // must com e from the Imaging S ite Parame ters, not Network Lo cation. | |
132 | Storag eDataSourc eRouter da taRouter = StorageCo ntext.getD ataSourceR outer(); | |
133 | Networ kLocationI nfo nwl = dataRouter .getNetwor kLocationD etails(thi s.instance Info.getNe tworkIEN() ); | |
134 | this.i nstanceInf o.setNetwo rkIENUsern ame(nwl.ge tUsername( )); | |
135 | this.i nstanceInf o.setNetwo rkIENPassw ord(nwl.ge tPassword( )); | |
136 | ||
137 | identi fier = thi s.instance Info.getOb jectIdenti fier(); | |
138 | if(thi s.instance Info.getOb jectStorag eIdentifie r().endsWi th(".DCM") ){ | |
139 | //Get th e one stre am necessa ry. | |
140 | Artifact SourceInfo artifact = new Arti factSource Info(type, | |
141 | th is.instanc eInfo.getO bjectStora geIdentifi er(), | |
142 | th is.instanc eInfo.getN etworkIENU sername(), | |
143 | th is.instanc eInfo.getN etworkIENP assword()) ; | |
144 | InputStr eam dcmStr eam = stor ageRouter. getResolve dArtifactS tream(arti fact); | |
145 | //CSABA -I don't n eed a size d stream. Not readin g bytes. What shoul d be the d efault byt esize? | |
146 | SizedInp utStream s izedDCMStr eam; | |
147 | try{ | |
148 | sizedDCMSt ream = new SizedInpu tStream(dc mStream, d cmStream.a vailable() ); | |
149 | } | |
150 | catch(IO Exception ioX){ | |
151 | logger.err or(this.ge tClass().g etName()+" : Failed t o get DCM stream len gth.\n"+ | |
152 | ioX. getMessage ()); | |
153 | return nul l; | |
154 | } | |
155 | try { | |
156 | dds = reco nstitutor. updateDico mObject(si zedDCMStre am, hisCha nges); | |
157 | dds.setNam e(identifi er); | |
158 | } | |
159 | catch (G enericDico mReconstit utionExcep tion gdrX) { | |
160 | lo gger.error (gdrX.getM essage()); | |
161 | lo gger.error (this.getC lass().get Name()+": Exception thrown upd ating DICO M Object w ith " + | |
162 | "HIS chang es."); | |
163 | th row new Me thodExcept ion(gdrX); | |
164 | } | |
165 | } | |
166 | //IF . tga, reque st both .t ga and .tx t from Sto rage API t o get two streams. | |
167 | //Take t he two str eams and R ECONSTITUT E into a I DicomDataS et object. | |
168 | //P116 - Modify to accept .tga and . big indepe ndent of c ase sensit ivity. | |
169 | if((th is.instanc eInfo.getO bjectStora geIdentifi er().endsW ith(".TGA" )) | |
170 | || (this.i nstanceInf o.getObjec tStorageId entifier() .endsWith( ".BIG"))){ | |
171 | //Get th e two stre ams necess ary. | |
172 | Artifact SourceInfo tgaArtifa ct = new A rtifactSou rceInfo(ty pe, | |
173 | th is.instanc eInfo.getO bjectStora geIdentifi er(), | |
174 | th is.instanc eInfo.getN etworkIENU sername(), | |
175 | th is.instanc eInfo.getN etworkIENP assword()) ; | |
176 | InputStr eam tgaStr eam = stor ageRouter. getResolve dArtifactS tream(tgaA rtifact); | |
177 | SizedInp utStream s izedTGAStr eam; | |
178 | try{ | |
179 | sizedTGASt ream = new SizedInpu tStream(tg aStream, t gaStream.a vailable() ); | |
180 | } | |
181 | catch(IO Exception ioX){ | |
182 | logger.err or(this.ge tClass().g etName()+" : Failed t o get TGA stream len gth.\n"+ | |
183 | ioX. getMessage ()); | |
184 | return nul l; | |
185 | } | |
186 | ||
187 | Artifact SourceInfo txtArtifa ct = new A rtifactSou rceInfo(ty pe, | |
188 | this .instanceI nfo.getObj ectSupport edTextStor ageIdentif ier(), | |
189 | this .instanceI nfo.getNet workIENUse rname(), | |
190 | this .instanceI nfo.getNet workIENPas sword()); | |
191 | InputStr eam txtStr eam = stor ageRouter. getResolve dArtifactS tream(txtA rtifact); | |
192 | SizedInp utStream s izedTXTStr eam; | |
193 | try{ | |
194 | sizedTXTSt ream = new SizedInpu tStream(tx tStream, t xtStream.a vailable() ); | |
195 | } | |
196 | catch(IO Exception ioX){ | |
197 | logger.err or(this.ge tClass().g etName()+" : Failed t o get TXT stream len gth.\n"+ | |
198 | ioX. getMessage ()); | |
199 | return nul l; | |
200 | } | |
201 | ||
202 | try { | |
203 | dds = reco nstitutor. assembleDi comObject( sizedTXTSt ream, size dTGAStream , hisChang es); | |
204 | dds.setNam e(identifi er); | |
205 | } | |
206 | catch (G enericDico mUtilities TextFileEx ception gd utfX) { | |
207 | lo gger.error (gdutfX.ge tMessage() ); | |
208 | lo gger.error (this.getC lass().get Name()+": Exception thrown dur ing recons ititution of " + | |
209 | "DICOM Obj ect while accessing Text file. "); | |
210 | th row new Me thodExcept ion(gdutfX ); | |
211 | } | |
212 | catch (G enericDico mUtilities TextFileEx tractionEx ception gd utfeX) { | |
213 | lo gger.error (gdutfeX.g etMessage( )); | |
214 | lo gger.error (this.getC lass().get Name()+": Exception thrown dur ing recons ititution of " + | |
215 | "DICOM Obj ect while extracting Text file ."); | |
216 | th row new Me thodExcept ion(gdutfe X); | |
217 | } | |
218 | catch (G enericDico mUtilities TGAFileExc eption gdu tgafX) { | |
219 | lo gger.error (gdutgafX. getMessage ()); | |
220 | lo gger.error (this.getC lass().get Name()+": Exception thrown dur ing recons ititution of " + | |
221 | "DICOM Obj ect while accessing TGA file." ); | |
222 | th row new Me thodExcept ion(gdutga fX); | |
223 | } | |
224 | } | |
225 | } | |
226 | else { | |
227 | throw new Method Exception( "Artifact location i s unknown. "); | |
228 | } | |
229 | //Re turn the I DicomDataS et object. | |
230 | retu rn dds; | |
231 | } | |
232 | ||
233 | @O verride | |
234 | pr otected bo olean areC lassSpecif icFieldsEq ual(Object obj) { | |
235 | // T ODO Auto-g enerated m ethod stub | |
236 | retu rn false; | |
237 | } | |
238 | ||
239 | @O verride | |
240 | pr otected St ring param eterToStri ng() { | |
241 | // T ODO Auto-g enerated m ethod stub | |
242 | retu rn null; | |
243 | } | |
244 | ||
245 | ||
246 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.