Class SearchRequest

java.lang.Object
org.bluezoo.gumdrop.ldap.client.SearchRequest

public class SearchRequest extends Object
Represents an LDAP SearchRequest (RFC 4511 section 4.5.1).

Usage Example


 SearchRequest search = new SearchRequest();
 search.setBaseDN("dc=example,dc=com");
 search.setScope(SearchScope.SUBTREE);
 search.setFilter("(&(objectClass=person)(uid=jdoe))");
 search.setAttributes("cn", "mail", "memberOf");
 search.setSizeLimit(100);
 search.setTimeLimit(30);
 
Author:
Chris Burdess
See Also:
  • Constructor Details

    • SearchRequest

      public SearchRequest()
      Creates a new search request with default values.
  • Method Details

    • getBaseDN

      public String getBaseDN()
      Returns the base DN for the search.
      Returns:
      the base DN
    • setBaseDN

      public void setBaseDN(String baseDN)
      Sets the base DN for the search.
      Parameters:
      baseDN - the base DN
    • getScope

      public SearchScope getScope()
      Returns the search scope.
      Returns:
      the scope
    • setScope

      public void setScope(SearchScope scope)
      Sets the search scope.
      Parameters:
      scope - the scope
    • getDerefAliases

      public DerefAliases getDerefAliases()
      Returns the alias dereferencing policy.
      Returns:
      the deref policy
    • setDerefAliases

      public void setDerefAliases(DerefAliases derefAliases)
      Sets the alias dereferencing policy.
      Parameters:
      derefAliases - the deref policy
    • getSizeLimit

      public int getSizeLimit()
      Returns the maximum number of entries to return.
      Returns:
      the size limit (0 = no limit)
    • setSizeLimit

      public void setSizeLimit(int sizeLimit)
      Sets the maximum number of entries to return.
      Parameters:
      sizeLimit - the size limit (0 = no limit)
    • getTimeLimit

      public int getTimeLimit()
      Returns the time limit in seconds.
      Returns:
      the time limit (0 = no limit)
    • setTimeLimit

      public void setTimeLimit(int timeLimit)
      Sets the time limit in seconds.
      Parameters:
      timeLimit - the time limit (0 = no limit)
    • isTypesOnly

      public boolean isTypesOnly()
      Returns whether to return only attribute types (not values).
      Returns:
      true if types only
    • setTypesOnly

      public void setTypesOnly(boolean typesOnly)
      Sets whether to return only attribute types (not values).
      Parameters:
      typesOnly - true for types only
    • getFilter

      public String getFilter()
      Returns the search filter.
      Returns:
      the filter string
    • setFilter

      public void setFilter(String filter)
      Sets the search filter.

      The filter should use standard LDAP filter syntax (RFC 4515). Examples:

      • (uid=jdoe) - equality
      • (cn=John*) - substring
      • (&(objectClass=person)(uid=jdoe)) - AND
      • (|(uid=jdoe)(uid=jsmith)) - OR
      • (!(objectClass=computer)) - NOT
      Parameters:
      filter - the filter string
    • getAttributes

      public List<String> getAttributes()
      Returns the list of attributes to return.
      Returns:
      unmodifiable list of attribute names
    • setAttributes

      public void setAttributes(String... attributes)
      Sets the attributes to return.

      An empty list returns all user attributes. The special value "*" returns all user attributes, "+" returns all operational attributes.

      Parameters:
      attributes - the attribute names
    • setAttributes

      public void setAttributes(List<String> attributes)
      Sets the attributes to return.
      Parameters:
      attributes - the attribute names
    • toString

      public String toString()
      Overrides:
      toString in class Object