1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
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 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | 0 | public abstract class KeyValuesBase implements KeyValuesFinder, Serializable { |
34 | |
|
35 | |
public Collection<String> getOptionLabels() { |
36 | 0 | Collection<String> optionLabels = new ArrayList<String>(); |
37 | |
|
38 | 0 | Collection<KeyValue> keyLabels = getKeyValues(); |
39 | 0 | for (KeyValue keyLabel : keyLabels) { |
40 | 0 | optionLabels.add(keyLabel.getValue()); |
41 | |
} |
42 | 0 | return optionLabels; |
43 | |
} |
44 | |
|
45 | |
public Collection<String> getOptionValues() { |
46 | 0 | Collection<String> optionValues = new ArrayList<String>(); |
47 | |
|
48 | 0 | Collection<KeyValue> keyLabels = getKeyValues(); |
49 | 0 | for (KeyValue keyLabel : keyLabels) { |
50 | 0 | optionValues.add(keyLabel.getKey()); |
51 | |
} |
52 | 0 | return optionValues; |
53 | |
} |
54 | |
|
55 | |
@Override |
56 | |
public Map<String, String> getKeyLabelMap() { |
57 | 0 | Map<String, String> keyLabelMap = new HashMap<String, String>(); |
58 | |
|
59 | 0 | List<KeyValue> keyLabels = getKeyValues(); |
60 | 0 | for (KeyValue keyLabel : keyLabels) { |
61 | 0 | keyLabelMap.put(keyLabel.getKey(), keyLabel.getValue()); |
62 | |
} |
63 | |
|
64 | 0 | return keyLabelMap; |
65 | |
} |
66 | |
|
67 | |
@Override |
68 | |
public String getKeyLabel(String key) { |
69 | 0 | Map<String, String> keyLabelMap = getKeyLabelMap(); |
70 | |
|
71 | 0 | if (keyLabelMap.containsKey(key)) { |
72 | 0 | return keyLabelMap.get(key); |
73 | |
} |
74 | 0 | return null; |
75 | |
} |
76 | |
|
77 | |
@Override |
78 | |
public List<KeyValue> getKeyValues(boolean includeActiveOnly){ |
79 | 0 | return Collections.emptyList(); |
80 | |
} |
81 | |
|
82 | |
@Override |
83 | |
public void clearInternalCache() { |
84 | |
|
85 | 0 | } |
86 | |
|
87 | |
} |