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