1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kim.bo.ui;
17
18 import java.util.List;
19
20 import javax.persistence.Column;
21 import javax.persistence.Entity;
22 import javax.persistence.Id;
23 import javax.persistence.Table;
24
25 import org.kuali.rice.kew.util.KEWConstants;
26 import org.kuali.rice.kim.bo.entity.dto.KimPrincipalInfo;
27 import org.kuali.rice.kim.bo.group.dto.GroupInfo;
28 import org.kuali.rice.kim.bo.impl.RoleImpl;
29 import org.kuali.rice.kim.bo.role.dto.KimRoleInfo;
30 import org.kuali.rice.kim.document.KimTypeAttributesHelper;
31 import org.kuali.rice.kim.service.KIMServiceLocator;
32 import org.kuali.rice.kim.util.KimConstants;
33 import org.kuali.rice.kns.bo.BusinessObject;
34 import org.kuali.rice.kns.util.TypedArrayList;
35
36
37
38
39
40
41
42 @Entity
43 @Table(name="KRIM_PND_DLGN_MBR_T")
44 public class RoleDocumentDelegationMember extends KimDocumentBoBase {
45
46 private static final long serialVersionUID = 1L;
47
48 @Id
49 @Column(name="DLGN_MBR_ID")
50 protected String delegationMemberId;
51
52 @Id
53 @Column(name="ROLE_MBR_ID")
54 protected String roleMemberId;
55 protected String roleMemberMemberId;
56 protected String roleMemberMemberTypeCode;
57 protected String roleMemberName;
58 protected String roleMemberNamespaceCode;
59
60 private KimTypeAttributesHelper attributesHelper;
61
62 protected RoleImpl roleImpl = new RoleImpl();
63
64 @Id
65 @Column(name="DLGN_ID")
66 protected String delegationId;
67
68 @Column(name="MBR_ID")
69 protected String memberId;
70
71 @Column(name="MBR_TYP_CD")
72 protected String memberTypeCode = KimConstants.KimGroupMemberTypes.PRINCIPAL_MEMBER_TYPE;
73
74 protected String memberNamespaceCode;
75
76 @Column(name="MBR_NM")
77 protected String memberName;
78 protected List <RoleDocumentDelegationMemberQualifier> qualifiers = new TypedArrayList(RoleDocumentDelegationMemberQualifier.class);
79
80 protected String delegationTypeCode;
81
82
83
84
85 public String getDelegationTypeCode() {
86 return this.delegationTypeCode;
87 }
88
89
90
91
92 public void setDelegationTypeCode(String delegationTypeCode) {
93 this.delegationTypeCode = delegationTypeCode;
94 }
95
96 public String getDelegationId() {
97 return this.delegationId;
98 }
99
100 public void setDelegationId(String delegationId) {
101 this.delegationId = delegationId;
102 }
103
104
105
106
107 public List<RoleDocumentDelegationMemberQualifier> getQualifiers() {
108 return this.qualifiers;
109 }
110
111 public RoleDocumentDelegationMemberQualifier getQualifier(String kimAttributeDefnId) {
112 for(RoleDocumentDelegationMemberQualifier qualifier:qualifiers){
113 if(qualifier.getKimAttrDefnId().equals(kimAttributeDefnId))
114 return qualifier;
115 }
116 return null;
117 }
118
119
120
121
122 public void setQualifiers(List<RoleDocumentDelegationMemberQualifier> qualifiers) {
123 this.qualifiers = qualifiers;
124 }
125
126 public int getNumberOfQualifiers(){
127 return qualifiers==null?0:qualifiers.size();
128 }
129
130
131
132
133 public String getMemberId() {
134 return this.memberId;
135 }
136
137
138
139
140 public void setMemberId(String memberId) {
141 this.memberId = memberId;
142 }
143
144
145
146
147 public String getMemberName() {
148 return this.memberName;
149 }
150
151
152
153
154 public void setMemberName(String memberName) {
155 this.memberName = memberName;
156 }
157
158
159
160
161 public String getDelegationMemberId() {
162 return this.delegationMemberId;
163 }
164
165
166
167
168 public void setDelegationMemberId(String delegationMemberId) {
169 this.delegationMemberId = delegationMemberId;
170 }
171
172
173
174
175 public String getMemberTypeCode() {
176 return this.memberTypeCode;
177 }
178
179
180
181
182 public void setMemberTypeCode(String memberTypeCode) {
183 this.memberTypeCode = memberTypeCode;
184 }
185
186
187 public boolean isDelegationPrimary(){
188 return KEWConstants.DELEGATION_PRIMARY.equals(getDelegationTypeCode());
189 }
190
191 public boolean isDelegationSecondary(){
192 return KEWConstants.DELEGATION_SECONDARY.equals(getDelegationTypeCode());
193 }
194
195
196
197
198 public String getMemberNamespaceCode() {
199 if ( memberNamespaceCode == null ) {
200 populateDerivedValues();
201 }
202 return this.memberNamespaceCode;
203 }
204
205
206
207
208 public void setMemberNamespaceCode(String memberNamespaceCode) {
209 this.memberNamespaceCode = memberNamespaceCode;
210 }
211
212 protected void populateDerivedValues() {
213 if(KimConstants.KimUIConstants.MEMBER_TYPE_GROUP_CODE.equals(getMemberTypeCode())){
214 GroupInfo groupInfo = null;
215 groupInfo = KIMServiceLocator.getIdentityManagementService().getGroup(getMemberId());
216 if (groupInfo != null) {
217 setMemberNamespaceCode(groupInfo.getNamespaceCode());
218 }
219 } else if(KimConstants.KimUIConstants.MEMBER_TYPE_ROLE_CODE.equals(getMemberTypeCode())){
220 KimRoleInfo roleInfo = null;
221 roleInfo = KIMServiceLocator.getRoleService().getRole(getMemberId());
222 setMemberNamespaceCode(roleInfo.getNamespaceCode());
223 }
224 }
225
226
227
228
229 public String getRoleMemberId() {
230 return this.roleMemberId;
231 }
232
233
234
235
236 public void setRoleMemberId(String roleMemberId) {
237 this.roleMemberId = roleMemberId;
238 }
239
240 public boolean isRole(){
241 return getMemberTypeCode()!=null && getMemberTypeCode().equals(KimConstants.KimUIConstants.MEMBER_TYPE_ROLE_CODE);
242 }
243
244 public boolean isGroup(){
245 return getMemberTypeCode()!=null && getMemberTypeCode().equals(KimConstants.KimUIConstants.MEMBER_TYPE_GROUP_CODE);
246 }
247
248 public boolean isPrincipal(){
249 return getMemberTypeCode()!=null && getMemberTypeCode().equals(KimConstants.KimUIConstants.MEMBER_TYPE_PRINCIPAL_CODE);
250 }
251
252
253
254
255 public String getRoleMemberName() {
256 return this.roleMemberName;
257 }
258
259
260
261
262 public void setRoleMemberName(String roleMemberName) {
263 this.roleMemberName = roleMemberName;
264 }
265
266
267
268
269 public String getRoleMemberNamespaceCode() {
270 return this.roleMemberNamespaceCode;
271 }
272
273
274
275
276 public void setRoleMemberNamespaceCode(String roleMemberNamespaceCode) {
277 this.roleMemberNamespaceCode = roleMemberNamespaceCode;
278 }
279
280
281
282
283 public RoleImpl getRoleImpl() {
284 return this.roleImpl;
285 }
286
287
288
289
290 public void setRoleImpl(RoleImpl roleImpl) {
291 this.roleImpl = roleImpl;
292 setAttributesHelper(new KimTypeAttributesHelper(roleImpl.getKimRoleType()));
293 }
294
295
296
297
298 public KimTypeAttributesHelper getAttributesHelper() {
299 return this.attributesHelper;
300 }
301
302
303
304
305 public void setAttributesHelper(KimTypeAttributesHelper attributesHelper) {
306 this.attributesHelper = attributesHelper;
307 }
308
309
310
311
312 public String getRoleMemberMemberId() {
313 return this.roleMemberMemberId;
314 }
315
316
317
318
319 public void setRoleMemberMemberId(String roleMemberMemberId) {
320 this.roleMemberMemberId = roleMemberMemberId;
321 }
322
323
324
325
326 public String getRoleMemberMemberTypeCode() {
327 return this.roleMemberMemberTypeCode;
328 }
329
330
331
332
333 public void setRoleMemberMemberTypeCode(String roleMemberMemberTypeCode) {
334 this.roleMemberMemberTypeCode = roleMemberMemberTypeCode;
335 }
336 }