Coverage Report - org.kuali.rice.kew.docsearch.StandardDocumentSearchCriteriaProcessor
 
Classes in this File Line Coverage Branch Coverage Complexity
StandardDocumentSearchCriteriaProcessor
0%
0/168
0%
0/40
1.725
 
 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  
 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  
  * This is the standard document search criteria processor implementation.
 26  
  *
 27  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 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  
      * @return the searchingUser
 40  
      */
 41  
     public String getSearchingUser() {
 42  0
         return this.searchingUser;
 43  
     }
 44  
 
 45  
     /**
 46  
      * @param principalId the searchingUser to set
 47  
      */
 48  
     public void setSearchingUser(String principalId) {
 49  0
         this.searchingUser = searchingUser;
 50  0
     }
 51  
 
 52  
     /**
 53  
      * @return the docSearchCriteriaDTO
 54  
      */
 55  
     public DocSearchCriteriaDTO getDocSearchCriteriaDTO() {
 56  0
         return this.docSearchCriteriaDTO;
 57  
     }
 58  
 
 59  
     /**
 60  
      * @param docSearchCriteriaDTO the docSearchCriteriaDTO to set
 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  
      *   GLOBAL HELPER METHODS
 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  
          * Standard implementation of this method is that the header bar is always displayed
 84  
          * so this returns true.
 85  
          *
 86  
          * @see org.kuali.rice.kew.docsearch.DocumentSearchCriteriaProcessor#isHeaderBarDisplayed()
 87  
          */
 88  
         public boolean isHeaderBarDisplayed() {
 89  0
                 return true;
 90  
         }
 91  
 
 92  
     /**
 93  
      * This method returns a map of the standard criteria field containers by key.  The values
 94  
      * for the keys are constants in the {@link DocumentSearchCriteriaProcessor} class using
 95  
      * the name format CRITERIA_KEY_XXXXXXX.
 96  
      * @return map of standard critera field containers by key
 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  
             // create date
 111  0
             putContainerIntoMap(containersByKey, buildStandardDateRangeFieldContainer(DocumentSearchCriteriaProcessor.CRITERIA_KEY_CREATE_DATE, "docSearch.DocumentSearch.criteria.label.dateCreated", "DocSearchDateCreated", "fromDateCreated", "toDateCreated", "fromDateCreated", "toDateCreated"));
 112  
             // last modified date
 113  0
             putContainerIntoMap(containersByKey, buildStandardDateRangeFieldContainer(DocumentSearchCriteriaProcessor.CRITERIA_KEY_LAST_MODIFIED_DATE, "docSearch.DocumentSearch.criteria.label.dateLastModified", "DocSearchDateLastModified", "fromDateLastModified", "toDateLastModified", "advancedFromDateLastModified", "advancedToDateLastModified"));
 114  
             // finalized date
 115  0
             putContainerIntoMap(containersByKey, buildStandardDateRangeFieldContainer(DocumentSearchCriteriaProcessor.CRITERIA_KEY_FINALIZED_DATE, "docSearch.DocumentSearch.criteria.label.dateFinalized", "DocSearchDateFinalized", "fromDateFinalized", "toDateFinalized", "advancedFromDateFinalized", "advancedToDateFinalized"));
 116  
             // approved date
 117  0
             putContainerIntoMap(containersByKey, buildStandardDateRangeFieldContainer(DocumentSearchCriteriaProcessor.CRITERIA_KEY_APPROVED_DATE, "docSearch.DocumentSearch.criteria.label.dateApproved", "DocSearchDateApproved", "fromDateApproved", "toDateApproved", "advancedFromDateApproved", "advancedToDateApproved"));
 118  
 
 119  
             // custom fields including drop down type
 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  
             // route node dropdown
 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  
      * Helper method used in constructing the date range fields for standard criteria
 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  
      * Helper method used in constructing the standard field map
 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  
                 // set hidden field to true if hiddenKeys is not empty and if hiddenKeys contains either the field's propertyName value or savablePropertyName value
 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  
      *   BASIC SEARCH METHODS
 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  
      * Standard implementation of this method is that the search criteria is always displayed
 201  
      * on a basic search so this returns true.
 202  
      *
 203  
      * @see org.kuali.rice.kew.docsearch.DocumentSearchCriteriaProcessor#isBasicSearchCriteriaDisplayed()
 204  
      */
 205  
     public Boolean isBasicSearchCriteriaDisplayed() {
 206  0
         return Boolean.TRUE;
 207  
     }
 208  
 
 209  
     /**
 210  
      * This method returns the number of columns that should exist on a basic search
 211  
      * before the searchable attributes display in the criteria section.
 212  
      * @return one
 213  
      */
 214  
     public static int getBasicSearchPreSearchAttributesColumnSize() {
 215  0
         return 1;
 216  
     }
 217  
 
 218  
     /**
 219  
      * This method returns the number of columns that should exist on a basic search
 220  
      * after the searchable attributes display in the criteria section.
 221  
      * @return one
 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  
      *   ADVANCED SEARCH METHODS
 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  
      * Standard implementation of this method is that the search criteria is always displayed
 319  
      * on an advanced search so this returns true.
 320  
      *
 321  
      * @see org.kuali.rice.kew.docsearch.DocumentSearchCriteriaProcessor#isAdvancedSearchCriteriaDisplayed()
 322  
      */
 323  
     public Boolean isAdvancedSearchCriteriaDisplayed() {
 324  0
         return Boolean.TRUE;
 325  
     }
 326  
 
 327  
     /**
 328  
      * This method returns the number of columns that should exist on a advanced search
 329  
      * before the searchable attributes display in the criteria section.
 330  
      * @return two
 331  
      */
 332  
     public static int getAdvancedSearchPreSearchAttributesColumnSize() {
 333  0
         return 2;
 334  
     }
 335  
 
 336  
     /**
 337  
      * This method returns the number of columns that should exist on a advanced search
 338  
      * after the searchable attributes display in the criteria section.
 339  
      * @return one
 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  
 }