edu.internet2.middleware.grouper
Class GroupFinder

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

public class GroupFinder
extends Object

Find groups within the Groups Registry.

Version:
$Id: GroupFinder.java,v 1.62 2009-11-17 02:52:29 mchyzer Exp $
Author:
blair christensen.

Constructor Summary
GroupFinder()
           
 
Method Summary
static Set<Group> findAllByAttribute(GrouperSession s, String attr, String val)
          Find Groups by attribute value.
static Set<Group> findAllByType(GrouperSession s, GroupType type)
          Find all groups within the registry by their GroupType.
static Group findByAlternateName(GrouperSession s, String name, boolean exceptionIfNotFound)
          Find a group within the registry by its alternate name.
static Group findByAttribute(GrouperSession s, String attr, String val)
          Deprecated. use the overload
static 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.
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 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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupFinder

public GroupFinder()
Method Detail

findByAttribute

@Deprecated
public static Group findByAttribute(GrouperSession s,
                                               String attr,
                                               String val)
                             throws GroupNotFoundException,
                                    IllegalArgumentException
Deprecated. use the overload

Find 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

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

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 their GroupType. 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 this GroupType.
Returns:
A set of Groups
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

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 found
queryOptions -
Returns:
A Group
Throws:
GroupNotFoundException - if not found an exceptionIfNotFound is true