Class GrouperQuery

java.lang.Object
edu.internet2.middleware.grouper.filter.GrouperQuery

public class GrouperQuery extends Object
Perform arbitrary queries against the Groups Registry.

Version:
$Id: GrouperQuery.java,v 1.3 2009-08-11 20:18:09 mchyzer Exp $
  • Method Details

    • createQuery

      public static GrouperQuery createQuery(GrouperSession s, QueryFilter filter) throws QueryException
      Create a query for searching the Groups Registry.
       GrouperQuery gq = GrouperQuery.createQuery(
         s, 
         new AndFilter(
           new GroupCreatedAfterFilter(date, stem),
           new GroupAttributeFilter(attr, value, stem) 
         )
       );
       

      This method defines a query but does not execute the query. Evaulation takes place in the getGroups(), getMembers(), getMemberships() and getStems() methods. Those methods all operate in the same manner. They first execute the query filter. This returns a set of candidate results. Each method then iterates through the candidate set, extracting objects of the the appropriate time to return. Several of the methods also convert between object types in order to return results. See each method for more details.

      All query filters implement the QueryFilter interface. See that class for information on the query filters supplied by Grouper as well as information on creating custom query filters.

      Parameters:
      s - Query within this session context.
      filter - A QueryFilter specification.
      Returns:
      A GrouperQuery object.
      Throws:
      QueryException
    • getGroups

      public Set<Group> getGroups() throws QueryException
      Get groups matching query filter.
       Set groups = gq.getGroups();
       

      This method (currently) performs no candidate object conversion. Only Group objects in the candidate set will be returned.

      Returns:
      Set of matching Group objects.
      Throws:
      QueryException
    • getMembers

      public Set getMembers() throws QueryException
      Get members matching query filter.
       Set members = gq.getMembers();
       

      This method calls getMemberships() internally. Each Membership's Member is then extracted and returned.

      Returns:
      Set of matching Member objects.
      Throws:
      QueryException
    • getMemberships

      public Set getMemberships() throws QueryException
      Get memberships matching query filter.
       Set memberships = gq.getMemberships();
       

      If this method finds a Group in the candidate set it will add all Memberships returned by calling Group.getMemberships() to the result set.

      Returns:
      Set of matching Membership objects.
      Throws:
      QueryException
    • getStems

      public Set<Stem> getStems() throws QueryException
      Get stems matching query filter.
       Set stems = gq.getStems();
       

      This method (currently) performs no candidate object conversion. Only Stem objects in the candidate set will be returned.

      Returns:
      Set of matching Stem objects.
      Throws:
      QueryException