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