Coverage Report - org.kuali.rice.kns.lookup.keyvalues.KeyValuesBase
 
Classes in this File Line Coverage Branch Coverage Complexity
KeyValuesBase
0%
0/28
0%
0/8
1.833
 
 1  
 /*
 2  
  * Copyright 2005-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.kns.lookup.keyvalues;
 17  
 
 18  
 import java.util.ArrayList;
 19  
 import java.util.Collection;
 20  
 import java.util.HashMap;
 21  
 import java.util.Iterator;
 22  
 import java.util.List;
 23  
 import java.util.Map;
 24  
 
 25  
 import org.kuali.rice.core.util.KeyLabelPair;
 26  
 
 27  
 /**
 28  
  * This class returns list of chart key value pairs.
 29  
  *
 30  
  *
 31  
  */
 32  0
 public abstract class KeyValuesBase implements KeyValuesFinder {
 33  
     public Collection getOptionLabels() {
 34  0
         List optionLabels = new ArrayList();
 35  
 
 36  0
         List keyLabels = getKeyValues();
 37  0
         for (Iterator iter = keyLabels.iterator(); iter.hasNext();) {
 38  0
             KeyLabelPair keyLabel = (KeyLabelPair) iter.next();
 39  0
             optionLabels.add(keyLabel.getLabel());
 40  0
         }
 41  0
         return optionLabels;
 42  
     }
 43  
 
 44  
     public Collection getOptionValues() {
 45  0
         List optionValues = new ArrayList();
 46  
 
 47  0
         List keyLabels = getKeyValues();
 48  0
         for (Iterator iter = keyLabels.iterator(); iter.hasNext();) {
 49  0
             KeyLabelPair keyLabel = (KeyLabelPair) iter.next();
 50  0
             optionValues.add(keyLabel.getKey());
 51  0
         }
 52  0
         return optionValues;
 53  
     }
 54  
 
 55  
     /**
 56  
      * @see org.kuali.rice.kns.lookup.keyvalues.KeyValuesFinder#getKeyLabelMap()
 57  
      */
 58  
     public Map getKeyLabelMap() {
 59  0
         Map keyLabelMap = new HashMap();
 60  
 
 61  0
         List keyLabels = getKeyValues();
 62  0
         for (Iterator iter = keyLabels.iterator(); iter.hasNext();) {
 63  0
             KeyLabelPair keyLabel = (KeyLabelPair) iter.next();
 64  0
             keyLabelMap.put(keyLabel.getKey(), keyLabel.getLabel());
 65  0
         }
 66  
 
 67  0
         return keyLabelMap;
 68  
     }
 69  
 
 70  
     /**
 71  
      * @see org.kuali.rice.kns.lookup.keyvalues.KeyValuesFinder#getKeyLabel(java.lang.Object)
 72  
      */
 73  
     public String getKeyLabel(Object key) {
 74  0
         Map keyLabelMap = getKeyLabelMap();
 75  
 
 76  0
         if (keyLabelMap.containsKey(key)) {
 77  0
             return (String) keyLabelMap.get(key);
 78  
         }
 79  
         else {
 80  0
             return "";
 81  
         }
 82  
     }
 83  
     
 84  
     /***
 85  
      * @see org.kuali.rice.kns.lookup.keyvalues.KeyValuesFinder#getInactiveKeyValues()
 86  
      */
 87  
     public List getKeyValues(boolean includeActiveOnly){
 88  0
             return new ArrayList();
 89  
     }
 90  
     
 91  
     /**
 92  
      * @see org.kuali.rice.kns.lookup.keyvalues.KeyValuesFinder#clearInternalCache()
 93  
      */
 94  
         public void clearInternalCache() {
 95  
                 // do nothing
 96  0
         }
 97  
 
 98  
 }