1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kew.rule.bo; |
17 | |
|
18 | |
import org.kuali.rice.core.api.delegation.DelegationType; |
19 | |
import org.kuali.rice.core.api.util.ConcreteKeyValue; |
20 | |
import org.kuali.rice.core.api.util.KeyValue; |
21 | |
import org.kuali.rice.kew.api.KewApiConstants; |
22 | |
import org.kuali.rice.kns.util.KNSGlobalVariables; |
23 | |
import org.kuali.rice.kns.web.struts.form.KualiMaintenanceForm; |
24 | |
import org.kuali.rice.krad.keyvalues.KeyValuesBase; |
25 | |
|
26 | |
import java.util.ArrayList; |
27 | |
import java.util.Collections; |
28 | |
import java.util.List; |
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | 0 | public class DelegationTypeValuesFinder extends KeyValuesBase { |
36 | |
|
37 | |
private static final List<KeyValue> C_DELEGATION_TYPES; |
38 | |
private static final List<KeyValue> C_DELEGATION_TYPES_FOR_MAIN_DOCS; |
39 | |
static { |
40 | |
|
41 | 0 | final List<KeyValue> delegationTypes = new ArrayList<KeyValue>(); |
42 | 0 | final List<KeyValue> delegationTypesForMaintDocs = new ArrayList<KeyValue>(); |
43 | |
|
44 | 0 | for (DelegationType delegationType : DelegationType.values()) { |
45 | 0 | delegationTypes.add(new ConcreteKeyValue(delegationType.getCode(), delegationType.getLabel())); |
46 | 0 | delegationTypesForMaintDocs.add(new ConcreteKeyValue(delegationType.getCode(), delegationType.getLabel())); |
47 | |
} |
48 | |
|
49 | 0 | delegationTypes.add(new ConcreteKeyValue(KewApiConstants.DELEGATION_BOTH, KewApiConstants.DELEGATION_BOTH_LABEL)); |
50 | |
|
51 | 0 | C_DELEGATION_TYPES = Collections.unmodifiableList(delegationTypes); |
52 | 0 | C_DELEGATION_TYPES_FOR_MAIN_DOCS = Collections.unmodifiableList(delegationTypesForMaintDocs); |
53 | 0 | } |
54 | |
|
55 | |
@Override |
56 | |
public List<KeyValue> getKeyValues() { |
57 | |
|
58 | 0 | return (KNSGlobalVariables.getKualiForm() instanceof KualiMaintenanceForm) ? C_DELEGATION_TYPES_FOR_MAIN_DOCS : C_DELEGATION_TYPES; |
59 | |
} |
60 | |
|
61 | |
} |