Coverage Report - org.kuali.rice.kew.lookup.valuefinder.SavedSearchValuesFinder
 
Classes in this File Line Coverage Branch Coverage Complexity
SavedSearchValuesFinder
0%
0/20
0%
0/4
3
 
 1  
 /*
 2  
  * Copyright 2007-2009 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.lookup.valuefinder;
 17  
 
 18  
 import org.apache.commons.lang.StringUtils;
 19  
 import org.kuali.rice.core.api.util.ConcreteKeyValue;
 20  
 import org.kuali.rice.core.api.util.KeyValue;
 21  
 import org.kuali.rice.kew.service.KEWServiceLocator;
 22  
 import org.kuali.rice.krad.keyvalues.KeyValuesBase;
 23  
 import org.kuali.rice.krad.util.GlobalVariables;
 24  
 
 25  
 import java.util.ArrayList;
 26  
 import java.util.List;
 27  
 
 28  
 /**
 29  
  * This is a description of what this class does - chris don't forget to fill this in. 
 30  
  * 
 31  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 32  
  *
 33  
  */
 34  0
 public class SavedSearchValuesFinder extends KeyValuesBase {
 35  
 
 36  
         /**
 37  
          * @see org.kuali.rice.krad.keyvalues.KeyValuesFinder#getKeyValues()
 38  
          */
 39  
         @Override
 40  
         public List<KeyValue> getKeyValues() {
 41  0
                 List<KeyValue> savedSearchValues = new ArrayList<KeyValue>();
 42  0
                 savedSearchValues.add(new ConcreteKeyValue("", "Searches"));
 43  0
                 savedSearchValues.add(new ConcreteKeyValue("*ignore*", "-----"));
 44  0
                 savedSearchValues.add(new ConcreteKeyValue("*ignore*", "-Named Searches"));
 45  0
                 List<KeyValue> namedSearches = KEWServiceLocator.getDocumentSearchService().getNamedSearches(GlobalVariables.getUserSession().getPrincipalId());
 46  0
                 for (KeyValue keyValue : namedSearches) {
 47  0
                         String label = StringUtils.abbreviate(keyValue.getValue(), 75);
 48  0
                         KeyValue keyLabel = new ConcreteKeyValue(keyValue.getKey(),label);
 49  0
                         savedSearchValues.add(keyLabel);
 50  0
                 }
 51  0
                 savedSearchValues.add(new ConcreteKeyValue("*ignore*", "-----"));
 52  0
                 savedSearchValues.add(new ConcreteKeyValue("*ignore*", "-Recent Searches"));
 53  0
                 List<KeyValue> mostRecentSearches = KEWServiceLocator.getDocumentSearchService().getMostRecentSearches(GlobalVariables.getUserSession().getPrincipalId());
 54  0
                 for (KeyValue keyValue : mostRecentSearches) {
 55  0
                         String label = StringUtils.abbreviate(keyValue.getValue(), 75);
 56  0
                         KeyValue keyLabel = new ConcreteKeyValue(keyValue.getKey(),label);
 57  0
                         savedSearchValues.add(keyLabel);
 58  0
                 }
 59  0
                 return savedSearchValues;
 60  
         }
 61  
 
 62  
 }