1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
package net.smartlab.web; |
24 |
|
|
25 |
|
import java.io.Serializable; |
26 |
|
import java.sql.PreparedStatement; |
27 |
|
import java.sql.ResultSet; |
28 |
|
import java.sql.SQLException; |
29 |
|
import java.sql.Types; |
30 |
|
|
31 |
|
import org.hibernate.Hibernate; |
32 |
|
import org.hibernate.HibernateException; |
33 |
|
import org.hibernate.usertype.UserType; |
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
@author |
43 |
|
|
|
|
| 0% |
Uncovered Elements: 42 (42) |
Complexity: 19 |
Complexity Density: 0,83 |
|
44 |
|
public abstract class Enumeration implements UserType, Serializable { |
45 |
|
|
46 |
|
private final static long serialVersionUID = 8849967605617496075L; |
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
private final static int[] TYPES = new int[] {Types.SMALLINT}; |
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
private final int id; |
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
private final String display; |
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
|
72 |
0
|
protected Enumeration() {... |
73 |
|
|
74 |
0
|
this.id = -1; |
75 |
0
|
this.display = null; |
76 |
|
} |
77 |
|
|
78 |
|
|
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
@param |
83 |
|
@param |
84 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
|
85 |
0
|
protected Enumeration(int id, String display) {... |
86 |
0
|
this.id = id; |
87 |
0
|
this.display = display; |
88 |
|
} |
89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
|
93 |
|
@return |
94 |
|
|
95 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
96 |
0
|
public int getId() {... |
97 |
0
|
return id; |
98 |
|
} |
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
@return |
104 |
|
|
105 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
106 |
0
|
public String getDisplay() {... |
107 |
0
|
return display; |
108 |
|
} |
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
@param |
116 |
|
@return |
117 |
|
|
118 |
|
public abstract Enumeration decode(int id); |
119 |
|
|
120 |
|
|
121 |
|
@see |
122 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
123 |
0
|
public Object deepCopy(Object value) throws HibernateException {... |
124 |
0
|
return value; |
125 |
|
} |
126 |
|
|
127 |
|
|
128 |
|
@see |
129 |
|
|
130 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 4 |
Complexity Density: 0,8 |
|
131 |
0
|
public boolean equals(Object src, Object dst) throws HibernateException {... |
132 |
0
|
if (src == dst) { |
133 |
0
|
return true; |
134 |
|
} |
135 |
0
|
if (src == null || dst == null) { |
136 |
0
|
return false; |
137 |
|
} |
138 |
0
|
return Hibernate.INTEGER.isEqual(src, dst); |
139 |
|
} |
140 |
|
|
141 |
|
|
142 |
|
@see |
143 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
144 |
0
|
public boolean isMutable() {... |
145 |
0
|
return false; |
146 |
|
} |
147 |
|
|
148 |
|
|
149 |
|
@see |
150 |
|
|
151 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
|
152 |
0
|
public Object nullSafeGet(ResultSet rows, String[] names, Object value) throws HibernateException, SQLException {... |
153 |
0
|
int id = ((Integer)Hibernate.INTEGER.nullSafeGet(rows, names[0])).intValue(); |
154 |
0
|
return this.decode(id); |
155 |
|
} |
156 |
|
|
157 |
|
|
158 |
|
@see |
159 |
|
|
160 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 2 |
Complexity Density: 1 |
|
161 |
0
|
public void nullSafeSet(PreparedStatement statement, Object value, int index) throws HibernateException,... |
162 |
|
SQLException { |
163 |
0
|
try { |
164 |
0
|
statement.setInt(index, ((Enumeration)value).getId()); |
165 |
|
} catch (ClassCastException cce) { |
166 |
|
throw new HibernateException(cce); |
167 |
|
} |
168 |
|
} |
169 |
|
|
170 |
|
|
171 |
|
@see |
172 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
173 |
0
|
public Class returnedClass() {... |
174 |
0
|
return this.getClass(); |
175 |
|
} |
176 |
|
|
177 |
|
|
178 |
|
@see |
179 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
180 |
0
|
public int[] sqlTypes() {... |
181 |
0
|
return TYPES; |
182 |
|
} |
183 |
|
|
184 |
|
|
185 |
|
@see |
186 |
|
|
187 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
188 |
0
|
public Object assemble(Serializable arg0, Object arg1) throws HibernateException {... |
189 |
0
|
return null; |
190 |
|
|
191 |
|
} |
192 |
|
|
193 |
|
|
194 |
|
@see |
195 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
196 |
0
|
public Serializable disassemble(Object arg0) throws HibernateException {... |
197 |
0
|
return null; |
198 |
|
|
199 |
|
} |
200 |
|
|
201 |
|
|
202 |
|
@see |
203 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
204 |
0
|
public int hashCode(Object obj) throws HibernateException {... |
205 |
0
|
return ((Enumeration)obj).getId(); |
206 |
|
} |
207 |
|
|
208 |
|
|
209 |
|
@see |
210 |
|
|
211 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
212 |
0
|
public Object replace(Object arg0, Object arg1, Object arg2) throws HibernateException {... |
213 |
0
|
return null; |
214 |
|
|
215 |
|
} |
216 |
|
} |