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.util.Collection; |
19 | |
|
20 | |
import javax.xml.bind.annotation.XmlAccessType; |
21 | |
import javax.xml.bind.annotation.XmlAccessorType; |
22 | |
import javax.xml.bind.annotation.XmlAnyElement; |
23 | |
import javax.xml.bind.annotation.XmlElement; |
24 | |
import javax.xml.bind.annotation.XmlRootElement; |
25 | |
import javax.xml.bind.annotation.XmlType; |
26 | |
|
27 | |
import org.apache.commons.lang.StringUtils; |
28 | |
import org.kuali.rice.core.api.CoreConstants; |
29 | |
import org.kuali.rice.core.api.mo.AbstractDataTransferObject; |
30 | |
import org.w3c.dom.Element; |
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
@XmlRootElement(name = WorkflowAttributeValidationError.Constants.ROOT_ELEMENT_NAME) |
36 | |
@XmlAccessorType(XmlAccessType.NONE) |
37 | |
@XmlType(name = WorkflowAttributeValidationError.Constants.TYPE_NAME, propOrder = { |
38 | |
WorkflowAttributeValidationError.Elements.KEY, |
39 | |
WorkflowAttributeValidationError.Elements.MESSAGE, |
40 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
41 | |
}) |
42 | |
public final class WorkflowAttributeValidationError extends AbstractDataTransferObject { |
43 | |
|
44 | |
private static final long serialVersionUID = 3323649177455266977L; |
45 | |
|
46 | |
@XmlElement(name = Elements.KEY, required = true) |
47 | |
private final String key; |
48 | |
|
49 | |
@XmlElement(name = Elements.MESSAGE, required = true) |
50 | |
private final String message; |
51 | |
|
52 | 0 | @SuppressWarnings("unused") |
53 | |
@XmlAnyElement |
54 | |
private final Collection<Element> _futureElements = null; |
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | 0 | public WorkflowAttributeValidationError() { |
60 | 0 | this.key = null; |
61 | 0 | this.message = null; |
62 | 0 | } |
63 | |
|
64 | 0 | private WorkflowAttributeValidationError(String key, String message) { |
65 | 0 | if (StringUtils.isBlank(key)) { |
66 | 0 | throw new IllegalArgumentException("key was null or blank"); |
67 | |
} |
68 | 0 | if (StringUtils.isBlank(message)) { |
69 | 0 | throw new IllegalArgumentException("message was null or blank"); |
70 | |
} |
71 | 0 | this.key = key; |
72 | 0 | this.message = message; |
73 | 0 | } |
74 | |
|
75 | |
public static WorkflowAttributeValidationError create(String key, String message) { |
76 | 0 | return new WorkflowAttributeValidationError(key, message); |
77 | |
} |
78 | |
|
79 | |
public String getKey() { |
80 | 0 | return key; |
81 | |
} |
82 | |
|
83 | |
public String getMessage() { |
84 | 0 | return message; |
85 | |
} |
86 | |
|
87 | |
|
88 | |
|
89 | |
|
90 | 0 | static class Constants { |
91 | |
final static String ROOT_ELEMENT_NAME = "workflowAttributeValidationError"; |
92 | |
final static String TYPE_NAME = "WorkflowAttributeValidationErrorType"; |
93 | |
} |
94 | |
|
95 | |
|
96 | |
|
97 | |
|
98 | |
|
99 | 0 | static class Elements { |
100 | |
final static String KEY = "key"; |
101 | |
final static String MESSAGE = "message"; |
102 | |
} |
103 | |
|
104 | |
|
105 | |
} |