edu.internet2.middleware.grouper
Class MembershipFinder

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

public class MembershipFinder
extends Object

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

Version:
$Id: MembershipFinder.java,v 1.108 2009-12-17 06:57:57 mchyzer Exp $
Author:
blair christensen.

Constructor Summary
MembershipFinder()
           
 
Method Summary
static Membership findByUuid(GrouperSession grouperSession, String uuid, boolean exceptionIfNotFound, boolean enabledOnly)
          Find a membership within the registry by UUID.
static Membership findCompositeMembership(GrouperSession s, Group g, Subject subj)
          Deprecated. see overload
static Membership findCompositeMembership(GrouperSession s, Group g, Subject subj, boolean exceptionOnNull)
          Return the composite membership if it exists.
static Set<Membership> findEffectiveMemberships(GrouperSession s, Group g, Subject subj, Field f, Group via, int depth)
          Return effective memberships.
static Membership findImmediateMembership(GrouperSession s, Group g, Subject subj, Field f)
          Deprecated. see overload
static Membership findImmediateMembership(GrouperSession s, Group g, Subject subj, Field f, boolean exceptionIfNotFound)
          Return the immediate membership if it exists.
static Set<Member> findMembers(Group group, Field field)
           
static Set<Member> findMembers(Group group, Field field, QueryOptions queryOptions)
           
static Set<Member> findMembers(Group group, Field field, Set<Source> sources, QueryOptions queryOptions)
           
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)
           
static Set<Membership> internal_findAllByCreatedAfter(GrouperSession s, Date d, Field f)
           
static Set<Membership> internal_findAllByCreatedBefore(GrouperSession s, Date d, Field f)
           
static Set<Membership> internal_findAllByGroupAndFieldAndPage(Group group, Field field, int start, int pageSize, int sortLimit, int[] numberOfRecords)
           
static Set<Membership> internal_findAllByGroupOwnerAndFieldAndType(GrouperSession s, Group groupOwner, Field f, String type)
           
static Set<Membership> internal_findAllChildrenNoPriv(Membership dto)
           
static Set<Membership> internal_findAllCompositeByGroupAndPage(Group group, int start, int pageSize, int sortLimit, int[] numberOfRecords)
           
static Set<Membership> internal_findAllEffectiveByGroupAndFieldAndPage(Group group, Field field, int start, int pageSize, int sortLimit, int[] numberOfRecords)
           
static Set<Membership> internal_findAllEffectiveByMemberAndField(GrouperSession s, Member m, Field f)
           
static Set<Membership> internal_findAllImmediateByGroupAndFieldAndPage(Group group, Field field, int start, int pageSize, int sortLimit, int[] numberOfRecords)
           
static Set<Membership> internal_findAllImmediateByMemberAndField(GrouperSession s, Member m, Field f)
           
static Set<Membership> internal_findAllNonImmediateByMemberAndField(GrouperSession s, Member m, Field f)
           
static Set<Subject> internal_findAttributeDefSubjects(GrouperSession s, AttributeDef attributeDef, Field f)
           
static Set<Subject> internal_findAttributeDefSubjectsImmediateOnly(GrouperSession s, AttributeDef attributeDef, Field f)
           
static Set<Subject> internal_findGroupSubjects(GrouperSession s, Group group, Field f)
           
static Set<Subject> internal_findGroupSubjectsImmediateOnly(GrouperSession s, Group group, Field f)
           
static Set<Member> internal_findMembersByType(GrouperSession s, Group g, Field f, String type)
           
static Set<Membership> internal_findMemberships(GrouperSession s, Member m, Field f)
           
static Set<Subject> internal_findStemSubjectsImmediateOnly(GrouperSession s, Stem stem, Field f)
           
static Set<Subject> internal_findSubjectsStemPriv(GrouperSession s, Stem stem, Field f)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MembershipFinder

public MembershipFinder()
Method Detail

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:
MembershipDAO.findAllByGroupOwnerOptions(java.util.Collection, java.util.Collection, java.util.Collection, edu.internet2.middleware.grouper.membership.MembershipType, edu.internet2.middleware.grouper.Field, Set, java.lang.String, edu.internet2.middleware.grouper.Stem, edu.internet2.middleware.grouper.Stem.Scope, java.lang.Boolean)

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,
                                                 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

internal_findAllChildrenNoPriv

public static Set<Membership> internal_findAllChildrenNoPriv(Membership dto)
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
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
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
Parameters:
s -
stem -
f -
Returns:
set of subjects
Throws:
GrouperException

internal_findSubjectsStemPriv

public static Set<Subject> internal_findSubjectsStemPriv(GrouperSession s,
                                                         Stem stem,
                                                         Field f)
Parameters:
s -
stem -
f -
Returns:
set of subjects

internal_findMembersByType

public static Set<Member> internal_findMembersByType(GrouperSession s,
                                                     Group g,
                                                     Field f,
                                                     String type)
Parameters:
s -
g -
f -
type -
Returns:
set of members

internal_findAllByCreatedAfter

public static Set<Membership> internal_findAllByCreatedAfter(GrouperSession s,
                                                             Date d,
                                                             Field f)
                                                      throws QueryException
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
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)
Parameters:
s -
groupOwner -
f -
type -
Returns:
set of memberships

internal_findAllEffectiveByMemberAndField

public static Set<Membership> internal_findAllEffectiveByMemberAndField(GrouperSession s,
                                                                        Member m,
                                                                        Field f)
Parameters:
s -
m -
f -
Returns:
set of memberships

internal_findAllImmediateByMemberAndField

public static Set<Membership> internal_findAllImmediateByMemberAndField(GrouperSession s,
                                                                        Member m,
                                                                        Field f)
Parameters:
s -
m -
f -
Returns:
set of memberships

internal_findAllNonImmediateByMemberAndField

public static Set<Membership> internal_findAllNonImmediateByMemberAndField(GrouperSession s,
                                                                           Member m,
                                                                           Field f)
Parameters:
s -
m -
f -
Returns:
set of memberships

internal_findMemberships

public static Set<Membership> internal_findMemberships(GrouperSession s,
                                                       Member m,
                                                       Field f)
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
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
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
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
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
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
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