1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kew.api.action; |
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 | 0 | @XmlRootElement(name = "recipientType") |
26 | |
@XmlType(name = "RecipientTypeType") |
27 | |
@XmlEnum |
28 | |
public enum RecipientType implements Coded { |
29 | |
|
30 | 0 | @XmlEnumValue("U") PRINCIPAL("U", "principal"), |
31 | 0 | @XmlEnumValue("W") GROUP("W", "group"), |
32 | 0 | @XmlEnumValue("R") ROLE("R", "role"); |
33 | |
|
34 | |
private final String code; |
35 | |
private final String label; |
36 | |
|
37 | 0 | RecipientType(String code, String label) { |
38 | 0 | this.code = code; |
39 | 0 | this.label = label; |
40 | 0 | } |
41 | |
|
42 | |
@Override |
43 | |
public String getCode() { |
44 | 0 | return code; |
45 | |
} |
46 | |
|
47 | |
public String getLabel() { |
48 | 0 | return label; |
49 | |
} |
50 | |
|
51 | |
public static RecipientType fromCode(String code) { |
52 | 0 | if (code == null) { |
53 | 0 | return null; |
54 | |
} |
55 | 0 | for (RecipientType request : values()) { |
56 | 0 | if (request.code.equals(code)) { |
57 | 0 | return request; |
58 | |
} |
59 | |
} |
60 | 0 | throw new IllegalArgumentException("Failed to locate the RecipientType with the given code: " + code); |
61 | |
} |
62 | |
|
63 | |
} |