Coverage Report - org.kuali.rice.kew.docsearch.StandardDocSearchCriteriaManager
 
Classes in this File Line Coverage Branch Coverage Complexity
StandardDocSearchCriteriaManager
0%
0/28
0%
0/10
1.5
 
 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 java.util.ArrayList;
 19  
 import java.util.Iterator;
 20  
 import java.util.List;
 21  
 
 22  
 
 23  
 /**
 24  
  * Class to hold management capabilities for standard document search. 
 25  
  * 
 26  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 27  
  *
 28  
  */
 29  
 public class StandardDocSearchCriteriaManager implements java.io.Serializable {
 30  
         
 31  
         private static final long serialVersionUID = -1898076444679158722L;
 32  
         
 33  0
     private List<List<StandardDocSearchCriteriaFieldContainer>> columnsPreSearchAttributes = new ArrayList<List<StandardDocSearchCriteriaFieldContainer>>();
 34  0
         private List<List<StandardDocSearchCriteriaFieldContainer>> columnsPostSearchAttributes = new ArrayList<List<StandardDocSearchCriteriaFieldContainer>>();
 35  
         
 36  0
         public StandardDocSearchCriteriaManager(int preSearchAttributeColumns, int postSearchAttributeColumns, boolean searchCriteriaDisplayed, boolean headerBarDisplayed) {
 37  0
                 setupColumns(preSearchAttributeColumns,postSearchAttributeColumns);
 38  0
         }
 39  
         
 40  
         private void setupColumns(int preSearchAttributeColumns, int postSearchAttributeColumns) {
 41  0
                 for (int i = 0; i < preSearchAttributeColumns; i++) {
 42  0
                         columnsPreSearchAttributes.add(new ArrayList<StandardDocSearchCriteriaFieldContainer>());
 43  
                 }
 44  0
                 for (int i = 0; i < postSearchAttributeColumns; i++) {
 45  0
                         columnsPostSearchAttributes.add(new ArrayList<StandardDocSearchCriteriaFieldContainer>());
 46  
                 }
 47  0
         }
 48  
         
 49  
         public List<StandardDocSearchCriteriaFieldContainer> getPreSearchAttributeMaxRows() {
 50  0
                 return getMaxRowsForList(columnsPreSearchAttributes);
 51  
         }
 52  
         
 53  
         public List<StandardDocSearchCriteriaFieldContainer> getPostSearchAttributeMaxRows() {
 54  0
                 return getMaxRowsForList(columnsPostSearchAttributes);
 55  
         }
 56  
         
 57  
         @SuppressWarnings("unchecked")
 58  
         private List<StandardDocSearchCriteriaFieldContainer> getMaxRowsForList(List<List<StandardDocSearchCriteriaFieldContainer>> columns) {
 59  0
                 List<StandardDocSearchCriteriaFieldContainer> biggestFieldContainerList = null;
 60  0
                 for (Iterator iter = columns.iterator(); iter.hasNext();) {
 61  0
                         List<StandardDocSearchCriteriaFieldContainer> fieldContainerList = (List<StandardDocSearchCriteriaFieldContainer>) iter.next();
 62  0
                         if (biggestFieldContainerList == null) {
 63  0
                                 biggestFieldContainerList = fieldContainerList;
 64  
                         } else {
 65  0
                                 if (fieldContainerList.size() > biggestFieldContainerList.size()) {
 66  0
                                         biggestFieldContainerList = fieldContainerList;
 67  
                                 }
 68  
                         }
 69  0
                 }
 70  0
                 return biggestFieldContainerList;
 71  
         }
 72  
         
 73  
         public int getMaxColumnCount() {
 74  0
                 return Math.max(columnsPreSearchAttributes.size(), columnsPostSearchAttributes.size());
 75  
         }
 76  
 
 77  
     public List<List<StandardDocSearchCriteriaFieldContainer>> getColumnsPreSearchAttributes() {
 78  0
                 return this.columnsPreSearchAttributes;
 79  
         }
 80  
 
 81  
         public void setColumnsPreSearchAttributes(List<List<StandardDocSearchCriteriaFieldContainer>> columnsPreSearchAttributes) {
 82  0
                 this.columnsPreSearchAttributes = columnsPreSearchAttributes;
 83  0
         }
 84  
 
 85  
         public List<List<StandardDocSearchCriteriaFieldContainer>> getColumnsPostSearchAttributes() {
 86  0
                 return this.columnsPostSearchAttributes;
 87  
         }
 88  
 
 89  
         public void setColumnsPostSearchAttributes(List<List<StandardDocSearchCriteriaFieldContainer>> columnsPostSearchAttributes) {
 90  0
                 this.columnsPostSearchAttributes = columnsPostSearchAttributes;
 91  0
         }
 92  
         
 93  
 }