org.apache.directory.ldap.client.api.message
Class SearchRequest

java.lang.Object
  extended by org.apache.directory.ldap.client.api.message.AbstractMessage
      extended by org.apache.directory.ldap.client.api.message.AbstractRequest
          extended by org.apache.directory.ldap.client.api.message.SearchRequest
All Implemented Interfaces:
AbandonableRequest, Message, Request, RequestWithResponse

public class SearchRequest
extends AbstractRequest
implements AbandonableRequest, RequestWithResponse

Search request protocol message interface.

Version:
$Rev: 760724 $
Author:
Apache Directory Project

Constructor Summary
SearchRequest()
          Creates a new instance of SearchRequestImpl.
 
Method Summary
 SearchRequest addAttributes(java.lang.String... attributes)
          Adds attributes to the set of entry attributes to return.
 java.util.Set<java.lang.String> getAttributes()
          Gets a list of the attributes to be returned from each entry which matches the search filter.
 java.lang.String getBaseDn()
          Gets the search base as a distinguished name.
 org.apache.directory.shared.ldap.message.AliasDerefMode getDerefAliases()
          Gets the alias handling parameter.
 java.lang.String getFilter()
          Gets the search filter associated with this search request.
 org.apache.directory.shared.ldap.filter.SearchScope getScope()
          Gets the search scope parameter enumeration.
 long getSizeLimit()
          A sizelimit that restricts the maximum number of entries to be returned as a result of the search.
 int getTimeLimit()
          Gets the timelimit that restricts the maximum time (in seconds) allowed for a search.
 boolean getTypesOnly()
          An indicator as to whether search results will contain both attribute types and values, or just attribute types.
 SearchRequest removeAttributes(java.lang.String... attributes)
          Removes attributes to the set of entry attributes to return.
 void setBaseDn(java.lang.String baseDn)
          Sets the search base as a distinguished name.
 void setDerefAliases(org.apache.directory.shared.ldap.message.AliasDerefMode aliasDerefAliases)
          Sets the alias handling parameter.
 void setFilter(java.lang.String filter)
          Sets the search filter associated with this search request.
 void setScope(org.apache.directory.shared.ldap.filter.SearchScope scope)
          Sets the search scope parameter enumeration.
 void setSizeLimit(long entriesMax)
          Sets sizelimit that restricts the maximum number of entries to be returned as a result of the search.
 void setTimeLimit(int secondsMax)
          Sets the timelimit that restricts the maximum time (in seconds) allowed for a search.
 void setTypesOnly(boolean typesOnly)
          An indicator as to whether search results will contain both attribute types and values, or just attribute types.
 
Methods inherited from class org.apache.directory.ldap.client.api.message.AbstractRequest
getTimeout, setTimeout
 
Methods inherited from class org.apache.directory.ldap.client.api.message.AbstractMessage
add, getControl, getControls, getMessageId, hasControl, remove, setMessageId, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.directory.ldap.client.api.message.Request
getTimeout, setTimeout
 
Methods inherited from interface org.apache.directory.ldap.client.api.message.Message
add, getControl, getControls, getMessageId, hasControl, remove, setMessageId
 

Constructor Detail

SearchRequest

public SearchRequest()
Creates a new instance of SearchRequestImpl.

Parameters:
messageId - The message ID
Method Detail

getAttributes

public java.util.Set<java.lang.String> getAttributes()
Gets a list of the attributes to be returned from each entry which matches the search filter. There are two special values which may be used: an empty list with no attributes, and the attribute description string "*". Both of these signify that all user attributes are to be returned. (The "*" allows the client to request all user attributes in addition to specific operational attributes). Attributes MUST be named at most once in the list, and are returned at most once in an entry. If there are attribute descriptions in the list which are not recognized, they are ignored by the server. If the client does not want any attributes returned, it can specify a list containing only the attribute with OID "1.1". This OID was chosen arbitrarily and does not correspond to any attribute in use. Client implementors should note that even if all user attributes are requested, some attributes of the entry may not be included in search results due to access control or other restrictions. Furthermore, servers will not return operational attributes, such as objectClasses or attributeTypes, unless they are listed by name, since there may be extremely large number of values for certain operational attributes.

Returns:
the attributes to return for this request

getBaseDn

public java.lang.String getBaseDn()
Gets the search base as a distinguished name.

Returns:
the search base

setBaseDn

public void setBaseDn(java.lang.String baseDn)
Sets the search base as a distinguished name.

Parameters:
baseDn - the search base

getDerefAliases

public org.apache.directory.shared.ldap.message.AliasDerefMode getDerefAliases()
Gets the alias handling parameter.

Returns:
the alias handling parameter enumeration.

setDerefAliases

public void setDerefAliases(org.apache.directory.shared.ldap.message.AliasDerefMode aliasDerefAliases)
Sets the alias handling parameter.

Parameters:
aliasDerefAliases - the alias handling parameter enumeration.

getFilter

public java.lang.String getFilter()
Gets the search filter associated with this search request.

Returns:
the expression node for the root of the filter expression tree.

setFilter

public void setFilter(java.lang.String filter)
Sets the search filter associated with this search request.

Parameters:
filter - the expression node for the root of the filter expression tree.

getScope

public org.apache.directory.shared.ldap.filter.SearchScope getScope()
Gets the search scope parameter enumeration.

Returns:
the scope enumeration parameter.

setScope

public void setScope(org.apache.directory.shared.ldap.filter.SearchScope scope)
Sets the search scope parameter enumeration.

Parameters:
scope - the scope enumeration parameter.

getSizeLimit

public long getSizeLimit()
A sizelimit that restricts the maximum number of entries to be returned as a result of the search. A value of 0 in this field indicates that no client-requested sizelimit restrictions are in effect for the search. Servers may enforce a maximum number of entries to return.

Returns:
search size limit.

setSizeLimit

public void setSizeLimit(long entriesMax)
Sets sizelimit that restricts the maximum number of entries to be returned as a result of the search. A value of 0 in this field indicates that no client-requested sizelimit restrictions are in effect for the search. Servers may enforce a maximum number of entries to return.

Parameters:
entriesMax - maximum search result entries to return.

getTimeLimit

public int getTimeLimit()
Gets the timelimit that restricts the maximum time (in seconds) allowed for a search. A value of 0 in this field indicates that no client- requested timelimit restrictions are in effect for the search.

Returns:
the search time limit in seconds.

setTimeLimit

public void setTimeLimit(int secondsMax)
Sets the timelimit that restricts the maximum time (in seconds) allowed for a search. A value of 0 in this field indicates that no client- requested timelimit restrictions are in effect for the search.

Parameters:
secondsMax - the search time limit in seconds.

getTypesOnly

public boolean getTypesOnly()
An indicator as to whether search results will contain both attribute types and values, or just attribute types. Setting this field to TRUE causes only attribute types (no values) to be returned. Setting this field to FALSE causes both attribute types and values to be returned.

Returns:
true for only types, false for types and values.

setTypesOnly

public void setTypesOnly(boolean typesOnly)
An indicator as to whether search results will contain both attribute types and values, or just attribute types. Setting this field to TRUE causes only attribute types (no values) to be returned. Setting this field to FALSE causes both attribute types and values to be returned.

Parameters:
typesOnly - true for only types, false for types and values.

addAttributes

public SearchRequest addAttributes(java.lang.String... attributes)
Adds attributes to the set of entry attributes to return.

Parameters:
attributes - the attributes description or identifier.
Returns:
The object itself, to allow chaining

removeAttributes

public SearchRequest removeAttributes(java.lang.String... attributes)
Removes attributes to the set of entry attributes to return.

Parameters:
attributes - the attributes description or identifier.
Returns:
The object itself, to allow chaining


Copyright © 2009-2011 Apache Software Foundation. All Rights Reserved.