1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.lm.leaverequest;
17
18
19 public enum LeaveRequestActionValue {
20 DEFER("W", "Defer"),
21 APPROVE("A", "Approve"),
22 DISAPPROVE("D", "Disapprove"),
23 NO_ACTION("", "No Action");
24
25 public final String code;
26 public final String label;
27
28 private LeaveRequestActionValue(String code, String label) {
29 this.code = code;
30 this.label = label;
31 }
32
33 public String getCode() {
34 return this.code;
35 }
36
37 public String getLabel() {
38 return this.label;
39 }
40
41 public static LeaveRequestActionValue fromCode(String code) {
42 if (code == null) {
43 return null;
44 }
45 for (LeaveRequestActionValue type : values()) {
46 if (type.code.equals(code)) {
47 return type;
48 }
49 }
50 throw new IllegalArgumentException("Failed to locate the LeaveRequestAction with the given code: " + code);
51 }
52
53 }