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 | 0 | public ResponsibleParty() { |
39 | 0 | } |
40 | |
|
41 | |
public static ResponsibleParty fromGroupId(String groupId) { |
42 | 0 | ResponsibleParty responsibleParty = new ResponsibleParty(); |
43 | 0 | responsibleParty.setGroupId(groupId); |
44 | 0 | return responsibleParty; |
45 | |
} |
46 | |
|
47 | |
public static ResponsibleParty fromPrincipalId(String principalId) { |
48 | 0 | ResponsibleParty responsibleParty = new ResponsibleParty(); |
49 | 0 | responsibleParty.setPrincipalId(principalId); |
50 | 0 | return responsibleParty; |
51 | |
} |
52 | |
|
53 | |
public static ResponsibleParty fromRoleName(String roleName) { |
54 | 0 | ResponsibleParty responsibleParty = new ResponsibleParty(); |
55 | 0 | responsibleParty.setRoleName(roleName); |
56 | 0 | return responsibleParty; |
57 | |
} |
58 | |
|
59 | |
public String toString() { |
60 | 0 | StringBuffer sb = new StringBuffer("["); |
61 | 0 | if (principalId != null) { |
62 | 0 | sb.append("user="); |
63 | 0 | sb.append(principalId.toString()); |
64 | 0 | } else if (groupId != null) { |
65 | 0 | sb.append("groupID="); |
66 | 0 | sb.append(groupId.toString()); |
67 | 0 | } else if (roleName != null) { |
68 | 0 | sb.append("roleName="); |
69 | 0 | sb.append(roleName); |
70 | |
} |
71 | 0 | sb.append("]"); |
72 | 0 | return sb.toString(); |
73 | |
} |
74 | |
|
75 | |
public String getGroupId() { |
76 | 0 | return groupId; |
77 | |
} |
78 | |
|
79 | |
public String getPrincipalId() { |
80 | 0 | return principalId; |
81 | |
} |
82 | |
|
83 | |
public void setPrincipalId(String principalId) { |
84 | 0 | this.principalId = principalId; |
85 | 0 | } |
86 | |
|
87 | |
public String getRoleName() { |
88 | 0 | return roleName; |
89 | |
} |
90 | |
|
91 | |
public void setGroupId(String groupId) { |
92 | 0 | this.groupId = groupId; |
93 | 0 | } |
94 | |
|
95 | |
public void setRoleName(String roleName) { |
96 | 0 | this.roleName = roleName; |
97 | 0 | } |
98 | |
|
99 | |
public boolean isPrincipal() { |
100 | 0 | return getPrincipalId() != null; |
101 | |
} |
102 | |
|
103 | |
public boolean isGroup() { |
104 | 0 | return getGroupId() != null; |
105 | |
} |
106 | |
|
107 | |
public boolean isRole() { |
108 | 0 | return getRoleName() != null; |
109 | |
} |
110 | |
|
111 | |
} |