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