1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.rice.kew.docsearch; |
18 | |
|
19 | |
import org.apache.commons.collections.CollectionUtils; |
20 | |
import org.apache.commons.lang.StringUtils; |
21 | |
import org.kuali.rice.kew.util.KEWConstants; |
22 | |
|
23 | |
import java.io.Serializable; |
24 | |
import java.util.List; |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
public class SearchAttributeCriteriaComponent implements Serializable { |
32 | 0 | private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(SearchAttributeCriteriaComponent.class); |
33 | |
|
34 | |
private static final long serialVersionUID = -5927435567057306529L; |
35 | |
|
36 | |
private String formKey; |
37 | |
private String value; |
38 | |
private List<String> values; |
39 | |
private String lookupableFieldType; |
40 | 0 | private boolean caseSensitive = false; |
41 | 0 | private boolean searchInclusive = true; |
42 | |
private SearchableAttributeValue searchableAttributeValue; |
43 | 0 | private boolean searchable = true; |
44 | 0 | private boolean canHoldMultipleValues = false; |
45 | |
|
46 | |
|
47 | 0 | private boolean rangeSearch = false; |
48 | 0 | private boolean allowInlineRange = false; |
49 | |
|
50 | |
private String savedKey; |
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
public SearchAttributeCriteriaComponent(String formKey, String value, boolean rangeSearch) { |
58 | 0 | super(); |
59 | 0 | this.formKey = formKey; |
60 | 0 | this.value = value; |
61 | 0 | this.rangeSearch = rangeSearch; |
62 | 0 | if (!rangeSearch) { |
63 | 0 | this.savedKey = formKey; |
64 | |
} |
65 | 0 | } |
66 | |
|
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
|
72 | |
public SearchAttributeCriteriaComponent(String formKey, String value, String savedKey) { |
73 | 0 | super(); |
74 | 0 | this.formKey = formKey; |
75 | 0 | this.value = value; |
76 | 0 | this.savedKey = savedKey; |
77 | 0 | } |
78 | |
|
79 | |
|
80 | |
|
81 | |
|
82 | |
|
83 | |
|
84 | |
|
85 | |
public SearchAttributeCriteriaComponent(String formKey, String value, String savedKey, SearchableAttributeValue searchableAttributeValue) { |
86 | 0 | super(); |
87 | 0 | this.formKey = formKey; |
88 | 0 | this.value = value; |
89 | 0 | this.savedKey = savedKey; |
90 | 0 | this.searchableAttributeValue = searchableAttributeValue; |
91 | 0 | } |
92 | |
|
93 | |
public boolean isComponentLowerBoundValue() { |
94 | 0 | return isComponentGivenBoundValue(KEWConstants.SearchableAttributeConstants.RANGE_LOWER_BOUND_PROPERTY_PREFIX); |
95 | |
} |
96 | |
|
97 | |
public boolean isComponentUpperBoundValue() { |
98 | 0 | return isComponentGivenBoundValue(KEWConstants.SearchableAttributeConstants.RANGE_UPPER_BOUND_PROPERTY_PREFIX); |
99 | |
} |
100 | |
|
101 | |
private boolean isComponentGivenBoundValue(String boundKeyPrefix) { |
102 | 0 | if (!isRangeSearch()) { |
103 | 0 | String errorMsg = "Criteria Component with formKey value '" + formKey + "' is not part of a range search"; |
104 | 0 | LOG.error("isComponentGivenBoundValue() " + errorMsg); |
105 | 0 | throw new RuntimeException(errorMsg); |
106 | |
} |
107 | 0 | return formKey.indexOf(boundKeyPrefix) == 0; |
108 | |
} |
109 | |
|
110 | |
public boolean isNonBlankValueGiven() { |
111 | 0 | return ( (StringUtils.isNotBlank(getValue())) || (!CollectionUtils.isEmpty(getValues())) ); |
112 | |
} |
113 | |
|
114 | |
|
115 | |
|
116 | |
|
117 | |
public boolean isCanHoldMultipleValues() { |
118 | 0 | return canHoldMultipleValues; |
119 | |
} |
120 | |
|
121 | |
|
122 | |
|
123 | |
|
124 | |
public void setCanHoldMultipleValues(boolean canHoldMultipleValues) { |
125 | 0 | this.canHoldMultipleValues = canHoldMultipleValues; |
126 | 0 | } |
127 | |
|
128 | |
|
129 | |
|
130 | |
|
131 | |
public boolean isSearchable() { |
132 | 0 | return searchable; |
133 | |
} |
134 | |
|
135 | |
|
136 | |
|
137 | |
|
138 | |
public void setSearchable(boolean searchable) { |
139 | 0 | this.searchable = searchable; |
140 | 0 | } |
141 | |
|
142 | |
|
143 | |
|
144 | |
|
145 | |
public boolean isCaseSensitive() { |
146 | 0 | return caseSensitive; |
147 | |
} |
148 | |
|
149 | |
|
150 | |
|
151 | |
|
152 | |
public void setCaseSensitive(boolean caseSensitive) { |
153 | 0 | this.caseSensitive = caseSensitive; |
154 | 0 | } |
155 | |
|
156 | |
|
157 | |
|
158 | |
|
159 | |
public String getFormKey() { |
160 | 0 | return formKey; |
161 | |
} |
162 | |
|
163 | |
|
164 | |
|
165 | |
|
166 | |
public void setFormKey(String formKey) { |
167 | 0 | this.formKey = formKey; |
168 | 0 | } |
169 | |
|
170 | |
|
171 | |
|
172 | |
|
173 | |
public boolean isRangeSearch() { |
174 | 0 | return rangeSearch; |
175 | |
} |
176 | |
|
177 | |
|
178 | |
|
179 | |
|
180 | |
public void setRangeSearch(boolean rangeSearch) { |
181 | 0 | this.rangeSearch = rangeSearch; |
182 | 0 | } |
183 | |
|
184 | |
|
185 | |
|
186 | |
|
187 | |
public String getSavedKey() { |
188 | 0 | return savedKey; |
189 | |
} |
190 | |
|
191 | |
|
192 | |
|
193 | |
|
194 | |
public void setSavedKey(String savedKey) { |
195 | 0 | this.savedKey = savedKey; |
196 | 0 | } |
197 | |
|
198 | |
|
199 | |
|
200 | |
|
201 | |
public SearchableAttributeValue getSearchableAttributeValue() { |
202 | 0 | return searchableAttributeValue; |
203 | |
} |
204 | |
|
205 | |
|
206 | |
|
207 | |
|
208 | |
public void setSearchableAttributeValue( |
209 | |
SearchableAttributeValue searchableAttributeValue) { |
210 | 0 | this.searchableAttributeValue = searchableAttributeValue; |
211 | 0 | } |
212 | |
|
213 | |
|
214 | |
|
215 | |
|
216 | |
public boolean isSearchInclusive() { |
217 | 0 | return searchInclusive; |
218 | |
} |
219 | |
|
220 | |
|
221 | |
|
222 | |
|
223 | |
public void setSearchInclusive(boolean searchInclusive) { |
224 | 0 | this.searchInclusive = searchInclusive; |
225 | 0 | } |
226 | |
|
227 | |
|
228 | |
|
229 | |
|
230 | |
public String getValue() { |
231 | 0 | return value; |
232 | |
} |
233 | |
|
234 | |
|
235 | |
|
236 | |
|
237 | |
public void setValue(String value) { |
238 | 0 | this.value = value; |
239 | 0 | } |
240 | |
|
241 | |
|
242 | |
|
243 | |
|
244 | |
public List<String> getValues() { |
245 | 0 | return values; |
246 | |
} |
247 | |
|
248 | |
|
249 | |
|
250 | |
|
251 | |
public void setValues(List<String> values) { |
252 | 0 | this.values = values; |
253 | 0 | } |
254 | |
|
255 | |
|
256 | |
|
257 | |
|
258 | |
public String getLookupableFieldType() { |
259 | 0 | return lookupableFieldType; |
260 | |
} |
261 | |
|
262 | |
|
263 | |
|
264 | |
|
265 | |
public void setLookupableFieldType(String lookupableFieldType) { |
266 | 0 | this.lookupableFieldType = lookupableFieldType; |
267 | 0 | } |
268 | |
|
269 | |
|
270 | |
|
271 | |
|
272 | |
public boolean isAllowInlineRange() { |
273 | 0 | return this.allowInlineRange; |
274 | |
} |
275 | |
|
276 | |
|
277 | |
|
278 | |
|
279 | |
public void setAllowInlineRange(boolean allowInlineRange) { |
280 | 0 | this.allowInlineRange = allowInlineRange; |
281 | 0 | } |
282 | |
|
283 | |
} |