1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.rice.kew.engine.node; |
18 | |
|
19 | |
import org.kuali.rice.core.api.mo.common.Coded; |
20 | |
import org.kuali.rice.kew.util.KEWConstants; |
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
public final class ActivationTypeEnum implements Coded { |
30 | |
|
31 | 0 | public static final ActivationTypeEnum SEQUENTIAL = new ActivationTypeEnum(KEWConstants.ROUTE_LEVEL_SEQUENCE, KEWConstants.ROUTE_LEVEL_SEQUENTIAL_NAME, KEWConstants.ROUTE_LEVEL_SEQUENCE_LABEL); |
32 | |
|
33 | 0 | public static final ActivationTypeEnum PARALLEL = new ActivationTypeEnum(KEWConstants.ROUTE_LEVEL_PARALLEL, KEWConstants.ROUTE_LEVEL_PARALLEL_NAME, KEWConstants.ROUTE_LEVEL_PARALLEL_LABEL); |
34 | |
|
35 | |
private final String code; |
36 | |
private final String name; |
37 | |
private final String label; |
38 | |
|
39 | 0 | private ActivationTypeEnum(String code, String name, String label) { |
40 | 0 | this.code = code; |
41 | 0 | this.name = name; |
42 | 0 | this.label = label; |
43 | 0 | } |
44 | |
|
45 | |
public String getCode() { |
46 | 0 | return code; |
47 | |
} |
48 | |
|
49 | |
public String getName() { |
50 | 0 | return name; |
51 | |
} |
52 | |
|
53 | |
public String getLabel() { |
54 | 0 | return label; |
55 | |
} |
56 | |
|
57 | |
public String toString() { |
58 | 0 | return "[ActivationTypeEnum: code=" + code + ", name=" + name + ", label=" + label + "]"; |
59 | |
} |
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
|
66 | |
|
67 | |
public static ActivationTypeEnum lookupCode(String code) { |
68 | 0 | if (code == null) { |
69 | 0 | throw new IllegalArgumentException("Activation type code must be non-null"); |
70 | |
} |
71 | 0 | if (SEQUENTIAL.code.equals(code)) { |
72 | 0 | return SEQUENTIAL; |
73 | 0 | } else if (PARALLEL.code.equals(code)) { |
74 | 0 | return PARALLEL; |
75 | |
} else { |
76 | 0 | throw new IllegalArgumentException("Invalid activation code: '" + code + "'"); |
77 | |
} |
78 | |
} |
79 | |
|
80 | |
|
81 | |
|
82 | |
|
83 | |
|
84 | |
|
85 | |
|
86 | |
|
87 | |
public static ActivationTypeEnum parse(String string) { |
88 | 0 | if (string == null) { |
89 | 0 | throw new IllegalArgumentException("Activation type string must be non-null"); |
90 | |
} |
91 | 0 | if (SEQUENTIAL.code.equalsIgnoreCase(string) || |
92 | |
SEQUENTIAL.name.equalsIgnoreCase(string) || |
93 | |
SEQUENTIAL.label.equalsIgnoreCase(string)) { |
94 | 0 | return SEQUENTIAL; |
95 | 0 | } else if (PARALLEL.code.equalsIgnoreCase(string) || |
96 | |
PARALLEL.name.equalsIgnoreCase(string) || |
97 | |
PARALLEL.label.equalsIgnoreCase(string)) { |
98 | 0 | return PARALLEL; |
99 | |
} else { |
100 | 0 | throw new IllegalArgumentException("Invalid activation type: '" + string + "'"); |
101 | |
} |
102 | |
} |
103 | |
} |