Search in sources :

Example 1 with Role

use of org.kuali.kfs.kim.impl.role.Role in project cu-kfs by CU-CommunityApps.

the class IdentityManagementRoleDocument method initializeMinimalRoleBoForDelegationMember.

protected void initializeMinimalRoleBoForDelegationMember(RoleDocumentDelegationMember delegationMember) {
    Role role = delegationMember.getMemberRole();
    if (ObjectUtils.isNull(role)) {
        role = new Role();
    }
    role.setId(getRoleId());
    role.setKimTypeId(getRoleTypeId());
    delegationMember.setMemberRole(role);
}
Also used : Role(org.kuali.kfs.kim.impl.role.Role)

Example 2 with Role

use of org.kuali.kfs.kim.impl.role.Role in project cu-kfs by CU-CommunityApps.

the class CuUiDocumentServiceImpl method setMembersInDocument.

/**
 * Overridden to allow for loading unmodified role members even when there are no delegations,
 * and to create a copy of the RoleBo's members list (to prevent potential member auto-deletion).
 */
@Override
public void setMembersInDocument(IdentityManagementRoleDocument identityManagementRoleDocument) {
    Map<String, String> criteria = new HashMap<>();
    criteria.put(KimConstants.PrimaryKeyConstants.ROLE_ID, identityManagementRoleDocument.getRoleId());
    Role roleBo = getBusinessObjectService().findByPrimaryKey(Role.class, criteria);
    List<RoleMember> members = new ArrayList<>(roleBo.getMembers());
    List<RoleMember> membersToRemove = new ArrayList<>();
    boolean found = false;
    for (KimDocumentRoleMember modifiedMember : identityManagementRoleDocument.getModifiedMembers()) {
        for (RoleMember member : members) {
            if (modifiedMember.getRoleMemberId().equals(member.getId())) {
                membersToRemove.add(member);
                found = true;
            }
            if (found) {
                break;
            }
        }
    }
    for (RoleMember memberToRemove : membersToRemove) {
        members.remove(memberToRemove);
    }
    identityManagementRoleDocument.setMembers(loadRoleMembers(identityManagementRoleDocument, members));
    loadMemberRoleRspActions(identityManagementRoleDocument);
}
Also used : Role(org.kuali.kfs.kim.impl.role.Role) KimDocumentRoleMember(org.kuali.kfs.kim.bo.ui.KimDocumentRoleMember) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) RoleMember(org.kuali.kfs.kim.impl.role.RoleMember) KimDocumentRoleMember(org.kuali.kfs.kim.bo.ui.KimDocumentRoleMember)

Aggregations

Role (org.kuali.kfs.kim.impl.role.Role)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 KimDocumentRoleMember (org.kuali.kfs.kim.bo.ui.KimDocumentRoleMember)1 RoleMember (org.kuali.kfs.kim.impl.role.RoleMember)1