1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kew.api.document; |
17 | |
|
18 | |
import javax.xml.bind.annotation.XmlEnum; |
19 | |
import javax.xml.bind.annotation.XmlEnumValue; |
20 | |
import javax.xml.bind.annotation.XmlRootElement; |
21 | |
import javax.xml.bind.annotation.XmlType; |
22 | |
|
23 | |
import org.kuali.rice.core.api.mo.common.Coded; |
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | 0 | @XmlRootElement(name = "documentStatus") |
32 | |
@XmlType(name = "DocumentStatusType") |
33 | |
@XmlEnum |
34 | |
public enum DocumentStatus implements Coded { |
35 | |
|
36 | 0 | @XmlEnumValue("I") INITIATED("I"), |
37 | 0 | @XmlEnumValue("S") SAVED("S"), |
38 | 0 | @XmlEnumValue("R") ENROUTE("R"), |
39 | 0 | @XmlEnumValue("P") PROCESSED("P"), |
40 | 0 | @XmlEnumValue("F") FINAL("F"), |
41 | 0 | @XmlEnumValue("X") CANCELED("X"), |
42 | 0 | @XmlEnumValue("D") DISAPPROVED("D"), |
43 | 0 | @XmlEnumValue("E") EXCEPTION("E"); |
44 | |
|
45 | |
private final String code; |
46 | |
|
47 | 0 | private DocumentStatus(String code) { |
48 | 0 | this.code = code; |
49 | 0 | } |
50 | |
|
51 | |
@Override |
52 | |
public String getCode() { |
53 | 0 | return code; |
54 | |
} |
55 | |
|
56 | |
public String getLabel() { |
57 | 0 | return name(); |
58 | |
} |
59 | |
|
60 | |
public static DocumentStatus fromCode(String code) { |
61 | 0 | if (code == null) { |
62 | 0 | return null; |
63 | |
} |
64 | 0 | for (DocumentStatus status : values()) { |
65 | 0 | if (status.code.equals(code)) { |
66 | 0 | return status; |
67 | |
} |
68 | |
} |
69 | 0 | throw new IllegalArgumentException("Failed to locate the DocumentStatus with the given code: " + code); |
70 | |
} |
71 | |
|
72 | |
} |