Produced by Araxis Merge on 10/18/2018 2:02:22 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\VistaImagingDataSourceProvider\main\src\java\gov\va\med\imaging\vistaimagingdatasource\common | EntityDAO.java | Thu Oct 11 13:30:14 2018 UTC |
2 | VIX_SIV_v3_0_patch_201_build_8.zip\v3.0_patch_201_build_8\VISA\Java\VistaImagingDataSourceProvider\main\src\java\gov\va\med\imaging\vistaimagingdatasource\common | EntityDAO.java | Wed Oct 17 19:09:50 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 716 |
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 | 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: Nov, 2009 | |
6 | Site Nam e: Washin gton OI Fi eld Office , Silver S pring, MD | |
7 | Developer: PII | |
8 | Descript ion: DICOM Study cac he manager . Maintain s the cach e of study instances | |
9 | and expires o ld studies after 15 minutes. | |
10 | ||
11 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
12 | ;; Property of the US Government . | |
13 | ;; No permis sion to co py or redi stribute t his softwa re is give n. | |
14 | ;; Use of un released v ersions of this soft ware requi res the us er | |
15 | ;; to execu te a writt en test ag reement wi th the Vis tA Imaging | |
16 | ;; Developm ent Office of the De partment o f Veterans Affairs, | |
17 | ;; telephon e (301) 73 4-0100. | |
18 | ;; | |
19 | ;; The Food and Drug A dministrat ion classi fies this software a s | |
20 | ;; a Class I I medical device. A s such, it may not b e changed | |
21 | ;; in any wa y. Modifi cations to this soft ware may r esult in a n | |
22 | ;; adulterat ed medical device un der 21CFR8 20, the us e of which | |
23 | ;; is consid ered to be a violati on of US F ederal Sta tutes. | |
24 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
25 | ||
26 | */ | |
27 | package go v.va.med.i maging.vis taimagingd atasource. common; | |
28 | ||
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.Invalid UserCreden tialsExcep tion; | |
31 | import gov .va.med.im aging.core .interface s.exceptio ns.MethodE xception; | |
32 | import gov .va.med.im aging.data source.exc eptions.Da oMethodNot Implemente dException ; | |
33 | import gov .va.med.im aging.data source.exc eptions.In validCrede ntialsExce ption; | |
34 | import gov .va.med.im aging.exch ange.busin ess.Persis tentEntity ; | |
35 | import gov .va.med.im aging.exch ange.busin ess.storag e.exceptio ns.Creatio nException ; | |
36 | import gov .va.med.im aging.exch ange.busin ess.storag e.exceptio ns.Deletio nException ; | |
37 | import gov .va.med.im aging.exch ange.busin ess.storag e.exceptio ns.Retriev alExceptio n; | |
38 | import gov .va.med.im aging.exch ange.busin ess.storag e.exceptio ns.UpdateE xception; | |
39 | import gov .va.med.im aging.url. vista.Stri ngUtils; | |
40 | import gov .va.med.im aging.url. vista.Vist aQuery; | |
41 | import gov .va.med.im aging.url. vista.exce ptions.Inv alidVistaC redentials Exception; | |
42 | import gov .va.med.im aging.url. vista.exce ptions.Vis taMethodEx ception; | |
43 | import gov .va.med.im aging.vist adatasourc e.session. VistaSessi on; | |
44 | ||
45 | import jav a.io.IOExc eption; | |
46 | import jav a.util.Has hMap; | |
47 | import jav a.util.Lis t; | |
48 | ||
49 | import org .apache.lo gging.log4 j.LogManag er; | |
50 | import org .apache.lo gging.log4 j.Logger; | |
51 | ||
52 | public abs tract clas s EntityDA O<T extend s Persiste ntEntity> { | |
53 | pr otected st atic final String FI ELD_SEPARA TOR1 = Str ingUtils.T ILDE; // P 34 initial ization RP Cs result separator | |
54 | pr otected st atic final String FI ELD_SEPARA TOR2 = Str ingUtils.C OMMA; // p 34 initial ization RP Cs data se parator | |
55 | // pr otected ch ar separat or = '~'; | |
56 | pr otected ch ar dbSepar ator = '`' ; // Backt ick -- P3 4 db input name-valu e pair sep arator, an d output r esult | |
57 | pr otected st atic final String DB _OUTPUT_SE PARATOR1 = StringUti ls.BACKTIC K; // -- P 34 db outp ut result pair separ ator | |
58 | pr otected st atic final String DB _OUTPUT_SE PARATOR2 = StringUti ls.STICK;; // -- P 34 db outp ut name-va lue pair s eparator | |
59 | pr otected st atic final String LI NE_SEPARAT OR = "\r\n "; | |
60 | pr otected st atic final int MAX_M _STRING_LE NGTH = 240 ; // *** < -- 240 is correct | |
61 | ||
62 | pr otected Vi staSession session; | |
63 | pr otected Vi staSession Factory se ssionFacto ry; | |
64 | ||
65 | pr otected st atic final Logger lo gger = Log Manager.ge tLogger(En tityDAO.cl ass); | |
66 | ||
67 | pr otected vo id setSess ionFactory (VistaSess ionFactory sessionFa ctory) | |
68 | { | |
69 | this .sessionFa ctory = se ssionFacto ry; | |
70 | } | |
71 | ||
72 | pr otected Vi staSession getVistaS ession() t hrows IOEx ception, C onnectionE xception, MethodExce ption | |
73 | { | |
74 | if ( session == null) { | |
75 | sessio n = sessio nFactory.g etVistaSes sion(); | |
76 | } | |
77 | retu rn session ; | |
78 | } | |
79 | ||
80 | ||
81 | // | |
82 | // Execute a n RPC | |
83 | // | |
84 | pu blic Strin g executeR PC(VistaQu ery vm) th rows Metho dException , Connecti onExceptio n { | |
85 | Stri ng result = null; | |
86 | Vist aSession l ocalVistaS ession = n ull; | |
87 | try | |
88 | { | |
89 | localV istaSessio n = getVis taSession( ); | |
90 | result = localVi staSession .call(vm); | |
91 | ||
92 | } ca tch (IOExc eption e) { | |
93 | throw new Connec tionExcept ion(e); | |
94 | } ca tch (Vista MethodExce ption e) { | |
95 | throw new Method Exception( e.getMessa ge()); | |
96 | } ca tch (Inval idVistaCre dentialsEx ception e) { | |
97 | throw new Invali dCredentia lsExceptio n(e.getMes sage()); | |
98 | } | |
99 | catc h(InvalidU serCredent ialsExcept ion icX) | |
100 | { | |
101 | throw icX; | |
102 | } | |
103 | catc h (Excepti on e) { | |
104 | throw new Method Exception( e.getMessa ge()); | |
105 | } fi nally { | |
106 | try { | |
107 | if(local VistaSessi on != null ) | |
108 | localVista Session.cl ose(); | |
109 | } catc h (Throwab le x) { | |
110 | } | |
111 | } | |
112 | ||
113 | // R eturn the result | |
114 | retu rn result; | |
115 | ||
116 | } | |
117 | ||
118 | ||
119 | // | |
120 | // Create an d supporti ng methods | |
121 | // | |
122 | pu blic T cre ate(T t) t hrows Meth odExceptio n, Connect ionExcepti on | |
123 | { | |
124 | Vist aQuery vm = generate CreateQuer y(t); | |
125 | retu rn transla teCreate(t , executeR PC(vm)); | |
126 | } | |
127 | ||
128 | pu blic Vista Query gene rateCreate Query(T t) throws Me thodExcept ion | |
129 | { | |
130 | thro w new DaoM ethodNotIm plementedE xception() ; | |
131 | } | |
132 | ||
133 | pu blic T tra nslateCrea te(T t, St ring retur nValue) th rows Metho dException , Creation Exception | |
134 | { | |
135 | thro w new DaoM ethodNotIm plementedE xception() ; | |
136 | } | |
137 | ||
138 | // | |
139 | // Get Entit y by Id an d supporti ng methods | |
140 | // | |
141 | pu blic T get EntityById (String id ) throws M ethodExcep tion, Conn ectionExce ption | |
142 | { | |
143 | Vist aQuery vm = generate GetEntityB yIdQuery(i d); | |
144 | retu rn transla teGetEntit yById(id, executeRPC (vm)); | |
145 | } | |
146 | ||
147 | pu blic Vista Query gene rateGetEnt ityByIdQue ry(String id) throws MethodExc eption | |
148 | { | |
149 | thro w new DaoM ethodNotIm plementedE xception() ; | |
150 | } | |
151 | ||
152 | pu blic T tra nslateGetE ntityById( String id, String re turnValue) throws Me thodExcept ion, Retri evalExcept ion | |
153 | { | |
154 | thro w new DaoM ethodNotIm plementedE xception() ; | |
155 | } | |
156 | ||
157 | // | |
158 | // Get by Cr iteria and supportin g methods | |
159 | // | |
160 | pu blic T get EntityByCr iteria(Obj ect criter ia) throws MethodExc eption, Co nnectionEx ception | |
161 | { | |
162 | Vist aQuery vm = generate GetEntityB yCriteriaQ uery(crite ria); | |
163 | retu rn transla teGetEntit yByCriteri a(criteria , executeR PC(vm)); | |
164 | } | |
165 | ||
166 | pu blic Vista Query gene rateGetEnt ityByCrite riaQuery(O bject crit eria) thro ws MethodE xception | |
167 | { | |
168 | thro w new DaoM ethodNotIm plementedE xception() ; | |
169 | } | |
170 | ||
171 | pu blic T tra nslateGetE ntityByCri teria(Obje ct criteri a, String returnValu e) throws MethodExce ption, Ret rievalExce ption | |
172 | { | |
173 | thro w new DaoM ethodNotIm plementedE xception() ; | |
174 | } | |
175 | ||
176 | ||
177 | // | |
178 | // Get by Cr iteria and supportin g methods | |
179 | // | |
180 | pu blic T get EntityByEx ample(T t) throws Me thodExcept ion, Conne ctionExcep tion | |
181 | { | |
182 | Vist aQuery vm = generate GetEntityB yExampleQu ery(t); | |
183 | retu rn transla teGetEntit yByExample (t, execut eRPC(vm)); | |
184 | } | |
185 | ||
186 | pu blic Vista Query gene rateGetEnt ityByExamp leQuery(T t) throws MethodExce ption | |
187 | { | |
188 | thro w new DaoM ethodNotIm plementedE xception() ; | |
189 | } | |
190 | ||
191 | pu blic T tra nslateGetE ntityByExa mple(T t, String ret urnValue) throws Met hodExcepti on, Retrie valExcepti on | |
192 | { | |
193 | thro w new DaoM ethodNotIm plementedE xception() ; | |
194 | } | |
195 | ||
196 | // | |
197 | // Retrieve by Example and suppo rting meth ods | |
198 | // | |
199 | pu blic List< T> findByE xample(T t ) throws M ethodExcep tion, Conn ectionExce ption | |
200 | { | |
201 | Vist aQuery vm = generate FindByExam pleQuery(t ); | |
202 | retu rn transla teFindByEx ample(t, e xecuteRPC( vm)); | |
203 | } | |
204 | ||
205 | pu blic Vista Query gene rateFindBy ExampleQue ry(T t) th rows Metho dException | |
206 | { | |
207 | thro w new DaoM ethodNotIm plementedE xception() ; | |
208 | } | |
209 | ||
210 | pu blic List< T> transla teFindByEx ample(T t, String re turnValue) throws Me thodExcept ion, Retri evalExcept ion | |
211 | { | |
212 | thro w new DaoM ethodNotIm plementedE xception() ; | |
213 | } | |
214 | ||
215 | // | |
216 | // Retrieve by Criteri a and supp orting met hods | |
217 | // | |
218 | pu blic List< T> findByC riteria(Ob ject crite ria) throw s MethodEx ception, C onnectionE xception | |
219 | { | |
220 | Vist aQuery vm = generate FindByCrit eriaQuery( criteria); | |
221 | retu rn transla teFindByCr iteria(cri teria, exe cuteRPC(vm )); | |
222 | } | |
223 | ||
224 | pu blic Vista Query gene rateFindBy CriteriaQu ery(Object criteria) throws Me thodExcept ion | |
225 | { | |
226 | thro w new DaoM ethodNotIm plementedE xception() ; | |
227 | } | |
228 | ||
229 | pu blic List< T> transla teFindByCr iteria(Obj ect criter ia, String returnVal ue) throws MethodExc eption, Re trievalExc eption | |
230 | { | |
231 | thro w new DaoM ethodNotIm plementedE xception() ; | |
232 | } | |
233 | ||
234 | // | |
235 | // Retrieve All and su pporting m ethods | |
236 | // | |
237 | pu blic List< T> findAll () throws MethodExce ption, Con nectionExc eption | |
238 | { | |
239 | Vist aQuery vm = generate FindAllQue ry(); | |
240 | retu rn transla teFindAll( executeRPC (vm)); | |
241 | } | |
242 | ||
243 | pu blic Vista Query gene rateFindAl lQuery() t hrows Meth odExceptio n | |
244 | { | |
245 | thro w new DaoM ethodNotIm plementedE xception() ; | |
246 | } | |
247 | ||
248 | pu blic List< T> transla teFindAll( String ret urnValue) throws Met hodExcepti on, Retrie valExcepti on | |
249 | { | |
250 | thro w new DaoM ethodNotIm plementedE xception() ; | |
251 | } | |
252 | ||
253 | // | |
254 | // Update an d supporti ng methods | |
255 | // | |
256 | pu blic T upd ate(T t) t hrows Meth odExceptio n, Connect ionExcepti on | |
257 | { | |
258 | Vist aQuery vm = generate UpdateQuer y(t); | |
259 | retu rn transla teUpdate(t , executeR PC(vm)); | |
260 | } | |
261 | ||
262 | pu blic Vista Query gene rateUpdate Query(T t) throws Me thodExcept ion | |
263 | { | |
264 | thro w new DaoM ethodNotIm plementedE xception() ; | |
265 | } | |
266 | ||
267 | pu blic T tra nslateUpda te(T t, St ring retur nValue) th rows Metho dException , UpdateEx ception | |
268 | { | |
269 | thro w new DaoM ethodNotIm plementedE xception() ; | |
270 | } | |
271 | ||
272 | ||
273 | // | |
274 | // Delete by Example a nd delete by id and supporting methods | |
275 | // | |
276 | pu blic void delete(T t ) throws M ethodExcep tion, Conn ectionExce ption | |
277 | { | |
278 | Vist aQuery vm = generate DeleteQuer y(t); | |
279 | tran slateDelet e(executeR PC(vm)); | |
280 | } | |
281 | ||
282 | pu blic void delete(int id) throw s MethodEx ception, C onnectionE xception | |
283 | { | |
284 | Vist aQuery vm = generate DeleteQuer y(id); | |
285 | tran slateDelet e(executeR PC(vm)); | |
286 | } | |
287 | ||
288 | pu blic Vista Query gene rateDelete Query(T t) throws Me thodExcept ion | |
289 | { | |
290 | thro w new DaoM ethodNotIm plementedE xception() ; | |
291 | } | |
292 | ||
293 | pu blic Vista Query gene rateDelete Query(int id) throws MethodExc eption | |
294 | { | |
295 | thro w new DaoM ethodNotIm plementedE xception() ; | |
296 | } | |
297 | ||
298 | pu blic void translateD elete(Stri ng returnV alue) thro ws Deletio nException , MethodEx ception | |
299 | { | |
300 | thro w new DaoM ethodNotIm plementedE xception() ; | |
301 | } | |
302 | ||
303 | ||
304 | // Miscellan eous utili ty methods | |
305 | pr otected St ring trans lateNewEnt ityIEN(Str ing return Value, Boo lean doCre ate) throw s Creation Exception | |
306 | { | |
307 | Stri ng[] resul ts = Strin gUtils.Spl it(returnV alue, DB_O UTPUT_SEPA RATOR1); | |
308 | Stri ng ien = " -1"; | |
309 | ||
310 | if ( results[0] .equals("0 ")) // Suc cessful op eration | |
311 | { | |
312 | ien = results[2] ; | |
313 | } | |
314 | else if (doCre ate) | |
315 | throw new Creati onExceptio n("Could n ot create record: " + results[ 1]); | |
316 | ||
317 | retu rn ien; | |
318 | } | |
319 | ||
320 | // --------- ---------- ----- priv ate transl ate utilit y -------- ---------- ---------- ---------- - | |
321 | pr otected Ha shMap <Str ing, Strin g> stringT oHashMap(S tring inSt r) | |
322 | { | |
323 | Hash Map <Strin g, String> hm = new HashMap <S tring, Str ing>(); | |
324 | if ( inStr.leng th()>MAX_M _STRING_LE NGTH) { | |
325 | int be gI, endI=0 ; | |
326 | for(in t index=0; endI<inSt r.length() ; ++index) | |
327 | { | |
328 | begI=ind ex*MAX_M_S TRING_LENG TH; | |
329 | endI=(in dex+1)*MAX _M_STRING_ LENGTH; | |
330 | if (endI >= inStr. length()) | |
331 | endI = inS tr.length( ); | |
332 | hm.put(S tring.valu eOf(index+ 1), inStr. substring( begI, endI )); | |
333 | } | |
334 | } el se | |
335 | hm.put ("1", inSt r); | |
336 | retu rn hm; | |
337 | } | |
338 | ||
339 | ||
340 | pr otected st atic void stringToHa shMap2(Has hMap <Stri ng, String > hm, Stri ng prefix, String in Str) | |
341 | { | |
342 | if ( inStr.leng th()>MAX_M _STRING_LE NGTH) { | |
343 | int be gI, endI=0 ; | |
344 | for(in t index=0; endI<inSt r.length() ; ++index) | |
345 | { | |
346 | begI=ind ex*MAX_M_S TRING_LENG TH; | |
347 | endI=(in dex+1)*MAX _M_STRING_ LENGTH; | |
348 | if (endI >= inStr. length()) | |
349 | endI = inS tr.length( ); | |
350 | String n um = Strin g.valueOf( index+1); | |
351 | for (int i=num.len gth(); i<3 ; i++) | |
352 | num =" 0" + num; | |
353 | hm.put(p refix + nu m, inStr.s ubstring(b egI, endI) ); | |
354 | } | |
355 | } el se | |
356 | hm.put (prefix + "001", inS tr); | |
357 | } | |
358 | ||
359 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.