Package edu.internet2.middleware.grouper
Class GroupFinder
java.lang.Object
edu.internet2.middleware.grouper.GroupFinder
Use this class to find groups within the Groups registry
Sample call
Group group = GroupFinder.findByName(grouperSession, "test", true);
Sample call to find groups a subject has specific privileges on
Setgroups = new GroupFinder().assignPrivileges(AccessPrivilege.VIEW_PRIVILEGES) .assignField(Group.getDefaultList()).assignSubject(subject) .assignQueryOptions(new QueryOptions().paging(1000, 1, false)).findGroups();
-
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 valuesaddGroupId
(String groupId) add a group id to search foraddGroupName
(String groupName) add a group name to search foraddPrivilege
(Privilege privilege) add a privilege to filter by that the subject has on the groupaddTypeOfGroup
(TypeOfGroup typeOfGroup) assignAttributeCheckReadOnAttributeDef
(boolean theAttributeDefNameUseSecurity) use security around attribute def? default is trueassignAttributeNotAssigned
(boolean attributeNotAssigned) find groups that don't have a certain type assignedassignAttributeValue
(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 valuesassignCompositeOwner
(Boolean theCompositeOwner) if we are filtering for groups which are composite owners or notassignExcludeAlternateNames
(boolean excludeAlternateNames) whether to exclude alternate names from name/scope searchassignField
(Field theField) field to look for if searching for memberships in groupsassignFieldName
(String theFieldName) field name to look for if searching for memberships in groupsassignFindByUuidOrName
(boolean theFindByUuidOrName) if we are looking up a group, only look by uuid or nameassignGroupIds
(Collection<String> theGroupIds) assign group ids to search forassignGroupNames
(Collection<String> theGroupNames) assign group names to search forassignIdOfAttributeDefName
(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 assignmentassignMembershipsForSubject
(boolean membershipsForSubject1) if this is true, or there is a field assigned, then get memberships for a subjectassignNameOfAttributeDefName
(String theNameOfAttributeDefName) find groups that have this attribute assignedassignNameOfAttributeDefName2
(String theNameOfAttributeDefName) find groups that have this attribute assignedassignParentStemId
(String theParentStemId) parent or ancestor stem of the groupassignPrivileges
(Set<Privilege> theGroups) assign privileges to filter by that the subject has on the groupassignQueryOptions
(QueryOptions theQueryOptions) if sorting, paging, caching, etcassignScope
(String theScope) scope to look for groups Wildcards will be appended or percent is the wildcardassignSplitScope
(boolean theSplitScope) if the scope has spaces in it, then split by whitespace, and find results that contain all of the scope stringsassignStemScope
(Stem.Scope theStemScope) if passing in a stem, this is the stem scope...assignSubject
(Subject theSubject) this is the subject that has certain memberships in the queryassignSubjectNotInGroup
(Subject theSubjectNotInGroup) assign a subject which does not have an immediate membership in the groupassignTypeOfGroups
(Set<TypeOfGroup> theTypeOfGroups) findAllByAttribute
(GrouperSession s, String attr, String val) Find Groups by attribute value.findAllByType
(GrouperSession s, GroupType type) Find all groups within the registry by theirGroupType
.static Group
findByAlternateName
(GrouperSession s, String name, boolean exceptionIfNotFound) Find a group within the registry by its alternate name.findByApproximateDescriptionSecure
(String description, QueryOptions queryOptions, Set<TypeOfGroup> typeOfGroups) findByApproximateDisplayExtensionSecure
(String extension, QueryOptions queryOptions, Set<TypeOfGroup> typeOfGroups) findByApproximateDisplayNameSecure
(String displayName, QueryOptions queryOptions, Set<TypeOfGroup> typeOfGroups) findByApproximateExtensionSecure
(String extension, QueryOptions queryOptions, Set<TypeOfGroup> typeOfGroups) static Group
findByAttribute
(GrouperSession s, String attr, String val) Deprecated.use the overloadstatic Group
findByAttribute
(GrouperSession s, String attr, String val, boolean exceptionOnNull) Find Group by attribute value.static Group
findByCurrentName
(GrouperSession s, String name, boolean exceptionIfNotFound) Find a group within the registry by its current name.findByDescriptionSecure
(String description, QueryOptions queryOptions, Set<TypeOfGroup> typeOfGroups) findByDisplayExtensionSecure
(String displayExtension, QueryOptions queryOptions, Set<TypeOfGroup> typeOfGroups) findByDisplayNameSecure
(String displayName, QueryOptions queryOptions, Set<TypeOfGroup> typeOfGroups) findByExtensionSecure
(String extension, QueryOptions queryOptions, Set<TypeOfGroup> typeOfGroups) static Group
findByIdIndexSecure
(Long idIndex, boolean exceptionIfNotFound, QueryOptions queryOptions) Find a group within the registry by ID index.static Group
findByName
(GrouperSession s, String name) Deprecated.static Group
findByName
(GrouperSession s, String name, boolean exceptionIfNotFound) Find a group within the registry by name.static Group
findByName
(GrouperSession s, String name, boolean exceptionIfNotFound, QueryOptions queryOptions) Find a group within the registry by name.static Group
findByName
(String name, boolean exceptionIfNotFound) Find a group within the registry by name.static Group
findByNameAsGrouperSystem
(String name, boolean exceptionIfNotFound) Find a group within the registry by name as grouper system.static Group
findByUuid
(GrouperSession s, String uuid) Deprecated.static Group
findByUuid
(GrouperSession s, String uuid, boolean exceptionIfNotFound) Find a group within the registry by UUID.static Group
findByUuid
(GrouperSession s, String uuid, boolean exceptionIfNotFound, QueryOptions queryOptions) Find a group within the registry by UUID.static Group
findByUuid
(String uuid, boolean exceptionIfNotFound) Find a group within the registry by UUID.static Group
findByUuidAsGrouperSystem
(String uuid, boolean exceptionIfNotFound) Find a group within the registry by UUID as grouper system.find the groupfind all the groupfindInternalIdsByNames
(Set<String> groupNames2) this will cache for a minute, find internal ids by namestatic void
Grouper internal method onlystatic void
Grouper internal method onlystatic void
groupCacheRemove
(Group group) Grouper internal method only
-
Constructor Details
-
GroupFinder
public GroupFinder()default constructor
-
-
Method Details
-
groupCacheAsRootAddSystemGroup
Grouper internal method only
- Parameters:
group
-
-
groupCacheClear
public static void groupCacheClear()Grouper internal method only
remove all caches -
groupCacheRemove
Grouper internal method only
remove this from all caches- Parameters:
group
-
-
assignCompositeOwner
if we are filtering for groups which are composite owners or not- Parameters:
theCompositeOwner
-- Returns:
- this for chaining
-
findByAttribute
@Deprecated public static Group findByAttribute(GrouperSession s, String attr, String val) throws GroupNotFoundException, IllegalArgumentException Deprecated.use the overloadFind Group by attribute value.try { Group g = GroupFinder.findByAttribute(s, "description", "some value"); } catch (GroupNotFoundException eGNF) { }
- Parameters:
s
- Search within this session context.attr
- Search on this attribute.val
- Search for this value.- Returns:
- Matching
Group
. - Throws:
GroupNotFoundException
IllegalArgumentException
- Since:
- 1.1.0
-
findByAttribute
public static Group findByAttribute(GrouperSession s, String attr, String val, boolean exceptionOnNull) throws GroupNotFoundException, IllegalArgumentException Find Group by attribute value.Group g = GroupFinder.findByAttribute(s, "description", "some value", true);
- Parameters:
s
- Search within this session context.attr
- Search on this attribute.val
- Search for this value.exceptionOnNull
- true if there should be an exception on null- Returns:
- Matching
Group
. - Throws:
GroupNotFoundException
IllegalArgumentException
- Since:
- 1.1.0
-
findAllByAttribute
public static Set<Group> findAllByAttribute(GrouperSession s, String attr, String val) throws IllegalArgumentException Find Groups by attribute value. Returns groups or empty set if none (never null)Set
groups = GroupFinder.findAllByAttribute(s, "description", "some value"); - Parameters:
s
- Search within this session context.attr
- Search on this attribute.val
- Search for this value.- Returns:
- Matching
Group
. - Throws:
IllegalArgumentException
- Since:
- 1.1.0
-
findByName
@Deprecated public static Group findByName(GrouperSession s, String name) throws GroupNotFoundException Deprecated.Find a group within the registry by name.try { Group g = GroupFinder.findByName(name); } catch (GroupNotFoundException e) { // Group not found }
- Parameters:
s
- Find group within this session context.name
- Name of group to find.- Returns:
- A
Group
- Throws:
GroupNotFoundException
-
findByName
public static Group findByName(GrouperSession s, String name, boolean exceptionIfNotFound) throws GroupNotFoundException Find a group within the registry by name.try { Group g = GroupFinder.findByName(name); } catch (GroupNotFoundException e) { // Group not found }
- Parameters:
s
- Find group within this session context.name
- Name of group to find.exceptionIfNotFound
-- Returns:
- A
Group
- Throws:
GroupNotFoundException
-
findByNameAsGrouperSystem
public static Group findByNameAsGrouperSystem(String name, boolean exceptionIfNotFound) throws GroupNotFoundException Find a group within the registry by name as grouper system.try { Group g = GroupFinder.findByName(name); } catch (GroupNotFoundException e) { // Group not found }
- Parameters:
s
- Find group within this session context.name
- Name of group to find.exceptionIfNotFound
-- Returns:
- A
Group
- Throws:
GroupNotFoundException
-
findByName
Find a group within the registry by name.try { Group g = GroupFinder.findByName(name, true); } catch (GroupNotFoundException e) { // Group not found }
- Parameters:
name
- Name of group to find.exceptionIfNotFound
-queryOptions
- paging, sorting, caching options- Returns:
- A
Group
- Throws:
GroupNotFoundException
-
findByName
public static Group findByName(GrouperSession s, String name, boolean exceptionIfNotFound, QueryOptions queryOptions) throws GroupNotFoundException Find a group within the registry by name.try { Group g = GroupFinder.findByName(name); } catch (GroupNotFoundException e) { // Group not found }
- Parameters:
s
- Find group within this session context.name
- Name of group to find.exceptionIfNotFound
-queryOptions
- paging, sorting, caching options- Returns:
- A
Group
- Throws:
GroupNotFoundException
-
findByApproximateDescriptionSecure
public static Set<Group> findByApproximateDescriptionSecure(String description, QueryOptions queryOptions, Set<TypeOfGroup> typeOfGroups) -
findByDescriptionSecure
public static Set<Group> findByDescriptionSecure(String description, QueryOptions queryOptions, Set<TypeOfGroup> typeOfGroups) -
findByDisplayNameSecure
public static Set<Group> findByDisplayNameSecure(String displayName, QueryOptions queryOptions, Set<TypeOfGroup> typeOfGroups) -
findByApproximateDisplayNameSecure
public static Set<Group> findByApproximateDisplayNameSecure(String displayName, QueryOptions queryOptions, Set<TypeOfGroup> typeOfGroups) -
findByExtensionSecure
public static Set<Group> findByExtensionSecure(String extension, QueryOptions queryOptions, Set<TypeOfGroup> typeOfGroups) -
findByApproximateExtensionSecure
public static Set<Group> findByApproximateExtensionSecure(String extension, QueryOptions queryOptions, Set<TypeOfGroup> typeOfGroups) -
findByDisplayExtensionSecure
public static Set<Group> findByDisplayExtensionSecure(String displayExtension, QueryOptions queryOptions, Set<TypeOfGroup> typeOfGroups) -
findByApproximateDisplayExtensionSecure
public static Set<Group> findByApproximateDisplayExtensionSecure(String extension, QueryOptions queryOptions, Set<TypeOfGroup> typeOfGroups) -
findByCurrentName
public static Group findByCurrentName(GrouperSession s, String name, boolean exceptionIfNotFound) throws GroupNotFoundException Find a group within the registry by its current name.try { Group g = GroupFinder.findByCurrentName(name, true); } catch (GroupNotFoundException e) { // Group not found }
- Parameters:
s
- Find group within this session context.name
- Name of group to find.exceptionIfNotFound
-- Returns:
- A
Group
- Throws:
GroupNotFoundException
-
findByAlternateName
public static Group findByAlternateName(GrouperSession s, String name, boolean exceptionIfNotFound) throws GroupNotFoundException Find a group within the registry by its alternate name.try { Group g = GroupFinder.findByAlternateName(name, true); } catch (GroupNotFoundException e) { // Group not found }
- Parameters:
s
- Find group within this session context.name
- Name of group to find.exceptionIfNotFound
-- Returns:
- A
Group
- Throws:
GroupNotFoundException
-
findAllByType
public static Set<Group> findAllByType(GrouperSession s, GroupType type) throws IllegalArgumentException Find all groups within the registry by theirGroupType
. Or empty set if none (never null).Set
groups = GroupFinder.findAllByType( s, GroupTypeFinder.find("your type") ); - Parameters:
s
- Find group within this session context.type
- Find group with thisGroupType
.- Returns:
- A set of
Group
s - Throws:
IllegalArgumentException
-
findByUuid
@Deprecated public static Group findByUuid(GrouperSession s, String uuid) throws GroupNotFoundException Deprecated.Find a group within the registry by UUID.Group g = GroupFinder.findByUuid(s, uuid);
- Parameters:
s
- Find group within this session context.uuid
- UUID of group to find.- Returns:
- A
Group
- Throws:
GroupNotFoundException
-
findByUuid
Find a group within the registry by UUID.Group g = GroupFinder.findByUuid(s, uuid);
- Parameters:
s
- Find group within this session context.uuid
- UUID of group to find.exceptionIfNotFound
- true if exception if not found- Returns:
- A
Group
- Throws:
GroupNotFoundException
- if not found an exceptionIfNotFound is true
-
findByUuidAsGrouperSystem
Find a group within the registry by UUID as grouper system.Group g = GroupFinder.findByUuid(s, uuid);
- Parameters:
s
- Find group within this session context.uuid
- UUID of group to find.exceptionIfNotFound
- true if exception if not found- Returns:
- A
Group
- Throws:
GroupNotFoundException
- if not found an exceptionIfNotFound is true
-
findByUuid
public static Group findByUuid(GrouperSession s, String uuid, boolean exceptionIfNotFound) throws GroupNotFoundException Find a group within the registry by UUID.Group g = GroupFinder.findByUuid(s, uuid);
- Parameters:
s
- Find group within this session context.uuid
- UUID of group to find.exceptionIfNotFound
- true if exception if not found- Returns:
- A
Group
- Throws:
GroupNotFoundException
- if not found an exceptionIfNotFound is true
-
findByUuid
public static Group findByUuid(GrouperSession s, String uuid, boolean exceptionIfNotFound, QueryOptions queryOptions) throws GroupNotFoundException Find a group within the registry by UUID.Group g = GroupFinder.findByUuid(s, uuid);
- Parameters:
s
- Find group within this session context.uuid
- UUID of group to find.exceptionIfNotFound
- true if exception if not foundqueryOptions
-- Returns:
- A
Group
- Throws:
GroupNotFoundException
- if not found an exceptionIfNotFound is true
-
findByIdIndexSecure
public static Group findByIdIndexSecure(Long idIndex, boolean exceptionIfNotFound, QueryOptions queryOptions) throws GroupNotFoundException Find a group within the registry by ID index.- Parameters:
idIndex
- id index of group to find.exceptionIfNotFound
- true if exception if not foundqueryOptions
-- Returns:
- A
Group
- Throws:
GroupNotFoundException
- if not found an exceptionIfNotFound is true
-
assignSubjectNotInGroup
assign a subject which does not have an immediate membership in the group- Parameters:
theSubjectNotInGroup
-- Returns:
- this for chaining
-
addPrivilege
add a privilege to filter by that the subject has on the group- Parameters:
privilege
- should be AccessPrivilege- Returns:
- this for chaining
-
assignPrivileges
assign privileges to filter by that the subject has on the group- Parameters:
theGroups
-- Returns:
- this for chaining
-
assignQueryOptions
if sorting, paging, caching, etc- Parameters:
theQueryOptions
-- Returns:
- this for chaining
-
assignAttributeCheckReadOnAttributeDef
use security around attribute def? default is true- Parameters:
theAttributeDefNameUseSecurity
-- Returns:
- this for chaining
-
assignAttributeNotAssigned
find groups that don't have a certain type assigned- Parameters:
attributeNotAssigned
-- Returns:
-
assignAttributeValuesOnAssignment
if looking for an attribute value on an assignment, could be multiple values- Parameters:
theValues
-- Returns:
- this for chaining
-
addAttributeValuesOnAssignment
if looking for an attribute value on an assignment, could be multiple values- Parameters:
theValues
-- Returns:
- this for chaining
-
assignAttributeValue
find objects with this value- Parameters:
theValue
-- 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
-
assignNameOfAttributeDefName
find groups that have this attribute assigned- Parameters:
theNameOfAttributeDefName
-- Returns:
- this for chaining
-
addGroupId
add a group id to search for- Parameters:
groupId
-- Returns:
- this for chaining
-
assignGroupNames
assign group names to search for- Parameters:
theGroupNames
-- Returns:
- this for chaining
-
addGroupName
add a group name to search for- Parameters:
groupName
-- Returns:
- this for chaining
-
assignGroupIds
assign group ids to search for- Parameters:
theGroupIds
-- Returns:
- this for chaining
-
assignField
field to look for if searching for memberships in groups- Parameters:
theField
-- Returns:
- this for chaining
-
assignFieldName
field name to look for if searching for memberships in groups- Parameters:
theFieldName
-- Returns:
- theFieldName
-
assignMembershipsForSubject
if this is true, or there is a field assigned, then get memberships for a subject- Parameters:
membershipsForSubject1
-- Returns:
- this for chaining
-
findGroups
find all the group- Returns:
- the set of groups or the empty set if none found
-
assignTypeOfGroups
- Parameters:
theTypeOfGroups
-- Returns:
- this for chaining
-
addTypeOfGroup
- Parameters:
typeOfGroup
-- Returns:
- this
-
assignScope
scope to look for groups Wildcards will be appended or percent is the wildcard- Parameters:
theScope
-- Returns:
- this for chaining
-
assignSplitScope
if the scope has spaces in it, then split by whitespace, and find results that contain all of the scope strings- Parameters:
theSplitScope
-- Returns:
- this for chaining
-
assignSubject
this is the subject that has certain memberships in the query- Parameters:
theSubject
-- Returns:
- this for chaining
-
assignParentStemId
parent or ancestor stem of the group- Parameters:
theParentStemId
-- Returns:
- this for chaining
-
assignStemScope
if passing in a stem, this is the stem scope...- Parameters:
theStemScope
-- Returns:
- this for chaining
-
assignFindByUuidOrName
if we are looking up a group, only look by uuid or name- Parameters:
theFindByUuidOrName
-- Returns:
- the group finder
-
findGroup
find the group- Returns:
- the group or null
-
assignAttributeValue2
find objects with this value2- Parameters:
theValue
-- 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
-
assignNameOfAttributeDefName2
find groups that have this attribute assigned- Parameters:
theNameOfAttributeDefName
-- Returns:
- this for chaining
-
addAttributeValuesOnAssignment2
if looking for an attribute value on an assignment2, could be multiple values- Parameters:
value
-- Returns:
- this for chaining
-
assignAttributeValuesOnAssignment2
if looking for an attribute value on an assignment2, could be multiple values- Parameters:
theValues
-- Returns:
- this for chaining
-
assignExcludeAlternateNames
whether to exclude alternate names from name/scope search- Parameters:
excludeAlternateNames
-- Returns:
-
findInternalIdsByNames
this will cache for a minute, find internal ids by name- Parameters:
groupNames2
-- Returns:
- the internal ids
-