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_INCLUSIVE,
40 RemotableAttributeLookupSettings.Elements.UPPER_BOUND_INCLUSIVE,
41 RemotableAttributeLookupSettings.Elements.CASE_SENSITIVE,
42 RemotableAttributeLookupSettings.Elements.LOWER_LABEL,
43 RemotableAttributeLookupSettings.Elements.UPPER_LABEL,
44 RemotableAttributeLookupSettings.Elements.LOWER_DATEPICKER,
45 RemotableAttributeLookupSettings.Elements.UPPER_DATEPICKER,
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_INCLUSIVE, required = false)
60 private final boolean lowerBoundInclusive;
61
62 @XmlElement(name = Elements.UPPER_BOUND_INCLUSIVE, required = false)
63 private final boolean upperBoundInclusive;
64
65 @XmlElement(name = Elements.CASE_SENSITIVE, required = false)
66 private final Boolean caseSensitive;
67
68 @XmlElement(name = Elements.UPPER_LABEL, required = false)
69 private final String upperLabel;
70
71 @XmlElement(name = Elements.LOWER_LABEL, required = false)
72 private final String lowerLabel;
73
74 @XmlElement(name = Elements.UPPER_DATEPICKER, required = false)
75 private final Boolean upperDatePicker;
76
77 @XmlElement(name = Elements.LOWER_DATEPICKER, required = false)
78 private final Boolean lowerDatePicker;
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.lowerBoundInclusive = false;
92 this.upperBoundInclusive = false;
93 this.caseSensitive = null;
94 this.lowerLabel = null;
95 this.upperLabel = null;
96 this.lowerDatePicker = null;
97 this.upperDatePicker = 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.lowerBoundInclusive = builder.isLowerBoundInclusive();
105 this.upperBoundInclusive = builder.isUpperBoundInclusive();
106 this.caseSensitive = builder.isCaseSensitive();
107 this.lowerLabel = builder.getLowerLabel();
108 this.upperLabel = builder.getUpperLabel();
109 this.lowerDatePicker = builder.isLowerDatePicker();
110 this.upperDatePicker= builder.isUpperDatePicker();
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 boolean isLowerBoundInclusive() {
130 return this.lowerBoundInclusive;
131 }
132
133 @Override
134 public boolean isUpperBoundInclusive() {
135 return this.upperBoundInclusive;
136 }
137
138 @Override
139 public Boolean isCaseSensitive() {
140 return caseSensitive;
141 }
142
143 @Override
144 public String getLowerLabel() {
145 return lowerLabel;
146 }
147
148 @Override
149 public String getUpperLabel() {
150 return upperLabel;
151 }
152
153 @Override
154 public Boolean isLowerDatePicker() {
155 return lowerDatePicker;
156 }
157
158 @Override
159 public Boolean isUpperDatePicker() {
160 return upperDatePicker;
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 boolean lowerBoundInclusive;
172 private boolean upperBoundInclusive;
173 private Boolean caseSensitive;
174 private String lowerLabel;
175 private String upperLabel;
176 private Boolean lowerDatePicker;
177 private Boolean upperDatePicker;
178
179 private Builder() {
180 setInCriteria(true);
181 setInResults(true);
182 setRanged(false);
183 setLowerLabel(null);
184 setUpperLabel(null);
185 setLowerDatePicker(null);
186 setUpperDatePicker(null);
187 }
188
189 public static Builder create() {
190 return new Builder();
191 }
192
193 public static Builder create(AttributeLookupSettings contract) {
194 if (contract == null) {
195 throw new IllegalArgumentException("contract was null");
196 }
197 Builder builder = create();
198 builder.setInCriteria(contract.isInCriteria());
199 builder.setInResults(contract.isInResults());
200 builder.setRanged(contract.isRanged());
201 builder.setLowerBoundInclusive(contract.isLowerBoundInclusive());
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 boolean isLowerBoundInclusive() {
228 return this.lowerBoundInclusive;
229 }
230
231 @Override
232 public boolean isUpperBoundInclusive() {
233 return this.upperBoundInclusive;
234 }
235
236 @Override
237 public Boolean isCaseSensitive() {
238 return caseSensitive;
239 }
240
241 @Override
242 public String getLowerLabel() {
243 return lowerLabel;
244 }
245
246 @Override
247 public String getUpperLabel() {
248 return upperLabel;
249 }
250
251 @Override
252 public Boolean isLowerDatePicker() {
253 return lowerDatePicker;
254 }
255
256 @Override
257 public Boolean isUpperDatePicker() {
258 return upperDatePicker;
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 setLowerBoundInclusive(boolean lowerBoundInclusive) {
274 this.lowerBoundInclusive = lowerBoundInclusive;
275 }
276
277 public void setUpperBoundInclusive(boolean upperBoundInclusive) {
278 this.upperBoundInclusive = upperBoundInclusive;
279 }
280
281 public void setCaseSensitive(Boolean caseSensitive) {
282 this.caseSensitive = caseSensitive;
283 }
284
285 public void setLowerLabel(String s) {
286 this.lowerLabel = s;
287 }
288
289 public void setUpperLabel(String s) {
290 this.upperLabel = s;
291 }
292
293 public void setLowerDatePicker(Boolean b) {
294 this.lowerDatePicker = b;
295 }
296
297 public void setUpperDatePicker(Boolean b) {
298 this.upperDatePicker = b;
299 }
300 }
301
302
303
304
305 static class Constants {
306 final static String ROOT_ELEMENT_NAME = "remotableAttributeLookupSettings";
307 final static String TYPE_NAME = "RemotableAttributeLookupSettingsType";
308 }
309
310
311
312
313 static class Elements {
314 final static String IN_CRITERIA = "inCriteria";
315 final static String IN_RESULTS = "inResults";
316 final static String RANGED = "ranged";
317 final static String LOWER_BOUND_INCLUSIVE = "lowerBoundInclusive";
318 final static String UPPER_BOUND_INCLUSIVE = "upperBoundInclusive";
319 final static String CASE_SENSITIVE = "caseSensitive";
320 final static String LOWER_LABEL = "lowerLabel";
321 final static String UPPER_LABEL = "upperLabel";
322 final static String LOWER_DATEPICKER = "lowerDatePicker";
323 final static String UPPER_DATEPICKER = "upperDatePicker";
324 }
325 }