Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
DocumentRouteStatusValuesFinder |
|
| 2.0;2 |
1 | /* | |
2 | * Copyright 2007-2009 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.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 | * This is a description of what this class does - chris don't forget to fill this in. | |
28 | * | |
29 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
30 | * | |
31 | */ | |
32 | 0 | public class DocumentRouteStatusValuesFinder extends KeyValuesBase { |
33 | ||
34 | private static | |
35 | <T extends Comparable<? super T>> List<T> asSortedList(Collection<T> c) { | |
36 | 0 | List<T> list = new ArrayList<T>(c); |
37 | 0 | java.util.Collections.sort(list); |
38 | 0 | return list; |
39 | } | |
40 | ||
41 | /** | |
42 | * @see org.kuali.rice.kns.lookup.keyvalues.KeyValuesFinder#getKeyValues() | |
43 | */ | |
44 | public List getKeyValues() { | |
45 | 0 | List<KeyLabelPair> keyValues = new ArrayList<KeyLabelPair>(); |
46 | 0 | List<String> docStatusParentKeys = asSortedList(KEWConstants.DOCUMENT_STATUS_PARENT_TYPES.keySet()); |
47 | ||
48 | 0 | for (String parentKey : docStatusParentKeys) { |
49 | 0 | KeyLabelPair keyLabel = new KeyLabelPair(parentKey,parentKey + " Statuses"); |
50 | 0 | keyValues.add(keyLabel); |
51 | ||
52 | // each parent key, pending, successful, unsuccessful each has a sub list of real document statuses | |
53 | 0 | List<String> docStatusCodes = KEWConstants.DOCUMENT_STATUS_PARENT_TYPES.get(parentKey); |
54 | 0 | for(String docStatusCode : docStatusCodes){ |
55 | 0 | KeyLabelPair docStat = new KeyLabelPair(docStatusCode, "- "+ KEWConstants.DOCUMENT_STATUSES.get(docStatusCode)); |
56 | 0 | keyValues.add(docStat); |
57 | 0 | } |
58 | 0 | } |
59 | 0 | return keyValues; |
60 | } | |
61 | ||
62 | } |