Produced by Araxis Merge on 3/8/2018 10:11:37 AM Eastern Standard 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 | PRE_PPS-N_v3.0.1.zip\PS_PPS_domain\src\main\java\gov\va\med\pharmacy\peps\domain\common\utility | BlobHandler.java | Fri Jan 12 15:42:36 2018 UTC |
2 | PRE_PPS-N_v3.0.1.zip\PS_PPS_domain\src\main\java\gov\va\med\pharmacy\peps\domain\common\utility | BlobHandler.java | Wed Mar 7 01:50:55 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 202 |
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 | package go v.va.med.p harmacy.pe ps.domain. common.uti lity; | |
2 | ||
3 | import jav a.io.Input Stream; | |
4 | import jav a.sql.Blob ; | |
5 | import jav a.sql.SQLE xception; | |
6 | ||
7 | import jav ax.annotat ion.Resour ce; | |
8 | ||
9 | import org .hibernate .Hibernate ; | |
10 | import org .hibernate .SessionFa ctory; | |
11 | import org .springfra mework.bea ns.factory .Initializ ingBean; | |
12 | import org .springfra mework.ste reotype.Se rvice; | |
13 | ||
14 | /** | |
15 | * A class that can be used to create/re trieve Blo b content. This clas s was crea ted since the Hibern ate method s now take a | |
16 | * Session in order to perform these ope rations. | |
17 | * | |
18 | * @author DNS DNS | |
19 | * | |
20 | * @deprec ated 20150 827 - Hibe rnate 4 no w handles BLOBs as b yte[]. | |
21 | */ | |
22 | @Service | |
23 | @Deprecate d | |
24 | public cla ss BlobHan dler imple ments Init ializingBe an { | |
25 | ||
26 | @Resou rce(name = "sessionF actory") | |
27 | privat e SessionF actory ses sionFactor y; | |
28 | ||
29 | /** | |
30 | * Cre ates a Blo b from a b yte array. | |
31 | * | |
32 | * @pa ram bytes | |
33 | * by te array | |
34 | * @re turn Blob | |
35 | */ | |
36 | public final Blo b createBl ob(byte[] bytes) { | |
37 | re turn Hiber nate.getLo bCreator(s essionFact ory.getCur rentSessio n()).creat eBlob(byte s); | |
38 | } | |
39 | ||
40 | /** | |
41 | * Cre ates a Blo b from an InputStrea m. | |
42 | * | |
43 | * @pa ram stream | |
44 | * In putStream | |
45 | * @pa ram length | |
46 | * th e length o f the cont ent | |
47 | * @re turn Blob | |
48 | */ | |
49 | public final Blo b createBl ob(InputSt ream strea m, Long le ngth) { | |
50 | re turn Hiber nate.getLo bCreator(s essionFact ory.getCur rentSessio n()).creat eBlob(stre am, length ); | |
51 | } | |
52 | ||
53 | /** | |
54 | * Ret urns a Blo b as a byt e array. | |
55 | * | |
56 | * @pa ram blob | |
57 | * th e Blob | |
58 | * @re turn byte[ ] | |
59 | * @th rows SQLEx ception | |
60 | * i f an error occurs du ring conve rsion | |
61 | */ | |
62 | public final byt e[] toByte Array(Blob blob) thr ows SQLExc eption { | |
63 | Lo ng length = blob.len gth(); | |
64 | re turn blob. getBytes(1 L, length. intValue() ); | |
65 | } | |
66 | ||
67 | /** | |
68 | * Ret urns a Blo b as an In putStream. | |
69 | * | |
70 | * @pa ram blob | |
71 | * th e Blob | |
72 | * @re turn Input Stream | |
73 | * @th rows SQLEx ception | |
74 | * i f an error occurs du ring conve rsion | |
75 | */ | |
76 | public final Inp utStream g etStream(B lob blob) throws SQL Exception { | |
77 | re turn blob. getBinaryS tream(); | |
78 | } | |
79 | ||
80 | /** | |
81 | * Set s the Sess ionFactory that shou ld be used by this c lass. | |
82 | * | |
83 | * @pa ram sessio nFactory | |
84 | * th e SessionF actory | |
85 | */ | |
86 | public final voi d setSessi onFactory( SessionFac tory sessi onFactory) { | |
87 | th is.session Factory = sessionFac tory; | |
88 | } | |
89 | ||
90 | /** | |
91 | * Met hod to che ck to make sure the any needs beans have been inje cted. | |
92 | * | |
93 | * @th rows Excep tion | |
94 | * i f a proper ty has not been inje cted | |
95 | */ | |
96 | @Overr ide | |
97 | public final voi d afterPro pertiesSet () throws Exception { | |
98 | if (sessionF actory == null) { | |
99 | throw ne w Exceptio n("Session Factory ha s not been injected in to Blob Handler.") ; | |
100 | } | |
101 | } | |
102 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.