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 | 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 | |
|
79 | 0 | } |
80 | |
|
81 | |
} |