| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.rice.kns.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 | |
|
| 78 | 0 | } |
| 79 | |
|
| 80 | |
} |