1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kim.document; |
17 | |
|
18 | |
import java.util.ArrayList; |
19 | |
import java.util.Comparator; |
20 | |
import java.util.List; |
21 | |
|
22 | |
import org.apache.commons.lang.StringUtils; |
23 | |
import org.kuali.rice.kew.dto.DocumentRouteStatusChangeDTO; |
24 | |
import org.kuali.rice.kim.api.responsibility.ResponsibilityService; |
25 | |
import org.kuali.rice.kim.api.services.KimApiServiceLocator; |
26 | |
import org.kuali.rice.kim.api.type.KimType; |
27 | |
import org.kuali.rice.kim.bo.ui.KimDocumentRoleMember; |
28 | |
import org.kuali.rice.kim.bo.ui.KimDocumentRolePermission; |
29 | |
import org.kuali.rice.kim.bo.ui.KimDocumentRoleQualifier; |
30 | |
import org.kuali.rice.kim.bo.ui.KimDocumentRoleResponsibility; |
31 | |
import org.kuali.rice.kim.bo.ui.KimDocumentRoleResponsibilityAction; |
32 | |
import org.kuali.rice.kim.bo.ui.RoleDocumentDelegation; |
33 | |
import org.kuali.rice.kim.bo.ui.RoleDocumentDelegationMember; |
34 | |
import org.kuali.rice.kim.bo.ui.RoleDocumentDelegationMemberQualifier; |
35 | |
import org.kuali.rice.kim.impl.responsibility.ResponsibilityInternalService; |
36 | |
import org.kuali.rice.kim.impl.type.IdentityManagementTypeAttributeTransactionalDocument; |
37 | |
import org.kuali.rice.kim.service.KIMServiceLocatorInternal; |
38 | |
import org.kuali.rice.kim.util.KimConstants; |
39 | |
import org.kuali.rice.kim.web.struts.form.IdentityManagementRoleDocumentForm; |
40 | |
import org.kuali.rice.krad.datadictionary.AttributeDefinition; |
41 | |
import org.kuali.rice.krad.datadictionary.KimAttributeDefinition; |
42 | |
import org.kuali.rice.krad.service.SequenceAccessorService; |
43 | |
import org.springframework.util.AutoPopulatingList; |
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
public class IdentityManagementRoleDocument extends IdentityManagementTypeAttributeTransactionalDocument { |
53 | |
|
54 | |
private static final long serialVersionUID = 1L; |
55 | |
|
56 | |
protected String roleId; |
57 | |
protected String roleTypeId; |
58 | |
protected String roleTypeName; |
59 | 0 | protected String roleNamespace = ""; |
60 | 0 | protected String roleName = ""; |
61 | 0 | protected String roleDescription = ""; |
62 | |
|
63 | 0 | protected boolean active = true; |
64 | |
|
65 | |
protected boolean editing; |
66 | |
|
67 | 0 | protected List<KimDocumentRolePermission> permissions = new AutoPopulatingList(KimDocumentRolePermission.class); |
68 | 0 | protected List<KimDocumentRoleResponsibility> responsibilities = new AutoPopulatingList(KimDocumentRoleResponsibility.class); |
69 | 0 | protected List<KimDocumentRoleMember> members = new AutoPopulatingList(KimDocumentRoleMember.class); |
70 | 0 | private List<RoleDocumentDelegationMember> delegationMembers = new AutoPopulatingList(RoleDocumentDelegationMember.class); |
71 | 0 | private List<RoleDocumentDelegation> delegations = new AutoPopulatingList(RoleDocumentDelegation.class); |
72 | |
|
73 | |
transient private ResponsibilityService responsibilityService; |
74 | |
transient private ResponsibilityInternalService responsibilityInternalService; |
75 | |
|
76 | 0 | public IdentityManagementRoleDocument() { |
77 | 0 | } |
78 | |
|
79 | |
|
80 | |
|
81 | |
|
82 | |
public boolean isActive() { |
83 | 0 | return this.active; |
84 | |
} |
85 | |
|
86 | |
|
87 | |
|
88 | |
|
89 | |
public void setActive(boolean active) { |
90 | 0 | this.active = active; |
91 | 0 | } |
92 | |
|
93 | |
|
94 | |
|
95 | |
|
96 | |
public void setRoleId(String roleId) { |
97 | 0 | this.roleId = roleId; |
98 | 0 | } |
99 | |
|
100 | |
|
101 | |
|
102 | |
|
103 | |
public String getRoleName() { |
104 | 0 | return this.roleName; |
105 | |
} |
106 | |
|
107 | |
|
108 | |
|
109 | |
|
110 | |
public void setRoleName(String roleName) { |
111 | 0 | this.roleName = roleName; |
112 | 0 | } |
113 | |
|
114 | |
|
115 | |
|
116 | |
|
117 | |
public String getRoleDescription() { |
118 | 0 | return this.roleDescription; |
119 | |
} |
120 | |
|
121 | |
|
122 | |
|
123 | |
|
124 | |
public void setRoleDescription(String roleDescription) { |
125 | 0 | this.roleDescription = roleDescription; |
126 | 0 | } |
127 | |
|
128 | |
|
129 | |
|
130 | |
|
131 | |
public String getRoleNamespace() { |
132 | 0 | return this.roleNamespace; |
133 | |
} |
134 | |
|
135 | |
|
136 | |
|
137 | |
|
138 | |
public void setRoleNamespace(String roleNamespace) { |
139 | 0 | this.roleNamespace = roleNamespace; |
140 | 0 | } |
141 | |
|
142 | |
|
143 | |
|
144 | |
|
145 | |
public String getRoleTypeId() { |
146 | 0 | return this.roleTypeId; |
147 | |
} |
148 | |
|
149 | |
|
150 | |
|
151 | |
|
152 | |
public void setRoleTypeId(String roleTypeId) { |
153 | 0 | this.roleTypeId = roleTypeId; |
154 | 0 | } |
155 | |
|
156 | |
|
157 | |
|
158 | |
|
159 | |
public String getRoleTypeName() { |
160 | 0 | if ( roleTypeName == null ) { |
161 | 0 | if ( kimType != null ) { |
162 | 0 | roleTypeName = kimType.getName(); |
163 | 0 | } else if ( roleTypeId != null ) { |
164 | 0 | setKimType( KimApiServiceLocator.getKimTypeInfoService().getKimType(roleTypeId) ); |
165 | 0 | if ( kimType != null ) { |
166 | 0 | roleTypeName = kimType.getName(); |
167 | |
} |
168 | |
} |
169 | |
} |
170 | 0 | return this.roleTypeName; |
171 | |
} |
172 | |
|
173 | |
|
174 | |
|
175 | |
|
176 | |
public void setRoleTypeName(String roleTypeName) { |
177 | 0 | this.roleTypeName = roleTypeName; |
178 | 0 | } |
179 | |
|
180 | |
|
181 | |
|
182 | |
|
183 | |
public List<RoleDocumentDelegationMember> getDelegationMembers() { |
184 | 0 | return this.delegationMembers; |
185 | |
} |
186 | |
|
187 | |
|
188 | |
|
189 | |
|
190 | |
public void setDelegationMembers( |
191 | |
List<RoleDocumentDelegationMember> delegationMembers) { |
192 | 0 | this.delegationMembers = delegationMembers; |
193 | 0 | } |
194 | |
|
195 | |
|
196 | |
|
197 | |
|
198 | |
public List<KimDocumentRolePermission> getPermissions() { |
199 | 0 | return this.permissions; |
200 | |
} |
201 | |
|
202 | |
|
203 | |
|
204 | |
|
205 | |
public void setPermissions(List<KimDocumentRolePermission> permissions) { |
206 | 0 | this.permissions = permissions; |
207 | 0 | } |
208 | |
|
209 | |
|
210 | |
|
211 | |
|
212 | |
public List<KimDocumentRoleResponsibility> getResponsibilities() { |
213 | 0 | return this.responsibilities; |
214 | |
} |
215 | |
|
216 | |
|
217 | |
|
218 | |
|
219 | |
public void setResponsibilities( |
220 | |
List<KimDocumentRoleResponsibility> responsibilities) { |
221 | 0 | this.responsibilities = responsibilities; |
222 | 0 | } |
223 | |
|
224 | |
|
225 | |
|
226 | |
|
227 | |
public List<KimDocumentRoleMember> getMembers() { |
228 | 0 | return this.members; |
229 | |
} |
230 | |
|
231 | 0 | public enum RoleMemberMetaDataType implements Comparator<KimDocumentRoleMember>{ |
232 | 0 | MEMBER_ID("memberId"), |
233 | 0 | MEMBER_NAME("memberName"), |
234 | 0 | FULL_MEMBER_NAME("memberFullName"); |
235 | |
|
236 | |
private final String attributeName; |
237 | |
|
238 | 0 | RoleMemberMetaDataType(String anAttributeName) { |
239 | 0 | this.attributeName = anAttributeName; |
240 | 0 | } |
241 | |
|
242 | |
public String getAttributeName() { |
243 | 0 | return attributeName; |
244 | |
} |
245 | |
|
246 | |
@Override |
247 | |
public int compare(KimDocumentRoleMember m1, KimDocumentRoleMember m2) { |
248 | 0 | if (m1 == null && m2 == null) { |
249 | 0 | return 0; |
250 | 0 | } else if (m1 == null) { |
251 | 0 | return -1; |
252 | 0 | } else if (m2 == null) { |
253 | 0 | return 1; |
254 | |
} |
255 | 0 | if (this.getAttributeName().equals(MEMBER_ID.getAttributeName())) { |
256 | 0 | return m1.getMemberId().compareToIgnoreCase(m2.getMemberId()); |
257 | |
} |
258 | 0 | else if (this.getAttributeName().equals(FULL_MEMBER_NAME.getAttributeName())) { |
259 | 0 | return m1.getMemberFullName().compareToIgnoreCase(m2.getMemberFullName()); |
260 | |
} |
261 | 0 | return m1.getMemberName().compareToIgnoreCase(m2.getMemberName()); |
262 | |
} |
263 | |
} |
264 | |
|
265 | |
public void setMemberMetaDataTypeToSort(Integer columnNumber) |
266 | |
{ |
267 | 0 | switch( columnNumber ) |
268 | |
{ |
269 | |
case 1: |
270 | 0 | this.memberMetaDataType = RoleMemberMetaDataType.MEMBER_ID; |
271 | 0 | break; |
272 | |
case 2: |
273 | 0 | this.memberMetaDataType = RoleMemberMetaDataType.MEMBER_NAME; |
274 | 0 | break; |
275 | |
case 3: |
276 | 0 | this.memberMetaDataType = RoleMemberMetaDataType.FULL_MEMBER_NAME; |
277 | 0 | break; |
278 | |
default: |
279 | 0 | this.memberMetaDataType = RoleMemberMetaDataType.MEMBER_NAME; |
280 | |
break; |
281 | |
} |
282 | 0 | } |
283 | |
|
284 | 0 | protected RoleMemberMetaDataType memberMetaDataType = RoleMemberMetaDataType.MEMBER_NAME; |
285 | |
|
286 | |
public RoleMemberMetaDataType getMemberMetaDataType() { |
287 | 0 | return memberMetaDataType; |
288 | |
} |
289 | |
|
290 | |
public void setMemberMetaDataType(RoleMemberMetaDataType memberMetaDataType) { |
291 | 0 | this.memberMetaDataType = memberMetaDataType; |
292 | 0 | } |
293 | |
|
294 | |
|
295 | |
|
296 | |
|
297 | |
public KimDocumentRoleMember getMember(String roleMemberId) { |
298 | 0 | if(StringUtils.isEmpty(roleMemberId)) {return null;} |
299 | 0 | for(KimDocumentRoleMember roleMember: getMembers()){ |
300 | 0 | if(roleMemberId.equals(roleMember.getRoleMemberId())) { |
301 | 0 | return roleMember; |
302 | |
} |
303 | |
} |
304 | 0 | return null; |
305 | |
} |
306 | |
|
307 | |
|
308 | |
|
309 | |
|
310 | |
public void setMembers(List<KimDocumentRoleMember> members) { |
311 | 0 | this.members = members; |
312 | 0 | } |
313 | |
|
314 | |
public void addResponsibility(KimDocumentRoleResponsibility roleResponsibility){ |
315 | 0 | if(!getResponsibilityInternalService().areActionsAtAssignmentLevelById(roleResponsibility.getResponsibilityId())) { |
316 | 0 | roleResponsibility.getRoleRspActions().add(getNewRespAction(roleResponsibility)); |
317 | |
} |
318 | 0 | getResponsibilities().add(roleResponsibility); |
319 | 0 | } |
320 | |
|
321 | |
protected KimDocumentRoleResponsibilityAction getNewRespAction(KimDocumentRoleResponsibility roleResponsibility){ |
322 | 0 | KimDocumentRoleResponsibilityAction roleRspAction = new KimDocumentRoleResponsibilityAction(); |
323 | 0 | roleRspAction.setKimResponsibility(roleResponsibility.getKimResponsibility()); |
324 | 0 | roleRspAction.setRoleResponsibilityId(roleResponsibility.getRoleResponsibilityId()); |
325 | 0 | return roleRspAction; |
326 | |
} |
327 | |
|
328 | |
public void addDelegationMember(RoleDocumentDelegationMember newDelegationMember){ |
329 | 0 | getDelegationMembers().add(newDelegationMember); |
330 | 0 | } |
331 | |
|
332 | |
|
333 | |
|
334 | |
|
335 | |
public void addMember(KimDocumentRoleMember member) { |
336 | 0 | SequenceAccessorService sas = getSequenceAccessorService(); |
337 | 0 | Long nextSeq = sas.getNextAvailableSequenceNumber( |
338 | |
KimConstants.SequenceNames.KRIM_ROLE_MBR_ID_S, |
339 | |
KimDocumentRoleMember.class); |
340 | 0 | String roleMemberId = nextSeq.toString(); |
341 | 0 | member.setRoleMemberId(roleMemberId); |
342 | 0 | setupMemberRspActions(member); |
343 | 0 | getMembers().add(member); |
344 | 0 | } |
345 | |
|
346 | |
public KimDocumentRoleMember getBlankMember() { |
347 | 0 | KimDocumentRoleMember member = new KimDocumentRoleMember(); |
348 | |
KimDocumentRoleQualifier qualifier; |
349 | 0 | if(getDefinitions()!=null){ |
350 | 0 | for(String key : getDefinitions().keySet()) { |
351 | 0 | qualifier = new KimDocumentRoleQualifier(); |
352 | 0 | qualifier.setKimAttrDefnId(getKimAttributeDefnId(getDefinitions().get(key))); |
353 | 0 | member.getQualifiers().add(qualifier); |
354 | |
} |
355 | |
} |
356 | 0 | setupMemberRspActions(member); |
357 | 0 | return member; |
358 | |
} |
359 | |
|
360 | |
public RoleDocumentDelegationMember getBlankDelegationMember() { |
361 | 0 | RoleDocumentDelegationMember member = new RoleDocumentDelegationMember(); |
362 | |
RoleDocumentDelegationMemberQualifier qualifier; |
363 | 0 | if(getDefinitions()!=null){ |
364 | 0 | for(String key : getDefinitions().keySet()) { |
365 | 0 | qualifier = new RoleDocumentDelegationMemberQualifier(); |
366 | 0 | setAttrDefnIdForDelMemberQualifier(qualifier, getDefinitions().get(key)); |
367 | 0 | member.getQualifiers().add(qualifier); |
368 | |
} |
369 | |
} |
370 | 0 | return member; |
371 | |
} |
372 | |
|
373 | |
public void setupMemberRspActions(KimDocumentRoleMember member) { |
374 | 0 | member.getRoleRspActions().clear(); |
375 | 0 | for (KimDocumentRoleResponsibility roleResp: getResponsibilities()) { |
376 | 0 | if (getResponsibilityInternalService().areActionsAtAssignmentLevelById(roleResp.getResponsibilityId())) { |
377 | 0 | KimDocumentRoleResponsibilityAction action = new KimDocumentRoleResponsibilityAction(); |
378 | 0 | action.setRoleResponsibilityId("*"); |
379 | 0 | action.setRoleMemberId(member.getRoleMemberId()); |
380 | 0 | member.getRoleRspActions().add(action); |
381 | 0 | break; |
382 | |
} |
383 | |
} |
384 | 0 | } |
385 | |
|
386 | |
public void updateMembers(IdentityManagementRoleDocumentForm roleDocumentForm){ |
387 | 0 | for(KimDocumentRoleMember member: roleDocumentForm.getRoleDocument().getMembers()){ |
388 | 0 | roleDocumentForm.getRoleDocument().setupMemberRspActions(member); |
389 | |
} |
390 | 0 | } |
391 | |
|
392 | |
public void updateMembers(KimDocumentRoleResponsibility newResponsibility){ |
393 | 0 | for(KimDocumentRoleMember member: getMembers()){ |
394 | 0 | setupMemberRspActions(newResponsibility, member); |
395 | |
} |
396 | 0 | } |
397 | |
|
398 | |
public void setupMemberRspActions(KimDocumentRoleResponsibility roleResp, KimDocumentRoleMember member) { |
399 | 0 | if ((member.getRoleRspActions()==null || member.getRoleRspActions().size()<1) && getResponsibilityInternalService().areActionsAtAssignmentLevelById(roleResp.getResponsibilityId())) { |
400 | 0 | KimDocumentRoleResponsibilityAction action = new KimDocumentRoleResponsibilityAction(); |
401 | 0 | action.setRoleResponsibilityId("*"); |
402 | 0 | action.setRoleMemberId(member.getRoleMemberId()); |
403 | 0 | if(member.getRoleRspActions()==null) { |
404 | 0 | member.setRoleRspActions(new ArrayList<KimDocumentRoleResponsibilityAction>()); |
405 | |
} |
406 | 0 | member.getRoleRspActions().add(action); |
407 | |
} |
408 | 0 | } |
409 | |
|
410 | |
protected void setAttrDefnIdForDelMemberQualifier(RoleDocumentDelegationMemberQualifier qualifier,AttributeDefinition definition) { |
411 | 0 | qualifier.setKimAttrDefnId(((KimAttributeDefinition)definition).getKimAttrDefnId()); |
412 | 0 | } |
413 | |
|
414 | |
|
415 | |
|
416 | |
|
417 | |
@Override |
418 | |
public void doRouteStatusChange(DocumentRouteStatusChangeDTO statusChangeEvent) { |
419 | 0 | super.doRouteStatusChange(statusChangeEvent); |
420 | 0 | if (getDocumentHeader().getWorkflowDocument().isProcessed()) { |
421 | 0 | KIMServiceLocatorInternal.getUiDocumentService().saveRole(this); |
422 | |
} |
423 | 0 | } |
424 | |
|
425 | |
public void initializeDocumentForNewRole() { |
426 | 0 | if(StringUtils.isBlank(this.roleId)){ |
427 | 0 | SequenceAccessorService sas = getSequenceAccessorService(); |
428 | 0 | Long nextSeq = sas.getNextAvailableSequenceNumber( |
429 | |
KimConstants.SequenceNames.KRIM_ROLE_ID_S, this.getClass()); |
430 | 0 | this.roleId = nextSeq.toString(); |
431 | |
} |
432 | 0 | if(StringUtils.isBlank(this.roleTypeId)) { |
433 | 0 | this.roleTypeId = "1"; |
434 | |
} |
435 | 0 | } |
436 | |
|
437 | |
public String getRoleId(){ |
438 | 0 | if(StringUtils.isBlank(this.roleId)){ |
439 | 0 | initializeDocumentForNewRole(); |
440 | |
} |
441 | 0 | return roleId; |
442 | |
} |
443 | |
|
444 | |
@Override |
445 | |
public void prepareForSave(){ |
446 | 0 | SequenceAccessorService sas = getSequenceAccessorService(); |
447 | |
|
448 | |
String roleId; |
449 | 0 | if(StringUtils.isBlank(getRoleId())){ |
450 | 0 | Long nextSeq = sas.getNextAvailableSequenceNumber( |
451 | |
KimConstants.SequenceNames.KRIM_ROLE_ID_S, this.getClass()); |
452 | 0 | roleId = nextSeq.toString(); |
453 | 0 | setRoleId(roleId); |
454 | 0 | } else { |
455 | 0 | roleId = getRoleId(); |
456 | |
} |
457 | |
|
458 | 0 | if(getPermissions()!=null){ |
459 | |
String rolePermissionId; |
460 | 0 | for(KimDocumentRolePermission permission: getPermissions()){ |
461 | 0 | permission.setRoleId(roleId); |
462 | 0 | if(StringUtils.isBlank(permission.getRolePermissionId())){ |
463 | 0 | Long nextSeq = sas.getNextAvailableSequenceNumber( |
464 | |
KimConstants.SequenceNames.KRIM_ROLE_PERM_ID_S, |
465 | |
KimDocumentRolePermission.class); |
466 | 0 | rolePermissionId = nextSeq.toString(); |
467 | 0 | permission.setRolePermissionId(rolePermissionId); |
468 | 0 | } |
469 | |
} |
470 | |
} |
471 | 0 | if(getResponsibilities()!=null){ |
472 | |
String roleResponsibilityId; |
473 | 0 | for(KimDocumentRoleResponsibility responsibility: getResponsibilities()){ |
474 | 0 | if(StringUtils.isBlank(responsibility.getRoleResponsibilityId())){ |
475 | 0 | Long nextSeq = sas.getNextAvailableSequenceNumber( |
476 | |
KimConstants.SequenceNames.KRIM_ROLE_RSP_ID_S, |
477 | |
KimDocumentRoleResponsibility.class); |
478 | 0 | roleResponsibilityId = nextSeq.toString(); |
479 | 0 | responsibility.setRoleResponsibilityId(roleResponsibilityId); |
480 | |
} |
481 | 0 | responsibility.setRoleId(roleId); |
482 | 0 | if(!getResponsibilityInternalService().areActionsAtAssignmentLevelById(responsibility.getResponsibilityId())){ |
483 | 0 | if(StringUtils.isBlank(responsibility.getRoleRspActions().get(0).getRoleResponsibilityActionId())){ |
484 | 0 | Long nextSeq = sas.getNextAvailableSequenceNumber( |
485 | |
KimConstants.SequenceNames.KRIM_ROLE_RSP_ACTN_ID_S, |
486 | |
KimDocumentRoleResponsibilityAction.class); |
487 | 0 | String roleResponsibilityActionId = nextSeq.toString(); |
488 | 0 | responsibility.getRoleRspActions().get(0).setRoleResponsibilityActionId(roleResponsibilityActionId); |
489 | |
} |
490 | 0 | responsibility.getRoleRspActions().get(0).setRoleMemberId("*"); |
491 | 0 | responsibility.getRoleRspActions().get(0).setDocumentNumber(getDocumentNumber()); |
492 | |
} |
493 | |
} |
494 | |
} |
495 | 0 | if(getMembers()!=null){ |
496 | |
String roleMemberId; |
497 | |
String roleResponsibilityActionId; |
498 | 0 | for(KimDocumentRoleMember member: getMembers()){ |
499 | 0 | member.setRoleId(roleId); |
500 | 0 | if(StringUtils.isBlank(member.getRoleMemberId())){ |
501 | 0 | Long nextSeq = sas.getNextAvailableSequenceNumber( |
502 | |
KimConstants.SequenceNames.KRIM_ROLE_MBR_ID_S, |
503 | |
KimDocumentRoleMember.class); |
504 | 0 | roleMemberId = nextSeq.toString(); |
505 | 0 | member.setRoleMemberId(roleMemberId); |
506 | |
} |
507 | 0 | for(KimDocumentRoleQualifier qualifier: member.getQualifiers()){ |
508 | 0 | qualifier.setKimTypId(getKimType().getId()); |
509 | |
} |
510 | 0 | for(KimDocumentRoleResponsibilityAction roleRespAction: member.getRoleRspActions()){ |
511 | 0 | if(StringUtils.isBlank(roleRespAction.getRoleResponsibilityActionId())){ |
512 | 0 | Long nextSeq = sas.getNextAvailableSequenceNumber( |
513 | |
KimConstants.SequenceNames.KRIM_ROLE_RSP_ACTN_ID_S, |
514 | |
KimDocumentRoleResponsibilityAction.class); |
515 | 0 | roleResponsibilityActionId = nextSeq.toString(); |
516 | 0 | roleRespAction.setRoleResponsibilityActionId(roleResponsibilityActionId); |
517 | |
} |
518 | 0 | roleRespAction.setRoleMemberId(member.getRoleMemberId()); |
519 | 0 | roleRespAction.setDocumentNumber(getDocumentNumber()); |
520 | 0 | if ( !StringUtils.equals( roleRespAction.getRoleResponsibilityId(), "*" ) ) { |
521 | 0 | for(KimDocumentRoleResponsibility responsibility: getResponsibilities()){ |
522 | 0 | if( StringUtils.equals( roleRespAction.getKimResponsibility().getId(), responsibility.getResponsibilityId() ) ) { |
523 | 0 | roleRespAction.setRoleResponsibilityId(responsibility.getRoleResponsibilityId()); |
524 | |
} |
525 | |
} |
526 | |
} |
527 | |
} |
528 | |
} |
529 | |
} |
530 | 0 | if(getDelegationMembers()!=null){ |
531 | 0 | for(RoleDocumentDelegationMember delegationMember: getDelegationMembers()){ |
532 | 0 | delegationMember.setDocumentNumber(getDocumentNumber()); |
533 | 0 | addDelegationMemberToDelegation(delegationMember); |
534 | |
} |
535 | 0 | for(RoleDocumentDelegation delegation: getDelegations()){ |
536 | 0 | delegation.setDocumentNumber(getDocumentNumber()); |
537 | 0 | delegation.setKimTypeId(getKimType().getId()); |
538 | 0 | for(RoleDocumentDelegationMember member: delegation.getMembers()){ |
539 | 0 | for(RoleDocumentDelegationMemberQualifier qualifier: member.getQualifiers()){ |
540 | 0 | qualifier.setKimTypId(getKimType().getId()); |
541 | |
} |
542 | |
} |
543 | 0 | delegation.setRoleId(roleId); |
544 | |
} |
545 | |
} |
546 | 0 | } |
547 | |
|
548 | |
public ResponsibilityService getResponsibilityService() { |
549 | 0 | if ( responsibilityService == null ) { |
550 | 0 | responsibilityService = KimApiServiceLocator.getResponsibilityService(); |
551 | |
} |
552 | 0 | return responsibilityService; |
553 | |
} |
554 | |
|
555 | |
public ResponsibilityInternalService getResponsibilityInternalService() { |
556 | 0 | if ( responsibilityInternalService == null ) { |
557 | 0 | responsibilityInternalService = org.kuali.rice.kim.impl.services.KIMServiceLocatorInternal.getResponsibilityInternalService(); |
558 | |
} |
559 | 0 | return responsibilityInternalService; |
560 | |
} |
561 | |
|
562 | |
|
563 | |
|
564 | |
|
565 | |
public boolean isEditing() { |
566 | 0 | return this.editing; |
567 | |
} |
568 | |
|
569 | |
|
570 | |
|
571 | |
|
572 | |
public void setEditing(boolean editing) { |
573 | 0 | this.editing = editing; |
574 | 0 | } |
575 | |
|
576 | |
|
577 | |
|
578 | |
|
579 | |
public List<RoleDocumentDelegation> getDelegations() { |
580 | 0 | return this.delegations; |
581 | |
} |
582 | |
|
583 | |
|
584 | |
|
585 | |
|
586 | |
public void setDelegations(List<RoleDocumentDelegation> delegations) { |
587 | 0 | this.delegations = delegations; |
588 | 0 | } |
589 | |
|
590 | |
public void setKimType(KimType kimType) { |
591 | 0 | super.setKimType(kimType); |
592 | 0 | if (kimType != null){ |
593 | 0 | setRoleTypeId(kimType.getId()); |
594 | 0 | setRoleTypeName(kimType.getName()); |
595 | |
} |
596 | 0 | } |
597 | |
} |