| 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 |
|
@author |
| 39 |
|
|
|
|
|
| 0% |
Uncovered Elements: 37 (37) |
Complexity: 18 |
Complexity Density: 0,9 |
|
| 40 |
|
public abstract class StringEnumeration implements Serializable, UserType, Comparable { |
| 41 |
|
|
| 42 |
|
private final static long serialVersionUID = -1298346029203487615L; |
| 43 |
|
|
| 44 |
|
|
| 45 |
|
|
| 46 |
|
|
| 47 |
|
private final static int[] TYPES = new int[] {Types.VARCHAR}; |
| 48 |
|
|
| 49 |
|
|
| 50 |
|
|
| 51 |
|
|
| 52 |
|
|
| 53 |
|
|
| 54 |
|
protected String code; |
| 55 |
|
|
| 56 |
|
|
| 57 |
|
|
| 58 |
|
|
| 59 |
|
|
| 60 |
|
@return |
| 61 |
|
|
| 62 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 63 |
0
|
public String getCode() {... |
| 64 |
0
|
return code; |
| 65 |
|
} |
| 66 |
|
|
| 67 |
|
|
| 68 |
|
|
| 69 |
|
|
| 70 |
|
@return |
| 71 |
|
|
| 72 |
|
public abstract String getDisplay(); |
| 73 |
|
|
| 74 |
|
|
| 75 |
|
|
| 76 |
|
|
| 77 |
|
|
| 78 |
|
|
| 79 |
|
@param |
| 80 |
|
@return |
| 81 |
|
|
| 82 |
|
public abstract StringEnumeration decode(String code); |
| 83 |
|
|
| 84 |
|
|
| 85 |
|
@see |
| 86 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 87 |
0
|
public int[] sqlTypes() {... |
| 88 |
0
|
return TYPES; |
| 89 |
|
} |
| 90 |
|
|
| 91 |
|
|
| 92 |
|
@see |
| 93 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 94 |
0
|
public Class returnedClass() {... |
| 95 |
0
|
return this.getClass(); |
| 96 |
|
} |
| 97 |
|
|
| 98 |
|
|
| 99 |
|
@see |
| 100 |
|
|
| 101 |
|
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 4 |
Complexity Density: 0,8 |
|
| 102 |
0
|
public boolean equals(Object src, Object dst) throws HibernateException {... |
| 103 |
0
|
if (src == dst) { |
| 104 |
0
|
return true; |
| 105 |
|
} |
| 106 |
0
|
if (src == null || dst == null) { |
| 107 |
0
|
return false; |
| 108 |
|
} |
| 109 |
0
|
return Hibernate.STRING.isEqual(src, dst); |
| 110 |
|
} |
| 111 |
|
|
| 112 |
|
|
| 113 |
|
@see |
| 114 |
|
|
| 115 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
|
| 116 |
0
|
public Object nullSafeGet(ResultSet rows, String[] names, Object owner) throws HibernateException, SQLException {... |
| 117 |
0
|
String code = ((String)Hibernate.STRING.nullSafeGet(rows, names[0])); |
| 118 |
0
|
return this.decode(code); |
| 119 |
|
} |
| 120 |
|
|
| 121 |
|
|
| 122 |
|
@see |
| 123 |
|
|
| 124 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 2 |
Complexity Density: 1 |
|
| 125 |
0
|
public void nullSafeSet(PreparedStatement statement, Object value, int index) throws HibernateException,... |
| 126 |
|
SQLException { |
| 127 |
0
|
try { |
| 128 |
0
|
statement.setString(index, ((StringEnumeration)value).getCode()); |
| 129 |
|
} catch (ClassCastException cce) { |
| 130 |
|
throw new HibernateException(cce); |
| 131 |
|
} |
| 132 |
|
} |
| 133 |
|
|
| 134 |
|
|
| 135 |
|
@see |
| 136 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 137 |
0
|
public Object deepCopy(Object value) throws HibernateException {... |
| 138 |
0
|
return value; |
| 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: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 152 |
0
|
public Object assemble(Serializable arg0, Object arg1) throws HibernateException {... |
| 153 |
|
|
| 154 |
0
|
return null; |
| 155 |
|
} |
| 156 |
|
|
| 157 |
|
|
| 158 |
|
@see |
| 159 |
|
|
| 160 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 161 |
0
|
public Serializable disassemble(Object arg0) throws HibernateException {... |
| 162 |
|
|
| 163 |
0
|
return null; |
| 164 |
|
} |
| 165 |
|
|
| 166 |
|
|
| 167 |
|
@see |
| 168 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 169 |
0
|
public int hashCode(Object obj) throws HibernateException {... |
| 170 |
0
|
return ((Enumeration)obj).hashCode(); |
| 171 |
|
} |
| 172 |
|
|
| 173 |
|
|
| 174 |
|
@see |
| 175 |
|
|
| 176 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 177 |
0
|
public Object replace(Object arg0, Object arg1, Object arg2) throws HibernateException {... |
| 178 |
0
|
return null; |
| 179 |
|
} |
| 180 |
|
|
| 181 |
|
|
| 182 |
|
|
| 183 |
|
|
| 184 |
|
@param |
| 185 |
|
@return |
| 186 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 2 |
Complexity Density: 1 |
|
| 187 |
0
|
public int compareTo(Object obj) {... |
| 188 |
0
|
try { |
| 189 |
0
|
return this.getCode().compareTo(((StringEnumeration)obj).code); |
| 190 |
|
} catch (ClassCastException cce) { |
| 191 |
|
return 0; |
| 192 |
|
} |
| 193 |
|
} |
| 194 |
|
} |