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.StringUtils; |
28 | |
import org.apache.commons.lang.builder.EqualsBuilder; |
29 | |
import org.apache.commons.lang.builder.HashCodeBuilder; |
30 | |
import org.apache.commons.lang.builder.ToStringBuilder; |
31 | |
import org.kuali.rice.core.api.CoreConstants; |
32 | |
import org.w3c.dom.Element; |
33 | |
|
34 | |
@XmlRootElement(name = MovePoint.Constants.ROOT_ELEMENT_NAME) |
35 | |
@XmlAccessorType(XmlAccessType.NONE) |
36 | |
@XmlType(name = MovePoint.Constants.TYPE_NAME, propOrder = { |
37 | |
MovePoint.Elements.START_NODE_NAME, |
38 | |
MovePoint.Elements.STEPS_TO_MOVE, |
39 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
40 | |
}) |
41 | |
public final class MovePoint { |
42 | |
|
43 | |
@XmlElement(name = Elements.START_NODE_NAME, required = true) |
44 | |
private final String startNodeName; |
45 | |
|
46 | |
@XmlElement(name = Elements.STEPS_TO_MOVE, required = true) |
47 | |
private final int stepsToMove; |
48 | |
|
49 | 0 | @SuppressWarnings("unused") |
50 | |
@XmlAnyElement |
51 | |
private final Collection<Element> _futureElements = null; |
52 | |
|
53 | 0 | private MovePoint() { |
54 | 0 | this.startNodeName = null; |
55 | 0 | this.stepsToMove = 0; |
56 | 0 | } |
57 | |
|
58 | 0 | private MovePoint(String startNodeName, int stepsToMove) { |
59 | 0 | if (StringUtils.isBlank(startNodeName)) { |
60 | 0 | throw new IllegalArgumentException("startNodeName was null or blank"); |
61 | |
} |
62 | 0 | this.startNodeName = startNodeName; |
63 | 0 | this.stepsToMove = stepsToMove; |
64 | 0 | } |
65 | |
|
66 | |
public static MovePoint create(String startNodeName, int stepsToMove) { |
67 | 0 | return new MovePoint(startNodeName, stepsToMove); |
68 | |
} |
69 | |
|
70 | |
public String getStartNodeName() { |
71 | 0 | return startNodeName; |
72 | |
} |
73 | |
|
74 | |
public int getStepsToMove() { |
75 | 0 | return stepsToMove; |
76 | |
} |
77 | |
|
78 | |
@Override |
79 | |
public int hashCode() { |
80 | 0 | return HashCodeBuilder.reflectionHashCode(this, Constants.HASH_CODE_EQUALS_EXCLUDE); |
81 | |
} |
82 | |
|
83 | |
@Override |
84 | |
public boolean equals(Object object) { |
85 | 0 | return EqualsBuilder.reflectionEquals(object, this, Constants.HASH_CODE_EQUALS_EXCLUDE); |
86 | |
} |
87 | |
|
88 | |
@Override |
89 | |
public String toString() { |
90 | 0 | return ToStringBuilder.reflectionToString(this); |
91 | |
} |
92 | |
|
93 | |
|
94 | |
|
95 | |
|
96 | 0 | static class Constants { |
97 | |
final static String ROOT_ELEMENT_NAME = "movePoint"; |
98 | |
final static String TYPE_NAME = "MovePointType"; |
99 | 0 | final static String[] HASH_CODE_EQUALS_EXCLUDE = new String[] { CoreConstants.CommonElements.FUTURE_ELEMENTS }; |
100 | |
} |
101 | |
|
102 | |
|
103 | |
|
104 | |
|
105 | 0 | static class Elements { |
106 | |
final static String START_NODE_NAME = "startNodeName"; |
107 | |
final static String STEPS_TO_MOVE = "stepsToMove"; |
108 | |
} |
109 | |
|
110 | |
} |