1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kew.docsearch; |
17 | |
|
18 | |
|
19 | |
import org.kuali.rice.kns.web.ui.Field; |
20 | |
import org.kuali.rice.kns.web.ui.Row; |
21 | |
|
22 | |
import java.util.*; |
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
public class StandardDocumentSearchCriteriaProcessor implements DocumentSearchCriteriaProcessor { |
32 | 0 | private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(StandardDocumentSearchCriteriaProcessor.class); |
33 | |
|
34 | |
private String searchingUser; |
35 | 0 | private DocSearchCriteriaDTO docSearchCriteriaDTO = new DocSearchCriteriaDTO(); |
36 | |
|
37 | 0 | public StandardDocumentSearchCriteriaProcessor() {} |
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
public String getSearchingUser() { |
43 | 0 | return this.searchingUser; |
44 | |
} |
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | |
public void setSearchingUser(String principalId) { |
50 | 0 | this.searchingUser = searchingUser; |
51 | 0 | } |
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
public DocSearchCriteriaDTO getDocSearchCriteriaDTO() { |
57 | 0 | return this.docSearchCriteriaDTO; |
58 | |
} |
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
public void setDocSearchCriteriaDTO(DocSearchCriteriaDTO docSearchCriteriaDTO) { |
64 | 0 | this.docSearchCriteriaDTO = docSearchCriteriaDTO; |
65 | 0 | } |
66 | |
|
67 | |
private Set<String> generateHiddenFieldKeySet(List<String> hiddenFieldKeys) { |
68 | 0 | hiddenFieldKeys.addAll(getGlobalHiddenFieldKeys()); |
69 | 0 | return new HashSet<String>(hiddenFieldKeys); |
70 | |
} |
71 | |
|
72 | |
|
73 | |
|
74 | |
|
75 | |
|
76 | |
|
77 | |
public List<String> getGlobalHiddenFieldKeys() { |
78 | 0 | List<String> hiddenFieldKeys = new ArrayList<String>(); |
79 | 0 | hiddenFieldKeys.add(CRITERIA_KEY_WORKGROUP_VIEWER_ID); |
80 | 0 | return hiddenFieldKeys; |
81 | |
} |
82 | |
|
83 | |
|
84 | |
|
85 | |
|
86 | |
|
87 | |
|
88 | |
|
89 | |
public boolean isHeaderBarDisplayed() { |
90 | 0 | return true; |
91 | |
} |
92 | |
|
93 | |
|
94 | |
|
95 | |
|
96 | |
|
97 | |
|
98 | |
|
99 | |
public Map<String,StandardDocSearchCriteriaFieldContainer> getStandardCriteriaFieldContainerMap() { |
100 | 0 | Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey = new HashMap<String,StandardDocSearchCriteriaFieldContainer>(); |
101 | 0 | putContainerIntoMap(containersByKey, new StandardDocSearchCriteriaFieldContainer("docSearch.DocumentSearch.criteria.label.searchName", new StandardSearchCriteriaField(DocumentSearchCriteriaProcessor.CRITERIA_KEY_NAMED_SEARCH,"criteria.namedSearch",StandardSearchCriteriaField.TEXT,null,null,"DocSearchNamedSearch",false,null,null,false))); |
102 | 0 | putContainerIntoMap(containersByKey, new StandardDocSearchCriteriaFieldContainer("docSearch.DocumentSearch.criteria.label.documentType", new StandardSearchCriteriaField(DocumentSearchCriteriaProcessor.CRITERIA_KEY_DOC_TYPE_FULL_NAME,"criteria.docTypeFullName",StandardSearchCriteriaField.TEXT,null,null,"DocSearchDocumentType",false,"docTypeDisplayName",DOC_TYP_LOOKUPABLE,false))); |
103 | 0 | putContainerIntoMap(containersByKey, new StandardDocSearchCriteriaFieldContainer("docSearch.DocumentSearch.criteria.label.initiatorId", new StandardSearchCriteriaField(DocumentSearchCriteriaProcessor.CRITERIA_KEY_INITIATOR,"criteria.initiator",StandardSearchCriteriaField.TEXT,null,null,"DocSearchInitiator",false,null,PERSON_LOOKUPABLE,true))); |
104 | 0 | putContainerIntoMap(containersByKey, new StandardDocSearchCriteriaFieldContainer("docSearch.DocumentSearch.criteria.label.documentId", new StandardSearchCriteriaField(DocumentSearchCriteriaProcessor.CRITERIA_KEY_DOCUMENT_ID,"criteria.documentId",StandardSearchCriteriaField.TEXT,null,null,"DocSearchDocumentId",false,null,null,false))); |
105 | 0 | putContainerIntoMap(containersByKey, new StandardDocSearchCriteriaFieldContainer("docSearch.DocumentSearch.criteria.label.viewerId", new StandardSearchCriteriaField(DocumentSearchCriteriaProcessor.CRITERIA_KEY_VIEWER_ID,"criteria.viewer",StandardSearchCriteriaField.TEXT,null,null,"DocSearchViewer",false,null,PERSON_LOOKUPABLE,true))); |
106 | 0 | putContainerIntoMap(containersByKey, new StandardDocSearchCriteriaFieldContainer("docSearch.DocumentSearch.criteria.label.approverId", new StandardSearchCriteriaField(DocumentSearchCriteriaProcessor.CRITERIA_KEY_APPROVER_ID,"criteria.approver",StandardSearchCriteriaField.TEXT,null,null,"DocSearchApprover",false,null,PERSON_LOOKUPABLE,true))); |
107 | 0 | putContainerIntoMap(containersByKey, new StandardDocSearchCriteriaFieldContainer("docSearch.DocumentSearch.criteria.label.workgroupViewer", new StandardSearchCriteriaField(DocumentSearchCriteriaProcessor.CRITERIA_KEY_WORKGROUP_VIEWER,"criteria.workgroupViewerName",StandardSearchCriteriaField.TEXT,null,null,"WorkgroupName",false,null,WORKGROUP_LOOKUPABLE,false))); |
108 | 0 | putContainerIntoMap(containersByKey, new StandardDocSearchCriteriaFieldContainer("docSearch.DocumentSearch.criteria.label.workgroupViewerId", new StandardSearchCriteriaField(DocumentSearchCriteriaProcessor.CRITERIA_KEY_WORKGROUP_VIEWER_ID,"criteria.workgroupViewerId",StandardSearchCriteriaField.TEXT,null,null,"WorkgroupID",true,null,null,false))); |
109 | 0 | putContainerIntoMap(containersByKey, new StandardDocSearchCriteriaFieldContainer("docSearch.DocumentSearch.criteria.label.applicationDocumentId", new StandardSearchCriteriaField(DocumentSearchCriteriaProcessor.CRITERIA_KEY_APPLICATION_DOCUMENT_ID,"criteria.appDocId",StandardSearchCriteriaField.TEXT,null,null,"DocSearchApplicationDocId",false,null,null,false))); |
110 | 0 | putContainerIntoMap(containersByKey, new StandardDocSearchCriteriaFieldContainer("docSearch.DocumentSearch.criteria.label.documentTitle", new StandardSearchCriteriaField(DocumentSearchCriteriaProcessor.CRITERIA_KEY_DOCUMENT_TITLE,"criteria.docTitle",StandardSearchCriteriaField.TEXT,null,null,"DocSearchDocumentTitle",false,null,null,false))); |
111 | |
|
112 | 0 | putContainerIntoMap(containersByKey, buildStandardDateRangeFieldContainer(DocumentSearchCriteriaProcessor.CRITERIA_KEY_CREATE_DATE, "docSearch.DocumentSearch.criteria.label.dateCreated", "DocSearchDateCreated", "fromDateCreated", "toDateCreated", "fromDateCreated", "toDateCreated")); |
113 | |
|
114 | 0 | putContainerIntoMap(containersByKey, buildStandardDateRangeFieldContainer(DocumentSearchCriteriaProcessor.CRITERIA_KEY_LAST_MODIFIED_DATE, "docSearch.DocumentSearch.criteria.label.dateLastModified", "DocSearchDateLastModified", "fromDateLastModified", "toDateLastModified", "advancedFromDateLastModified", "advancedToDateLastModified")); |
115 | |
|
116 | 0 | putContainerIntoMap(containersByKey, buildStandardDateRangeFieldContainer(DocumentSearchCriteriaProcessor.CRITERIA_KEY_FINALIZED_DATE, "docSearch.DocumentSearch.criteria.label.dateFinalized", "DocSearchDateFinalized", "fromDateFinalized", "toDateFinalized", "advancedFromDateFinalized", "advancedToDateFinalized")); |
117 | |
|
118 | 0 | putContainerIntoMap(containersByKey, buildStandardDateRangeFieldContainer(DocumentSearchCriteriaProcessor.CRITERIA_KEY_APPROVED_DATE, "docSearch.DocumentSearch.criteria.label.dateApproved", "DocSearchDateApproved", "fromDateApproved", "toDateApproved", "advancedFromDateApproved", "advancedToDateApproved")); |
119 | |
|
120 | |
|
121 | 0 | StandardSearchCriteriaField dropDown = new StandardSearchCriteriaField(DocumentSearchCriteriaProcessor.CRITERIA_KEY_DOCUMENT_ROUTE_STATUS,"criteria.docRouteStatus",StandardSearchCriteriaField.DROPDOWN,null,null,"DocSearchDocumentRouteStatus",false,null,null,false); |
122 | 0 | dropDown.setOptionsCollectionProperty("documentRouteStatus"); |
123 | 0 | dropDown.setCollectionKeyProperty("key"); |
124 | 0 | dropDown.setCollectionLabelProperty("value"); |
125 | 0 | putContainerIntoMap(containersByKey, new StandardDocSearchCriteriaFieldContainer("docSearch.DocumentSearch.criteria.label.documentRouteStatus", dropDown)); |
126 | |
|
127 | |
|
128 | 0 | StandardDocSearchCriteriaFieldContainer container = new StandardDocSearchCriteriaFieldContainer(); |
129 | 0 | container.setLabelMessageKey("docSearch.DocumentSearch.criteria.label.documentRouteNode"); |
130 | 0 | container.setFieldKey(DocumentSearchCriteriaProcessor.CRITERIA_KEY_DOCUMENT_ROUTE_NODE); |
131 | 0 | dropDown = new StandardSearchCriteriaField(DocumentSearchCriteriaProcessor.CRITERIA_KEY_DOCUMENT_ROUTE_NODE + "_VALUES","criteria.docRouteNodeId",StandardSearchCriteriaField.DROPDOWN_HIDE_EMPTY,null,null,"DocSearchDocumentRouteLevel",false,null,null,false); |
132 | 0 | dropDown.setOptionsCollectionProperty("routeNodes"); |
133 | 0 | dropDown.setCollectionKeyProperty("routeNodeName"); |
134 | 0 | dropDown.setCollectionLabelProperty("routeNodeName"); |
135 | 0 | dropDown.setEmptyCollectionMessage("Select a document type."); |
136 | 0 | container.addField(dropDown); |
137 | 0 | dropDown = new StandardSearchCriteriaField(DocumentSearchCriteriaProcessor.CRITERIA_KEY_DOCUMENT_ROUTE_NODE + "_LOGIC","criteria.docRouteNodeLogic",StandardSearchCriteriaField.DROPDOWN_HIDE_EMPTY,null,null,null,false,null,null,false); |
138 | 0 | dropDown.setOptionsCollectionProperty("qualifierLogic"); |
139 | 0 | dropDown.setCollectionKeyProperty("key"); |
140 | 0 | dropDown.setCollectionLabelProperty("value"); |
141 | 0 | container.addField(dropDown); |
142 | 0 | putContainerIntoMap(containersByKey, container); |
143 | |
|
144 | 0 | return containersByKey; |
145 | |
} |
146 | |
|
147 | |
|
148 | |
|
149 | |
|
150 | |
public StandardDocSearchCriteriaFieldContainer buildStandardDateRangeFieldContainer(String criteriaKey, String labelKey, String helpMessageArgument, String lowerBoundPropertyName, String upperBoundPropertyName, String lowerBoundDatePickerKey, String upperBoundDatePickerKey) { |
151 | 0 | List<StandardSearchCriteriaField> dateFields = new ArrayList<StandardSearchCriteriaField>(); |
152 | 0 | dateFields.add(new StandardSearchCriteriaField(criteriaKey + DocumentSearchCriteriaProcessor.CRITERIA_KEYS_SUFFIX_RANGE_LOWER_BOUND,lowerBoundPropertyName,StandardSearchCriteriaField.TEXT,lowerBoundDatePickerKey,"docSearch.DocumentSearch.criteria.label.from",helpMessageArgument,false,null,null,false)); |
153 | 0 | dateFields.add(new StandardSearchCriteriaField(criteriaKey + DocumentSearchCriteriaProcessor.CRITERIA_KEYS_SUFFIX_RANGE_UPPER_BOUND,upperBoundPropertyName,StandardSearchCriteriaField.TEXT,upperBoundDatePickerKey,"docSearch.DocumentSearch.criteria.label.to",null,false,null,null,false)); |
154 | 0 | return new StandardDocSearchCriteriaFieldContainer(criteriaKey, labelKey, dateFields); |
155 | |
} |
156 | |
|
157 | |
|
158 | |
|
159 | |
|
160 | |
public void putContainerIntoMap(Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey, StandardDocSearchCriteriaFieldContainer container) { |
161 | 0 | containersByKey.put(container.getFieldKey(), container); |
162 | 0 | } |
163 | |
|
164 | |
private List<Row> processSearchableAttributeRows(List<Row> searchableAttributeRows, List<String> hiddenFieldKeys) { |
165 | 0 | Set<String> hiddenKeys = generateHiddenFieldKeySet(hiddenFieldKeys); |
166 | 0 | if (hiddenKeys.isEmpty()) { |
167 | 0 | return searchableAttributeRows; |
168 | |
} |
169 | 0 | for (Row searchableAttributeRow : searchableAttributeRows) |
170 | |
{ |
171 | 0 | for (Field field : searchableAttributeRow.getFields()) |
172 | |
{ |
173 | |
|
174 | 0 | final boolean hidden = (!hiddenKeys.isEmpty()) && ((hiddenKeys.contains(field.getPropertyName())) || (hiddenKeys.contains(field.getPropertyName()))); |
175 | 0 | if (hidden) { |
176 | 0 | field.setFieldType(Field.HIDDEN); |
177 | |
} |
178 | 0 | } |
179 | |
} |
180 | 0 | return searchableAttributeRows; |
181 | |
} |
182 | |
|
183 | |
|
184 | |
|
185 | |
|
186 | |
|
187 | |
|
188 | |
public List<Row> processSearchableAttributeRowsForBasicSearch(List<Row> searchableAttributeRows) { |
189 | 0 | return processSearchableAttributeRows(searchableAttributeRows, getBasicSearchHiddenFieldKeys()); |
190 | |
} |
191 | |
|
192 | |
public StandardDocSearchCriteriaManager getBasicSearchManager() { |
193 | 0 | return buildBasicSearchManager(); |
194 | |
} |
195 | |
|
196 | |
public List<String> getBasicSearchHiddenFieldKeys() { |
197 | 0 | return new ArrayList<String>(); |
198 | |
} |
199 | |
|
200 | |
|
201 | |
|
202 | |
|
203 | |
|
204 | |
|
205 | |
|
206 | |
public Boolean isBasicSearchCriteriaDisplayed() { |
207 | 0 | return Boolean.TRUE; |
208 | |
} |
209 | |
|
210 | |
|
211 | |
|
212 | |
|
213 | |
|
214 | |
|
215 | |
public static int getBasicSearchPreSearchAttributesColumnSize() { |
216 | 0 | return 1; |
217 | |
} |
218 | |
|
219 | |
|
220 | |
|
221 | |
|
222 | |
|
223 | |
|
224 | |
public static int getBasicSearchPostSearchAttributesColumnSize() { |
225 | 0 | return 1; |
226 | |
} |
227 | |
|
228 | |
public StandardDocSearchCriteriaManager buildBasicSearchManager() { |
229 | 0 | StandardDocSearchCriteriaManager manager = new StandardDocSearchCriteriaManager(getBasicSearchPreSearchAttributesColumnSize(),getBasicSearchPostSearchAttributesColumnSize(),isBasicSearchCriteriaDisplayed(),isHeaderBarDisplayed()); |
230 | 0 | Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey = getStandardCriteriaFieldContainerMap(); |
231 | 0 | manager.setColumnsPreSearchAttributes(getBasicSearchPreSearchAttributeColumns(containersByKey)); |
232 | 0 | manager.setColumnsPostSearchAttributes(getBasicSearchPostSearchAttributeColumns(containersByKey)); |
233 | 0 | return manager; |
234 | |
} |
235 | |
|
236 | |
public List<List<StandardDocSearchCriteriaFieldContainer>> getBasicSearchPreSearchAttributeColumns(Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey) { |
237 | 0 | List<List<StandardDocSearchCriteriaFieldContainer>> columnHolder = new ArrayList<List<StandardDocSearchCriteriaFieldContainer>>(); |
238 | 0 | for (int i = 1; i <= getBasicSearchPreSearchAttributesColumnSize(); i++) { |
239 | 0 | columnHolder.add(getBasicSearchPreSearchAttributeContainerList(i, containersByKey)); |
240 | |
} |
241 | 0 | return columnHolder; |
242 | |
} |
243 | |
|
244 | |
public List<List<StandardDocSearchCriteriaFieldContainer>> getBasicSearchPostSearchAttributeColumns(Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey) { |
245 | 0 | List<List<StandardDocSearchCriteriaFieldContainer>> columnHolder = new ArrayList<List<StandardDocSearchCriteriaFieldContainer>>(); |
246 | 0 | for (int i = 1; i <= getBasicSearchPostSearchAttributesColumnSize(); i++) { |
247 | 0 | columnHolder.add(getBasicSearchPostSearchAttributeContainerList(i, containersByKey)); |
248 | |
} |
249 | 0 | return columnHolder; |
250 | |
} |
251 | |
|
252 | |
public List<StandardDocSearchCriteriaFieldContainer> getBasicSearchPreSearchAttributeContainerList(int columnNumber, Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey) { |
253 | 0 | return getBasicSearchContainerList(containersByKey, generateHiddenFieldKeySet(getBasicSearchHiddenFieldKeys()), getBasicSearchPreSearchAttributeFieldKeys(columnNumber)); |
254 | |
} |
255 | |
|
256 | |
public List<StandardDocSearchCriteriaFieldContainer> getBasicSearchPostSearchAttributeContainerList(int columnNumber, Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey) { |
257 | 0 | return getBasicSearchContainerList(containersByKey, generateHiddenFieldKeySet(getBasicSearchHiddenFieldKeys()), getBasicSearchPostSearchAttributeFieldKeys(columnNumber)); |
258 | |
} |
259 | |
|
260 | |
public List<StandardDocSearchCriteriaFieldContainer> getBasicSearchContainerList(Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey, Set<String> hiddenKeys, List<String> fieldKeys) { |
261 | 0 | List<StandardDocSearchCriteriaFieldContainer> containers = new ArrayList<StandardDocSearchCriteriaFieldContainer>(); |
262 | 0 | boolean setWidth = false; |
263 | 0 | for (String fieldKey : fieldKeys) |
264 | |
{ |
265 | 0 | StandardDocSearchCriteriaFieldContainer container = new StandardDocSearchCriteriaFieldContainer(containersByKey.get(fieldKey)); |
266 | 0 | container.hideFieldsIfNecessary(hiddenKeys); |
267 | 0 | if ((!setWidth) && (!container.isHidden())) |
268 | |
{ |
269 | 0 | container.setLabelFieldWidthValue("22%"); |
270 | 0 | container.setDataFieldWidthValue("78%"); |
271 | 0 | setWidth = true; |
272 | |
} |
273 | 0 | containers.add(container); |
274 | 0 | } |
275 | 0 | return containers; |
276 | |
} |
277 | |
|
278 | |
public List<String> getBasicSearchPreSearchAttributeFieldKeys(int columnNumber) { |
279 | 0 | if (columnNumber == 1) { |
280 | 0 | List<String> fieldKeys = new ArrayList<String>(); |
281 | 0 | fieldKeys.add(CRITERIA_KEY_DOC_TYPE_FULL_NAME); |
282 | 0 | fieldKeys.add(CRITERIA_KEY_INITIATOR); |
283 | 0 | fieldKeys.add(CRITERIA_KEY_DOCUMENT_ID); |
284 | 0 | fieldKeys.add(CRITERIA_KEY_CREATE_DATE); |
285 | 0 | return fieldKeys; |
286 | |
} else { |
287 | 0 | throw new RuntimeException("Column number given (" + columnNumber + ") is invalid for standard search"); |
288 | |
} |
289 | |
} |
290 | |
|
291 | |
public List<String> getBasicSearchPostSearchAttributeFieldKeys(int columnNumber) { |
292 | 0 | if (columnNumber == 1) { |
293 | 0 | List<String> fieldKeys = new ArrayList<String>(); |
294 | 0 | fieldKeys.add(CRITERIA_KEY_NAMED_SEARCH); |
295 | 0 | return fieldKeys; |
296 | |
} else { |
297 | 0 | throw new RuntimeException("Column number given (" + columnNumber + ") is invalid for standard search"); |
298 | |
} |
299 | |
} |
300 | |
|
301 | |
|
302 | |
|
303 | |
|
304 | |
|
305 | |
|
306 | |
public List<Row> processSearchableAttributeRowsForAdvancedSearch(List<Row> searchableAttributeRows) { |
307 | 0 | return processSearchableAttributeRows(searchableAttributeRows, getAdvancedSearchHiddenFieldKeys()); |
308 | |
} |
309 | |
|
310 | |
public StandardDocSearchCriteriaManager getAdvancedSearchManager() { |
311 | 0 | return buildAdvancedSearchManager(); |
312 | |
} |
313 | |
|
314 | |
public List<String> getAdvancedSearchHiddenFieldKeys() { |
315 | 0 | return new ArrayList<String>(); |
316 | |
} |
317 | |
|
318 | |
|
319 | |
|
320 | |
|
321 | |
|
322 | |
|
323 | |
|
324 | |
public Boolean isAdvancedSearchCriteriaDisplayed() { |
325 | 0 | return Boolean.TRUE; |
326 | |
} |
327 | |
|
328 | |
|
329 | |
|
330 | |
|
331 | |
|
332 | |
|
333 | |
public static int getAdvancedSearchPreSearchAttributesColumnSize() { |
334 | 0 | return 2; |
335 | |
} |
336 | |
|
337 | |
|
338 | |
|
339 | |
|
340 | |
|
341 | |
|
342 | |
public static int getAdvancedSearchPostSearchAttributesColumnSize() { |
343 | 0 | return 1; |
344 | |
} |
345 | |
|
346 | |
public StandardDocSearchCriteriaManager buildAdvancedSearchManager() { |
347 | 0 | StandardDocSearchCriteriaManager manager = new StandardDocSearchCriteriaManager(getBasicSearchPreSearchAttributesColumnSize(),getBasicSearchPostSearchAttributesColumnSize(),isAdvancedSearchCriteriaDisplayed(),isHeaderBarDisplayed()); |
348 | 0 | Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey = getStandardCriteriaFieldContainerMap(); |
349 | 0 | manager.setColumnsPreSearchAttributes(getAdvancedSearchPreSearchAttributeColumns(containersByKey)); |
350 | 0 | manager.setColumnsPostSearchAttributes(getAdvancedSearchPostSearchAttributeColumns(containersByKey)); |
351 | 0 | return manager; |
352 | |
} |
353 | |
|
354 | |
public List<List<StandardDocSearchCriteriaFieldContainer>> getAdvancedSearchPreSearchAttributeColumns(Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey) { |
355 | 0 | List<List<StandardDocSearchCriteriaFieldContainer>> columnHolder = new ArrayList<List<StandardDocSearchCriteriaFieldContainer>>(); |
356 | 0 | for (int i = 1; i <= getAdvancedSearchPreSearchAttributesColumnSize(); i++) { |
357 | 0 | columnHolder.add(getAdvancedSearchPreSearchAttributeContainerList(i, containersByKey)); |
358 | |
} |
359 | 0 | return columnHolder; |
360 | |
} |
361 | |
|
362 | |
public List<List<StandardDocSearchCriteriaFieldContainer>> getAdvancedSearchPostSearchAttributeColumns(Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey) { |
363 | 0 | List<List<StandardDocSearchCriteriaFieldContainer>> columnHolder = new ArrayList<List<StandardDocSearchCriteriaFieldContainer>>(); |
364 | 0 | for (int i = 1; i <= getAdvancedSearchPostSearchAttributesColumnSize(); i++) { |
365 | 0 | columnHolder.add(getAdvancedSearchPostSearchAttributeContainerList(i, containersByKey)); |
366 | |
} |
367 | 0 | return columnHolder; |
368 | |
} |
369 | |
|
370 | |
public List<StandardDocSearchCriteriaFieldContainer> getAdvancedSearchPreSearchAttributeContainerList(int columnNumber, Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey) { |
371 | 0 | return getAdvancedSearchContainerList(containersByKey, generateHiddenFieldKeySet(getAdvancedSearchHiddenFieldKeys()), getAdvancedSearchPreSearchAttributeFieldKeys(columnNumber)); |
372 | |
} |
373 | |
|
374 | |
public List<StandardDocSearchCriteriaFieldContainer> getAdvancedSearchPostSearchAttributeContainerList(int columnNumber, Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey) { |
375 | 0 | return getAdvancedSearchContainerList(containersByKey, generateHiddenFieldKeySet(getAdvancedSearchHiddenFieldKeys()), getAdvancedSearchPostSearchAttributeFieldKeys(columnNumber)); |
376 | |
} |
377 | |
|
378 | |
public List<StandardDocSearchCriteriaFieldContainer> getAdvancedSearchContainerList(Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey, Set<String> hiddenKeys, List<String> fieldKeys) { |
379 | 0 | List<StandardDocSearchCriteriaFieldContainer> containers = new ArrayList<StandardDocSearchCriteriaFieldContainer>(); |
380 | 0 | for (String fieldKey : fieldKeys) |
381 | |
{ |
382 | 0 | StandardDocSearchCriteriaFieldContainer container = new StandardDocSearchCriteriaFieldContainer(containersByKey.get(fieldKey)); |
383 | 0 | container.hideFieldsIfNecessary(hiddenKeys); |
384 | 0 | containers.add(container); |
385 | 0 | } |
386 | 0 | return containers; |
387 | |
} |
388 | |
|
389 | |
public List<String> getAdvancedSearchPreSearchAttributeFieldKeys(int columnNumber) { |
390 | 0 | if (columnNumber == 1) { |
391 | 0 | List<String> fieldKeys = new ArrayList<String>(); |
392 | 0 | fieldKeys.add(CRITERIA_KEY_INITIATOR); |
393 | 0 | fieldKeys.add(CRITERIA_KEY_APPROVER_ID); |
394 | 0 | fieldKeys.add(CRITERIA_KEY_DOCUMENT_ID); |
395 | 0 | fieldKeys.add(CRITERIA_KEY_APPLICATION_DOCUMENT_ID); |
396 | 0 | fieldKeys.add(CRITERIA_KEY_LAST_MODIFIED_DATE); |
397 | 0 | fieldKeys.add(CRITERIA_KEY_FINALIZED_DATE); |
398 | 0 | fieldKeys.add(CRITERIA_KEY_DOC_TYPE_FULL_NAME); |
399 | 0 | return fieldKeys; |
400 | 0 | } else if (columnNumber == 2) { |
401 | 0 | List<String> fieldKeys = new ArrayList<String>(); |
402 | 0 | fieldKeys.add(CRITERIA_KEY_VIEWER_ID); |
403 | 0 | fieldKeys.add(CRITERIA_KEY_WORKGROUP_VIEWER); |
404 | 0 | fieldKeys.add(CRITERIA_KEY_WORKGROUP_VIEWER_ID); |
405 | 0 | fieldKeys.add(CRITERIA_KEY_DOCUMENT_ROUTE_STATUS); |
406 | 0 | fieldKeys.add(CRITERIA_KEY_DOCUMENT_ROUTE_NODE); |
407 | 0 | fieldKeys.add(CRITERIA_KEY_CREATE_DATE); |
408 | 0 | fieldKeys.add(CRITERIA_KEY_APPROVED_DATE); |
409 | 0 | fieldKeys.add(CRITERIA_KEY_DOCUMENT_TITLE); |
410 | 0 | return fieldKeys; |
411 | |
} else { |
412 | 0 | throw new RuntimeException("Column number given (" + columnNumber + ") is invalid for standard search"); |
413 | |
} |
414 | |
} |
415 | |
|
416 | |
public List<String> getAdvancedSearchPostSearchAttributeFieldKeys(int columnNumber) { |
417 | 0 | if (columnNumber == 1) { |
418 | 0 | List<String> fieldKeys = new ArrayList<String>(); |
419 | 0 | fieldKeys.add(CRITERIA_KEY_NAMED_SEARCH); |
420 | 0 | return fieldKeys; |
421 | |
} else { |
422 | 0 | throw new RuntimeException("Column number given (" + columnNumber + ") is invalid for standard search"); |
423 | |
} |
424 | |
} |
425 | |
} |