org.apache.directory.api.ldap.model.message
Interface SearchRequest

All Superinterfaces:
AbandonableRequest, ManyReplyRequest<SearchResultDone>, Message, Request, ResultResponseRequest<SearchResultDone>
All Known Implementing Classes:
SearchRequestImpl

public interface SearchRequest
extends ManyReplyRequest<SearchResultDone>, AbandonableRequest

Search request protocol message interface.

Author:
Apache Directory Project

Field Summary
static MessageTypeEnum[] RESPONSE_TYPES
          Different response types that a search request may return.
 
Method Summary
 SearchRequest addAllControls(Control[] controls)
          Adds an array of controls to this Message.
 SearchRequest addAttributes(String... attributes)
          Adds some attributes to the set of entry attributes to return.
 SearchRequest addControl(Control control)
          Adds a control to this Message.
 List<String> getAttributes()
          Gets a list of the attributes to be returned from each entry which matches the search filter.
 Dn getBase()
          Gets the search base as a distinguished name.
 AliasDerefMode getDerefAliases()
          Gets the alias handling parameter.
 ExprNode getFilter()
          Gets the search filter associated with this search request.
 MessageTypeEnum[] getResponseTypes()
          Gets the different response types generated by a search request.
 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 removeAttribute(String attribute)
          Removes an attribute to the set of entry attributes to return.
 SearchRequest removeControl(Control control)
          Deletes a control removing it from this Message.
 SearchRequest setBase(Dn baseDn)
          Sets the search base as a distinguished name.
 SearchRequest setDerefAliases(AliasDerefMode aliasDerefAliases)
          Sets the alias handling parameter.
 SearchRequest setFilter(ExprNode filter)
          Sets the search filter associated with this search request.
 SearchRequest setFilter(String filter)
          Sets the search filter associated with this search request.
 SearchRequest setMessageId(int messageId)
          Sets the Message ID for this request
 SearchRequest setScope(SearchScope scope)
          Sets the search scope parameter enumeration.
 SearchRequest setSizeLimit(long entriesMax)
          Sets sizelimit that restricts the maximum number of entries to be returned as a result of the search.
 SearchRequest setTimeLimit(int secondsMax)
          Sets the timelimit that restricts the maximum time (in seconds) allowed for a search.
 SearchRequest setTypesOnly(boolean typesOnly)
          An indicator as to whether search results will contain both attribute types and values, or just attribute types.
 
Methods inherited from interface org.apache.directory.api.ldap.model.message.ResultResponseRequest
getResultResponse
 
Methods inherited from interface org.apache.directory.api.ldap.model.message.Request
hasResponse
 
Methods inherited from interface org.apache.directory.api.ldap.model.message.Message
get, getControl, getControls, getMessageId, getType, hasControl, put
 
Methods inherited from interface org.apache.directory.api.ldap.model.message.AbandonableRequest
abandon, addAbandonListener, isAbandoned
 

Field Detail

RESPONSE_TYPES

static final MessageTypeEnum[] RESPONSE_TYPES
Different response types that a search request may return. A search request unlike any other request type can generate four different kinds of responses. It is at most required to return a done response when it is complete however before then it can return search entry, search reference, and extended responses to the client.

See Also:
getResponseTypes()
Method Detail

getResponseTypes

MessageTypeEnum[] getResponseTypes()
Gets the different response types generated by a search request.

Specified by:
getResponseTypes in interface ManyReplyRequest<SearchResultDone>
Returns:
the RESPONSE_TYPES array
See Also:
RESPONSE_TYPES

getBase

Dn getBase()
Gets the search base as a distinguished name.

Returns:
the search base

setBase

SearchRequest setBase(Dn baseDn)
Sets the search base as a distinguished name.

Parameters:
baseDn - the search base
Returns:
The SearchRequest instance

getScope

SearchScope getScope()
Gets the search scope parameter enumeration.

Returns:
the scope enumeration parameter.

setScope

SearchRequest setScope(SearchScope scope)
Sets the search scope parameter enumeration.

Parameters:
scope - the scope enumeration parameter.
Returns:
The SearchRequest instance

getDerefAliases

AliasDerefMode getDerefAliases()
Gets the alias handling parameter.

Returns:
the alias handling parameter enumeration.

setDerefAliases

SearchRequest setDerefAliases(AliasDerefMode aliasDerefAliases)
Sets the alias handling parameter.

Parameters:
aliasDerefAliases - the alias handling parameter enumeration.
Returns:
The SearchRequest instance

getSizeLimit

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

SearchRequest 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.
Returns:
The SearchRequest instance

getTimeLimit

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

SearchRequest 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.
Returns:
The SearchRequest instance

getTypesOnly

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

SearchRequest 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.
Returns:
The SearchRequest instance

getFilter

ExprNode getFilter()
Gets the search filter associated with this search request.

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

setFilter

SearchRequest setFilter(ExprNode filter)
Sets the search filter associated with this search request.

Parameters:
filter - the expression node for the root of the filter expression tree.
Returns:
The SearchRequest instance

setFilter

SearchRequest setFilter(String filter)
                        throws LdapException
Sets the search filter associated with this search request.

Parameters:
filter - the expression node for the root of the filter expression tree.
Returns:
The SearchRequest instance
Throws:
LdapException

getAttributes

List<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

addAttributes

SearchRequest addAttributes(String... attributes)
Adds some attributes to the set of entry attributes to return.

Parameters:
attributes - the attributes description or identifier.
Returns:
The SearchRequest instance

removeAttribute

SearchRequest removeAttribute(String attribute)
Removes an attribute to the set of entry attributes to return.

Parameters:
attribute - the attribute description or identifier.
Returns:
The SearchRequest instance

setMessageId

SearchRequest setMessageId(int messageId)
Sets the Message ID for this request

Specified by:
setMessageId in interface Message
Parameters:
messageId - The message Id
Returns:
A Message reference

addControl

SearchRequest addControl(Control control)
                         throws MessageException
Adds a control to this Message.

Specified by:
addControl in interface Message
Parameters:
control - the control to add.
Returns:
A Message reference
Throws:
MessageException - if controls cannot be added to this Message or the control is not known etc.

addAllControls

SearchRequest addAllControls(Control[] controls)
                             throws MessageException
Adds an array of controls to this Message.

Specified by:
addAllControls in interface Message
Parameters:
controls - the controls to add.
Returns:
A Message reference
Throws:
MessageException - if controls cannot be added to this Message or they are not known etc.

removeControl

SearchRequest removeControl(Control control)
                            throws MessageException
Deletes a control removing it from this Message.

Specified by:
removeControl in interface Message
Parameters:
control - the control to remove.
Returns:
A Message reference
Throws:
MessageException - if controls cannot be added to this Message or the control is not known etc.


Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.