use of org.kuali.kfs.kim.bo.ui.RoleDocumentDelegationMemberQualifier in project cu-kfs by CU-CommunityApps.
the class IdentityManagementRoleDocument method getBlankDelegationMember.
public RoleDocumentDelegationMember getBlankDelegationMember() {
RoleDocumentDelegationMember member = new RoleDocumentDelegationMember();
RoleDocumentDelegationMemberQualifier qualifier;
if (getDefinitions() != null) {
for (KimAttributeField key : getDefinitions()) {
qualifier = new RoleDocumentDelegationMemberQualifier();
setAttrDefnIdForDelMemberQualifier(qualifier, key);
member.getQualifiers().add(qualifier);
}
}
return member;
}
use of org.kuali.kfs.kim.bo.ui.RoleDocumentDelegationMemberQualifier in project cu-kfs by CU-CommunityApps.
the class IdentityManagementRoleDocument method prepareForSave.
@Override
public void prepareForSave() {
SequenceAccessorService sas = getSequenceAccessorService();
String roleId;
if (StringUtils.isBlank(getRoleId())) {
Long nextSeq = sas.getNextAvailableSequenceNumber(KimConstants.SequenceNames.KRIM_ROLE_ID_S, this.getClass());
roleId = nextSeq.toString();
setRoleId(roleId);
} else {
roleId = getRoleId();
}
if (getPermissions() != null) {
String rolePermissionId;
for (KimDocumentRolePermission permission : getPermissions()) {
permission.setRoleId(roleId);
permission.setDocumentNumber(getDocumentNumber());
if (StringUtils.isBlank(permission.getRolePermissionId())) {
Long nextSeq = sas.getNextAvailableSequenceNumber(KimConstants.SequenceNames.KRIM_ROLE_PERM_ID_S, KimDocumentRolePermission.class);
rolePermissionId = nextSeq.toString();
permission.setRolePermissionId(rolePermissionId);
}
}
}
if (getResponsibilities() != null) {
String roleResponsibilityId;
for (KimDocumentRoleResponsibility responsibility : getResponsibilities()) {
if (StringUtils.isBlank(responsibility.getRoleResponsibilityId())) {
Long nextSeq = sas.getNextAvailableSequenceNumber(KimConstants.SequenceNames.KRIM_ROLE_RSP_ID_S, KimDocumentRoleResponsibility.class);
roleResponsibilityId = nextSeq.toString();
responsibility.setRoleResponsibilityId(roleResponsibilityId);
}
responsibility.setRoleId(roleId);
if (!getResponsibilityInternalService().areActionsAtAssignmentLevelById(responsibility.getResponsibilityId())) {
if (StringUtils.isBlank(responsibility.getRoleRspActions().get(0).getRoleResponsibilityActionId())) {
Long nextSeq = sas.getNextAvailableSequenceNumber(KimConstants.SequenceNames.KRIM_ROLE_RSP_ACTN_ID_S, KimDocumentRoleResponsibilityAction.class);
String roleResponsibilityActionId = nextSeq.toString();
responsibility.getRoleRspActions().get(0).setRoleResponsibilityActionId(roleResponsibilityActionId);
}
responsibility.getRoleRspActions().get(0).setRoleMemberId("*");
responsibility.getRoleRspActions().get(0).setDocumentNumber(getDocumentNumber());
}
}
}
if (getModifiedMembers() != null) {
String roleMemberId;
String roleResponsibilityActionId;
for (KimDocumentRoleMember member : getModifiedMembers()) {
member.setDocumentNumber(getDocumentNumber());
member.setRoleId(roleId);
if (StringUtils.isBlank(member.getRoleMemberId())) {
Long nextSeq = sas.getNextAvailableSequenceNumber(KimConstants.SequenceNames.KRIM_ROLE_MBR_ID_S, KimDocumentRoleMember.class);
roleMemberId = nextSeq.toString();
member.setRoleMemberId(roleMemberId);
}
for (KimDocumentRoleQualifier qualifier : member.getQualifiers()) {
qualifier.setDocumentNumber(getDocumentNumber());
qualifier.setRoleMemberId(member.getRoleMemberId());
qualifier.setKimTypId(getKimType().getId());
}
for (KimDocumentRoleResponsibilityAction roleRespAction : member.getRoleRspActions()) {
if (StringUtils.isBlank(roleRespAction.getRoleResponsibilityActionId())) {
Long nextSeq = sas.getNextAvailableSequenceNumber(KimConstants.SequenceNames.KRIM_ROLE_RSP_ACTN_ID_S, KimDocumentRoleResponsibilityAction.class);
roleResponsibilityActionId = nextSeq.toString();
roleRespAction.setRoleResponsibilityActionId(roleResponsibilityActionId);
}
roleRespAction.setRoleMemberId(member.getRoleMemberId());
roleRespAction.setDocumentNumber(getDocumentNumber());
if (!StringUtils.equals(roleRespAction.getRoleResponsibilityId(), "*")) {
for (KimDocumentRoleResponsibility responsibility : getResponsibilities()) {
if (StringUtils.equals(roleRespAction.getKimResponsibility().getId(), responsibility.getResponsibilityId())) {
roleRespAction.setRoleResponsibilityId(responsibility.getRoleResponsibilityId());
}
}
}
}
}
}
if (getDelegationMembers() != null) {
for (RoleDocumentDelegationMember delegationMember : getDelegationMembers()) {
delegationMember.setDocumentNumber(getDocumentNumber());
addDelegationMemberToDelegation(delegationMember);
}
for (RoleDocumentDelegation delegation : getDelegations()) {
delegation.setDocumentNumber(getDocumentNumber());
delegation.setKimTypeId(getKimType().getId());
List<RoleDocumentDelegationMember> membersToRemove = new AutoPopulatingList<>(RoleDocumentDelegationMember.class);
for (RoleDocumentDelegationMember member : delegation.getMembers()) {
if (delegation.getDelegationId().equals(member.getDelegationId()) && delegation.getDelegationTypeCode().equals(member.getDelegationTypeCode())) {
for (RoleDocumentDelegationMemberQualifier qualifier : member.getQualifiers()) {
qualifier.setKimTypId(getKimType().getId());
qualifier.setDocumentNumber(getDocumentNumber());
}
} else {
membersToRemove.add(member);
}
}
if (!membersToRemove.isEmpty()) {
for (RoleDocumentDelegationMember member : membersToRemove) {
delegation.getMembers().remove(member);
}
}
delegation.setRoleId(roleId);
}
}
}
Aggregations