1 | |
package org.kuali.rice.kew.api.doctype; |
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.kuali.rice.core.api.mo.ModelBuilder; |
19 | |
import org.kuali.rice.core.api.mo.ModelObjectComplete; |
20 | |
import org.w3c.dom.Element; |
21 | |
|
22 | |
@XmlRootElement(name = RouteNodeConfigurationParameter.Constants.ROOT_ELEMENT_NAME) |
23 | |
@XmlAccessorType(XmlAccessType.NONE) |
24 | |
@XmlType(name = RouteNodeConfigurationParameter.Constants.TYPE_NAME, propOrder = { |
25 | |
RouteNodeConfigurationParameter.Elements.ID, |
26 | |
RouteNodeConfigurationParameter.Elements.ROUTE_NODE_ID, |
27 | |
RouteNodeConfigurationParameter.Elements.KEY, |
28 | |
RouteNodeConfigurationParameter.Elements.VALUE, |
29 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
30 | |
}) |
31 | 0 | public final class RouteNodeConfigurationParameter implements ModelObjectComplete, |
32 | |
RouteNodeConfigurationParameterContract { |
33 | |
|
34 | |
private static final long serialVersionUID = 3494982096398369148L; |
35 | |
|
36 | |
@XmlElement(name = Elements.ID, required = false) |
37 | |
private final String id; |
38 | |
|
39 | |
@XmlElement(name = Elements.ROUTE_NODE_ID, required = false) |
40 | |
private final String routeNodeId; |
41 | |
|
42 | |
@XmlElement(name = Elements.KEY, required = true) |
43 | |
private final String key; |
44 | |
|
45 | |
@XmlElement(name = Elements.VALUE, required = false) |
46 | |
private final String value; |
47 | |
|
48 | 0 | @SuppressWarnings("unused") |
49 | |
@XmlAnyElement |
50 | |
private final Collection<Element> _futureElements = null; |
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | 0 | private RouteNodeConfigurationParameter() { |
56 | 0 | this.id = null; |
57 | 0 | this.routeNodeId = null; |
58 | 0 | this.key = null; |
59 | 0 | this.value = null; |
60 | 0 | } |
61 | |
|
62 | 0 | private RouteNodeConfigurationParameter(Builder builder) { |
63 | 0 | this.id = builder.getId(); |
64 | 0 | this.routeNodeId = builder.getRouteNodeId(); |
65 | 0 | this.key = builder.getKey(); |
66 | 0 | this.value = builder.getValue(); |
67 | 0 | } |
68 | |
|
69 | |
@Override |
70 | |
public String getId() { |
71 | 0 | return this.id; |
72 | |
} |
73 | |
|
74 | |
@Override |
75 | |
public String getRouteNodeId() { |
76 | 0 | return this.routeNodeId; |
77 | |
} |
78 | |
|
79 | |
@Override |
80 | |
public String getKey() { |
81 | 0 | return this.key; |
82 | |
} |
83 | |
|
84 | |
@Override |
85 | |
public String getValue() { |
86 | 0 | return this.value; |
87 | |
} |
88 | |
|
89 | |
@Override |
90 | |
public int hashCode() { |
91 | 0 | return HashCodeBuilder.reflectionHashCode(this, Constants.HASH_CODE_EQUALS_EXCLUDE); |
92 | |
} |
93 | |
|
94 | |
@Override |
95 | |
public boolean equals(Object object) { |
96 | 0 | return EqualsBuilder.reflectionEquals(object, this, Constants.HASH_CODE_EQUALS_EXCLUDE); |
97 | |
} |
98 | |
|
99 | |
@Override |
100 | |
public String toString() { |
101 | 0 | return ToStringBuilder.reflectionToString(this); |
102 | |
} |
103 | |
|
104 | |
|
105 | |
|
106 | |
|
107 | |
|
108 | |
|
109 | 0 | public final static class Builder |
110 | |
implements Serializable, ModelBuilder, RouteNodeConfigurationParameterContract { |
111 | |
|
112 | |
private static final long serialVersionUID = -7040162478345153231L; |
113 | |
|
114 | |
private String id; |
115 | |
private String routeNodeId; |
116 | |
private String key; |
117 | |
private String value; |
118 | |
|
119 | 0 | private Builder(String key) { |
120 | 0 | setKey(key); |
121 | 0 | } |
122 | |
|
123 | |
public static Builder create(String key) { |
124 | 0 | return new Builder(key); |
125 | |
} |
126 | |
|
127 | |
public static Builder create(RouteNodeConfigurationParameterContract contract) { |
128 | 0 | if (contract == null) { |
129 | 0 | throw new IllegalArgumentException("contract was null"); |
130 | |
} |
131 | 0 | Builder builder = create(contract.getKey()); |
132 | 0 | builder.setId(contract.getId()); |
133 | 0 | builder.setRouteNodeId(contract.getRouteNodeId()); |
134 | 0 | builder.setValue(contract.getValue()); |
135 | 0 | return builder; |
136 | |
} |
137 | |
|
138 | |
public RouteNodeConfigurationParameter build() { |
139 | 0 | return new RouteNodeConfigurationParameter(this); |
140 | |
} |
141 | |
|
142 | |
@Override |
143 | |
public String getId() { |
144 | 0 | return this.id; |
145 | |
} |
146 | |
|
147 | |
@Override |
148 | |
public String getRouteNodeId() { |
149 | 0 | return this.routeNodeId; |
150 | |
} |
151 | |
|
152 | |
@Override |
153 | |
public String getKey() { |
154 | 0 | return this.key; |
155 | |
} |
156 | |
|
157 | |
@Override |
158 | |
public String getValue() { |
159 | 0 | return this.value; |
160 | |
} |
161 | |
|
162 | |
public void setId(String id) { |
163 | 0 | this.id = id; |
164 | 0 | } |
165 | |
|
166 | |
public void setRouteNodeId(String routeNodeId) { |
167 | 0 | this.routeNodeId = routeNodeId; |
168 | 0 | } |
169 | |
|
170 | |
public void setKey(String key) { |
171 | 0 | if (StringUtils.isBlank(key)) { |
172 | 0 | throw new IllegalArgumentException("key was null or blank"); |
173 | |
} |
174 | 0 | this.key = key; |
175 | 0 | } |
176 | |
|
177 | |
public void setValue(String value) { |
178 | 0 | this.value = value; |
179 | 0 | } |
180 | |
|
181 | |
} |
182 | |
|
183 | |
|
184 | |
|
185 | |
|
186 | 0 | static class Constants { |
187 | |
final static String ROOT_ELEMENT_NAME = "routeNodeConfigurationParameter"; |
188 | |
final static String TYPE_NAME = "RouteNodeConfigurationParameterType"; |
189 | 0 | final static String[] HASH_CODE_EQUALS_EXCLUDE = new String[]{CoreConstants.CommonElements.FUTURE_ELEMENTS}; |
190 | |
} |
191 | |
|
192 | |
|
193 | |
|
194 | |
|
195 | |
|
196 | 0 | static class Elements { |
197 | |
final static String ID = "id"; |
198 | |
final static String ROUTE_NODE_ID = "routeNodeId"; |
199 | |
final static String KEY = "key"; |
200 | |
final static String VALUE = "value"; |
201 | |
} |
202 | |
|
203 | |
} |