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.kew.util.KEWConstants; |
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
public final class ActivationTypeEnum { |
29 | |
|
30 | 0 | public static final ActivationTypeEnum SEQUENTIAL = new ActivationTypeEnum(KEWConstants.ROUTE_LEVEL_SEQUENCE, KEWConstants.ROUTE_LEVEL_SEQUENTIAL_NAME, KEWConstants.ROUTE_LEVEL_SEQUENCE_LABEL); |
31 | |
|
32 | 0 | public static final ActivationTypeEnum PARALLEL = new ActivationTypeEnum(KEWConstants.ROUTE_LEVEL_PARALLEL, KEWConstants.ROUTE_LEVEL_PARALLEL_NAME, KEWConstants.ROUTE_LEVEL_PARALLEL_LABEL); |
33 | |
|
34 | |
private final String code; |
35 | |
private final String name; |
36 | |
private final String label; |
37 | |
|
38 | 0 | private ActivationTypeEnum(String code, String name, String label) { |
39 | 0 | this.code = code; |
40 | 0 | this.name = name; |
41 | 0 | this.label = label; |
42 | 0 | } |
43 | |
|
44 | |
public String getCode() { |
45 | 0 | return code; |
46 | |
} |
47 | |
|
48 | |
public String getName() { |
49 | 0 | return name; |
50 | |
} |
51 | |
|
52 | |
public String getLabel() { |
53 | 0 | return label; |
54 | |
} |
55 | |
|
56 | |
public String toString() { |
57 | 0 | return "[ActivationTypeEnum: code=" + code + ", name=" + name + ", label=" + label + "]"; |
58 | |
} |
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
|
66 | |
public static ActivationTypeEnum lookupCode(String code) { |
67 | 0 | if (code == null) { |
68 | 0 | throw new IllegalArgumentException("Activation type code must be non-null"); |
69 | |
} |
70 | 0 | if (SEQUENTIAL.code.equals(code)) { |
71 | 0 | return SEQUENTIAL; |
72 | 0 | } else if (PARALLEL.code.equals(code)) { |
73 | 0 | return PARALLEL; |
74 | |
} else { |
75 | 0 | throw new IllegalArgumentException("Invalid activation code: '" + code + "'"); |
76 | |
} |
77 | |
} |
78 | |
|
79 | |
|
80 | |
|
81 | |
|
82 | |
|
83 | |
|
84 | |
|
85 | |
|
86 | |
public static ActivationTypeEnum parse(String string) { |
87 | 0 | if (string == null) { |
88 | 0 | throw new IllegalArgumentException("Activation type string must be non-null"); |
89 | |
} |
90 | 0 | if (SEQUENTIAL.code.equalsIgnoreCase(string) || |
91 | |
SEQUENTIAL.name.equalsIgnoreCase(string) || |
92 | |
SEQUENTIAL.label.equalsIgnoreCase(string)) { |
93 | 0 | return SEQUENTIAL; |
94 | 0 | } else if (PARALLEL.code.equalsIgnoreCase(string) || |
95 | |
PARALLEL.name.equalsIgnoreCase(string) || |
96 | |
PARALLEL.label.equalsIgnoreCase(string)) { |
97 | 0 | return PARALLEL; |
98 | |
} else { |
99 | 0 | throw new IllegalArgumentException("Invalid activation type: '" + string + "'"); |
100 | |
} |
101 | |
} |
102 | |
} |