1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kew.api.document; |
17 | |
|
18 | |
import java.io.Serializable; |
19 | |
import java.util.Collection; |
20 | |
|
21 | |
import javax.xml.bind.annotation.XmlAccessType; |
22 | |
import javax.xml.bind.annotation.XmlAccessorType; |
23 | |
import javax.xml.bind.annotation.XmlAnyElement; |
24 | |
import javax.xml.bind.annotation.XmlElement; |
25 | |
import javax.xml.bind.annotation.XmlRootElement; |
26 | |
import javax.xml.bind.annotation.XmlType; |
27 | |
|
28 | |
import org.apache.commons.lang.StringUtils; |
29 | |
import org.apache.commons.lang.builder.EqualsBuilder; |
30 | |
import org.apache.commons.lang.builder.HashCodeBuilder; |
31 | |
import org.apache.commons.lang.builder.ToStringBuilder; |
32 | |
import org.kuali.rice.core.api.CoreConstants; |
33 | |
import org.w3c.dom.Element; |
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
@XmlRootElement(name = WorkflowAttributeValidationError.Constants.ROOT_ELEMENT_NAME) |
39 | |
@XmlAccessorType(XmlAccessType.NONE) |
40 | |
@XmlType(name = WorkflowAttributeValidationError.Constants.TYPE_NAME, propOrder = { |
41 | |
WorkflowAttributeValidationError.Elements.KEY, |
42 | |
WorkflowAttributeValidationError.Elements.MESSAGE, |
43 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
44 | |
}) |
45 | |
public final class WorkflowAttributeValidationError implements Serializable { |
46 | |
|
47 | |
private static final long serialVersionUID = 3323649177455266977L; |
48 | |
|
49 | |
@XmlElement(name = Elements.KEY, required = true) |
50 | |
private final String key; |
51 | |
|
52 | |
@XmlElement(name = Elements.MESSAGE, required = true) |
53 | |
private final String message; |
54 | |
|
55 | 0 | @SuppressWarnings("unused") |
56 | |
@XmlAnyElement |
57 | |
private final Collection<Element> _futureElements = null; |
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | 0 | public WorkflowAttributeValidationError() { |
63 | 0 | this.key = null; |
64 | 0 | this.message = null; |
65 | 0 | } |
66 | |
|
67 | 0 | private WorkflowAttributeValidationError(String key, String message) { |
68 | 0 | if (StringUtils.isBlank(key)) { |
69 | 0 | throw new IllegalArgumentException("key was null or blank"); |
70 | |
} |
71 | 0 | if (StringUtils.isBlank(message)) { |
72 | 0 | throw new IllegalArgumentException("message was null or blank"); |
73 | |
} |
74 | 0 | this.key = key; |
75 | 0 | this.message = message; |
76 | 0 | } |
77 | |
|
78 | |
public static WorkflowAttributeValidationError create(String key, String message) { |
79 | 0 | return new WorkflowAttributeValidationError(key, message); |
80 | |
} |
81 | |
|
82 | |
public String getKey() { |
83 | 0 | return key; |
84 | |
} |
85 | |
|
86 | |
public String getMessage() { |
87 | 0 | return message; |
88 | |
} |
89 | |
|
90 | |
@Override |
91 | |
public int hashCode() { |
92 | 0 | return HashCodeBuilder.reflectionHashCode(this, Constants.HASH_CODE_EQUALS_EXCLUDE); |
93 | |
} |
94 | |
|
95 | |
@Override |
96 | |
public boolean equals(Object object) { |
97 | 0 | return EqualsBuilder.reflectionEquals(object, this, Constants.HASH_CODE_EQUALS_EXCLUDE); |
98 | |
} |
99 | |
|
100 | |
@Override |
101 | |
public String toString() { |
102 | 0 | return ToStringBuilder.reflectionToString(this); |
103 | |
} |
104 | |
|
105 | |
|
106 | |
|
107 | |
|
108 | 0 | static class Constants { |
109 | |
final static String ROOT_ELEMENT_NAME = "workflowAttributeValidationError"; |
110 | |
final static String TYPE_NAME = "WorkflowAttributeValidationErrorType"; |
111 | 0 | final static String[] HASH_CODE_EQUALS_EXCLUDE = new String[]{CoreConstants.CommonElements.FUTURE_ELEMENTS}; |
112 | |
} |
113 | |
|
114 | |
|
115 | |
|
116 | |
|
117 | |
|
118 | 0 | static class Elements { |
119 | |
final static String KEY = "key"; |
120 | |
final static String MESSAGE = "message"; |
121 | |
} |
122 | |
|
123 | |
|
124 | |
} |