1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.core.api.uif; |
17 | |
|
18 | |
import java.io.Serializable; |
19 | |
import java.util.Collection; |
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.kuali.rice.core.api.CoreConstants; |
29 | |
import org.kuali.rice.core.api.mo.AbstractDataTransferObject; |
30 | |
import org.kuali.rice.core.api.mo.ModelBuilder; |
31 | |
import org.w3c.dom.Element; |
32 | |
|
33 | |
@XmlRootElement(name = RemotableAttributeLookupSettings.Constants.ROOT_ELEMENT_NAME) |
34 | |
@XmlAccessorType(XmlAccessType.NONE) |
35 | |
@XmlType(name = RemotableAttributeLookupSettings.Constants.TYPE_NAME, propOrder = { |
36 | |
RemotableAttributeLookupSettings.Elements.IN_CRITERIA, |
37 | |
RemotableAttributeLookupSettings.Elements.IN_RESULTS, |
38 | |
RemotableAttributeLookupSettings.Elements.RANGED, |
39 | |
RemotableAttributeLookupSettings.Elements.LOWER_BOUND_NAME, |
40 | |
RemotableAttributeLookupSettings.Elements.LOWER_BOUND_LABEL, |
41 | |
RemotableAttributeLookupSettings.Elements.LOWER_BOUND_INCLUSIVE, |
42 | |
RemotableAttributeLookupSettings.Elements.UPPER_BOUND_NAME, |
43 | |
RemotableAttributeLookupSettings.Elements.UPPER_BOUND_LABEL, |
44 | |
RemotableAttributeLookupSettings.Elements.UPPER_BOUND_INCLUSIVE, |
45 | |
RemotableAttributeLookupSettings.Elements.CASE_SENSITIVE, |
46 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
47 | |
}) |
48 | 0 | public final class RemotableAttributeLookupSettings extends AbstractDataTransferObject implements AttributeLookupSettings { |
49 | |
|
50 | |
@XmlElement(name = Elements.IN_CRITERIA, required = true) |
51 | |
private final boolean inCriteria; |
52 | |
|
53 | |
@XmlElement(name = Elements.IN_RESULTS, required = true) |
54 | |
private final boolean inResults; |
55 | |
|
56 | |
@XmlElement(name = Elements.RANGED, required = true) |
57 | |
private final boolean ranged; |
58 | |
|
59 | |
@XmlElement(name = Elements.LOWER_BOUND_NAME, required = false) |
60 | |
private final String lowerBoundName; |
61 | |
|
62 | |
@XmlElement(name = Elements.LOWER_BOUND_LABEL, required = false) |
63 | |
private final String lowerBoundLabel; |
64 | |
|
65 | |
@XmlElement(name = Elements.LOWER_BOUND_INCLUSIVE, required = false) |
66 | |
private final boolean lowerBoundInclusive; |
67 | |
|
68 | |
@XmlElement(name = Elements.UPPER_BOUND_NAME, required = false) |
69 | |
private final String upperBoundName; |
70 | |
|
71 | |
@XmlElement(name = Elements.UPPER_BOUND_LABEL, required = false) |
72 | |
private final String upperBoundLabel; |
73 | |
|
74 | |
@XmlElement(name = Elements.UPPER_BOUND_INCLUSIVE, required = false) |
75 | |
private final boolean upperBoundInclusive; |
76 | |
|
77 | |
@XmlElement(name = Elements.CASE_SENSITIVE, required = false) |
78 | |
private final Boolean caseSensitive; |
79 | |
|
80 | 0 | @SuppressWarnings("unused") |
81 | |
@XmlAnyElement |
82 | |
private final Collection<Element> _futureElements = null; |
83 | |
|
84 | |
|
85 | |
|
86 | |
|
87 | 0 | private RemotableAttributeLookupSettings() { |
88 | 0 | this.inCriteria = false; |
89 | 0 | this.inResults = false; |
90 | 0 | this.ranged = false; |
91 | 0 | this.lowerBoundName = null; |
92 | 0 | this.lowerBoundLabel = null; |
93 | 0 | this.lowerBoundInclusive = false; |
94 | 0 | this.upperBoundName = null; |
95 | 0 | this.upperBoundLabel = null; |
96 | 0 | this.upperBoundInclusive = false; |
97 | 0 | this.caseSensitive = null; |
98 | 0 | } |
99 | |
|
100 | 0 | private RemotableAttributeLookupSettings(Builder builder) { |
101 | 0 | this.inCriteria = builder.isInCriteria(); |
102 | 0 | this.inResults = builder.isInResults(); |
103 | 0 | this.ranged = builder.isRanged(); |
104 | 0 | this.lowerBoundName = builder.getLowerBoundName(); |
105 | 0 | this.lowerBoundLabel = builder.getLowerBoundLabel(); |
106 | 0 | this.lowerBoundInclusive = builder.isLowerBoundInclusive(); |
107 | 0 | this.upperBoundName = builder.getUpperBoundName(); |
108 | 0 | this.upperBoundLabel = builder.getUpperBoundLabel(); |
109 | 0 | this.upperBoundInclusive = builder.isUpperBoundInclusive(); |
110 | 0 | this.caseSensitive = builder.isCaseSensitive(); |
111 | 0 | } |
112 | |
|
113 | |
@Override |
114 | |
public boolean isInCriteria() { |
115 | 0 | return inCriteria; |
116 | |
} |
117 | |
|
118 | |
@Override |
119 | |
public boolean isInResults() { |
120 | 0 | return inResults; |
121 | |
} |
122 | |
|
123 | |
@Override |
124 | |
public boolean isRanged() { |
125 | 0 | return ranged; |
126 | |
} |
127 | |
|
128 | |
@Override |
129 | |
public String getLowerBoundName() { |
130 | 0 | return this.lowerBoundName; |
131 | |
} |
132 | |
|
133 | |
@Override |
134 | |
public String getLowerBoundLabel() { |
135 | 0 | return this.lowerBoundLabel; |
136 | |
} |
137 | |
|
138 | |
@Override |
139 | |
public boolean isLowerBoundInclusive() { |
140 | 0 | return this.lowerBoundInclusive; |
141 | |
} |
142 | |
|
143 | |
@Override |
144 | |
public String getUpperBoundName() { |
145 | 0 | return this.upperBoundName; |
146 | |
} |
147 | |
|
148 | |
@Override |
149 | |
public String getUpperBoundLabel() { |
150 | 0 | return this.upperBoundLabel; |
151 | |
} |
152 | |
|
153 | |
@Override |
154 | |
public boolean isUpperBoundInclusive() { |
155 | 0 | return this.upperBoundInclusive; |
156 | |
} |
157 | |
|
158 | |
@Override |
159 | |
public Boolean isCaseSensitive() { |
160 | 0 | return caseSensitive; |
161 | |
} |
162 | |
|
163 | |
|
164 | |
|
165 | |
|
166 | 0 | public final static class Builder implements Serializable, ModelBuilder, AttributeLookupSettings { |
167 | |
|
168 | |
private boolean inCriteria; |
169 | |
private boolean inResults; |
170 | |
private boolean ranged; |
171 | |
private String lowerBoundName; |
172 | |
private String lowerBoundLabel; |
173 | |
private boolean lowerBoundInclusive; |
174 | |
private String upperBoundName; |
175 | |
private String upperBoundLabel; |
176 | |
private boolean upperBoundInclusive; |
177 | |
private Boolean caseSensitive; |
178 | |
|
179 | 0 | private Builder() { |
180 | 0 | setInCriteria(true); |
181 | 0 | setInResults(true); |
182 | 0 | setRanged(false); |
183 | 0 | } |
184 | |
|
185 | |
public static Builder create() { |
186 | 0 | return new Builder(); |
187 | |
} |
188 | |
|
189 | |
public static Builder create(AttributeLookupSettings contract) { |
190 | 0 | if (contract == null) { |
191 | 0 | throw new IllegalArgumentException("contract was null"); |
192 | |
} |
193 | 0 | Builder builder = create(); |
194 | 0 | builder.setInCriteria(contract.isInCriteria()); |
195 | 0 | builder.setInResults(contract.isInResults()); |
196 | 0 | builder.setRanged(contract.isRanged()); |
197 | 0 | builder.setLowerBoundName(contract.getLowerBoundName()); |
198 | 0 | builder.setLowerBoundLabel(contract.getLowerBoundLabel()); |
199 | 0 | builder.setLowerBoundInclusive(contract.isLowerBoundInclusive()); |
200 | 0 | builder.setUpperBoundName(contract.getUpperBoundName()); |
201 | 0 | builder.setUpperBoundLabel(contract.getUpperBoundLabel()); |
202 | 0 | builder.setUpperBoundInclusive(contract.isUpperBoundInclusive()); |
203 | 0 | builder.setCaseSensitive(contract.isCaseSensitive()); |
204 | 0 | return builder; |
205 | |
} |
206 | |
|
207 | |
public RemotableAttributeLookupSettings build() { |
208 | 0 | return new RemotableAttributeLookupSettings(this); |
209 | |
} |
210 | |
|
211 | |
@Override |
212 | |
public boolean isInCriteria() { |
213 | 0 | return inCriteria; |
214 | |
} |
215 | |
|
216 | |
@Override |
217 | |
public boolean isInResults() { |
218 | 0 | return inResults; |
219 | |
} |
220 | |
|
221 | |
@Override |
222 | |
public boolean isRanged() { |
223 | 0 | return ranged; |
224 | |
} |
225 | |
|
226 | |
@Override |
227 | |
public String getLowerBoundName() { |
228 | 0 | return this.lowerBoundName; |
229 | |
} |
230 | |
|
231 | |
@Override |
232 | |
public String getLowerBoundLabel() { |
233 | 0 | return this.lowerBoundLabel; |
234 | |
} |
235 | |
|
236 | |
@Override |
237 | |
public boolean isLowerBoundInclusive() { |
238 | 0 | return this.lowerBoundInclusive; |
239 | |
} |
240 | |
|
241 | |
@Override |
242 | |
public String getUpperBoundName() { |
243 | 0 | return this.upperBoundName; |
244 | |
} |
245 | |
|
246 | |
@Override |
247 | |
public String getUpperBoundLabel() { |
248 | 0 | return this.upperBoundLabel; |
249 | |
} |
250 | |
|
251 | |
@Override |
252 | |
public boolean isUpperBoundInclusive() { |
253 | 0 | return this.upperBoundInclusive; |
254 | |
} |
255 | |
|
256 | |
@Override |
257 | |
public Boolean isCaseSensitive() { |
258 | 0 | return caseSensitive; |
259 | |
} |
260 | |
|
261 | |
public void setInCriteria(boolean inCriteria) { |
262 | 0 | this.inCriteria = inCriteria; |
263 | 0 | } |
264 | |
|
265 | |
public void setInResults(boolean inResults) { |
266 | 0 | this.inResults = inResults; |
267 | 0 | } |
268 | |
|
269 | |
public void setRanged(boolean ranged) { |
270 | 0 | this.ranged = ranged; |
271 | 0 | } |
272 | |
|
273 | |
public void setLowerBoundName(String lowerBoundName) { |
274 | 0 | if (StringUtils.isBlank(lowerBoundName)) { |
275 | 0 | throw new IllegalArgumentException("lowerBoundName was null or blank"); |
276 | |
} |
277 | 0 | this.lowerBoundName = lowerBoundName; |
278 | 0 | } |
279 | |
|
280 | |
public void setLowerBoundLabel(String lowerBoundLabel) { |
281 | 0 | this.lowerBoundLabel = lowerBoundLabel; |
282 | 0 | } |
283 | |
|
284 | |
public void setLowerBoundInclusive(boolean lowerBoundInclusive) { |
285 | 0 | this.lowerBoundInclusive = lowerBoundInclusive; |
286 | 0 | } |
287 | |
|
288 | |
public void setUpperBoundName(String upperBoundName) { |
289 | 0 | if (StringUtils.isBlank(upperBoundName)) { |
290 | 0 | throw new IllegalArgumentException("upperBoundName was null or blank"); |
291 | |
} |
292 | 0 | this.upperBoundName = upperBoundName; |
293 | 0 | } |
294 | |
|
295 | |
public void setUpperBoundLabel(String upperBoundLabel) { |
296 | 0 | this.upperBoundLabel = upperBoundLabel; |
297 | 0 | } |
298 | |
|
299 | |
public void setUpperBoundInclusive(boolean upperBoundInclusive) { |
300 | 0 | this.upperBoundInclusive = upperBoundInclusive; |
301 | 0 | } |
302 | |
|
303 | |
public void setCaseSensitive(Boolean caseSensitive) { |
304 | 0 | this.caseSensitive = caseSensitive; |
305 | 0 | } |
306 | |
|
307 | |
} |
308 | |
|
309 | |
|
310 | |
|
311 | |
|
312 | 0 | static class Constants { |
313 | |
final static String ROOT_ELEMENT_NAME = "remotableAttributeLookupSettings"; |
314 | |
final static String TYPE_NAME = "RemotableAttributeLookupSettingsType"; |
315 | |
} |
316 | |
|
317 | |
|
318 | |
|
319 | |
|
320 | 0 | static class Elements { |
321 | |
final static String IN_CRITERIA = "inCriteria"; |
322 | |
final static String IN_RESULTS = "inResults"; |
323 | |
final static String RANGED = "ranged"; |
324 | |
final static String LOWER_BOUND_NAME = "lowerBoundName"; |
325 | |
final static String LOWER_BOUND_LABEL = "lowerBoundLabel"; |
326 | |
final static String LOWER_BOUND_INCLUSIVE = "lowerBoundInclusive"; |
327 | |
final static String UPPER_BOUND_NAME = "upperBoundName"; |
328 | |
final static String UPPER_BOUND_LABEL = "upperBoundLabel"; |
329 | |
final static String UPPER_BOUND_INCLUSIVE = "upperBoundInclusive"; |
330 | |
final static String CASE_SENSITIVE = "caseSensitive"; |
331 | |
} |
332 | |
|
333 | |
} |