Revision 8d91be96
Added by Ayco Hollemann about 10 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/validation/SeverityType.java | ||
---|---|---|
12 | 12 |
import eu.etaxonomy.cdm.validation.Severity; |
13 | 13 |
|
14 | 14 |
/** |
15 |
* A Hibernate {@code UserType} implementation for persisting {@link Severity} instances.
|
|
15 |
* A Hibernate {@code UserType} for persisting {@link Severity} instances. |
|
16 | 16 |
* |
17 | 17 |
* @see EntityConstraintViolation |
18 | 18 |
* |
... | ... | |
39 | 39 |
@Override |
40 | 40 |
public boolean equals(Object x, Object y) throws HibernateException |
41 | 41 |
{ |
42 |
if (x == null && y != null) { |
|
42 |
if (x == null) { |
|
43 |
if (y == null) { |
|
44 |
return true; |
|
45 |
} |
|
43 | 46 |
return false; |
44 | 47 |
} |
45 |
if (x != null && y == null) {
|
|
48 |
if (y == null) { |
|
46 | 49 |
return false; |
47 | 50 |
} |
48 | 51 |
return ((Severity) x).equals(y); |
... | ... | |
67 | 70 |
@Override |
68 | 71 |
public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException |
69 | 72 |
{ |
70 |
st.setString(index, value.toString()); |
|
73 |
st.setString(index, value == null ? null : value.toString());
|
|
71 | 74 |
} |
72 | 75 |
|
73 | 76 |
|
cdmlib-model/src/main/java/eu/etaxonomy/cdm/validation/Severity.java | ||
---|---|---|
13 | 13 |
* message. Concrete instances or {@code enum}s (an obvious choice for severity levels) |
14 | 14 |
* cannot function as {@code Payload} objects. The Severity class enables you to program |
15 | 15 |
* using true Severity instances (one for each level), while behind the scenes only the |
16 |
* class of those instances is taken into account (e.g. when sending data back and forth |
|
17 |
* from the database) |
|
16 |
* class of those instances is taken into account. |
|
18 | 17 |
*/ |
19 | 18 |
public abstract class Severity implements Payload { |
20 | 19 |
|
Also available in: Unified diff
removed bug in unit test for dao.saveValidationResult()