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