01: /**
02: *
03: */package org.emforge.jbpm;
04:
05: import org.apache.commons.lang.StringUtils;
06:
07: /**
08: * Contains all EmForge BPM system roles
09: *
10: * @author szakusov, 28.02.2008: Implemented to keep all EmForge BPM system roles in one place
11: */
12: public enum BpmSystemRole {
13:
14: OWNER("_processOwner", "Owner");
15:
16: private String m_roleName;
17: private String m_variableName;
18:
19: /**
20: * @param i_roleName a role name
21: * @param i_varName a related variable name
22: */
23: private BpmSystemRole(String i_roleName, String i_varName) {
24:
25: m_roleName = i_roleName;
26: m_variableName = i_varName;
27: }
28:
29: /**
30: * @return Role name
31: */
32: public String getRoleName() {
33:
34: return m_roleName;
35: }
36:
37: /**
38: * @return Variable name
39: */
40: public String getVariableName() {
41:
42: return m_variableName;
43: }
44:
45: /**
46: * @param i_roleName a role name to check
47: * @return <code>True</code> if the specified role is system role
48: */
49: public static boolean isSystemRole(String i_roleName) {
50:
51: boolean result = false;
52:
53: for (BpmSystemRole role : BpmSystemRole.values()) {
54: if (StringUtils.equals(role.m_roleName, i_roleName)) {
55: result = true;
56: break;
57: }
58: }
59: return result;
60: }
61:
62: /**
63: * @param i_roleName a role name to get related variable name
64: * @return Variable name or empty value if specified role is not a system role
65: */
66: public static String getVariableName(String i_roleName) {
67:
68: String result = "";
69:
70: for (BpmSystemRole role : BpmSystemRole.values()) {
71: if (StringUtils.equals(role.m_roleName, i_roleName)) {
72: result = role.m_variableName;
73: break;
74: }
75: }
76: return result;
77: }
78:
79: /**
80: * @see java.lang.Enum#toString()
81: */
82: @Override
83: public String toString() {
84:
85: return m_roleName;
86: }
87: }
|