View Javadoc

1   /*
2    * Copyright 2007 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
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   * This is the standard document search criteria processor implementation.
27   *
28   * @author Kuali Rice Team (rice.collab@kuali.org)
29   *
30   */
31  public class StandardDocumentSearchCriteriaProcessor implements DocumentSearchCriteriaProcessor {
32      private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(StandardDocumentSearchCriteriaProcessor.class);
33  
34      private String searchingUser;
35      private DocSearchCriteriaDTO docSearchCriteriaDTO = new DocSearchCriteriaDTO();
36  
37      public StandardDocumentSearchCriteriaProcessor() {}
38  
39      /**
40       * @return the searchingUser
41       */
42      public String getSearchingUser() {
43          return this.searchingUser;
44      }
45  
46      /**
47       * @param principalId the searchingUser to set
48       */
49      public void setSearchingUser(String principalId) {
50          this.searchingUser = searchingUser;
51      }
52  
53      /**
54       * @return the docSearchCriteriaDTO
55       */
56      public DocSearchCriteriaDTO getDocSearchCriteriaDTO() {
57          return this.docSearchCriteriaDTO;
58      }
59  
60      /**
61       * @param docSearchCriteriaDTO the docSearchCriteriaDTO to set
62       */
63      public void setDocSearchCriteriaDTO(DocSearchCriteriaDTO docSearchCriteriaDTO) {
64          this.docSearchCriteriaDTO = docSearchCriteriaDTO;
65      }
66  
67      private Set<String> generateHiddenFieldKeySet(List<String> hiddenFieldKeys) {
68          hiddenFieldKeys.addAll(getGlobalHiddenFieldKeys());
69          return new HashSet<String>(hiddenFieldKeys);
70      }
71  
72      /*
73       *   GLOBAL HELPER METHODS
74       *
75       */
76  
77      public List<String> getGlobalHiddenFieldKeys() {
78      	List<String> hiddenFieldKeys = new ArrayList<String>();
79      	hiddenFieldKeys.add(CRITERIA_KEY_WORKGROUP_VIEWER_ID);
80          return hiddenFieldKeys;
81      }
82  
83  	/**
84  	 * Standard implementation of this method is that the header bar is always displayed
85  	 * so this returns true.
86  	 *
87  	 * @see org.kuali.rice.kew.docsearch.DocumentSearchCriteriaProcessor#isHeaderBarDisplayed()
88  	 */
89  	public boolean isHeaderBarDisplayed() {
90  		return true;
91  	}
92  
93      /**
94       * This method returns a map of the standard criteria field containers by key.  The values
95       * for the keys are constants in the {@link DocumentSearchCriteriaProcessor} class using
96       * the name format CRITERIA_KEY_XXXXXXX.
97       * @return map of standard critera field containers by key
98       */
99      public Map<String,StandardDocSearchCriteriaFieldContainer> getStandardCriteriaFieldContainerMap() {
100     	Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey = new HashMap<String,StandardDocSearchCriteriaFieldContainer>();
101     	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     	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     	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     	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     	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     	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     	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     	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     	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     	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     	// create date
112     	putContainerIntoMap(containersByKey, buildStandardDateRangeFieldContainer(DocumentSearchCriteriaProcessor.CRITERIA_KEY_CREATE_DATE, "docSearch.DocumentSearch.criteria.label.dateCreated", "DocSearchDateCreated", "fromDateCreated", "toDateCreated", "fromDateCreated", "toDateCreated"));
113     	// last modified date
114     	putContainerIntoMap(containersByKey, buildStandardDateRangeFieldContainer(DocumentSearchCriteriaProcessor.CRITERIA_KEY_LAST_MODIFIED_DATE, "docSearch.DocumentSearch.criteria.label.dateLastModified", "DocSearchDateLastModified", "fromDateLastModified", "toDateLastModified", "advancedFromDateLastModified", "advancedToDateLastModified"));
115     	// finalized date
116     	putContainerIntoMap(containersByKey, buildStandardDateRangeFieldContainer(DocumentSearchCriteriaProcessor.CRITERIA_KEY_FINALIZED_DATE, "docSearch.DocumentSearch.criteria.label.dateFinalized", "DocSearchDateFinalized", "fromDateFinalized", "toDateFinalized", "advancedFromDateFinalized", "advancedToDateFinalized"));
117     	// approved date
118     	putContainerIntoMap(containersByKey, buildStandardDateRangeFieldContainer(DocumentSearchCriteriaProcessor.CRITERIA_KEY_APPROVED_DATE, "docSearch.DocumentSearch.criteria.label.dateApproved", "DocSearchDateApproved", "fromDateApproved", "toDateApproved", "advancedFromDateApproved", "advancedToDateApproved"));
119 
120     	// custom fields including drop down type
121     	StandardSearchCriteriaField dropDown = new StandardSearchCriteriaField(DocumentSearchCriteriaProcessor.CRITERIA_KEY_DOCUMENT_ROUTE_STATUS,"criteria.docRouteStatus",StandardSearchCriteriaField.DROPDOWN,null,null,"DocSearchDocumentRouteStatus",false,null,null,false);
122     	dropDown.setOptionsCollectionProperty("documentRouteStatus");
123     	dropDown.setCollectionKeyProperty("key");
124     	dropDown.setCollectionLabelProperty("value");
125     	putContainerIntoMap(containersByKey, new StandardDocSearchCriteriaFieldContainer("docSearch.DocumentSearch.criteria.label.documentRouteStatus", dropDown));
126 
127     	// route node dropdown
128     	StandardDocSearchCriteriaFieldContainer container = new StandardDocSearchCriteriaFieldContainer();
129     	container.setLabelMessageKey("docSearch.DocumentSearch.criteria.label.documentRouteNode");
130     	container.setFieldKey(DocumentSearchCriteriaProcessor.CRITERIA_KEY_DOCUMENT_ROUTE_NODE);
131     	dropDown = new StandardSearchCriteriaField(DocumentSearchCriteriaProcessor.CRITERIA_KEY_DOCUMENT_ROUTE_NODE + "_VALUES","criteria.docRouteNodeId",StandardSearchCriteriaField.DROPDOWN_HIDE_EMPTY,null,null,"DocSearchDocumentRouteLevel",false,null,null,false);
132     	dropDown.setOptionsCollectionProperty("routeNodes");
133     	dropDown.setCollectionKeyProperty("routeNodeName");
134     	dropDown.setCollectionLabelProperty("routeNodeName");
135     	dropDown.setEmptyCollectionMessage("Select a document type.");
136     	container.addField(dropDown);
137     	dropDown = new StandardSearchCriteriaField(DocumentSearchCriteriaProcessor.CRITERIA_KEY_DOCUMENT_ROUTE_NODE + "_LOGIC","criteria.docRouteNodeLogic",StandardSearchCriteriaField.DROPDOWN_HIDE_EMPTY,null,null,null,false,null,null,false);
138     	dropDown.setOptionsCollectionProperty("qualifierLogic");
139     	dropDown.setCollectionKeyProperty("key");
140     	dropDown.setCollectionLabelProperty("value");
141     	container.addField(dropDown);
142     	putContainerIntoMap(containersByKey, container);
143 
144     	return containersByKey;
145     }
146 
147     /**
148      * Helper method used in constructing the date range fields for standard criteria
149      */
150     public StandardDocSearchCriteriaFieldContainer buildStandardDateRangeFieldContainer(String criteriaKey, String labelKey, String helpMessageArgument, String lowerBoundPropertyName, String upperBoundPropertyName, String lowerBoundDatePickerKey, String upperBoundDatePickerKey) {
151     	List<StandardSearchCriteriaField> dateFields = new ArrayList<StandardSearchCriteriaField>();
152     	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     	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     	return new StandardDocSearchCriteriaFieldContainer(criteriaKey, labelKey, dateFields);
155     }
156 
157     /**
158      * Helper method used in constructing the standard field map
159      */
160     public void putContainerIntoMap(Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey, StandardDocSearchCriteriaFieldContainer container) {
161     	containersByKey.put(container.getFieldKey(), container);
162     }
163 
164     private List<Row> processSearchableAttributeRows(List<Row> searchableAttributeRows, List<String> hiddenFieldKeys) {
165         Set<String> hiddenKeys = generateHiddenFieldKeySet(hiddenFieldKeys);
166         if (hiddenKeys.isEmpty()) {
167             return searchableAttributeRows;
168         }
169         for (Row searchableAttributeRow : searchableAttributeRows)
170         {
171             for (Field field : searchableAttributeRow.getFields())
172             {
173                 // set hidden field to true if hiddenKeys is not empty and if hiddenKeys contains either the field's propertyName value or savablePropertyName value
174                 final boolean hidden = (!hiddenKeys.isEmpty()) && ((hiddenKeys.contains(field.getPropertyName())) || (hiddenKeys.contains(field.getPropertyName())));
175                 if (hidden) {
176                     field.setFieldType(Field.HIDDEN);
177                 }
178             }
179         }
180         return searchableAttributeRows;
181     }
182 
183     /*
184      *   BASIC SEARCH METHODS
185      *
186      */
187 
188     public List<Row> processSearchableAttributeRowsForBasicSearch(List<Row> searchableAttributeRows) {
189         return processSearchableAttributeRows(searchableAttributeRows, getBasicSearchHiddenFieldKeys());
190     }
191 
192     public StandardDocSearchCriteriaManager getBasicSearchManager() {
193         return buildBasicSearchManager();
194     }
195 
196     public List<String> getBasicSearchHiddenFieldKeys() {
197         return new ArrayList<String>();
198     }
199 
200     /**
201      * Standard implementation of this method is that the search criteria is always displayed
202      * on a basic search so this returns true.
203      *
204      * @see org.kuali.rice.kew.docsearch.DocumentSearchCriteriaProcessor#isBasicSearchCriteriaDisplayed()
205      */
206     public Boolean isBasicSearchCriteriaDisplayed() {
207         return Boolean.TRUE;
208     }
209 
210     /**
211      * This method returns the number of columns that should exist on a basic search
212      * before the searchable attributes display in the criteria section.
213      * @return one
214      */
215     public static int getBasicSearchPreSearchAttributesColumnSize() {
216         return 1;
217     }
218 
219     /**
220      * This method returns the number of columns that should exist on a basic search
221      * after the searchable attributes display in the criteria section.
222      * @return one
223      */
224     public static int getBasicSearchPostSearchAttributesColumnSize() {
225         return 1;
226     }
227 
228     public StandardDocSearchCriteriaManager buildBasicSearchManager() {
229         StandardDocSearchCriteriaManager manager = new StandardDocSearchCriteriaManager(getBasicSearchPreSearchAttributesColumnSize(),getBasicSearchPostSearchAttributesColumnSize(),isBasicSearchCriteriaDisplayed(),isHeaderBarDisplayed());
230     	Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey = getStandardCriteriaFieldContainerMap();
231     	manager.setColumnsPreSearchAttributes(getBasicSearchPreSearchAttributeColumns(containersByKey));
232     	manager.setColumnsPostSearchAttributes(getBasicSearchPostSearchAttributeColumns(containersByKey));
233     	return manager;
234     }
235 
236     public List<List<StandardDocSearchCriteriaFieldContainer>> getBasicSearchPreSearchAttributeColumns(Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey) {
237         List<List<StandardDocSearchCriteriaFieldContainer>> columnHolder = new ArrayList<List<StandardDocSearchCriteriaFieldContainer>>();
238         for (int i = 1; i <= getBasicSearchPreSearchAttributesColumnSize(); i++) {
239             columnHolder.add(getBasicSearchPreSearchAttributeContainerList(i, containersByKey));
240         }
241         return columnHolder;
242     }
243 
244     public List<List<StandardDocSearchCriteriaFieldContainer>> getBasicSearchPostSearchAttributeColumns(Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey) {
245         List<List<StandardDocSearchCriteriaFieldContainer>> columnHolder = new ArrayList<List<StandardDocSearchCriteriaFieldContainer>>();
246         for (int i = 1; i <= getBasicSearchPostSearchAttributesColumnSize(); i++) {
247             columnHolder.add(getBasicSearchPostSearchAttributeContainerList(i, containersByKey));
248         }
249         return columnHolder;
250     }
251 
252     public List<StandardDocSearchCriteriaFieldContainer> getBasicSearchPreSearchAttributeContainerList(int columnNumber, Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey) {
253         return getBasicSearchContainerList(containersByKey, generateHiddenFieldKeySet(getBasicSearchHiddenFieldKeys()), getBasicSearchPreSearchAttributeFieldKeys(columnNumber));
254     }
255 
256     public List<StandardDocSearchCriteriaFieldContainer> getBasicSearchPostSearchAttributeContainerList(int columnNumber, Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey) {
257         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         List<StandardDocSearchCriteriaFieldContainer> containers = new ArrayList<StandardDocSearchCriteriaFieldContainer>();
262         boolean setWidth = false;
263         for (String fieldKey : fieldKeys)
264         {
265             StandardDocSearchCriteriaFieldContainer container = new StandardDocSearchCriteriaFieldContainer(containersByKey.get(fieldKey));
266             container.hideFieldsIfNecessary(hiddenKeys);
267             if ((!setWidth) && (!container.isHidden()))
268             {
269                 container.setLabelFieldWidthValue("22%");
270                 container.setDataFieldWidthValue("78%");
271                 setWidth = true;
272             }
273             containers.add(container);
274         }
275         return containers;
276     }
277 
278     public List<String> getBasicSearchPreSearchAttributeFieldKeys(int columnNumber) {
279         if (columnNumber == 1) {
280             List<String> fieldKeys = new ArrayList<String>();
281             fieldKeys.add(CRITERIA_KEY_DOC_TYPE_FULL_NAME);
282             fieldKeys.add(CRITERIA_KEY_INITIATOR);
283             fieldKeys.add(CRITERIA_KEY_DOCUMENT_ID);
284             fieldKeys.add(CRITERIA_KEY_CREATE_DATE);
285             return fieldKeys;
286         } else {
287             throw new RuntimeException("Column number given (" + columnNumber + ") is invalid for standard search");
288         }
289     }
290 
291     public List<String> getBasicSearchPostSearchAttributeFieldKeys(int columnNumber) {
292         if (columnNumber == 1) {
293             List<String> fieldKeys = new ArrayList<String>();
294             fieldKeys.add(CRITERIA_KEY_NAMED_SEARCH);
295             return fieldKeys;
296         } else {
297             throw new RuntimeException("Column number given (" + columnNumber + ") is invalid for standard search");
298         }
299     }
300 
301     /*
302      *   ADVANCED SEARCH METHODS
303      *
304      */
305 
306     public List<Row> processSearchableAttributeRowsForAdvancedSearch(List<Row> searchableAttributeRows) {
307         return processSearchableAttributeRows(searchableAttributeRows, getAdvancedSearchHiddenFieldKeys());
308     }
309 
310     public StandardDocSearchCriteriaManager getAdvancedSearchManager() {
311         return buildAdvancedSearchManager();
312     }
313 
314     public List<String> getAdvancedSearchHiddenFieldKeys() {
315         return new ArrayList<String>();
316     }
317 
318     /**
319      * Standard implementation of this method is that the search criteria is always displayed
320      * on an advanced search so this returns true.
321      *
322      * @see org.kuali.rice.kew.docsearch.DocumentSearchCriteriaProcessor#isAdvancedSearchCriteriaDisplayed()
323      */
324     public Boolean isAdvancedSearchCriteriaDisplayed() {
325         return Boolean.TRUE;
326     }
327 
328     /**
329      * This method returns the number of columns that should exist on a advanced search
330      * before the searchable attributes display in the criteria section.
331      * @return two
332      */
333     public static int getAdvancedSearchPreSearchAttributesColumnSize() {
334         return 2;
335     }
336 
337     /**
338      * This method returns the number of columns that should exist on a advanced search
339      * after the searchable attributes display in the criteria section.
340      * @return one
341      */
342     public static int getAdvancedSearchPostSearchAttributesColumnSize() {
343         return 1;
344     }
345 
346     public StandardDocSearchCriteriaManager buildAdvancedSearchManager() {
347         StandardDocSearchCriteriaManager manager = new StandardDocSearchCriteriaManager(getBasicSearchPreSearchAttributesColumnSize(),getBasicSearchPostSearchAttributesColumnSize(),isAdvancedSearchCriteriaDisplayed(),isHeaderBarDisplayed());
348         Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey = getStandardCriteriaFieldContainerMap();
349         manager.setColumnsPreSearchAttributes(getAdvancedSearchPreSearchAttributeColumns(containersByKey));
350         manager.setColumnsPostSearchAttributes(getAdvancedSearchPostSearchAttributeColumns(containersByKey));
351         return manager;
352     }
353 
354     public List<List<StandardDocSearchCriteriaFieldContainer>> getAdvancedSearchPreSearchAttributeColumns(Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey) {
355         List<List<StandardDocSearchCriteriaFieldContainer>> columnHolder = new ArrayList<List<StandardDocSearchCriteriaFieldContainer>>();
356         for (int i = 1; i <= getAdvancedSearchPreSearchAttributesColumnSize(); i++) {
357             columnHolder.add(getAdvancedSearchPreSearchAttributeContainerList(i, containersByKey));
358         }
359         return columnHolder;
360     }
361 
362     public List<List<StandardDocSearchCriteriaFieldContainer>> getAdvancedSearchPostSearchAttributeColumns(Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey) {
363         List<List<StandardDocSearchCriteriaFieldContainer>> columnHolder = new ArrayList<List<StandardDocSearchCriteriaFieldContainer>>();
364         for (int i = 1; i <= getAdvancedSearchPostSearchAttributesColumnSize(); i++) {
365             columnHolder.add(getAdvancedSearchPostSearchAttributeContainerList(i, containersByKey));
366         }
367         return columnHolder;
368     }
369 
370     public List<StandardDocSearchCriteriaFieldContainer> getAdvancedSearchPreSearchAttributeContainerList(int columnNumber, Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey) {
371         return getAdvancedSearchContainerList(containersByKey, generateHiddenFieldKeySet(getAdvancedSearchHiddenFieldKeys()), getAdvancedSearchPreSearchAttributeFieldKeys(columnNumber));
372     }
373 
374     public List<StandardDocSearchCriteriaFieldContainer> getAdvancedSearchPostSearchAttributeContainerList(int columnNumber, Map<String,StandardDocSearchCriteriaFieldContainer> containersByKey) {
375         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         List<StandardDocSearchCriteriaFieldContainer> containers = new ArrayList<StandardDocSearchCriteriaFieldContainer>();
380         for (String fieldKey : fieldKeys)
381         {
382             StandardDocSearchCriteriaFieldContainer container = new StandardDocSearchCriteriaFieldContainer(containersByKey.get(fieldKey));
383             container.hideFieldsIfNecessary(hiddenKeys);
384             containers.add(container);
385         }
386         return containers;
387     }
388 
389     public List<String> getAdvancedSearchPreSearchAttributeFieldKeys(int columnNumber) {
390         if (columnNumber == 1) {
391             List<String> fieldKeys = new ArrayList<String>();
392             fieldKeys.add(CRITERIA_KEY_INITIATOR);
393             fieldKeys.add(CRITERIA_KEY_APPROVER_ID);
394             fieldKeys.add(CRITERIA_KEY_DOCUMENT_ID);
395             fieldKeys.add(CRITERIA_KEY_APPLICATION_DOCUMENT_ID);
396             fieldKeys.add(CRITERIA_KEY_LAST_MODIFIED_DATE);
397             fieldKeys.add(CRITERIA_KEY_FINALIZED_DATE);
398             fieldKeys.add(CRITERIA_KEY_DOC_TYPE_FULL_NAME);
399             return fieldKeys;
400         } else if (columnNumber == 2) {
401             List<String> fieldKeys = new ArrayList<String>();
402             fieldKeys.add(CRITERIA_KEY_VIEWER_ID);
403             fieldKeys.add(CRITERIA_KEY_WORKGROUP_VIEWER);
404             fieldKeys.add(CRITERIA_KEY_WORKGROUP_VIEWER_ID);
405             fieldKeys.add(CRITERIA_KEY_DOCUMENT_ROUTE_STATUS);
406             fieldKeys.add(CRITERIA_KEY_DOCUMENT_ROUTE_NODE);
407             fieldKeys.add(CRITERIA_KEY_CREATE_DATE);
408             fieldKeys.add(CRITERIA_KEY_APPROVED_DATE);
409             fieldKeys.add(CRITERIA_KEY_DOCUMENT_TITLE);
410             return fieldKeys;
411         } else {
412             throw new RuntimeException("Column number given (" + columnNumber + ") is invalid for standard search");
413         }
414     }
415 
416     public List<String> getAdvancedSearchPostSearchAttributeFieldKeys(int columnNumber) {
417         if (columnNumber == 1) {
418             List<String> fieldKeys = new ArrayList<String>();
419             fieldKeys.add(CRITERIA_KEY_NAMED_SEARCH);
420             return fieldKeys;
421         } else {
422             throw new RuntimeException("Column number given (" + columnNumber + ") is invalid for standard search");
423         }
424     }
425 }