1 | |
package org.kuali.rice.kew.api.action; |
2 | |
|
3 | |
import java.io.Serializable; |
4 | |
import java.util.Collection; |
5 | |
|
6 | |
import javax.xml.bind.annotation.XmlAccessType; |
7 | |
import javax.xml.bind.annotation.XmlAccessorType; |
8 | |
import javax.xml.bind.annotation.XmlAnyElement; |
9 | |
import javax.xml.bind.annotation.XmlElement; |
10 | |
import javax.xml.bind.annotation.XmlRootElement; |
11 | |
import javax.xml.bind.annotation.XmlType; |
12 | |
|
13 | |
import org.apache.commons.lang.StringUtils; |
14 | |
import org.apache.commons.lang.builder.EqualsBuilder; |
15 | |
import org.apache.commons.lang.builder.HashCodeBuilder; |
16 | |
import org.apache.commons.lang.builder.ToStringBuilder; |
17 | |
import org.kuali.rice.core.api.CoreConstants; |
18 | |
import org.w3c.dom.Element; |
19 | |
|
20 | |
@XmlRootElement(name = AdHocRevokeCommand.Constants.ROOT_ELEMENT_NAME) |
21 | |
@XmlAccessorType(XmlAccessType.NONE) |
22 | |
@XmlType(name = AdHocRevokeCommand.Constants.TYPE_NAME, propOrder = { |
23 | |
AdHocRevokeCommand.Elements.ACTION_REQUEST_ID, |
24 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
25 | |
}) |
26 | |
abstract class AdHocRevokeCommand implements Serializable { |
27 | |
|
28 | |
private static final long serialVersionUID = 5848714514445793355L; |
29 | |
|
30 | |
@XmlElement(name = Elements.ACTION_REQUEST_ID, required = false) |
31 | |
private final String actionRequestId; |
32 | |
|
33 | |
@XmlElement(name = Elements.NODE_NAME, required = false) |
34 | |
private final String nodeName; |
35 | |
|
36 | 0 | @SuppressWarnings("unused") |
37 | |
@XmlAnyElement |
38 | |
private final Collection<Element> _futureElements = null; |
39 | |
|
40 | 0 | protected AdHocRevokeCommand(String actionRequestId, String nodeName) { |
41 | 0 | boolean actionRequestIdNull = StringUtils.isBlank(actionRequestId); |
42 | 0 | boolean nodeNameNull = StringUtils.isBlank(nodeName); |
43 | 0 | if (actionRequestIdNull && nodeNameNull) { |
44 | 0 | throw new IllegalArgumentException("One of actionRequestId or nodeName must not be null or blank"); |
45 | |
} |
46 | 0 | if (!actionRequestIdNull && !nodeNameNull) { |
47 | 0 | throw new IllegalArgumentException("Only one of actionRequestId or nodeName must be defined on AdHocRevokeCommand"); |
48 | |
} |
49 | 0 | this.actionRequestId = actionRequestId; |
50 | 0 | this.nodeName = nodeName; |
51 | 0 | } |
52 | |
|
53 | |
public String getActionRequestId() { |
54 | 0 | return actionRequestId; |
55 | |
} |
56 | |
|
57 | |
public String getNodeName() { |
58 | 0 | return nodeName; |
59 | |
} |
60 | |
|
61 | |
@Override |
62 | |
public int hashCode() { |
63 | 0 | return HashCodeBuilder.reflectionHashCode(this, Constants.HASH_CODE_EQUALS_EXCLUDE); |
64 | |
} |
65 | |
|
66 | |
@Override |
67 | |
public boolean equals(Object object) { |
68 | 0 | return EqualsBuilder.reflectionEquals(object, this, Constants.HASH_CODE_EQUALS_EXCLUDE); |
69 | |
} |
70 | |
|
71 | |
@Override |
72 | |
public String toString() { |
73 | 0 | return ToStringBuilder.reflectionToString(this); |
74 | |
} |
75 | |
|
76 | |
|
77 | |
|
78 | |
|
79 | 0 | static class Constants { |
80 | |
final static String ROOT_ELEMENT_NAME = "adHocRevokeCommand"; |
81 | |
final static String TYPE_NAME = "AdHocRevokeCommandType"; |
82 | 0 | final static String[] HASH_CODE_EQUALS_EXCLUDE = new String[] { CoreConstants.CommonElements.FUTURE_ELEMENTS }; |
83 | |
} |
84 | |
|
85 | |
|
86 | |
|
87 | |
|
88 | 0 | static class Elements { |
89 | |
final static String ACTION_REQUEST_ID = "actionRequestedId"; |
90 | |
final static String NODE_NAME = "nodeName"; |
91 | |
} |
92 | |
|
93 | |
} |