Class MembershipFinder

java.lang.Object
edu.internet2.middleware.grouper.MembershipFinder

public class MembershipFinder extends Object

Use this class to find memberships within the Groups registry

A membership is the object which represents a join of member and group. Has metadata like type and creator, and, if an effective membership, the parent membership

Sample call

 Membership membership1 = new MembershipFinder().addGroup(group1).addSubject(subject).assignEnabled(true).findMembership(true);
 

Sample call to find multiple memberships

 Set<Object[]> members = new MembershipFinder().addMembershipId(membership1.getUuid()).addMembershipId(membership2.getUuid()).findMembershipsMembers();
 

Sample call to find immediate memberships of a user

 Set membershipsOwnersMembers = new MembershipFinder().addSubject(subject).addField(Group.getDefaultList()).assignMembershipType(MembershipType.IMMEDIATE).assignEnabled(true).findMembershipResult().getMembershipsOwnersMembers();

 for (Object membershipsOwnersMember : GrouperUtil.nonNull(membershipsOwnersMembers)) {
   Group group = (Group)((Object[])membershipsOwnersMember)[1];
   System.out.println(group.getName());
 }
 

  • Constructor Details

    • MembershipFinder

      public MembershipFinder()
  • Method Details

    • assignSubjectHasMembershipForGroup

      public MembershipFinder assignSubjectHasMembershipForGroup(Subject theSubjectHasMembershipForGroup)
      if the subject has a membership in the group
    • assignHasMembershipTypeForMember

      public MembershipFinder assignHasMembershipTypeForMember(boolean theHasMembershipType)
      return memberships where the member has this field, note, it will return all the memberships for those members
      Parameters:
      theHasMembershipType -
      Returns:
      this for chaining
    • assignHasFieldForGroup

      public MembershipFinder assignHasFieldForGroup(boolean theHasFieldForGroup)
      return memberships where the group has this field, note, it will return all the memberships for those members
      Returns:
      this for chaining
    • assignHasFieldForMember

      public MembershipFinder assignHasFieldForMember(boolean theHasField)
      return memberships where the member has this field, note, it will return all the memberships for those members
      Parameters:
      theHasField -
      Returns:
      this for chaining
    • assignPointInTimeFrom

      public MembershipFinder assignPointInTimeFrom(Timestamp pointInTimeFrom1)
      if searching point in time data, the start of the range of the point in time query.
      Parameters:
      pointInTimeFrom1 -
      Returns:
      this for chaining
    • assignPointInTimeTo

      public MembershipFinder assignPointInTimeTo(Timestamp pointInTimeTo1)
      if searching point in time data, the end of the range of the point in time query.
      Parameters:
      pointInTimeTo1 -
      Returns:
      this for chaining
    • assignScope

      public MembershipFinder assignScope(String scope1)
      sql like string to limit the results of the owner
      Parameters:
      scope1 -
      Returns:
      this for chaining
    • assignField

      public MembershipFinder assignField(Field theField)
      assign a field to filter by
      Parameters:
      theField -
      Returns:
      this for chaining
    • assignFieldName

      public MembershipFinder assignFieldName(String theFieldOrPrivilegeName)
      assign a field to filter by, or a privilege name
      Parameters:
      theField -
      Returns:
      this for chaining
    • assignFieldType

      public MembershipFinder assignFieldType(FieldType theFieldType)
      assign a field type, mutually exclusive with fieldId
      Parameters:
      theFieldType -
      Returns:
      this for chaining
    • assignServiceId

      public MembershipFinder assignServiceId(String serviceId1)
      if filtering by service role, this is the service id (id of the attributeDefName for service
      Parameters:
      serviceId1 -
      Returns:
      this for chaining
    • assignServiceRole

      public MembershipFinder assignServiceRole(ServiceRole serviceRole1)
      if filtering by service role, this is the service id (id of the attributeDefName for service
      Parameters:
      serviceRole1 -
      Returns:
      this for chaining
    • assignStemScope

      public MembershipFinder assignStemScope(Stem.Scope theStemScope)
      assign a stem scope to look in
      Parameters:
      theStemScope -
      Returns:
      this for chaining
    • assignStem

      public MembershipFinder assignStem(Stem theStem)
      assign a stem to search in
      Parameters:
      theStem -
      Returns:
      this for chaining
    • assignCheckSecurity

      public MembershipFinder assignCheckSecurity(boolean shouldCheckSecurity)
      assign if this should check security or run as grouper system
      Parameters:
      shouldCheckSecurity -
      Returns:
      this for chaining
    • addMemberId

      public MembershipFinder addMemberId(String memberId)
      add a member id to the search criteria
      Parameters:
      memberId -
      Returns:
      this for chaining
    • addMembershipId

      public MembershipFinder addMembershipId(String membershipId)
      add a membership id to the search criteria
      Parameters:
      membershipId -
      Returns:
      this for chaining
    • addSubjects

      public MembershipFinder addSubjects(Collection<Subject> subjects)
      add subjects
      Parameters:
      subjects -
      Returns:
      this for chaining
    • assignMemberIds

      public MembershipFinder assignMemberIds(Collection<String> theMemberIds)
      assign a collection of member ids to look for
      Parameters:
      theMemberIds -
      Returns:
      this for chaining
    • assignGroupIds

      public MembershipFinder assignGroupIds(Collection<String> theGroupIds)
      assign a collection of group ids to look for
      Parameters:
      theGroupIds -
      Returns:
      this for chaining
    • assignFields

      public MembershipFinder assignFields(Collection<Field> theFields)
      assign a collection of fields to look for
      Parameters:
      theFields -
      Returns:
      this for chaining
    • assignPrivileges

      public MembershipFinder assignPrivileges(Collection<Privilege> thePrivileges)
      assign a collection of privileges (fields) to look for
      Parameters:
      thePrivileges -
      Returns:
      this for chaining
    • assignFieldsByName

      public MembershipFinder assignFieldsByName(Collection<String> theFieldNames)
      assign a collection of fields to look for
      Parameters:
      theFieldNames -
      Returns:
      this for chaining
    • assignStemIds

      public MembershipFinder assignStemIds(Collection<String> theStemIds)
      assign a collection of stem ids to look for
      Parameters:
      theStemIds -
      Returns:
      this for chaining
    • assignAttributeDefIds

      public MembershipFinder assignAttributeDefIds(Collection<String> theAttributeDefIds)
      assign a collection of attributeDef ids to look for
      Parameters:
      theAttributeDefIds -
      Returns:
      this for chaining
    • assignMembershipType

      public MembershipFinder assignMembershipType(MembershipType theMembershipType)
      assign a membership type
      Parameters:
      theMembershipType -
      Returns:
      this for chaining
    • assignMembershipIds

      public MembershipFinder assignMembershipIds(Collection<String> theMembershipIds)
      assign a collection of membership ids to look for
      Parameters:
      theMembershipIds -
      Returns:
      this for chaining
    • addSubject

      public MembershipFinder addSubject(Subject subject)
      add a subject to look for.
      Parameters:
      subject -
      Returns:
      this for chaining
    • addGroupId

      public MembershipFinder addGroupId(String groupId)
      add a role id to the search criteria
      Parameters:
      groupId -
      Returns:
      this for chaining
    • assignRoleIds

      public MembershipFinder assignRoleIds(Collection<String> theRoleIds)
      assign a collection of role ids to look for
      Parameters:
      theRoleIds -
      Returns:
      this for chaining
    • assignSources

      public MembershipFinder assignSources(Set<Source> theSources)
      assign a collection of sources to look for
      Parameters:
      theSources -
      Returns:
      this for chaining
    • addGroup

      public MembershipFinder addGroup(Group group)
      add a role to look for.
      Parameters:
      group -
      Returns:
      this for chaining
    • addGroup

      public MembershipFinder addGroup(String name)
      add a role to look for by name.
      Parameters:
      name -
      Returns:
      this for chaining
    • addField

      public MembershipFinder addField(String name)
      add a field to filter by
      Parameters:
      name -
      Returns:
      this for chaining
    • addField

      public MembershipFinder addField(Field field)
      add a field to filter by
      Parameters:
      field -
      Returns:
      this for chaining
    • addPrivilegeTheUserHas

      public MembershipFinder addPrivilegeTheUserHas(String name)
      add a privilege the user has for group query
      Parameters:
      name -
      Returns:
      this for chaining
    • addPrivilegeTheUserHas

      public MembershipFinder addPrivilegeTheUserHas(Privilege field)
      add a privilege the user has for group query
      Parameters:
      field -
      Returns:
      this for chaining
    • assignCustomCompositeType

      public MembershipFinder assignCustomCompositeType(CompositeType theCustomCompositeType)
      if we are are doing a custom composite, this is the composite type (intersection or complement)
      Parameters:
      theCustomCompositeType -
      Returns:
      this for chaining
    • assignCustomCompositeGroup

      public MembershipFinder assignCustomCompositeGroup(Group theCustomCompositeGroup)
      if we are are doing a custom composite, this is the group
      Parameters:
      theCustomCompositeGroup -
      Returns:
      this for chaining
    • assignEnabled

      public MembershipFinder assignEnabled(Boolean theEnabled)
      true means enabled only, false, means disabled only, and null means all
      Parameters:
      theEnabled -
      Returns:
      this for chaining
    • assignHasEnabledDate

      public MembershipFinder assignHasEnabledDate(Boolean theHasEnabledDate)
      true means memberships with enabled dates false means memberships without enabled dates null means don't filter based on this (default)
      Parameters:
      theHasEnabledDate -
      Returns:
      this for chaining
    • assignHasDisabledDate

      public MembershipFinder assignHasDisabledDate(Boolean theHasDisabledDate)
      true means memberships with disabled dates false means memberships without disabled dates null means don't filter based on this (default)
      Parameters:
      theHasDisabledDate -
      Returns:
      this for chaining
    • hasMembership

      public boolean hasMembership()
      based on what you are querying for, see if has membership. Note, you should be looking for one subject, one group, one field, etc If you are looking for multiple, it will see if anyone has that membership or any group
      Returns:
      true if has membership, false if not
    • findMembershipResult

      public MembershipResult findMembershipResult()
      membership result gives helper methods in processing the results
      Returns:
      the membership result
    • assignIncludeInheritedPrivileges

      public MembershipFinder assignIncludeInheritedPrivileges(boolean theIncludeInheritedPrivileges)
      if inherited effective privileges should be included. i.e. if you query for UPDATE, then also query for ADMIN
      Parameters:
      theIncludeInheritedPrivileges -
      Returns:
      this for chaining
    • assignFindAllFields

      public MembershipFinder assignFindAllFields(boolean theFindAllFields)
      if true then find all fields in all membership and priv owners
      Parameters:
      theFindAllFields -
      Returns:
      this for chaining
    • findMembershipsMembers

      public Set<Object[]> findMembershipsMembers()
      find a set of object arrays which have a membership, group|stem|attributeDef, and member inside
      Returns:
      the set of arrays never null
    • findPITMembershipsMembers

      public Set<Object[]> findPITMembershipsMembers()
      find a set of object arrays which have a PITMembershipView, PITGroup|PITStem|PITAttributeDef, PITMember, and Member inside note that for now this only supports stem, stemScope, groupIds, memberIds, sources, checkSecurity, queryOptionsForMember, scopeForMember, hasFieldForMember, pointInTimeFrom, and pointInTimeTo
      Returns:
      the set of arrays never null
    • findMembership

      public Membership findMembership(boolean exceptionIfNotFound)
      find a membership
      Parameters:
      exceptionIfNotFound - true if exception should be thrown if permission not found
      Returns:
      the permission or null
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also:
    • addStem

      public MembershipFinder addStem(Stem stem)
      add a stem to look for.
      Parameters:
      stem -
      Returns:
      this for chaining
    • addStem

      public MembershipFinder addStem(String name)
      add a stem to look for by name.
      Parameters:
      name -
      Returns:
      this for chaining
    • addStemId

      public MembershipFinder addStemId(String stemId)
      add a stem id to the search criteria
      Parameters:
      stemId -
      Returns:
      this for chaining
    • addSourceId

      public MembershipFinder addSourceId(String sourceId)
      add a sourceId to the search criteria
      Parameters:
      sourceId -
      Returns:
      this for chaining
    • addSource

      public MembershipFinder addSource(Source source)
      add a source to the search criteria
      Parameters:
      source -
      Returns:
      this for chaining
    • addAttributeDef

      public MembershipFinder addAttributeDef(AttributeDef attributeDef)
      add a attributeDef to look for.
      Parameters:
      attributeDef -
      Returns:
      this for chaining
    • addAttributeDef

      public MembershipFinder addAttributeDef(String name)
      add a attributeDef to look for by name.
      Parameters:
      name -
      Returns:
      this for chaining
    • addAttributeDefId

      public MembershipFinder addAttributeDefId(String attributeDefId)
      add a attributeDef id to the search criteria
      Parameters:
      attributeDefId -
      Returns:
      this for chaining
    • findStemMemberships

      public static Set<Object[]> findStemMemberships(Collection<String> stemIds, Collection<String> memberIds, Collection<String> membershipIds, MembershipType membershipType, Field field, Set<Source> sources, String scope, Stem stem, Stem.Scope stemScope, Boolean enabled, Boolean shouldCheckSecurity)
      Parameters:
      stemIds - to limit memberships to (cant have more than 100 bind variables)
      memberIds - to limit memberships to (cant have more than 100 bind variables)
      membershipIds - to limit memberships to (cant have more than 100 bind variables)
      membershipType - Immediate, NonImmediate, etc
      field - if finding one field, list here, otherwise all list fields will be returned
      sources - if limiting memberships of members in certain sources, list here
      scope - sql like string which will have a % appended to it
      stem - if looking in a certain stem
      stemScope - if looking only in this stem, or all substems
      enabled - null for all, true for enabled only, false for disabled only
      shouldCheckSecurity - if we should check security, default to true
      Returns:
      the set of arrays of Membership, Group, and Member
      See Also:
    • findMemberships

      public static Set<Object[]> findMemberships(Collection<String> groupIds, Collection<String> memberIds, Collection<String> membershipIds, MembershipType membershipType, Field field, Set<Source> sources, String scope, Stem stem, Stem.Scope stemScope, Boolean enabled, Boolean shouldCheckSecurity)
      Parameters:
      groupIds - to limit memberships to (cant have more than 100 bind variables)
      memberIds - to limit memberships to (cant have more than 100 bind variables)
      membershipIds - to limit memberships to (cant have more than 100 bind variables)
      membershipType - Immediate, NonImmediate, etc
      field - if finding one field, list here, otherwise all list fields will be returned
      sources - if limiting memberships of members in certain sources, list here
      scope - sql like string which will have a % appended to it
      stem - if looking in a certain stem
      stemScope - if looking only in this stem, or all substems
      enabled - null for all, true for enabled only, false for disabled only
      shouldCheckSecurity - if we should check security, default to true
      Returns:
      the set of arrays of Membership, Group, and Member
      See Also:
    • findMemberships

      public static Set<Object[]> findMemberships(Collection<String> groupIds, Collection<String> memberIds, Collection<String> membershipIds, MembershipType membershipType, Field field, Set<Source> sources, String scope, Stem stem, Stem.Scope stemScope, Boolean enabled, Boolean shouldCheckSecurity, FieldType fieldType)
      Parameters:
      groupIds - to limit memberships to (cant have more than 100 bind variables)
      memberIds - to limit memberships to (cant have more than 100 bind variables)
      membershipIds - to limit memberships to (cant have more than 100 bind variables)
      membershipType - Immediate, NonImmediate, etc
      field - if finding one field, list here, otherwise all list fields will be returned
      sources - if limiting memberships of members in certain sources, list here
      scope - sql like string which will have a % appended to it
      stem - if looking in a certain stem
      stemScope - if looking only in this stem, or all substems
      enabled - null for all, true for enabled only, false for disabled only
      shouldCheckSecurity - if we should check security, default to true
      fieldType - is access or list
      Returns:
      the set of arrays of Membership, Group, and Member
      See Also:
    • findImmediateMembership

      public static Membership findImmediateMembership(GrouperSession s, Stem stem, Subject subj, Field f, boolean exceptionIfNotFound) throws MembershipNotFoundException, SchemaException
      Return the immediate membership if it exists. An immediate member is directly assigned to a stem. A stem can have potentially unlimited effective memberships

       
      Parameters:
      s - Get membership within this session context.
      stem - Immediate membership has this group.
      subj - Immediate membership has this subject.
      f - Immediate membership has this list.
      exceptionIfNotFound -
      Returns:
      A Membership object
      Throws:
      MembershipNotFoundException
      SchemaException
    • findMemberships

      public static Set<Object[]> findMemberships(Collection<String> groupIds, Collection<String> memberIds, Collection<String> membershipIds, MembershipType membershipType, Field field, Set<Source> sources, String scope, Stem stem, Stem.Scope stemScope, Boolean enabled)
      Parameters:
      groupIds - to limit memberships to (cant have more than 100 bind variables)
      memberIds - to limit memberships to (cant have more than 100 bind variables)
      membershipIds - to limit memberships to (cant have more than 100 bind variables)
      membershipType - Immediate, NonImmediate, etc
      field - if finding one field, list here, otherwise all list fields will be returned
      sources - if limiting memberships of members in certain sources, list here
      scope - sql like string which will have a % appended to it
      stem - if looking in a certain stem
      stemScope - if looking only in this stem, or all substems
      enabled - null for all, true for enabled only, false for disabled only
      Returns:
      the set of arrays of Membership, Group, and Member
      See Also:
    • findAttributeDefMemberships

      public static Set<Object[]> findAttributeDefMemberships(Collection<String> attributeDefIds, Collection<String> memberIds, Collection<String> membershipIds, MembershipType membershipType, Field field, Set<Source> sources, String scope, Stem stem, Stem.Scope stemScope, Boolean enabled, Boolean shouldCheckSecurity)
      Parameters:
      attributeDefIds - to limit memberships to (cant have more than 100 bind variables)
      memberIds - to limit memberships to (cant have more than 100 bind variables)
      membershipIds - to limit memberships to (cant have more than 100 bind variables)
      membershipType - Immediate, NonImmediate, etc
      field - if finding one field, list here, otherwise all list fields will be returned
      sources - if limiting memberships of members in certain sources, list here
      scope - sql like string which will have a % appended to it
      stem - if looking in a certain stem
      stemScope - if looking only in this stem, or all substems
      enabled - null for all, true for enabled only, false for disabled only
      shouldCheckSecurity - if we should check security, default to true
      Returns:
      the set of arrays of Membership, Group, and Member
      See Also:
    • findMemberships

      public static Set<Object[]> findMemberships(Collection<String> groupIds, Collection<String> memberIds, Collection<String> membershipIds, MembershipType membershipType, Field field, Set<Source> sources, String scope, Stem stem, Stem.Scope stemScope, Boolean enabled, Boolean shouldCheckSecurity, FieldType fieldType, String serviceId, ServiceRole serviceRole)
      Parameters:
      groupIds - to limit memberships to (cant have more than 100 bind variables)
      memberIds - to limit memberships to (cant have more than 100 bind variables)
      membershipIds - to limit memberships to (cant have more than 100 bind variables)
      membershipType - Immediate, NonImmediate, etc
      field - if finding one field, list here, otherwise all list fields will be returned
      sources - if limiting memberships of members in certain sources, list here
      scope - sql like string which will have a % appended to it
      stem - if looking in a certain stem
      stemScope - if looking only in this stem, or all substems
      enabled - null for all, true for enabled only, false for disabled only
      shouldCheckSecurity - if we should check security, default to true
      serviceId - is the id of the service (attributeDefName) if filtering memberships of people in a service
      serviceRole - is the user/admin role of the user in the service
      Returns:
      the set of arrays of Membership, Group, and Member
      See Also:
    • findCompositeMembership

      @Deprecated public static Membership findCompositeMembership(GrouperSession s, Group g, Subject subj) throws MembershipNotFoundException, SchemaException
      Deprecated.
      see overload
      Return the composite membership if it exists. A composite group is composed of two groups and a set operator (stored in grouper_composites table) (e.g. union, intersection, etc). A composite group has no immediate members. All subjects in a composite group are effective members.

       
      Parameters:
      s - Get membership within this session context.
      g - Composite membership has this group.
      subj - Composite membership has this subject.
      Returns:
      A Membership object
      Throws:
      MembershipNotFoundException
      SchemaException
      Since:
      1.0
    • findCompositeMembership

      public static Membership findCompositeMembership(GrouperSession s, Group g, Subject subj, boolean exceptionOnNull) throws MembershipNotFoundException, SchemaException
      Return the composite membership if it exists. A composite group is composed of two groups and a set operator (stored in grouper_composites table) (e.g. union, intersection, etc). A composite group has no immediate members. All subjects in a composite group are effective members.

       
      Parameters:
      s - Get membership within this session context.
      g - Composite membership has this group.
      subj - Composite membership has this subject.
      exceptionOnNull -
      Returns:
      A Membership object
      Throws:
      MembershipNotFoundException
      SchemaException
      Since:
      1.0
    • findEffectiveMemberships

      public static Set<Membership> findEffectiveMemberships(GrouperSession s, Group g, Subject subj, Field f, Group via, int depth) throws MembershipNotFoundException, SchemaException
      Return effective memberships. An effective member has an indirect membership to a group (e.g. in a group within a group). All subjects in a composite group are effective members (since the composite group has two groups and a set operator and no other immediate members). Note that a member can have an immediate membership and an effective membership.

       
      Parameters:
      s - Get membership within this session context.
      g - Effective membership has this group.
      subj - Effective membership has this subject.
      f - Effective membership has this list.
      via - Effective membership has this via group.
      depth - Effective membership has this depth.
      Returns:
      A set of Membership objects.
      Throws:
      MembershipNotFoundException
      SchemaException
    • findImmediateMembership

      @Deprecated public static Membership findImmediateMembership(GrouperSession s, Group g, Subject subj, Field f) throws MembershipNotFoundException, SchemaException
      Deprecated.
      see overload
      Return the immediate membership if it exists. An immediate member is directly assigned to a group. A composite group has no immediate members. Note that a member can have 0 to 1 immediate memberships to a single group, and 0 to many effective memberships to a group. A group can have potentially unlimited effective memberships

       
      Parameters:
      s - Get membership within this session context.
      g - Immediate membership has this group.
      subj - Immediate membership has this subject.
      f - Immediate membership has this list.
      Returns:
      A Membership object
      Throws:
      MembershipNotFoundException
      SchemaException
    • findImmediateMembership

      public static Membership findImmediateMembership(GrouperSession s, Group g, Subject subj, boolean exceptionIfNotFound) throws MembershipNotFoundException, SchemaException
      Return the immediate membership if it exists. An immediate member is directly assigned to a group. A composite group has no immediate members. Note that a member can have 0 to 1 immediate memberships to a single group, and 0 to many effective memberships to a group. A group can have potentially unlimited effective memberships

       
      Parameters:
      s - Get membership within this session context.
      g - Immediate membership has this group.
      subj - Immediate membership has this subject.
      f - Immediate membership has this list.
      exceptionIfNotFound -
      Returns:
      A Membership object
      Throws:
      MembershipNotFoundException
      SchemaException
    • findImmediateMembership

      public static Membership findImmediateMembership(GrouperSession s, Group g, Subject subj, Field f, boolean exceptionIfNotFound) throws MembershipNotFoundException, SchemaException
      Return the immediate membership if it exists. An immediate member is directly assigned to a group. A composite group has no immediate members. Note that a member can have 0 to 1 immediate memberships to a single group, and 0 to many effective memberships to a group. A group can have potentially unlimited effective memberships

       
      Parameters:
      s - Get membership within this session context.
      g - Immediate membership has this group.
      subj - Immediate membership has this subject.
      f - Immediate membership has this list.
      exceptionIfNotFound -
      Returns:
      A Membership object
      Throws:
      MembershipNotFoundException
      SchemaException
    • findImmediateMembership

      public static Membership findImmediateMembership(GrouperSession s, AttributeDef attributeDef, Subject subj, Field f, boolean exceptionIfNotFound) throws MembershipNotFoundException, SchemaException
      Return the immediate membership if it exists. An immediate member is directly assigned to an attributeDef. An attributeDef can have potentially unlimited effective memberships

       
      Parameters:
      s - Get membership within this session context.
      SchemaException - Immediate membership has this attribute def.
      subj - Immediate membership has this subject.
      f - Immediate membership has this list.
      exceptionIfNotFound -
      Returns:
      A Membership object
      Throws:
      MembershipNotFoundException
      SchemaException
    • internal_findAllChildrenNoPriv

      public static Set<Membership> internal_findAllChildrenNoPriv(Membership dto)

      Grouper internal method only

      Parameters:
      dto -
      Returns:
      set of memberships
    • findMembers

      public static Set<Member> findMembers(Group group, Field field) throws IllegalArgumentException
      Parameters:
      group -
      field -
      Returns:
      A set of all Member's in group's list field.
      Throws:
      IllegalArgumentException - if any parameter is null.
      Since:
      1.2.1
    • findMembers

      public static Set<Member> findMembers(Group group, Field field, QueryOptions queryOptions) throws IllegalArgumentException
      Parameters:
      group -
      field -
      queryOptions -
      Returns:
      A set of all Member's in group's list field.
      Throws:
      IllegalArgumentException - if any parameter is null.
      Since:
      1.2.1
    • findMembers

      public static Set<Member> findMembers(Group group, Field field, Set<Source> sources, QueryOptions queryOptions) throws IllegalArgumentException
      Parameters:
      group -
      field -
      sources - set of sources to retrieve from or null for all
      queryOptions -
      Returns:
      A set of all Member's in group's list field.
      Throws:
      IllegalArgumentException - if any parameter is null.
      Since:
      1.2.1
    • internal_findGroupSubjects

      public static Set<Subject> internal_findGroupSubjects(GrouperSession s, Group group, Field f) throws GrouperException

      Grouper internal method only

      Parameters:
      s -
      group -
      f -
      Returns:
      set of subjects
      Throws:
      GrouperException
    • internal_findAttributeDefSubjectsImmediateOnly

      public static Set<Subject> internal_findAttributeDefSubjectsImmediateOnly(GrouperSession s, AttributeDef attributeDef, Field f) throws GrouperException

      Grouper internal method only

      Parameters:
      s -
      attributeDef -
      f -
      Returns:
      set of subjects
      Throws:
      GrouperException
    • internal_findStemSubjectsImmediateOnly

      public static Set<Subject> internal_findStemSubjectsImmediateOnly(GrouperSession s, Stem stem, Field f) throws GrouperException

      Grouper internal method only

      Parameters:
      s -
      stem -
      f -
      Returns:
      set of subjects
      Throws:
      GrouperException
    • internal_findSubjectsStemPriv

      public static Set<Subject> internal_findSubjectsStemPriv(GrouperSession s, Stem stem, Field f)

      Grouper internal method only

      Parameters:
      s -
      stem -
      f -
      Returns:
      set of subjects
    • internal_findMembersByType

      public static Set<Member> internal_findMembersByType(GrouperSession s, Group g, Field f, String type)

      Grouper internal method only

      Parameters:
      s -
      g -
      f -
      type -
      Returns:
      set of members
    • assignScopeForMember

      public MembershipFinder assignScopeForMember(String theFilterForMember)
      if paging for member, then also filter for member
      Parameters:
      theFilterForMember -
      Returns:
      this for chaining
    • assignQueryOptionsForGroup

      public MembershipFinder assignQueryOptionsForGroup(QueryOptions theQueryOptionsForGroup)
      query options for group. must include paging. if sorting then sort by group
      Parameters:
      theQueryOptionsForGroup -
      Returns:
      this for chaining
    • assignHasFieldForStem

      public MembershipFinder assignHasFieldForStem(boolean theHasFieldForStem)
      return memberships where the stem has this field, note, it will return all the memberships for those stems
      Parameters:
      theHasFieldForStem -
      Returns:
      this for chaining
    • assignHasMembershipTypeForStem

      public MembershipFinder assignHasMembershipTypeForStem(boolean theHasMembershipTypeForStem)
      return memberships where the stem has this field, note, it will return all the memberships for those stems
      Returns:
      this for chaining
    • assignQueryOptionsForStem

      public MembershipFinder assignQueryOptionsForStem(QueryOptions theQueryOptionsForStem)
      query options for stem. must include paging. if sorting then sort by stem
      Parameters:
      theQueryOptionsForStem -
      Returns:
      this for chaining
    • assignScopeForStem

      public MembershipFinder assignScopeForStem(String theScopeForStem)
      if paging for stem, then also filter for stem
      Parameters:
      theScopeForStem -
      Returns:
      this for chaining
    • assignHasFieldForAttributeDef

      public MembershipFinder assignHasFieldForAttributeDef(boolean theHasFieldForAttributeDef)
      return memberships where the attributeDef has this field, note, it will return all the memberships for those attributeDefs
      Parameters:
      theHasFieldForAttributeDef -
      Returns:
      this for chaining
    • assignHasMembershipTypeForAttributeDef

      public MembershipFinder assignHasMembershipTypeForAttributeDef(boolean theHasMembershipTypeForAttributeDef)
      return memberships where the attributeDef has this field, note, it will return all the memberships for those attributeDefs
      Parameters:
      theHasMembershipTypeForAttributeDef -
      Returns:
      this for chaining
    • assignQueryOptionsForAttributeDef

      public MembershipFinder assignQueryOptionsForAttributeDef(QueryOptions theQueryOptionsForAttributeDef)
      query options for attributeDef. must include paging. if sorting then sort by attributeDef
      Parameters:
      theQueryOptionsForAttributeDef -
      Returns:
      this for chaining
    • assignScopeForAttributeDef

      public MembershipFinder assignScopeForAttributeDef(String theScopeForAttributeDef)
      if paging for attributeDef, then also filter for group
      Parameters:
      theScopeForAttributeDef -
      Returns:
      this for chaining
    • assignSplitScopeForAttributeDef

      public MembershipFinder assignSplitScopeForAttributeDef(boolean theSplitScopeForAttributeDef)
      if the scope for attributeDef has spaces in it, then split by whitespace, and find results that contain all of the scope strings
      Parameters:
      theSplitScopeForAttributeDef -
      Returns:
      this
    • assignSplitScopeForStem

      public MembershipFinder assignSplitScopeForStem(boolean theSplitScopeForStem)
      if the scope for stem has spaces in it, then split by whitespace, and find results that contain all of the scope strings
      Parameters:
      theSplitScopeForStem -
      Returns:
      this for chaining
    • assignScopeForGroup

      public MembershipFinder assignScopeForGroup(String theScopeForGroup)
      if paging for group, then also filter for member
      Parameters:
      theScopeForGroup -
      Returns:
      this for chaining
    • assignHasMembershipTypeForGroup

      public MembershipFinder assignHasMembershipTypeForGroup(boolean theHasMembershipTypeForGroup)
      return memberships where the group has this field, note, it will return all the memberships for those groups
      Parameters:
      theHasMembershipTypeForGroup -
      Returns:
      this for chaining
    • assignSplitScopeForGroup

      public MembershipFinder assignSplitScopeForGroup(boolean theSplitScopeForGroup)
      if the scope for group has spaces in it, then split by whitespace, and find results that contain all of the scope strings
      Parameters:
      theSplitScopeForGroup -
      Returns:
      this for chaining
    • assignSplitScopeForMember

      public MembershipFinder assignSplitScopeForMember(boolean theSplitScopeForMember)
      if the scope for member has spaces in it, then split by whitespace, and find results that contain all of the scope strings
      Parameters:
      theSplitScopeForMember -
      Returns:
      if splitting scope for member
    • assignQueryOptionsForMember

      public MembershipFinder assignQueryOptionsForMember(QueryOptions theQueryOptions)
      Parameters:
      theQueryOptions -
      Returns:
    • assignQueryOptionsForMembership

      public MembershipFinder assignQueryOptionsForMembership(QueryOptions theQueryOptions)
      Parameters:
      theQueryOptions -
      Returns:
    • assignPrivilegesTheUserHas

      public MembershipFinder assignPrivilegesTheUserHas(Collection<Privilege> thePrivilegesTheUserHas)
      assign a collection of fields to look for the user has for groups
      Parameters:
      thePrivilegesTheUserHas -
      Returns:
      this for chaining
    • assignPrivilegesTheUserHasByName

      public MembershipFinder assignPrivilegesTheUserHasByName(Collection<String> thePrivilegeNamesOfPrivilegesTheUserHas)
      assign a collection of fields to look for the user has for groups
      Parameters:
      thePrivilegeNamesOfPrivilegesTheUserHas -
      Returns:
      this for chaining
    • internal_findAllByCreatedAfter

      public static Set<Membership> internal_findAllByCreatedAfter(GrouperSession s, Date d, Field f) throws QueryException

      Grouper internal method only

      Parameters:
      s -
      d -
      f -
      Returns:
      set of memberships
      Throws:
      QueryException
    • internal_findAllByCreatedBefore

      public static Set<Membership> internal_findAllByCreatedBefore(GrouperSession s, Date d, Field f) throws QueryException

      Grouper internal method only

      Parameters:
      s -
      d -
      f -
      Returns:
      set of memberships
      Throws:
      QueryException
    • internal_findAllByGroupOwnerAndFieldAndType

      public static Set<Membership> internal_findAllByGroupOwnerAndFieldAndType(GrouperSession s, Group groupOwner, Field f, String type)

      Grouper internal method only

      Parameters:
      s -
      groupOwner -
      f -
      type -
      Returns:
      set of memberships
    • internal_findAllEffectiveByMemberAndField

      public static Set<Membership> internal_findAllEffectiveByMemberAndField(GrouperSession s, Member m, Field f)

      Grouper internal method only

      Parameters:
      s -
      m -
      f -
      Returns:
      set of memberships
    • internal_findAllImmediateByMemberAndField

      public static Set<Membership> internal_findAllImmediateByMemberAndField(GrouperSession s, Member m, Field f)

      Grouper internal method only

      Parameters:
      s -
      m -
      f -
      Returns:
      set of memberships
    • internal_findAllImmediateByMemberAndField

      public static Set<Membership> internal_findAllImmediateByMemberAndField(GrouperSession s, Member m, Field f, boolean enabledOnly)

      Grouper internal method only

      Parameters:
      s -
      m -
      f -
      enabledOnly -
      Returns:
      set of memberships
    • internal_findAllNonImmediateByMemberAndField

      public static Set<Membership> internal_findAllNonImmediateByMemberAndField(GrouperSession s, Member m, Field f)

      Grouper internal method only

      Parameters:
      s -
      m -
      f -
      Returns:
      set of memberships
    • internal_findMemberships

      public static Set<Membership> internal_findMemberships(GrouperSession s, Member m, Field f)

      Grouper internal method only

      Parameters:
      s -
      m -
      f -
      Returns:
      set of memberships
    • internal_findAllImmediateByGroupAndFieldAndPage

      public static Set<Membership> internal_findAllImmediateByGroupAndFieldAndPage(Group group, Field field, int start, int pageSize, int sortLimit, int[] numberOfRecords) throws SchemaException

      Grouper internal method only

      Parameters:
      start -
      pageSize -
      group -
      field -
      sortLimit -
      numberOfRecords - (pass in array of size one to get the result size back)
      Returns:
      the set of membership
      Throws:
      SchemaException
    • internal_findAllCompositeByGroupAndPage

      public static Set<Membership> internal_findAllCompositeByGroupAndPage(Group group, int start, int pageSize, int sortLimit, int[] numberOfRecords) throws SchemaException

      Grouper internal method only

      Parameters:
      start -
      pageSize -
      group -
      sortLimit -
      numberOfRecords - (pass in array of size one to get the result size back)
      Returns:
      the set of membership
      Throws:
      SchemaException
    • internal_findAllEffectiveByGroupAndFieldAndPage

      public static Set<Membership> internal_findAllEffectiveByGroupAndFieldAndPage(Group group, Field field, int start, int pageSize, int sortLimit, int[] numberOfRecords) throws SchemaException

      Grouper internal method only

      Parameters:
      start -
      pageSize -
      group -
      field -
      sortLimit -
      numberOfRecords - (pass in array of size one to get the result size back)
      Returns:
      the set of membership
      Throws:
      SchemaException
    • internal_findAllByGroupAndFieldAndPage

      public static Set<Membership> internal_findAllByGroupAndFieldAndPage(Group group, Field field, int start, int pageSize, int sortLimit, int[] numberOfRecords) throws SchemaException

      Grouper internal method only

      Parameters:
      start -
      pageSize -
      group -
      field -
      sortLimit -
      numberOfRecords - (pass in array of size one to get the result size back)
      Returns:
      the set of membership
      Throws:
      SchemaException
    • internal_findAttributeDefSubjects

      public static Set<Subject> internal_findAttributeDefSubjects(GrouperSession s, AttributeDef attributeDef, Field f) throws GrouperException

      Grouper internal method only

      Parameters:
      s -
      attributeDef -
      f -
      Returns:
      set of subjects
      Throws:
      GrouperException
    • internal_findGroupSubjectsImmediateOnly

      public static Set<Subject> internal_findGroupSubjectsImmediateOnly(GrouperSession s, Group group, Field f) throws GrouperException

      Grouper internal method only

      Parameters:
      s -
      group -
      f -
      Returns:
      set of subjects
      Throws:
      GrouperException
    • findByUuid

      public static Membership findByUuid(GrouperSession grouperSession, String uuid, boolean exceptionIfNotFound, boolean enabledOnly) throws MembershipNotFoundException
      Find a membership within the registry by UUID. This will be either the uuid or immediate uuid. Security will be checked to see if the grouper session is allowed to see the membership
         Membership membership = MembershipFinder.findByUuid(grouperSession, uuid);
       
      Parameters:
      grouperSession - Find membership within this session context.
      uuid - UUID of membership to find.
      exceptionIfNotFound - true if exception if not found
      enabledOnly - true for enabled only
      Returns:
      A Membership
      Throws:
      MembershipNotFoundException - if not found an exceptionIfNotFound is true
    • findAllImmediateMemberhipSubjectContainers

      public static Set<MembershipSubjectContainer> findAllImmediateMemberhipSubjectContainers(GrouperSession grouperSession, Subject subject)
      Find all the membership subject containers for a given subject
      Parameters:
      grouperSession -
      subject -
      Returns: