Search in sources :

Example 1 with Group

use of org.kuali.kfs.kim.impl.group.Group in project cu-kfs by CU-CommunityApps.

the class OrgReviewRoleServiceImpl method getDelegationMembersToSave.

protected List<KfsKimDocDelegateMember> getDelegationMembersToSave(OrgReviewRole orr) {
    KfsKimDocDelegateMember delegationMember = null;
    if (orr.isEdit() && StringUtils.isNotBlank(orr.getDelegationMemberId())) {
        delegationMember = new KfsKimDocDelegateMember(KimApiServiceLocator.getRoleService().getDelegationMemberById(orr.getDelegationMemberId()));
    }
    if (delegationMember == null) {
        delegationMember = new KfsKimDocDelegateMember();
        if (StringUtils.isNotEmpty(orr.getRoleMemberRoleNamespaceCode()) && StringUtils.isNotEmpty(orr.getRoleMemberRoleName())) {
            String roleId = KimApiServiceLocator.getRoleService().getRoleIdByNamespaceCodeAndName(orr.getRoleMemberRoleNamespaceCode(), orr.getRoleMemberRoleName());
            delegationMember.setMemberId(roleId);
            delegationMember.setType(MemberType.ROLE);
        } else if (StringUtils.isNotEmpty(orr.getGroupMemberGroupNamespaceCode()) && StringUtils.isNotEmpty(orr.getGroupMemberGroupName())) {
            Group groupInfo = KimApiServiceLocator.getGroupService().getGroupByNamespaceCodeAndName(orr.getGroupMemberGroupNamespaceCode(), orr.getGroupMemberGroupName());
            delegationMember.setMemberId(groupInfo.getId());
            delegationMember.setType(MemberType.GROUP);
        } else if (StringUtils.isNotEmpty(orr.getPrincipalMemberPrincipalName())) {
            Principal principal = KimApiServiceLocator.getIdentityService().getPrincipalByPrincipalName(orr.getPrincipalMemberPrincipalName());
            delegationMember.setMemberId(principal.getPrincipalId());
            delegationMember.setType(MemberType.PRINCIPAL);
        }
    }
    delegationMember.setDelegationType(DelegationType.fromCode(orr.getDelegationTypeCode()));
    delegationMember.setAttributes(getAttributes(orr, orr.getKimTypeId()));
    if (orr.getActiveFromDate() != null) {
        delegationMember.setActiveFromDate(new DateTime(orr.getActiveFromDate()));
    }
    if (orr.getActiveToDate() != null) {
        delegationMember.setActiveToDate(new DateTime(orr.getActiveToDate()));
    }
    delegationMember.setRoleMemberId(orr.getRoleMemberId());
    return Collections.singletonList(delegationMember);
}
Also used : Group(org.kuali.kfs.kim.impl.group.Group) Principal(org.kuali.kfs.kim.impl.identity.principal.Principal) DateTime(org.joda.time.DateTime) KfsKimDocDelegateMember(org.kuali.kfs.coa.identity.KfsKimDocDelegateMember)

Example 2 with Group

use of org.kuali.kfs.kim.impl.group.Group in project cu-kfs by CU-CommunityApps.

the class ActionItemActionListExtension method initializeGroupName.

private void initializeGroupName() {
    if (!groupNameInitialized) {
        if (getGroupId() != null) {
            Group group = super.getGroup();
            this.groupName = group.getName();
        }
        groupNameInitialized = true;
    }
}
Also used : Group(org.kuali.kfs.kim.impl.group.Group)

Example 3 with Group

use of org.kuali.kfs.kim.impl.group.Group in project cu-kfs by CU-CommunityApps.

the class ActionListFilterAction method getUserWorkgroupsDropDownList.

private List<? extends KeyValue> getUserWorkgroupsDropDownList(String principalId) {
    List<String> userWorkgroups = KimApiServiceLocator.getGroupService().getGroupIdsByPrincipalId(principalId);
    // note that userWorkgroups is unmodifiable so we need to create a new list that we can sort
    List<String> userGroupsToSort = new ArrayList<String>(userWorkgroups);
    List<KeyValue> sortedUserWorkgroups = new ArrayList<KeyValue>();
    KeyValue keyValue = null;
    keyValue = new ConcreteKeyValue(KewApiConstants.NO_FILTERING, KewApiConstants.NO_FILTERING);
    sortedUserWorkgroups.add(keyValue);
    if (userGroupsToSort != null && userGroupsToSort.size() > 0) {
        Collections.sort(userGroupsToSort);
        Group group;
        for (String groupId : userGroupsToSort) {
            group = KimApiServiceLocator.getGroupService().getGroup(groupId);
            keyValue = new ConcreteKeyValue(groupId, group.getName());
            sortedUserWorkgroups.add(keyValue);
        }
    }
    return sortedUserWorkgroups;
}
Also used : ConcreteKeyValue(org.kuali.kfs.core.api.util.ConcreteKeyValue) Group(org.kuali.kfs.kim.impl.group.Group) KeyValue(org.kuali.kfs.core.api.util.KeyValue) ConcreteKeyValue(org.kuali.kfs.core.api.util.ConcreteKeyValue) ArrayList(java.util.ArrayList)

Aggregations

Group (org.kuali.kfs.kim.impl.group.Group)3 ArrayList (java.util.ArrayList)1 DateTime (org.joda.time.DateTime)1 KfsKimDocDelegateMember (org.kuali.kfs.coa.identity.KfsKimDocDelegateMember)1 ConcreteKeyValue (org.kuali.kfs.core.api.util.ConcreteKeyValue)1 KeyValue (org.kuali.kfs.core.api.util.KeyValue)1 Principal (org.kuali.kfs.kim.impl.identity.principal.Principal)1