1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.tklm.leave.request;
17
18 import org.apache.log4j.Logger;
19 import org.kuali.kpme.tklm.leave.payout.web.LeavePayoutAction;
20
21
22 public enum LeaveRequestActionValue {
23 DEFER("W", "Defer"),
24 APPROVE("A", "Approve"),
25 DISAPPROVE("D", "Disapprove"),
26 NO_ACTION("", "No Action");
27
28 public final String code;
29 public final String label;
30 private static final Logger LOG = Logger.getLogger(LeaveRequestActionValue.class);
31
32 private LeaveRequestActionValue(String code, String label) {
33 this.code = code;
34 this.label = label;
35 }
36
37 public String getCode() {
38 return this.code;
39 }
40
41 public String getLabel() {
42 return this.label;
43 }
44
45 public static LeaveRequestActionValue fromCode(String code) {
46 if (code == null) {
47 return null;
48 }
49 for (LeaveRequestActionValue type : values()) {
50 if (type.code.equals(code)) {
51 return type;
52 }
53 }
54
55 LOG.warn("Failed to locate the LeaveRequestAction with the given code: " + code);
56 return null;
57 }
58
59 }