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.routeHeaderId",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 | field.setHidden((!hiddenKeys.isEmpty()) && ((hiddenKeys.contains(field.getPropertyName())) || (hiddenKeys.contains(field.getPropertyName())))); |
174 | |
} |
175 | |
} |
176 | 0 | return searchableAttributeRows; |
177 | |
} |
178 | |
|
179 | |
|
180 | |
|
181 | |
|
182 | |
|
183 | |
|
184 | |
public List<Row> processSearchableAttributeRowsForBasicSearch(List<Row> searchableAttributeRows) { |
185 | 0 | return processSearchableAttributeRows(searchableAttributeRows, getBasicSearchHiddenFieldKeys()); |
186 | |
} |
187 | |
|
188 | |
public StandardDocSearchCriteriaManager getBasicSearchManager() { |
189 | 0 | return buildBasicSearchManager(); |
190 | |
} |
191 | |
|
192 | |
public List<String> getBasicSearchHiddenFieldKeys() { |
193 | 0 | return new ArrayList<String>(); |
194 | |
} |
195 | |
|
196 | |
|
197 | |
|
198 | |
|
199 | |
|
200 | |
|
201 | |
|
202 | |
public Boolean isBasicSearchCriteriaDisplayed() { |
203 | 0 | return Boolean.TRUE; |
204 | |
} |
205 | |
|
206 | |
|
207 | |
|
208 | |
|
209 | |
|
210 | |
|
211 | |
public static int getBasicSearchPreSearchAttributesColumnSize() { |
212 | 0 | return 1; |
213 | |
} |
214 | |
|
215 | |
|
216 | |
|
217 | |
|
218 | |
|
219 | |
|
220 | |
public static int getBasicSearchPostSearchAttributesColumnSize() { |
221 | 0 | return 1; |
222 | |
} |
223 | |
|
224 | |
public StandardDocSearchCriteriaManager buildBasicSearchManager() { |
225 | 0 | StandardDocSearchCriteriaManager manager = new StandardDocSearchCriteriaManager(getBasicSearchPreSearchAttributesColumnSize(),getBasicSearchPostSearchAttributesColumnSize(),isBasicSearchCriteriaDisplayed(),isHeaderBarDisplayed()); |
226 | 0 | Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey = getStandardCriteriaFieldContainerMap(); |
227 | 0 | manager.setColumnsPreSearchAttributes(getBasicSearchPreSearchAttributeColumns(containersByKey)); |
228 | 0 | manager.setColumnsPostSearchAttributes(getBasicSearchPostSearchAttributeColumns(containersByKey)); |
229 | 0 | return manager; |
230 | |
} |
231 | |
|
232 | |
public List<List<StandardDocSearchCriteriaFieldContainer>> getBasicSearchPreSearchAttributeColumns(Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey) { |
233 | 0 | List<List<StandardDocSearchCriteriaFieldContainer>> columnHolder = new ArrayList<List<StandardDocSearchCriteriaFieldContainer>>(); |
234 | 0 | for (int i = 1; i <= getBasicSearchPreSearchAttributesColumnSize(); i++) { |
235 | 0 | columnHolder.add(getBasicSearchPreSearchAttributeContainerList(i, containersByKey)); |
236 | |
} |
237 | 0 | return columnHolder; |
238 | |
} |
239 | |
|
240 | |
public List<List<StandardDocSearchCriteriaFieldContainer>> getBasicSearchPostSearchAttributeColumns(Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey) { |
241 | 0 | List<List<StandardDocSearchCriteriaFieldContainer>> columnHolder = new ArrayList<List<StandardDocSearchCriteriaFieldContainer>>(); |
242 | 0 | for (int i = 1; i <= getBasicSearchPostSearchAttributesColumnSize(); i++) { |
243 | 0 | columnHolder.add(getBasicSearchPostSearchAttributeContainerList(i, containersByKey)); |
244 | |
} |
245 | 0 | return columnHolder; |
246 | |
} |
247 | |
|
248 | |
public List<StandardDocSearchCriteriaFieldContainer> getBasicSearchPreSearchAttributeContainerList(int columnNumber, Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey) { |
249 | 0 | return getBasicSearchContainerList(containersByKey, generateHiddenFieldKeySet(getBasicSearchHiddenFieldKeys()), getBasicSearchPreSearchAttributeFieldKeys(columnNumber)); |
250 | |
} |
251 | |
|
252 | |
public List<StandardDocSearchCriteriaFieldContainer> getBasicSearchPostSearchAttributeContainerList(int columnNumber, Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey) { |
253 | 0 | return getBasicSearchContainerList(containersByKey, generateHiddenFieldKeySet(getBasicSearchHiddenFieldKeys()), getBasicSearchPostSearchAttributeFieldKeys(columnNumber)); |
254 | |
} |
255 | |
|
256 | |
public List<StandardDocSearchCriteriaFieldContainer> getBasicSearchContainerList(Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey, Set<String> hiddenKeys, List<String> fieldKeys) { |
257 | 0 | List<StandardDocSearchCriteriaFieldContainer> containers = new ArrayList<StandardDocSearchCriteriaFieldContainer>(); |
258 | 0 | boolean setWidth = false; |
259 | 0 | for (String fieldKey : fieldKeys) |
260 | |
{ |
261 | 0 | StandardDocSearchCriteriaFieldContainer container = new StandardDocSearchCriteriaFieldContainer(containersByKey.get(fieldKey)); |
262 | 0 | container.hideFieldsIfNecessary(hiddenKeys); |
263 | 0 | if ((!setWidth) && (!container.isHidden())) |
264 | |
{ |
265 | 0 | container.setLabelFieldWidthValue("22%"); |
266 | 0 | container.setDataFieldWidthValue("78%"); |
267 | 0 | setWidth = true; |
268 | |
} |
269 | 0 | containers.add(container); |
270 | 0 | } |
271 | 0 | return containers; |
272 | |
} |
273 | |
|
274 | |
public List<String> getBasicSearchPreSearchAttributeFieldKeys(int columnNumber) { |
275 | 0 | if (columnNumber == 1) { |
276 | 0 | List<String> fieldKeys = new ArrayList<String>(); |
277 | 0 | fieldKeys.add(CRITERIA_KEY_DOC_TYPE_FULL_NAME); |
278 | 0 | fieldKeys.add(CRITERIA_KEY_INITIATOR); |
279 | 0 | fieldKeys.add(CRITERIA_KEY_DOCUMENT_ID); |
280 | 0 | fieldKeys.add(CRITERIA_KEY_CREATE_DATE); |
281 | 0 | return fieldKeys; |
282 | |
} else { |
283 | 0 | throw new RuntimeException("Column number given (" + columnNumber + ") is invalid for standard search"); |
284 | |
} |
285 | |
} |
286 | |
|
287 | |
public List<String> getBasicSearchPostSearchAttributeFieldKeys(int columnNumber) { |
288 | 0 | if (columnNumber == 1) { |
289 | 0 | List<String> fieldKeys = new ArrayList<String>(); |
290 | 0 | fieldKeys.add(CRITERIA_KEY_NAMED_SEARCH); |
291 | 0 | return fieldKeys; |
292 | |
} else { |
293 | 0 | throw new RuntimeException("Column number given (" + columnNumber + ") is invalid for standard search"); |
294 | |
} |
295 | |
} |
296 | |
|
297 | |
|
298 | |
|
299 | |
|
300 | |
|
301 | |
|
302 | |
public List<Row> processSearchableAttributeRowsForAdvancedSearch(List<Row> searchableAttributeRows) { |
303 | 0 | return processSearchableAttributeRows(searchableAttributeRows, getAdvancedSearchHiddenFieldKeys()); |
304 | |
} |
305 | |
|
306 | |
public StandardDocSearchCriteriaManager getAdvancedSearchManager() { |
307 | 0 | return buildAdvancedSearchManager(); |
308 | |
} |
309 | |
|
310 | |
public List<String> getAdvancedSearchHiddenFieldKeys() { |
311 | 0 | return new ArrayList<String>(); |
312 | |
} |
313 | |
|
314 | |
|
315 | |
|
316 | |
|
317 | |
|
318 | |
|
319 | |
|
320 | |
public Boolean isAdvancedSearchCriteriaDisplayed() { |
321 | 0 | return Boolean.TRUE; |
322 | |
} |
323 | |
|
324 | |
|
325 | |
|
326 | |
|
327 | |
|
328 | |
|
329 | |
public static int getAdvancedSearchPreSearchAttributesColumnSize() { |
330 | 0 | return 2; |
331 | |
} |
332 | |
|
333 | |
|
334 | |
|
335 | |
|
336 | |
|
337 | |
|
338 | |
public static int getAdvancedSearchPostSearchAttributesColumnSize() { |
339 | 0 | return 1; |
340 | |
} |
341 | |
|
342 | |
public StandardDocSearchCriteriaManager buildAdvancedSearchManager() { |
343 | 0 | StandardDocSearchCriteriaManager manager = new StandardDocSearchCriteriaManager(getBasicSearchPreSearchAttributesColumnSize(),getBasicSearchPostSearchAttributesColumnSize(),isAdvancedSearchCriteriaDisplayed(),isHeaderBarDisplayed()); |
344 | 0 | Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey = getStandardCriteriaFieldContainerMap(); |
345 | 0 | manager.setColumnsPreSearchAttributes(getAdvancedSearchPreSearchAttributeColumns(containersByKey)); |
346 | 0 | manager.setColumnsPostSearchAttributes(getAdvancedSearchPostSearchAttributeColumns(containersByKey)); |
347 | 0 | return manager; |
348 | |
} |
349 | |
|
350 | |
public List<List<StandardDocSearchCriteriaFieldContainer>> getAdvancedSearchPreSearchAttributeColumns(Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey) { |
351 | 0 | List<List<StandardDocSearchCriteriaFieldContainer>> columnHolder = new ArrayList<List<StandardDocSearchCriteriaFieldContainer>>(); |
352 | 0 | for (int i = 1; i <= getAdvancedSearchPreSearchAttributesColumnSize(); i++) { |
353 | 0 | columnHolder.add(getAdvancedSearchPreSearchAttributeContainerList(i, containersByKey)); |
354 | |
} |
355 | 0 | return columnHolder; |
356 | |
} |
357 | |
|
358 | |
public List<List<StandardDocSearchCriteriaFieldContainer>> getAdvancedSearchPostSearchAttributeColumns(Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey) { |
359 | 0 | List<List<StandardDocSearchCriteriaFieldContainer>> columnHolder = new ArrayList<List<StandardDocSearchCriteriaFieldContainer>>(); |
360 | 0 | for (int i = 1; i <= getAdvancedSearchPostSearchAttributesColumnSize(); i++) { |
361 | 0 | columnHolder.add(getAdvancedSearchPostSearchAttributeContainerList(i, containersByKey)); |
362 | |
} |
363 | 0 | return columnHolder; |
364 | |
} |
365 | |
|
366 | |
public List<StandardDocSearchCriteriaFieldContainer> getAdvancedSearchPreSearchAttributeContainerList(int columnNumber, Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey) { |
367 | 0 | return getAdvancedSearchContainerList(containersByKey, generateHiddenFieldKeySet(getAdvancedSearchHiddenFieldKeys()), getAdvancedSearchPreSearchAttributeFieldKeys(columnNumber)); |
368 | |
} |
369 | |
|
370 | |
public List<StandardDocSearchCriteriaFieldContainer> getAdvancedSearchPostSearchAttributeContainerList(int columnNumber, Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey) { |
371 | 0 | return getAdvancedSearchContainerList(containersByKey, generateHiddenFieldKeySet(getAdvancedSearchHiddenFieldKeys()), getAdvancedSearchPostSearchAttributeFieldKeys(columnNumber)); |
372 | |
} |
373 | |
|
374 | |
public List<StandardDocSearchCriteriaFieldContainer> getAdvancedSearchContainerList(Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey, Set<String> hiddenKeys, List<String> fieldKeys) { |
375 | 0 | List<StandardDocSearchCriteriaFieldContainer> containers = new ArrayList<StandardDocSearchCriteriaFieldContainer>(); |
376 | 0 | for (String fieldKey : fieldKeys) |
377 | |
{ |
378 | 0 | StandardDocSearchCriteriaFieldContainer container = new StandardDocSearchCriteriaFieldContainer(containersByKey.get(fieldKey)); |
379 | 0 | container.hideFieldsIfNecessary(hiddenKeys); |
380 | 0 | containers.add(container); |
381 | 0 | } |
382 | 0 | return containers; |
383 | |
} |
384 | |
|
385 | |
public List<String> getAdvancedSearchPreSearchAttributeFieldKeys(int columnNumber) { |
386 | 0 | if (columnNumber == 1) { |
387 | 0 | List<String> fieldKeys = new ArrayList<String>(); |
388 | 0 | fieldKeys.add(CRITERIA_KEY_INITIATOR); |
389 | 0 | fieldKeys.add(CRITERIA_KEY_APPROVER_ID); |
390 | 0 | fieldKeys.add(CRITERIA_KEY_DOCUMENT_ID); |
391 | 0 | fieldKeys.add(CRITERIA_KEY_APPLICATION_DOCUMENT_ID); |
392 | 0 | fieldKeys.add(CRITERIA_KEY_LAST_MODIFIED_DATE); |
393 | 0 | fieldKeys.add(CRITERIA_KEY_FINALIZED_DATE); |
394 | 0 | fieldKeys.add(CRITERIA_KEY_DOC_TYPE_FULL_NAME); |
395 | 0 | return fieldKeys; |
396 | 0 | } else if (columnNumber == 2) { |
397 | 0 | List<String> fieldKeys = new ArrayList<String>(); |
398 | 0 | fieldKeys.add(CRITERIA_KEY_VIEWER_ID); |
399 | 0 | fieldKeys.add(CRITERIA_KEY_WORKGROUP_VIEWER); |
400 | 0 | fieldKeys.add(CRITERIA_KEY_WORKGROUP_VIEWER_ID); |
401 | 0 | fieldKeys.add(CRITERIA_KEY_DOCUMENT_ROUTE_STATUS); |
402 | 0 | fieldKeys.add(CRITERIA_KEY_DOCUMENT_ROUTE_NODE); |
403 | 0 | fieldKeys.add(CRITERIA_KEY_CREATE_DATE); |
404 | 0 | fieldKeys.add(CRITERIA_KEY_APPROVED_DATE); |
405 | 0 | fieldKeys.add(CRITERIA_KEY_DOCUMENT_TITLE); |
406 | 0 | return fieldKeys; |
407 | |
} else { |
408 | 0 | throw new RuntimeException("Column number given (" + columnNumber + ") is invalid for standard search"); |
409 | |
} |
410 | |
} |
411 | |
|
412 | |
public List<String> getAdvancedSearchPostSearchAttributeFieldKeys(int columnNumber) { |
413 | 0 | if (columnNumber == 1) { |
414 | 0 | List<String> fieldKeys = new ArrayList<String>(); |
415 | 0 | fieldKeys.add(CRITERIA_KEY_NAMED_SEARCH); |
416 | 0 | return fieldKeys; |
417 | |
} else { |
418 | 0 | throw new RuntimeException("Column number given (" + columnNumber + ") is invalid for standard search"); |
419 | |
} |
420 | |
} |
421 | |
} |