1 | |
package org.kuali.student.lum.program.client.major; |
2 | |
|
3 | |
import java.util.ArrayList; |
4 | |
import java.util.List; |
5 | |
|
6 | |
import org.kuali.student.lum.program.client.ProgramStatus; |
7 | |
import org.kuali.student.lum.program.client.properties.ProgramProperties; |
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | 0 | public enum ActionType { |
13 | 0 | NO_ACTION(ProgramProperties.get().programAction_title()), |
14 | 0 | MODIFY(ProgramProperties.get().programAction_modify()), |
15 | 0 | MODIFY_VERSION(ProgramProperties.get().programAction_modifyVersion()); |
16 | |
|
17 | |
private final String value; |
18 | |
|
19 | |
private static List<String> values; |
20 | |
|
21 | 0 | ActionType(String value) { |
22 | 0 | this.value = value; |
23 | 0 | } |
24 | |
|
25 | |
public String getValue() { |
26 | 0 | return value; |
27 | |
} |
28 | |
|
29 | |
public static List<String> getValues() { |
30 | 0 | if (values == null) { |
31 | 0 | values = new ArrayList<String>(); |
32 | 0 | for (ActionType actionType : ActionType.values()) { |
33 | 0 | values.add(actionType.getValue()); |
34 | |
} |
35 | |
} |
36 | 0 | return values; |
37 | |
} |
38 | |
|
39 | |
public static List<String> getValues(boolean showAllActions){ |
40 | 0 | if (showAllActions){ |
41 | 0 | return getValues(); |
42 | |
} else { |
43 | 0 | List<String> values = new ArrayList<String>(); |
44 | 0 | values.add(NO_ACTION.getValue()); |
45 | 0 | values.add(MODIFY.getValue()); |
46 | |
|
47 | 0 | return values; |
48 | |
} |
49 | |
} |
50 | |
|
51 | |
public static ActionType of(String value) { |
52 | 0 | for (ActionType actionType : values()) { |
53 | 0 | if (actionType.getValue().equals(value)) { |
54 | 0 | return actionType; |
55 | |
} |
56 | |
} |
57 | 0 | return null; |
58 | |
} |
59 | |
} |