1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.lookup.valuefinder;
17
18 import java.util.ArrayList;
19 import java.util.Collection;
20 import java.util.List;
21
22 import org.kuali.rice.core.util.KeyLabelPair;
23 import org.kuali.rice.kew.util.KEWConstants;
24 import org.kuali.rice.kns.lookup.keyvalues.KeyValuesBase;
25
26
27
28
29
30
31
32 public class DocumentRouteStatusValuesFinder extends KeyValuesBase {
33
34 private static
35 <T extends Comparable<? super T>> List<T> asSortedList(Collection<T> c) {
36 List<T> list = new ArrayList<T>(c);
37 java.util.Collections.sort(list);
38 return list;
39 }
40
41
42
43
44 public List getKeyValues() {
45 List<KeyLabelPair> keyValues = new ArrayList<KeyLabelPair>();
46 List<String> docStatusParentKeys = asSortedList(KEWConstants.DOCUMENT_STATUS_PARENT_TYPES.keySet());
47
48 for (String parentKey : docStatusParentKeys) {
49 KeyLabelPair keyLabel = new KeyLabelPair(parentKey,parentKey + " Statuses");
50 keyValues.add(keyLabel);
51
52
53 List<String> docStatusCodes = KEWConstants.DOCUMENT_STATUS_PARENT_TYPES.get(parentKey);
54 for(String docStatusCode : docStatusCodes){
55 KeyLabelPair docStat = new KeyLabelPair(docStatusCode, "- "+ KEWConstants.DOCUMENT_STATUSES.get(docStatusCode));
56 keyValues.add(docStat);
57 }
58 }
59 return keyValues;
60 }
61
62 }