Search in sources :

Example 11 with SequenceAccessorService

use of org.kuali.kfs.krad.service.SequenceAccessorService in project cu-kfs by CU-CommunityApps.

the class IdentityManagementGroupDocument method prepareForSave.

@Override
public void prepareForSave() {
    String groupId;
    if (StringUtils.isBlank(getGroupId())) {
        SequenceAccessorService sas = getSequenceAccessorService();
        Long nextSeq = sas.getNextAvailableSequenceNumber("KRIM_GRP_ID_S", this.getClass());
        groupId = nextSeq.toString();
        setGroupId(groupId);
    } else {
        groupId = getGroupId();
    }
    if (getMembers() != null) {
        String groupMemberId;
        for (GroupDocumentMember member : getMembers()) {
            member.setGroupId(getGroupId());
            if (StringUtils.isBlank(member.getGroupMemberId())) {
                SequenceAccessorService sas = getSequenceAccessorService();
                Long nextSeq = sas.getNextAvailableSequenceNumber("KRIM_GRP_MBR_ID_S", this.getClass());
                groupMemberId = nextSeq.toString();
                member.setGroupMemberId(groupMemberId);
            }
            if (StringUtils.isBlank(member.getDocumentNumber())) {
                member.setDocumentNumber(getDocumentNumber());
            }
        }
    }
    int index = 0;
    // this needs to be checked - are all qualifiers present?
    if (getDefinitions() != null) {
        for (KimAttributeField key : getDefinitions()) {
            if (getQualifiers().size() > index) {
                GroupDocumentQualifier qualifier = getQualifiers().get(index);
                qualifier.setKimAttrDefnId(getKimAttributeDefnId(key));
                qualifier.setKimTypId(getKimType().getId());
                qualifier.setGroupId(groupId);
                qualifier.setDocumentNumber(getDocumentNumber());
            }
            index++;
        }
    }
}
Also used : SequenceAccessorService(org.kuali.kfs.krad.service.SequenceAccessorService) KimAttributeField(org.kuali.kfs.kim.api.type.KimAttributeField) GroupDocumentQualifier(org.kuali.kfs.kim.bo.ui.GroupDocumentQualifier) GroupDocumentMember(org.kuali.kfs.kim.bo.ui.GroupDocumentMember)

Aggregations

SequenceAccessorService (org.kuali.kfs.krad.service.SequenceAccessorService)11 ArrayList (java.util.ArrayList)3 List (java.util.List)3 PurchaseOrderItem (org.kuali.kfs.module.purap.businessobject.PurchaseOrderItem)2 SecurityGroup (edu.cornell.kfs.ksr.businessobject.SecurityGroup)1 SecurityGroupTab (edu.cornell.kfs.ksr.businessobject.SecurityGroupTab)1 NoteExtendedAttribute (edu.cornell.kfs.sys.businessobject.NoteExtendedAttribute)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 CapitalAssetSystem (org.kuali.kfs.integration.purap.CapitalAssetSystem)1 KimAttributeField (org.kuali.kfs.kim.api.type.KimAttributeField)1 GroupDocumentMember (org.kuali.kfs.kim.bo.ui.GroupDocumentMember)1 GroupDocumentQualifier (org.kuali.kfs.kim.bo.ui.GroupDocumentQualifier)1 KimDocumentRoleMember (org.kuali.kfs.kim.bo.ui.KimDocumentRoleMember)1 KimDocumentRolePermission (org.kuali.kfs.kim.bo.ui.KimDocumentRolePermission)1 KimDocumentRoleQualifier (org.kuali.kfs.kim.bo.ui.KimDocumentRoleQualifier)1 KimDocumentRoleResponsibility (org.kuali.kfs.kim.bo.ui.KimDocumentRoleResponsibility)1 KimDocumentRoleResponsibilityAction (org.kuali.kfs.kim.bo.ui.KimDocumentRoleResponsibilityAction)1 RoleDocumentDelegation (org.kuali.kfs.kim.bo.ui.RoleDocumentDelegation)1 RoleDocumentDelegationMember (org.kuali.kfs.kim.bo.ui.RoleDocumentDelegationMember)1