Coverage Report - org.kuali.rice.krad.keyvalues.KeyValuesBase
 
Classes in this File Line Coverage Branch Coverage Complexity
KeyValuesBase
0%
0/22
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.krad.keyvalues;
 17  
 
 18  
 import org.kuali.rice.core.api.util.KeyValue;
 19  
 
 20  
 import java.io.Serializable;
 21  
 import java.util.ArrayList;
 22  
 import java.util.Collection;
 23  
 import java.util.Collections;
 24  
 import java.util.HashMap;
 25  
 import java.util.List;
 26  
 import java.util.Map;
 27  
 
 28  0
 public abstract class KeyValuesBase implements KeyValuesFinder, Serializable {
 29  
     public Collection<String> getOptionLabels() {
 30  0
             Collection<String> optionLabels = new ArrayList<String>();
 31  
 
 32  0
             Collection<KeyValue> keyLabels = getKeyValues();
 33  0
         for (KeyValue keyLabel : keyLabels) {
 34  0
                 optionLabels.add(keyLabel.getValue());
 35  
         }
 36  0
         return optionLabels;
 37  
     }
 38  
 
 39  
     public Collection<String> getOptionValues() {
 40  0
             Collection<String> optionValues = new ArrayList<String>();
 41  
 
 42  0
             Collection<KeyValue> keyLabels = getKeyValues();
 43  0
         for (KeyValue keyLabel : keyLabels) {
 44  0
                 optionValues.add(keyLabel.getKey());
 45  
         }
 46  0
         return optionValues;
 47  
     }
 48  
 
 49  
     @Override
 50  
         public Map<String, String> getKeyLabelMap() {
 51  0
         Map<String, String> keyLabelMap = new HashMap<String, String>();
 52  
 
 53  0
         List<KeyValue> keyLabels = getKeyValues();
 54  0
         for (KeyValue keyLabel : keyLabels) {
 55  0
                 keyLabelMap.put(keyLabel.getKey(), keyLabel.getValue());
 56  
         }
 57  
 
 58  0
         return keyLabelMap;
 59  
     }
 60  
 
 61  
     @Override
 62  
         public String getKeyLabel(String key) {
 63  0
         Map<String, String> keyLabelMap = getKeyLabelMap();
 64  
 
 65  0
         if (keyLabelMap.containsKey(key)) {
 66  0
             return keyLabelMap.get(key);
 67  
         }
 68  0
         return null;
 69  
     }
 70  
     
 71  
     @Override
 72  
         public List<KeyValue> getKeyValues(boolean includeActiveOnly){
 73  0
             return Collections.emptyList();
 74  
     }
 75  
     
 76  
         @Override
 77  
         public void clearInternalCache() {
 78  
                 // do nothing
 79  0
         }
 80  
 
 81  
 }