Package edu.internet2.middleware.grouper
Class MemberFinder
java.lang.Object
edu.internet2.middleware.grouper.MemberFinder
Use this class to find members within the Groups registry
Sample call
Setmembers = MemberFinder.findAll(grouperSession, gsaSource);
Sample call to find members by attribute def names
Setmembers = new MemberFinder().assignNameOfAttributeDefName(attributeDefName.getName()) .assignAttributeCheckReadOnAttributeDef(true).assignQueryOptions(QueryOptions.create("subjectId", true, null, null)).findMembers();
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionif looking for an attribute value on an assignment, could be multiple valuesif looking for an attribute value on an assignment2, could be multiple valuesassignAttributeCheckReadOnAttributeDef
(boolean theAttributeDefNameUseSecurity) use security around attribute def? default is trueassignAttributeValue
(Object theValue) find objects with this valueassignAttributeValue2
(Object theValue) find objects with this value2assignAttributeValuesOnAssignment
(Set<Object> theValues) if looking for an attribute value on an assignment, could be multiple valuesassignAttributeValuesOnAssignment2
(Set<Object> theValues) if looking for an attribute value on an assignment2, could be multiple valuesassignIdOfAttributeDefName
(String theAttributeDefNameId) find groups that have this attribute def name id, note could be an assignment on an assignmentassignIdOfAttributeDefName2
(String theAttributeDefNameId) find groups that have this attribute def name id, note could be an assignment on an assignmentassignNameOfAttributeDefName
(String theNameOfAttributeDefName) find groups that have this attribute assignedassignNameOfAttributeDefName2
(String theNameOfAttributeDefName) find groups that have this attribute assignedassignQueryOptions
(QueryOptions theQueryOptions) if sorting, paging, caching, etcstatic void
Grouper internal method onlystatic Member
find
(String sourceId, String subjectId, String subjectIdentifier, String subjectIdOrIdentifier, String memberId) might want to make sure the user is root before doing thisstatic Set
Find all members.findAll
(GrouperSession s, Source source) Find all members by source.findAllUsed
(GrouperSession grouperSession, Source source) Find all members by source used somewhere, e.g.static Member
findBySubject
(GrouperSession s, Subject subj) Deprecated.use overloadstatic Member
findBySubject
(GrouperSession s, Subject subj, boolean createIfNotExist) static Member
findBySubject
(GrouperSession s, Subject subj, boolean createIfNotExist, QueryOptions queryOptions) findBySubjects
(Collection<Subject> subjects, boolean createIfNotExists) convert a set of subjects to a set of membersfindBySubjectsInGroup
(GrouperSession grouperSession, Set<Subject> subjects, Group group, Field field, MembershipType membershipType) convert a set of subjects to a set of membersstatic Member
findByUuid
(GrouperSession s, String uuid) Deprecated.static Member
findByUuid
(GrouperSession s, String uuid, boolean exceptionIfNotFound) Get a member by UUID.findInternalIdsByNames
(Set<MultiKey> sourceIdsSubjectIds) this will cache for a minute, find internal ids by namefind membersstatic Member
internal_createMember
(Subject subj, String memberUuidIfCreate) Grouper internal method onlystatic Member
Grouper internal method onlystatic Member
internal_findBySubject
(Subject subj, String uuidIfCreate, boolean createIfNotExist) Grouper internal method onlystatic Member
internal_findBySubject
(Subject subj, String uuidIfCreate, boolean createIfNotExist, QueryOptions queryOptions) Grouper internal method onlyinternal_findMembersByType
(GrouperSession grouperSession, Group group, Field field, String type, Set<Source> sources, QueryOptions queryOptions, SortStringEnum memberSortStringEnum, SearchStringEnum memberSearchStringEnum, String memberSearchStringValue) Grouper internal method onlystatic Member
internal_findOrCreateBySubject
(String id, String src, String type) Grouper internal method onlystatic Member
internal_findReadableMemberBySubject
(GrouperSession grouperSession, Subject subject, boolean exceptionIfNotExist, boolean createIfNotExist) Grouper internal method onlystatic Member
Grouper internal method onlystatic Member
internal_findViewableMemberBySubject
(GrouperSession s, Subject subj, boolean exceptionIfNotExist) Grouper internal method onlystatic void
memberCreatedCacheDelete
(String sourceId, String subjectId) Grouper internal method only
-
Constructor Details
-
MemberFinder
public MemberFinder()constructor
-
-
Method Details
-
findMembers
find members- Returns:
- the set of groups or the empty set if none found
-
addAttributeValuesOnAssignment
if looking for an attribute value on an assignment, could be multiple values- Parameters:
theValues
-- Returns:
- this for chaining
-
addAttributeValuesOnAssignment2
if looking for an attribute value on an assignment2, could be multiple values- Parameters:
value
-- Returns:
- this for chaining
-
assignAttributeCheckReadOnAttributeDef
use security around attribute def? default is true- Parameters:
theAttributeDefNameUseSecurity
-- Returns:
- this for chaining
-
assignAttributeValue
find objects with this value- Parameters:
theValue
-- Returns:
- this for chaining
-
assignAttributeValue2
find objects with this value2- Parameters:
theValue
-- Returns:
- this for chaining
-
assignAttributeValuesOnAssignment
if looking for an attribute value on an assignment, could be multiple values- Parameters:
theValues
-- Returns:
- this for chaining
-
assignAttributeValuesOnAssignment2
if looking for an attribute value on an assignment2, could be multiple values- Parameters:
theValues
-- Returns:
- this for chaining
-
assignIdOfAttributeDefName
find groups that have this attribute def name id, note could be an assignment on an assignment- Parameters:
theAttributeDefNameId
-- Returns:
- this for chaining
-
assignIdOfAttributeDefName2
find groups that have this attribute def name id, note could be an assignment on an assignment- Parameters:
theAttributeDefNameId
-- Returns:
- this for chaining
-
assignNameOfAttributeDefName
find groups that have this attribute assigned- Parameters:
theNameOfAttributeDefName
-- Returns:
- this for chaining
-
assignNameOfAttributeDefName2
find groups that have this attribute assigned- Parameters:
theNameOfAttributeDefName
-- Returns:
- this for chaining
-
assignQueryOptions
if sorting, paging, caching, etc- Parameters:
theQueryOptions
-- Returns:
- this for chaining
-
findAll
Find all members.Set members = MemberFinder.findAll(s);
- Parameters:
s
- Find all members within this session context.- Returns:
Set
ofMember
objects.- Throws:
GrouperException
-
findAllUsed
public static Set<Member> findAllUsed(GrouperSession grouperSession, Source source) throws GrouperException Find all members by source used somewhere, e.g. with memberships or attributes etc.Set members = MemberFinder.findAllUsed(s, source);
- Parameters:
grouperSession
- Find all members within this session context.source
- Find all members with this source.- Returns:
Set
ofMember
objects.- Throws:
GrouperException
-
findAll
Find all members by source.Set members = MemberFinder.findAll(s, source);
- Parameters:
s
- Find all members within this session context.source
- Find all members with this source.- Returns:
Set
ofMember
objects.- Throws:
GrouperException
-
internal_findMembersByType
public static Set<Member> internal_findMembersByType(GrouperSession grouperSession, Group group, Field field, String type, Set<Source> sources, QueryOptions queryOptions, SortStringEnum memberSortStringEnum, SearchStringEnum memberSearchStringEnum, String memberSearchStringValue) Grouper internal method only
make sure allowed to see them, and find the members- Parameters:
grouperSession
-group
-field
-type
-sources
-queryOptions
-memberSortStringEnum
-memberSearchStringEnum
-memberSearchStringValue
-- Returns:
- the members, dont return null
-
findBySubject
Deprecated.use overload -
findBySubjectsInGroup
public static Set<Member> findBySubjectsInGroup(GrouperSession grouperSession, Set<Subject> subjects, Group group, Field field, MembershipType membershipType) convert a set of subjects to a set of members- Parameters:
grouperSession
-subjects
- to convert to membersgroup
- that subjects must be infield
- that they must be in in the group (null will default to eh members listmembershipType
- that they must be in in the group or null for any- Returns:
- the members in the group
-
findBySubjects
convert a set of subjects to a set of members- Parameters:
subjects
- to convert to memberscreateIfNotExists
-group
- that subjects must be infield
- that they must be in in the group (null will default to eh members listmembershipType
- that they must be in in the group or null for any- Returns:
- the members in the group
-
find
public static Member find(String sourceId, String subjectId, String subjectIdentifier, String subjectIdOrIdentifier, String memberId) might want to make sure the user is root before doing this- Parameters:
sourceId
-subjectId
-subjectIdentifier
-subjectIdOrIdentifier
-memberId
-- Returns:
- the member
-
findBySubject
-
findBySubject
public static Member findBySubject(GrouperSession s, Subject subj, boolean createIfNotExist, QueryOptions queryOptions) -
findByUuid
@Deprecated public static Member findByUuid(GrouperSession s, String uuid) throws MemberNotFoundException Deprecated.Get a member by UUID.// Get a member by uuid. try { Member m = MemberFind.findByUuid(s, uuid); } catch (MemberNotFoundException e) { // Member not found }
- Parameters:
s
- GetMember
within this session context.uuid
- GetMember
with this UUID.- Returns:
- A
Member
object. - Throws:
MemberNotFoundException
-
findByUuid
public static Member findByUuid(GrouperSession s, String uuid, boolean exceptionIfNotFound) throws MemberNotFoundException Get a member by UUID.// Get a member by uuid. Member m = MemberFind.findByUuid(s, uuid, false);
- Parameters:
s
- GetMember
within this session context.uuid
- GetMember
with this UUID.exceptionIfNotFound
- true to throw exception if not found- Returns:
- A
Member
object. - Throws:
MemberNotFoundException
-
internal_findAllMember
Grouper internal method only
- Returns:
- member
- Throws:
GrouperException
-
internal_findRootMember
Grouper internal method only
- Returns:
- member
- Throws:
GrouperException
-
internal_findBySubject
public static Member internal_findBySubject(Subject subj, String uuidIfCreate, boolean createIfNotExist) Grouper internal method only
find a member, perhaps create a new one if not there- Parameters:
subj
-uuidIfCreate
- uuid to use if creatingcreateIfNotExist
-- Returns:
- the member or null if not found
-
internal_findBySubject
public static Member internal_findBySubject(Subject subj, String uuidIfCreate, boolean createIfNotExist, QueryOptions queryOptions) Grouper internal method only
find a member, perhaps create a new one if not there- Parameters:
subj
-uuidIfCreate
- uuid to use if creatingcreateIfNotExist
-- Returns:
- the member or null if not found
-
internal_findOrCreateBySubject
Grouper internal method only
find a member- Parameters:
id
-src
-type
-- Returns:
- the member
-
memberCreatedCacheDelete
Grouper internal method only
- Parameters:
sourceId
-subjectId
-
-
internal_createMember
Grouper internal method only
create a member- Parameters:
subj
-memberUuidIfCreate
-- Returns:
- the member object
-
internal_findViewableMemberBySubject
public static Member internal_findViewableMemberBySubject(GrouperSession s, Subject subj, boolean exceptionIfNotExist) throws InsufficientPrivilegeException, MemberNotFoundException Grouper internal method only
- Parameters:
s
-subj
-exceptionIfNotExist
-- Returns:
- the member or null if exceptionIfNotExist is false
- Throws:
InsufficientPrivilegeException
MemberNotFoundException
-
internal_findReadableMemberBySubject
public static Member internal_findReadableMemberBySubject(GrouperSession grouperSession, Subject subject, boolean exceptionIfNotExist, boolean createIfNotExist) throws MemberNotFoundException, InsufficientPrivilegeException Grouper internal method only
find a member object and if group, make sure it is readable- Parameters:
grouperSession
-subject
-exceptionIfNotExist
-createIfNotExist
-- Returns:
- the member
- Throws:
MemberNotFoundException
InsufficientPrivilegeException
-
clearInternalMembers
public static void clearInternalMembers()Grouper internal method only
-
findInternalIdsByNames
this will cache for a minute, find internal ids by name- Parameters:
sourceIdsSubjectIds
-- Returns:
- the internal ids
-