edu.internet2.middleware.grouper
Class StemFinder

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

public class StemFinder
extends Object

Find stems within the Groups Registry.

Version:
$Id: StemFinder.java,v 1.54 2009-11-18 17:03:50 mchyzer Exp $
Author:
blair christensen.

Constructor Summary
StemFinder()
           
 
Method Summary
 StemFinder addPrivilege(Privilege privilege)
          add a privilege to filter by that the subject has on the stem
 StemFinder addStemId(String stemId)
          add a stem id to search for
 StemFinder addUserHasInAttributeField(Field theUserHasInAttributeField)
          find stems where the user has these fields in an attribute
 StemFinder addUserHasInGroupField(Field theUserHasInGroupField)
          find stems where the user has these fields in a group
 StemFinder assignAttributeCheckReadOnAttributeDef(boolean theAttributeCheckReadOnAttributeDef)
          check read on attribute def when checking attribute def name
 StemFinder assignAttributeValue(Object theValue)
          find objects with this value
 StemFinder assignFindByUuidOrName(boolean theFindByUuidOrName)
          if we are looking up a stem, only look by uuid or name
 StemFinder assignIdOfAttributeDefName(String theAttributeDefNameId)
          find stems that have this attribute assigned
 StemFinder assignNameOfAttributeDefName(String theNameOfAttributeDefName)
          find stems that have this attribute assigned
 StemFinder assignParentStemId(String theParentStemId)
          parent or ancestor stem of the stem
 StemFinder assignPrivileges(Set<Privilege> theStems)
          assign privileges to filter by that the subject has on the stem
 StemFinder assignQueryOptions(QueryOptions theQueryOptions)
          if sorting, paging, caching, etc
 StemFinder assignScope(String theScope)
          scope to look for stems Wildcards will be appended or percent is the wildcard
 StemFinder assignSplitScope(boolean theSplitScope)
          if the scope has spaces in it, then split by whitespace, and find results that contain all of the scope strings
 StemFinder assignStemIds(Collection<String> theStemIds)
          assign stem ids to search for
 StemFinder assignStemScope(Stem.Scope theStemScope)
          if passing in a stem, this is the stem scope...
 StemFinder assignSubject(edu.internet2.middleware.subject.Subject theSubject)
          this is the subject that has certain privileges or is in the query
 StemFinder assignUserHasInAttributeField(Collection<Field> theUserHasInAttributeFields)
          find stems where the user has these fields in an attribute
 StemFinder assignUserHasInGroupField(Collection<Field> theUserHasInGroupFields)
          find stems where the user has these fields in an attribute
static Stem findByAlternateName(GrouperSession s, String name, boolean exceptionOnNotFound, QueryOptions queryOptions)
          Find stem by its alternate name.
static Stem findByCurrentName(GrouperSession s, String name, boolean exceptionOnNotFound, 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 overload
static Stem findByName(GrouperSession s, String name, boolean exceptionOnNotFound)
          Find stem by name.
static Stem findByName(GrouperSession s, String name, boolean exceptionOnNotFound, QueryOptions queryOptions)
          Find stem by name.
static Stem findByUuid(GrouperSession s, String uuid)
          Deprecated. see overload
static Stem findByUuid(GrouperSession s, String uuid, boolean exceptionIfNull)
          Get stem by uuid.
static Stem findByUuid(GrouperSession s, String uuid, boolean exceptionIfNull, QueryOptions queryOptions)
          Get stem by uuid.
static Set<Stem> findByUuids(GrouperSession s, Collection<String> uuids, QueryOptions queryOptions)
          Get stems by uuids.
static Stem findRootStem(GrouperSession s)
          Find root stem of the Groups Registry.
 Stem findStem()
          find the stem
 Set<Stem> findStems()
          find all the stems
static Set internal_findAllByApproximateDisplayExtension(GrouperSession s, String val)
           
static Set internal_findAllByApproximateDisplayName(GrouperSession s, String val)
           
static Set internal_findAllByApproximateExtension(GrouperSession s, String val)
           
static Set internal_findAllByApproximateName(GrouperSession s, String val)
           
static Set internal_findAllByApproximateNameAny(GrouperSession s, String val)
           
static Set internal_findAllByCreatedAfter(GrouperSession s, Date d)
           
static Set internal_findAllByCreatedBefore(GrouperSession s, Date d)
           
static Stem internal_findByName(String name, boolean exceptionIfNull)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StemFinder

public StemFinder()
Method Detail

addUserHasInGroupField

public StemFinder addUserHasInGroupField(Field theUserHasInGroupField)
find stems where the user has these fields in a group

Parameters:
theUserHasInGroupField -
Returns:
this for chaining

addUserHasInAttributeField

public StemFinder addUserHasInAttributeField(Field theUserHasInAttributeField)
find stems where the user has these fields in an attribute

Parameters:
theUserHasInAttributeField -
Returns:
this for chaining

assignUserHasInGroupField

public StemFinder assignUserHasInGroupField(Collection<Field> theUserHasInGroupFields)
find stems where the user has these fields in an attribute

Parameters:
theUserHasInGroupFields -
Returns:
this for chaining

assignUserHasInAttributeField

public StemFinder assignUserHasInAttributeField(Collection<Field> theUserHasInAttributeFields)
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 overload

Find stem by name.
 try {
   Stem stem = StemFinder.findByName(s, name);
 }
 catch (StemNotFoundException e) {
   // Stem not found
 }
 

Parameters:
s - Search within this GrouperSession context
name - Find stem with this name.
Returns:
A Stem object
Throws:
StemNotFoundException

findByName

public static Stem findByName(GrouperSession s,
                              String name,
                              boolean exceptionOnNotFound)
                       throws StemNotFoundException
Find stem by name.
   Stem stem = StemFinder.findByName(s, name, false);
 

Parameters:
s - Search within this GrouperSession context
name - Find stem with this name.
exceptionOnNotFound -
Returns:
A Stem object
Throws:
StemNotFoundException

findByName

public static Stem findByName(GrouperSession s,
                              String name,
                              boolean exceptionOnNotFound,
                              QueryOptions queryOptions)
                       throws StemNotFoundException
Find stem by name.
   Stem stem = StemFinder.findByName(s, name, false);
 

Parameters:
s - Search within this GrouperSession context
name - Find stem with this name.
exceptionOnNotFound -
queryOptions -
Returns:
A Stem object
Throws:
StemNotFoundException

findByAlternateName

public static Stem findByAlternateName(GrouperSession s,
                                       String name,
                                       boolean exceptionOnNotFound,
                                       QueryOptions queryOptions)
                                throws StemNotFoundException
Find stem by its alternate name.
   Stem stem = StemFinder.findByAlternateName(s, name, false);
 

Parameters:
s - Search within this GrouperSession context
name - Find stem with this alternate name.
exceptionOnNotFound -
queryOptions -
Returns:
A Stem object
Throws:
StemNotFoundException

findByCurrentName

public static Stem findByCurrentName(GrouperSession s,
                                     String name,
                                     boolean exceptionOnNotFound,
                                     QueryOptions queryOptions)
                              throws StemNotFoundException
Find stem by its current name.
   Stem stem = StemFinder.findByCurrentName(s, name, false);
 

Parameters:
s - Search within this GrouperSession context
name - Find stem with this name.
exceptionOnNotFound -
queryOptions -
Returns:
A Stem object
Throws:
StemNotFoundException

findRootStem

public static Stem findRootStem(GrouperSession s)
                         throws StemNotFoundException
Find root stem of the Groups Registry.
 // Find the root stem.
 Stem rootStem = StemFinder.findRootStem(s);
 

Parameters:
s - Search within this GrouperSession context
Returns:
A Stem object
Throws:
GrouperException
StemNotFoundException

findByUuid

@Deprecated
public static Stem findByUuid(GrouperSession s,
                                         String uuid)
                       throws StemNotFoundException
Deprecated. see overload

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 this GrouperSession context
uuid - Get stem with this UUID.
Returns:
A Stem object
Throws:
StemNotFoundException

findByUuid

public static Stem findByUuid(GrouperSession s,
                              String uuid,
                              boolean exceptionIfNull)
                       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 this GrouperSession context
uuid - Get stem with this UUID.
exceptionIfNull -
Returns:
A Stem object
Throws:
StemNotFoundException

findByUuid

public static Stem findByUuid(GrouperSession s,
                              String uuid,
                              boolean exceptionIfNull,
                              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 this GrouperSession context
uuid - Get stem with this UUID.
exceptionIfNull -
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 this GrouperSession context
uuid - Get stem with this UUID.
exceptionIfNull -
queryOptions -
Returns:
A Stem object
Throws:
StemNotFoundException

internal_findAllByApproximateDisplayExtension

public static Set internal_findAllByApproximateDisplayExtension(GrouperSession s,
                                                                String val)
                                                         throws QueryException
Throws:
QueryException

internal_findAllByApproximateDisplayName

public static Set internal_findAllByApproximateDisplayName(GrouperSession s,
                                                           String val)
                                                    throws QueryException
Throws:
QueryException

internal_findAllByApproximateExtension

public static Set internal_findAllByApproximateExtension(GrouperSession s,
                                                         String val)
                                                  throws QueryException
Throws:
QueryException

internal_findAllByApproximateName

public static Set internal_findAllByApproximateName(GrouperSession s,
                                                    String val)
                                             throws QueryException
Throws:
QueryException

internal_findAllByApproximateNameAny

public static Set internal_findAllByApproximateNameAny(GrouperSession s,
                                                       String val)
                                                throws QueryException
Throws:
QueryException

internal_findAllByCreatedAfter

public static Set internal_findAllByCreatedAfter(GrouperSession s,
                                                 Date d)
                                          throws QueryException
Throws:
QueryException

internal_findAllByCreatedBefore

public static Set internal_findAllByCreatedBefore(GrouperSession s,
                                                  Date d)
                                           throws QueryException
Throws:
QueryException

internal_findByName

public static Stem internal_findByName(String name,
                                       boolean exceptionIfNull)
                                throws StemNotFoundException
Parameters:
name -
exceptionIfNull -
Returns:
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 found
queryOptions -
Returns:
A Stem
Throws:
StemNotFoundException - if not found an exceptionIfNotFound is true

assignFindByUuidOrName

public StemFinder assignFindByUuidOrName(boolean theFindByUuidOrName)
if we are looking up a stem, only look by uuid or name

Parameters:
theFindByUuidOrName -
Returns:
the stem finder

assignAttributeCheckReadOnAttributeDef

public StemFinder assignAttributeCheckReadOnAttributeDef(boolean theAttributeCheckReadOnAttributeDef)
check read on attribute def when checking attribute def name

Parameters:
theAttributeCheckReadOnAttributeDef -
Returns:
this for chaining

assignAttributeValue

public StemFinder assignAttributeValue(Object theValue)
find objects with this value

Parameters:
theValue -
Returns:
this for chaining

assignIdOfAttributeDefName

public StemFinder assignIdOfAttributeDefName(String theAttributeDefNameId)
find stems that have this attribute assigned

Parameters:
theAttributeDefNameId -
Returns:
this for chaining

assignNameOfAttributeDefName

public StemFinder assignNameOfAttributeDefName(String theNameOfAttributeDefName)
find stems that have this attribute assigned

Parameters:
theNameOfAttributeDefName -
Returns:
this for chaining

addPrivilege

public StemFinder addPrivilege(Privilege privilege)
add a privilege to filter by that the subject has on the stem

Parameters:
privilege - should be AccessPrivilege
Returns:
this for chaining

assignPrivileges

public StemFinder assignPrivileges(Set<Privilege> theStems)
assign privileges to filter by that the subject has on the stem

Parameters:
theStems -
Returns:
this for chaining

assignQueryOptions

public StemFinder assignQueryOptions(QueryOptions theQueryOptions)
if sorting, paging, caching, etc

Parameters:
theQueryOptions -
Returns:
this for chaining

assignScope

public StemFinder assignScope(String theScope)
scope to look for stems Wildcards will be appended or percent is the wildcard

Parameters:
theScope -
Returns:
this for chaining

assignSplitScope

public StemFinder assignSplitScope(boolean theSplitScope)
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

public StemFinder assignSubject(edu.internet2.middleware.subject.Subject theSubject)
this is the subject that has certain privileges or is in the query

Parameters:
theSubject -
Returns:
this for chaining

findStem

public Stem findStem()
find the stem

Returns:
the stem or null

findStems

public Set<Stem> findStems()
find all the stems

Returns:
the set of stems or the empty set if none found

assignParentStemId

public StemFinder assignParentStemId(String theParentStemId)
parent or ancestor stem of the stem

Parameters:
theParentStemId -
Returns:
this for chaining

assignStemScope

public StemFinder assignStemScope(Stem.Scope theStemScope)
if passing in a stem, this is the stem scope...

Parameters:
theStemScope -
Returns:
this for chaining

addStemId

public StemFinder addStemId(String stemId)
add a stem id to search for

Parameters:
stemId -
Returns:
this for chaining

assignStemIds

public StemFinder assignStemIds(Collection<String> theStemIds)
assign stem ids to search for

Parameters:
theStemIds -
Returns:
this for chaining