Search in sources :

Example 11 with RichMember

use of cz.metacentrum.perun.core.api.RichMember in project perun by CESNET.

the class MembersManagerBlImpl method convertMembersToRichMembersWithAttributes.

public List<RichMember> convertMembersToRichMembersWithAttributes(PerunSession sess, List<RichMember> richMembers) throws InternalErrorException {
    for (RichMember richMember : richMembers) {
        List<Attribute> userAttributes = getPerunBl().getAttributesManagerBl().getAttributes(sess, richMember.getUser());
        List<Attribute> memberAttributes = getPerunBl().getAttributesManagerBl().getAttributes(sess, richMember);
        richMember.setUserAttributes(userAttributes);
        richMember.setMemberAttributes(memberAttributes);
    }
    return richMembers;
}
Also used : Attribute(cz.metacentrum.perun.core.api.Attribute) RichMember(cz.metacentrum.perun.core.api.RichMember)

Example 12 with RichMember

use of cz.metacentrum.perun.core.api.RichMember in project perun by CESNET.

the class MembersManagerBlImpl method convertMembersToRichMembers.

public List<RichMember> convertMembersToRichMembers(PerunSession sess, List<Member> members) throws InternalErrorException {
    List<RichMember> richMembers = new ArrayList<RichMember>();
    for (Member member : members) {
        User user = getPerunBl().getUsersManagerBl().getUserByMember(sess, member);
        List<UserExtSource> userExtSources = getPerunBl().getUsersManagerBl().getUserExtSources(sess, user);
        RichMember richMember = new RichMember(user, member, userExtSources);
        richMembers.add(richMember);
    }
    return richMembers;
}
Also used : User(cz.metacentrum.perun.core.api.User) UserExtSource(cz.metacentrum.perun.core.api.UserExtSource) ArrayList(java.util.ArrayList) RichMember(cz.metacentrum.perun.core.api.RichMember) RichMember(cz.metacentrum.perun.core.api.RichMember) Member(cz.metacentrum.perun.core.api.Member)

Example 13 with RichMember

use of cz.metacentrum.perun.core.api.RichMember in project perun by CESNET.

the class MembersManagerBlImpl method findRichMembersInVo.

public List<RichMember> findRichMembersInVo(PerunSession sess, Vo vo, String searchString) throws InternalErrorException {
    List<User> users = getPerunBl().getUsersManagerBl().findUsers(sess, searchString);
    List<Member> members = new ArrayList<Member>();
    for (User user : users) {
        try {
            members.add(getMembersManagerImpl().getMemberByUserId(sess, vo, user.getId()));
        } catch (MemberNotExistsException e) {
        // User is not member of this VO
        }
    }
    return this.convertMembersToRichMembers(sess, this.setAllMembersSameType(members, MembershipType.DIRECT));
}
Also used : User(cz.metacentrum.perun.core.api.User) MemberNotExistsException(cz.metacentrum.perun.core.api.exceptions.MemberNotExistsException) ArrayList(java.util.ArrayList) RichMember(cz.metacentrum.perun.core.api.RichMember) Member(cz.metacentrum.perun.core.api.Member)

Aggregations

RichMember (cz.metacentrum.perun.core.api.RichMember)13 ArrayList (java.util.ArrayList)9 Member (cz.metacentrum.perun.core.api.Member)6 Attribute (cz.metacentrum.perun.core.api.Attribute)3 AttributeDefinition (cz.metacentrum.perun.core.api.AttributeDefinition)3 User (cz.metacentrum.perun.core.api.User)3 InternalErrorException (cz.metacentrum.perun.core.api.exceptions.InternalErrorException)2 PrivilegeException (cz.metacentrum.perun.core.api.exceptions.PrivilegeException)2 Resource (cz.metacentrum.perun.core.api.Resource)1 RichUser (cz.metacentrum.perun.core.api.RichUser)1 Status (cz.metacentrum.perun.core.api.Status)1 UserExtSource (cz.metacentrum.perun.core.api.UserExtSource)1 Vo (cz.metacentrum.perun.core.api.Vo)1 MemberNotExistsException (cz.metacentrum.perun.core.api.exceptions.MemberNotExistsException)1 PerunException (cz.metacentrum.perun.core.api.exceptions.PerunException)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1