Package edu.internet2.middleware.grouper
Class StemFinder
java.lang.Object
edu.internet2.middleware.grouper.StemFinder
Use this class to find stems within the registry
Sample call
Stem stem = StemFinder.findByName(grouperSession, "test", true);
Sample call to find stems where an attribute def name and a value is assigned
Setstems = new StemFinder().assignNameOfAttributeDefName(attributeDefName.getName()) .assignPrivileges(NamingPrivilege.ATTRIBUTE_READ_PRIVILEGES).assignAttributeValue("abc").findStems();
-
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 valuesaddPrivilege
(Privilege privilege) add a privilege to filter by that the subject has on the stemadd a stem id to search foraddStemName
(String stemName) addUserHasInAttributeField
(Field theUserHasInAttributeField) find stems where the user has these fields in an attributeaddUserHasInGroupField
(Field theUserHasInGroupField) find stems where the user has these fields in a groupassignAttributeCheckReadOnAttributeDef
(boolean theAttributeCheckReadOnAttributeDef) check read on attribute def when checking attribute def nameassignAttributeNotAssigned
(boolean attributeNotAssigned) find stems that don't have a certain type assignedassignAttributeValue
(Object theValue) find objects with this valueassignAttributeValuesOnAssignment
(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 valuesassignExcludeAlternateNames
(boolean excludeAlternateNames) whether to exclude alternate names from name/scope searchassignFindByUuidOrName
(boolean theFindByUuidOrName) if we are looking up a stem, only look by uuid or nameassignIdOfAttributeDefName
(String theAttributeDefNameId) find stems that have this attribute def name id, note could be an assignment on an assignmentassignIdOfAttributeDefName2
(String theAttributeDefNameId) find stems that have this attribute def name id, note could be an assignment on an assignmentassignNameOfAttributeDefName
(String theNameOfAttributeDefName) find stems that have this attribute assignedassignNameOfAttributeDefName2
(String theNameOfAttributeDefName) find stems that have this attribute assignedassignParentStemId
(String theParentStemId) parent or ancestor stem of the stemassignPrivileges
(Set<Privilege> theStems) assign privileges to filter by that the subject has on the stemassignQueryOptions
(QueryOptions theQueryOptions) if sorting, paging, caching, etcassignScope
(String theScope) scope to look for stems 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 stringsassignStemIds
(Collection<String> theStemIds) assign stem ids to search forassignStemNames
(Collection<String> theStemNames) assignStemScope
(Stem.Scope theStemScope) if passing in a stem, this is the stem scope...assignSubject
(Subject theSubject) this is the subject that has certain privileges or is in the queryassignUserHasInAttributeField
(Collection<Field> theUserHasInAttributeFields) find stems where the user has these fields in an attributeassignUserHasInGroupField
(Collection<Field> theUserHasInGroupFields) find stems where the user has these fields in an attributestatic Stem
findByAlternateName
(GrouperSession s, String name, boolean exceptionIfNotFound, QueryOptions queryOptions) Find stem by its alternate name.static Stem
findByCurrentName
(GrouperSession s, String name, boolean exceptionIfNotFound, QueryOptions queryOptions) Find stem by its current name.static Stem
findByIdIndex
(Long idIndex, boolean exceptionIfNotFound, QueryOptions queryOptions) Find a stem within the registry by ID index.static Stem
findByName
(GrouperSession s, String name) Deprecated.see overloadstatic Stem
findByName
(GrouperSession s, String name, boolean exceptionIfNotFound) Find stem by name.static Stem
findByName
(GrouperSession s, String name, boolean exceptionIfNotFound, QueryOptions queryOptions) Find stem by name.static Stem
findByName
(String name, boolean exceptionIfNotFound) Find stem by name.static Stem
findByName
(String name, boolean exceptionIfNotFound, QueryOptions queryOptions) Find stem by name.findByNames
(Collection<String> names, boolean exceptionOnNotFound) find by namesstatic Stem
findByUuid
(GrouperSession s, String uuid) Deprecated.see overloadstatic Stem
findByUuid
(GrouperSession s, String uuid, boolean exceptionIfNotFound) Get stem by uuid.static Stem
findByUuid
(GrouperSession s, String uuid, boolean exceptionIfNotFound, QueryOptions queryOptions) Get stem by uuid.findByUuids
(GrouperSession s, Collection<String> uuids, QueryOptions queryOptions) Get stems by uuids.findIdIndexesByNames
(Set<String> stemNames2) this will cache for a minute, find id index by namestatic Stem
Find root stem of the Groups Registry.findStem()
find the stemfind all the stemsstatic Set
Grouper internal method onlystatic Set
Grouper internal method onlystatic Set
Grouper internal method onlystatic Set
Grouper internal method onlystatic Set
Grouper internal method onlystatic Set
Grouper internal method onlystatic Set
Grouper internal method onlystatic Stem
internal_findByName
(String name, boolean exceptionIfNotFound) Grouper internal method onlystatic void
Grouper internal method onlystatic void
stemCacheRemove
(Stem stem) Grouper internal method onlystatic void
Grouper internal method only
-
Constructor Details
-
StemFinder
public StemFinder()
-
-
Method Details
-
findByNames
find by names- Parameters:
names
-exceptionOnNotFound
-- Returns:
- the stems that were found
-
stemCacheClear
public static void stemCacheClear()Grouper internal method only
remove all caches -
stemCacheRemoveById
Grouper internal method only
remove this from all caches- Parameters:
id
-
-
stemCacheRemove
Grouper internal method only
remove this from all caches- Parameters:
stem
-
-
addUserHasInGroupField
find stems where the user has these fields in a group- Parameters:
theUserHasInGroupField
-- Returns:
- this for chaining
-
addUserHasInAttributeField
find stems where the user has these fields in an attribute- Parameters:
theUserHasInAttributeField
-- Returns:
- this for chaining
-
assignUserHasInGroupField
find stems where the user has these fields in an attribute- Parameters:
theUserHasInGroupFields
-- Returns:
- this for chaining
-
assignUserHasInAttributeField
find stems where the user has these fields in an attribute- Parameters:
theUserHasInAttributeFields
-- Returns:
- this for chaining
-
findByName
@Deprecated public static Stem findByName(GrouperSession s, String name) throws StemNotFoundException Deprecated.see overloadFind stem by name.try { Stem stem = StemFinder.findByName(s, name); } catch (StemNotFoundException e) { // Stem not found }
- Parameters:
s
- Search within thisGrouperSession
contextname
- Find stem with this name.- Returns:
- A
Stem
object - Throws:
StemNotFoundException
-
findByName
public static Stem findByName(GrouperSession s, String name, boolean exceptionIfNotFound) throws StemNotFoundException Find stem by name.Stem stem = StemFinder.findByName(s, name, false);
- Parameters:
s
- Search within thisGrouperSession
contextname
- Find stem with this name.exceptionIfNotFound
-- Returns:
- A
Stem
object - Throws:
StemNotFoundException
-
findByName
public static Stem findByName(GrouperSession s, String name, boolean exceptionIfNotFound, QueryOptions queryOptions) throws StemNotFoundException Find stem by name.Stem stem = StemFinder.findByName(s, name, false);
- Parameters:
s
- Search within thisGrouperSession
contextname
- Find stem with this name.exceptionIfNotFound
-queryOptions
-- Returns:
- A
Stem
object - Throws:
StemNotFoundException
-
findByAlternateName
public static Stem findByAlternateName(GrouperSession s, String name, boolean exceptionIfNotFound, QueryOptions queryOptions) throws StemNotFoundException Find stem by its alternate name.Stem stem = StemFinder.findByAlternateName(s, name, false);
- Parameters:
s
- Search within thisGrouperSession
contextname
- Find stem with this alternate name.exceptionIfNotFound
-queryOptions
-- Returns:
- A
Stem
object - Throws:
StemNotFoundException
-
findByCurrentName
public static Stem findByCurrentName(GrouperSession s, String name, boolean exceptionIfNotFound, QueryOptions queryOptions) throws StemNotFoundException Find stem by its current name.Stem stem = StemFinder.findByCurrentName(s, name, false);
- Parameters:
s
- Search within thisGrouperSession
contextname
- Find stem with this name.exceptionIfNotFound
-queryOptions
-- Returns:
- A
Stem
object - Throws:
StemNotFoundException
-
findRootStem
Find root stem of the Groups Registry.// Find the root stem. Stem rootStem = StemFinder.findRootStem(s);
- Parameters:
s
- Search within thisGrouperSession
context- Returns:
- A
Stem
object - Throws:
GrouperException
StemNotFoundException
-
findByUuid
@Deprecated public static Stem findByUuid(GrouperSession s, String uuid) throws StemNotFoundException Deprecated.see overloadGet stem by uuid.// Get the specified stem by uuid. try { Stem stem = StemFinder.findByUuid(s, uuid); } catch (StemNotFoundException e) { // Stem not found }
- Parameters:
s
- Search within thisGrouperSession
contextuuid
- Get stem with this UUID.- Returns:
- A
Stem
object - Throws:
StemNotFoundException
-
findByUuid
public static Stem findByUuid(GrouperSession s, String uuid, boolean exceptionIfNotFound) throws StemNotFoundException Get stem by uuid.// Get the specified stem by uuid. try { Stem stem = StemFinder.findByUuid(s, uuid); } catch (StemNotFoundException e) { // Stem not found }
- Parameters:
s
- Search within thisGrouperSession
contextuuid
- Get stem with this UUID.exceptionIfNotFound
-- Returns:
- A
Stem
object - Throws:
StemNotFoundException
-
findByUuid
public static Stem findByUuid(GrouperSession s, String uuid, boolean exceptionIfNotFound, QueryOptions queryOptions) throws StemNotFoundException Get stem by uuid.// Get the specified stem by uuid. try { Stem stem = StemFinder.findByUuid(s, uuid); } catch (StemNotFoundException e) { // Stem not found }
- Parameters:
s
- Search within thisGrouperSession
contextuuid
- Get stem with this UUID.exceptionIfNotFound
-queryOptions
-- Returns:
- A
Stem
object - Throws:
StemNotFoundException
-
findByUuids
public static Set<Stem> findByUuids(GrouperSession s, Collection<String> uuids, QueryOptions queryOptions) throws StemNotFoundException Get stems by uuids.// Get the specified stems by uuids. try { Set
stems = StemFinder.findByUuids(s, uuids, null); } catch (StemNotFoundException e) { // Stem not found } - Parameters:
s
- Search within thisGrouperSession
contextuuids
- Get stem with this UUID.queryOptions
-- Returns:
- A
Stem
object - Throws:
StemNotFoundException
-
internal_findAllByApproximateDisplayExtension
public static Set internal_findAllByApproximateDisplayExtension(GrouperSession s, String val) throws QueryException Grouper internal method only
- Parameters:
s
-val
-- Returns:
- Throws:
QueryException
- Since:
- 1.2.0
-
internal_findAllByApproximateDisplayName
public static Set internal_findAllByApproximateDisplayName(GrouperSession s, String val) throws QueryException Grouper internal method only
- Parameters:
s
-val
-- Returns:
- Throws:
QueryException
- Since:
- 1.2.0
-
internal_findAllByApproximateExtension
public static Set internal_findAllByApproximateExtension(GrouperSession s, String val) throws QueryException Grouper internal method only
- Parameters:
s
-val
-- Returns:
- Throws:
QueryException
- Since:
- 1.2.0
-
internal_findAllByApproximateName
public static Set internal_findAllByApproximateName(GrouperSession s, String val) throws QueryException Grouper internal method only
- Parameters:
s
-val
-- Returns:
- Throws:
QueryException
- Since:
- 1.2.0
-
internal_findAllByApproximateNameAny
public static Set internal_findAllByApproximateNameAny(GrouperSession s, String val) throws QueryException Grouper internal method only
- Parameters:
s
-val
-- Returns:
- Throws:
QueryException
- Since:
- 1.2.0
-
internal_findAllByCreatedAfter
Grouper internal method only
- Parameters:
s
-d
-- Returns:
- Throws:
QueryException
- Since:
- 1.2.0
-
internal_findAllByCreatedBefore
Grouper internal method only
- Parameters:
s
-d
-- Returns:
- Throws:
QueryException
- Since:
- 1.2.0
-
internal_findByName
public static Stem internal_findByName(String name, boolean exceptionIfNotFound) throws StemNotFoundException Grouper internal method only
- Parameters:
name
-exceptionIfNotFound
-- Returns:
- the stem
- Throws:
StemNotFoundException
-
findByIdIndex
public static Stem findByIdIndex(Long idIndex, boolean exceptionIfNotFound, QueryOptions queryOptions) throws StemNotFoundException Find a stem within the registry by ID index.- Parameters:
idIndex
- id index of stem to find.exceptionIfNotFound
- true if exception if not foundqueryOptions
-- Returns:
- A
Stem
- Throws:
StemNotFoundException
- if not found an exceptionIfNotFound is true
-
assignFindByUuidOrName
if we are looking up a stem, only look by uuid or name- Parameters:
theFindByUuidOrName
-- Returns:
- the stem finder
-
assignAttributeNotAssigned
find stems that don't have a certain type assigned- Parameters:
attributeNotAssigned
-- Returns:
-
assignExcludeAlternateNames
whether to exclude alternate names from name/scope search- Parameters:
excludeAlternateNames
-- Returns:
-
assignAttributeCheckReadOnAttributeDef
public StemFinder assignAttributeCheckReadOnAttributeDef(boolean theAttributeCheckReadOnAttributeDef) check read on attribute def when checking attribute def name- Parameters:
theAttributeCheckReadOnAttributeDef
-- Returns:
- this for chaining
-
assignAttributeValue
find objects with this value- Parameters:
theValue
-- Returns:
- this for chaining
-
addPrivilege
add a privilege to filter by that the subject has on the stem- Parameters:
privilege
- should be AccessPrivilege- Returns:
- this for chaining
-
assignPrivileges
assign privileges to filter by that the subject has on the stem- Parameters:
theStems
-- Returns:
- this for chaining
-
assignQueryOptions
if sorting, paging, caching, etc- Parameters:
theQueryOptions
-- Returns:
- this for chaining
-
assignScope
scope to look for stems 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 privileges or is in the query- Parameters:
theSubject
-- Returns:
- this for chaining
-
findStem
find the stem- Returns:
- the stem or null
-
findStems
find all the stems- Returns:
- the set of stems or the empty set if none found
-
assignParentStemId
parent or ancestor stem of the stem- Parameters:
theParentStemId
-- Returns:
- this for chaining
-
assignStemScope
if passing in a stem, this is the stem scope...- Parameters:
theStemScope
-- Returns:
- this for chaining
-
addStemId
add a stem id to search for- Parameters:
stemId
-- Returns:
- this for chaining
-
assignStemIds
assign stem ids to search for- Parameters:
theStemIds
-- Returns:
- this for chaining
-
addStemName
- Parameters:
stemName
-- Returns:
- this for chaining
-
assignStemNames
-
addAttributeValuesOnAssignment
if looking for an attribute value on an assignment, could be multiple values- Parameters:
value
-- Returns:
- this for chaining
-
addAttributeValuesOnAssignment2
if looking for an attribute value on an assignment2, could be multiple values- Parameters:
value
-- 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 stems that have this attribute def name id, note could be an assignment on an assignment- Parameters:
theAttributeDefNameId
-- Returns:
- this for chaining
-
assignIdOfAttributeDefName2
find stems that have this attribute def name id, note could be an assignment on an assignment- Parameters:
theAttributeDefNameId
-- Returns:
- this for chaining
-
assignNameOfAttributeDefName
find stems that have this attribute assigned- Parameters:
theNameOfAttributeDefName
-- Returns:
- this for chaining
-
assignNameOfAttributeDefName2
find stems that have this attribute assigned- Parameters:
theNameOfAttributeDefName
-- Returns:
- this for chaining
-
findByName
public static Stem findByName(String name, boolean exceptionIfNotFound) throws StemNotFoundException Find stem by name.Stem stem = StemFinder.findByName(s, name, false);
- Parameters:
s
- Search within thisGrouperSession
contextname
- Find stem with this name.exceptionIfNotFound
-- Returns:
- A
Stem
object - Throws:
StemNotFoundException
-
findByName
public static Stem findByName(String name, boolean exceptionIfNotFound, QueryOptions queryOptions) throws StemNotFoundException Find stem by name.Stem stem = StemFinder.findByName(s, name, false);
- Parameters:
s
- Search within thisGrouperSession
contextname
- Find stem with this name.exceptionIfNotFound
-queryOptions
-- Returns:
- A
Stem
object - Throws:
StemNotFoundException
-
findIdIndexesByNames
this will cache for a minute, find id index by name- Parameters:
stemNames2
-- Returns:
- the id indexes
-