1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.util;
17
18 import java.io.Serializable;
19
20 import org.kuali.rice.kew.actionrequest.ActionRequestValue;
21
22
23
24
25
26
27
28
29
30 public class ResponsibleParty implements Serializable {
31
32 private static final long serialVersionUID = 6788236688949489851L;
33
34 private String principalId;
35 private String groupId;
36 private String roleName;
37
38 public ResponsibleParty() {
39 }
40
41 public static ResponsibleParty fromGroupId(String groupId) {
42 ResponsibleParty responsibleParty = new ResponsibleParty();
43 responsibleParty.setGroupId(groupId);
44 return responsibleParty;
45 }
46
47 public static ResponsibleParty fromPrincipalId(String principalId) {
48 ResponsibleParty responsibleParty = new ResponsibleParty();
49 responsibleParty.setPrincipalId(principalId);
50 return responsibleParty;
51 }
52
53 public static ResponsibleParty fromRoleName(String roleName) {
54 ResponsibleParty responsibleParty = new ResponsibleParty();
55 responsibleParty.setRoleName(roleName);
56 return responsibleParty;
57 }
58
59 public String toString() {
60 StringBuffer sb = new StringBuffer("[");
61 if (principalId != null) {
62 sb.append("user=");
63 sb.append(principalId.toString());
64 } else if (groupId != null) {
65 sb.append("groupID=");
66 sb.append(groupId.toString());
67 } else if (roleName != null) {
68 sb.append("roleName=");
69 sb.append(roleName);
70 }
71 sb.append("]");
72 return sb.toString();
73 }
74
75 public String getGroupId() {
76 return groupId;
77 }
78
79 public String getPrincipalId() {
80 return principalId;
81 }
82
83 public void setPrincipalId(String principalId) {
84 this.principalId = principalId;
85 }
86
87 public String getRoleName() {
88 return roleName;
89 }
90
91 public void setGroupId(String groupId) {
92 this.groupId = groupId;
93 }
94
95 public void setRoleName(String roleName) {
96 this.roleName = roleName;
97 }
98
99 public boolean isPrincipal() {
100 return getPrincipalId() != null;
101 }
102
103 public boolean isGroup() {
104 return getGroupId() != null;
105 }
106
107 public boolean isRole() {
108 return getRoleName() != null;
109 }
110
111 }