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