1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kew.api.action; |
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.builder.EqualsBuilder; |
28 | |
import org.apache.commons.lang.builder.HashCodeBuilder; |
29 | |
import org.apache.commons.lang.builder.ToStringBuilder; |
30 | |
import org.kuali.rice.core.api.CoreConstants; |
31 | |
import org.kuali.rice.core.api.mo.ModelObjectComplete; |
32 | |
import org.w3c.dom.Element; |
33 | |
|
34 | |
@XmlRootElement(name = RequestedActions.Constants.ROOT_ELEMENT_NAME) |
35 | |
@XmlAccessorType(XmlAccessType.NONE) |
36 | |
@XmlType(name = RequestedActions.Constants.TYPE_NAME, propOrder = { |
37 | |
RequestedActions.Elements.COMPLETE_REQUESTED, |
38 | |
RequestedActions.Elements.APPROVE_REQUESTED, |
39 | |
RequestedActions.Elements.ACKNOWLEDGE_REQUESTED, |
40 | |
RequestedActions.Elements.FYI_REQUESTED, |
41 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
42 | |
}) |
43 | |
public final class RequestedActions implements ModelObjectComplete { |
44 | |
|
45 | |
private static final long serialVersionUID = -6600754341497697330L; |
46 | |
|
47 | |
@XmlElement(name = Elements.COMPLETE_REQUESTED, required = true) |
48 | |
private final boolean completeRequested; |
49 | |
|
50 | |
@XmlElement(name = Elements.APPROVE_REQUESTED, required = true) |
51 | |
private final boolean approveRequested; |
52 | |
|
53 | |
@XmlElement(name = Elements.ACKNOWLEDGE_REQUESTED, required = true) |
54 | |
private final boolean acknowledgeRequested; |
55 | |
|
56 | |
@XmlElement(name = Elements.FYI_REQUESTED, required = true) |
57 | |
private final boolean fyiRequested; |
58 | |
|
59 | 0 | @SuppressWarnings("unused") |
60 | |
@XmlAnyElement |
61 | |
private final Collection<Element> _futureElements = null; |
62 | |
|
63 | 0 | private RequestedActions() { |
64 | 0 | this.completeRequested = false; |
65 | 0 | this.approveRequested = false; |
66 | 0 | this.acknowledgeRequested = false; |
67 | 0 | this.fyiRequested = false; |
68 | 0 | } |
69 | |
|
70 | 0 | private RequestedActions(boolean completeRequested, boolean approveRequested, boolean acknowledgeRequested, boolean fyiRequested) { |
71 | 0 | this.completeRequested = completeRequested; |
72 | 0 | this.approveRequested = approveRequested; |
73 | 0 | this.acknowledgeRequested = acknowledgeRequested; |
74 | 0 | this.fyiRequested = fyiRequested; |
75 | 0 | } |
76 | |
|
77 | |
public static RequestedActions create(boolean completeRequested, boolean approveRequested, boolean acknowledgeRequested, boolean fyiRequested) { |
78 | 0 | return new RequestedActions(completeRequested, approveRequested, acknowledgeRequested, fyiRequested); |
79 | |
} |
80 | |
|
81 | |
public boolean isCompleteRequested() { |
82 | 0 | return completeRequested; |
83 | |
} |
84 | |
|
85 | |
public boolean isApproveRequested() { |
86 | 0 | return approveRequested; |
87 | |
} |
88 | |
|
89 | |
public boolean isAcknowledgeRequested() { |
90 | 0 | return acknowledgeRequested; |
91 | |
} |
92 | |
|
93 | |
public boolean isFyiRequested() { |
94 | 0 | return fyiRequested; |
95 | |
} |
96 | |
|
97 | |
@Override |
98 | |
public int hashCode() { |
99 | 0 | return HashCodeBuilder.reflectionHashCode(this, Constants.HASH_CODE_EQUALS_EXCLUDE); |
100 | |
} |
101 | |
|
102 | |
@Override |
103 | |
public boolean equals(Object object) { |
104 | 0 | return EqualsBuilder.reflectionEquals(object, this, Constants.HASH_CODE_EQUALS_EXCLUDE); |
105 | |
} |
106 | |
|
107 | |
@Override |
108 | |
public String toString() { |
109 | 0 | return ToStringBuilder.reflectionToString(this); |
110 | |
} |
111 | |
|
112 | |
|
113 | |
|
114 | |
|
115 | 0 | static class Constants { |
116 | |
final static String ROOT_ELEMENT_NAME = "requestedActions"; |
117 | |
final static String TYPE_NAME = "RequestedActionsType"; |
118 | 0 | final static String[] HASH_CODE_EQUALS_EXCLUDE = new String[] { CoreConstants.CommonElements.FUTURE_ELEMENTS }; |
119 | |
} |
120 | |
|
121 | |
|
122 | |
|
123 | |
|
124 | 0 | static class Elements { |
125 | |
final static String COMPLETE_REQUESTED = "completeRequested"; |
126 | |
final static String APPROVE_REQUESTED = "approveRequested"; |
127 | |
final static String ACKNOWLEDGE_REQUESTED = "acknowledgeRequested"; |
128 | |
final static String FYI_REQUESTED = "fyiRequested"; |
129 | |
} |
130 | |
|
131 | |
} |