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 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 @SuppressWarnings("unused")
81 @XmlAnyElement
82 private final Collection<Element> _futureElements = null;
83
84
85
86
87 private RemotableAttributeLookupSettings() {
88 this.inCriteria = false;
89 this.inResults = false;
90 this.ranged = false;
91 this.lowerBoundName = null;
92 this.lowerBoundLabel = null;
93 this.lowerBoundInclusive = false;
94 this.upperBoundName = null;
95 this.upperBoundLabel = null;
96 this.upperBoundInclusive = false;
97 this.caseSensitive = null;
98 }
99
100 private RemotableAttributeLookupSettings(Builder builder) {
101 this.inCriteria = builder.isInCriteria();
102 this.inResults = builder.isInResults();
103 this.ranged = builder.isRanged();
104 this.lowerBoundName = builder.getLowerBoundName();
105 this.lowerBoundLabel = builder.getLowerBoundLabel();
106 this.lowerBoundInclusive = builder.isLowerBoundInclusive();
107 this.upperBoundName = builder.getUpperBoundName();
108 this.upperBoundLabel = builder.getUpperBoundLabel();
109 this.upperBoundInclusive = builder.isUpperBoundInclusive();
110 this.caseSensitive = builder.isCaseSensitive();
111 }
112
113 @Override
114 public boolean isInCriteria() {
115 return inCriteria;
116 }
117
118 @Override
119 public boolean isInResults() {
120 return inResults;
121 }
122
123 @Override
124 public boolean isRanged() {
125 return ranged;
126 }
127
128 @Override
129 public String getLowerBoundName() {
130 return this.lowerBoundName;
131 }
132
133 @Override
134 public String getLowerBoundLabel() {
135 return this.lowerBoundLabel;
136 }
137
138 @Override
139 public boolean isLowerBoundInclusive() {
140 return this.lowerBoundInclusive;
141 }
142
143 @Override
144 public String getUpperBoundName() {
145 return this.upperBoundName;
146 }
147
148 @Override
149 public String getUpperBoundLabel() {
150 return this.upperBoundLabel;
151 }
152
153 @Override
154 public boolean isUpperBoundInclusive() {
155 return this.upperBoundInclusive;
156 }
157
158 @Override
159 public Boolean isCaseSensitive() {
160 return caseSensitive;
161 }
162
163
164
165
166 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 private Builder() {
180 setInCriteria(true);
181 setInResults(true);
182 setRanged(false);
183 }
184
185 public static Builder create() {
186 return new Builder();
187 }
188
189 public static Builder create(AttributeLookupSettings contract) {
190 if (contract == null) {
191 throw new IllegalArgumentException("contract was null");
192 }
193 Builder builder = create();
194 builder.setInCriteria(contract.isInCriteria());
195 builder.setInResults(contract.isInResults());
196 builder.setRanged(contract.isRanged());
197 builder.setLowerBoundName(contract.getLowerBoundName());
198 builder.setLowerBoundLabel(contract.getLowerBoundLabel());
199 builder.setLowerBoundInclusive(contract.isLowerBoundInclusive());
200 builder.setUpperBoundName(contract.getUpperBoundName());
201 builder.setUpperBoundLabel(contract.getUpperBoundLabel());
202 builder.setUpperBoundInclusive(contract.isUpperBoundInclusive());
203 builder.setCaseSensitive(contract.isCaseSensitive());
204 return builder;
205 }
206
207 public RemotableAttributeLookupSettings build() {
208 return new RemotableAttributeLookupSettings(this);
209 }
210
211 @Override
212 public boolean isInCriteria() {
213 return inCriteria;
214 }
215
216 @Override
217 public boolean isInResults() {
218 return inResults;
219 }
220
221 @Override
222 public boolean isRanged() {
223 return ranged;
224 }
225
226 @Override
227 public String getLowerBoundName() {
228 return this.lowerBoundName;
229 }
230
231 @Override
232 public String getLowerBoundLabel() {
233 return this.lowerBoundLabel;
234 }
235
236 @Override
237 public boolean isLowerBoundInclusive() {
238 return this.lowerBoundInclusive;
239 }
240
241 @Override
242 public String getUpperBoundName() {
243 return this.upperBoundName;
244 }
245
246 @Override
247 public String getUpperBoundLabel() {
248 return this.upperBoundLabel;
249 }
250
251 @Override
252 public boolean isUpperBoundInclusive() {
253 return this.upperBoundInclusive;
254 }
255
256 @Override
257 public Boolean isCaseSensitive() {
258 return caseSensitive;
259 }
260
261 public void setInCriteria(boolean inCriteria) {
262 this.inCriteria = inCriteria;
263 }
264
265 public void setInResults(boolean inResults) {
266 this.inResults = inResults;
267 }
268
269 public void setRanged(boolean ranged) {
270 this.ranged = ranged;
271 }
272
273 public void setLowerBoundName(String lowerBoundName) {
274 if (StringUtils.isBlank(lowerBoundName)) {
275 throw new IllegalArgumentException("lowerBoundName was null or blank");
276 }
277 this.lowerBoundName = lowerBoundName;
278 }
279
280 public void setLowerBoundLabel(String lowerBoundLabel) {
281 this.lowerBoundLabel = lowerBoundLabel;
282 }
283
284 public void setLowerBoundInclusive(boolean lowerBoundInclusive) {
285 this.lowerBoundInclusive = lowerBoundInclusive;
286 }
287
288 public void setUpperBoundName(String upperBoundName) {
289 if (StringUtils.isBlank(upperBoundName)) {
290 throw new IllegalArgumentException("upperBoundName was null or blank");
291 }
292 this.upperBoundName = upperBoundName;
293 }
294
295 public void setUpperBoundLabel(String upperBoundLabel) {
296 this.upperBoundLabel = upperBoundLabel;
297 }
298
299 public void setUpperBoundInclusive(boolean upperBoundInclusive) {
300 this.upperBoundInclusive = upperBoundInclusive;
301 }
302
303 public void setCaseSensitive(Boolean caseSensitive) {
304 this.caseSensitive = caseSensitive;
305 }
306
307 }
308
309
310
311
312 static class Constants {
313 final static String ROOT_ELEMENT_NAME = "remotableAttributeLookupSettings";
314 final static String TYPE_NAME = "RemotableAttributeLookupSettingsType";
315 }
316
317
318
319
320 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 }