Search in sources :

Example 1 with GroupDocumentQualifier

use of org.kuali.kfs.kim.bo.ui.GroupDocumentQualifier in project cu-kfs by CU-CommunityApps.

the class IdentityManagementGroupDocument method setDefinitions.

public void setDefinitions(List<KimAttributeField> definitions) {
    super.setDefinitions(definitions);
    if (getQualifiers() == null || getQualifiers().size() < 1) {
        GroupDocumentQualifier qualifier;
        setQualifiers(new ArrayList<>());
        if (getDefinitions() != null) {
            for (KimAttributeField key : getDefinitions()) {
                qualifier = new GroupDocumentQualifier();
                qualifier.setKimAttrDefnId(getKimAttributeDefnId(key));
                getQualifiers().add(qualifier);
            }
        }
    }
}
Also used : KimAttributeField(org.kuali.kfs.kim.api.type.KimAttributeField) GroupDocumentQualifier(org.kuali.kfs.kim.bo.ui.GroupDocumentQualifier)

Example 2 with GroupDocumentQualifier

use of org.kuali.kfs.kim.bo.ui.GroupDocumentQualifier in project cu-kfs by CU-CommunityApps.

the class IdentityManagementGroupDocument method getQualifiersAsAttributes.

public Map<String, String> getQualifiersAsAttributes() {
    Map<String, String> attributes = new HashMap<>();
    for (GroupDocumentQualifier qualifier : qualifiers) {
        if (qualifier.getKimAttribute() != null) {
            attributes.put(qualifier.getKimAttribute().getAttributeName(), qualifier.getAttrVal());
        } else {
            LOG.warn("Unknown attribute ID on group: " + qualifier.getKimAttrDefnId() + " / value=" + qualifier.getAttrVal());
            attributes.put("Unknown Attribute ID: " + qualifier.getKimAttrDefnId(), qualifier.getAttrVal());
        }
    }
    return attributes;
}
Also used : GroupDocumentQualifier(org.kuali.kfs.kim.bo.ui.GroupDocumentQualifier) HashMap(java.util.HashMap)

Example 3 with GroupDocumentQualifier

use of org.kuali.kfs.kim.bo.ui.GroupDocumentQualifier 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

GroupDocumentQualifier (org.kuali.kfs.kim.bo.ui.GroupDocumentQualifier)3 KimAttributeField (org.kuali.kfs.kim.api.type.KimAttributeField)2 HashMap (java.util.HashMap)1 GroupDocumentMember (org.kuali.kfs.kim.bo.ui.GroupDocumentMember)1 SequenceAccessorService (org.kuali.kfs.krad.service.SequenceAccessorService)1