org.apache.directory.shared.ldap.message
Class SearchRequestImpl

java.lang.Object
  extended by org.apache.directory.shared.ldap.message.internal.InternalAbstractMessage
      extended by org.apache.directory.shared.ldap.message.internal.InternalAbstractRequest
          extended by org.apache.directory.shared.ldap.message.AbstractAbandonableRequest
              extended by org.apache.directory.shared.ldap.message.SearchRequestImpl
All Implemented Interfaces:
InternalAbandonableRequest, InternalMessage, InternalRequest, InternalResultResponseRequest, InternalSearchRequest, ManyReplyRequest

public class SearchRequestImpl
extends AbstractAbandonableRequest
implements InternalSearchRequest

Lockable SearchRequest implementation.

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

Field Summary
 
Fields inherited from interface org.apache.directory.shared.ldap.message.internal.InternalSearchRequest
RESPONSE_TYPES
 
Constructor Summary
SearchRequestImpl(int id)
          Creates a Lockable SearcRequest implementing object used to search the DIT.
 
Method Summary
 void addAttribute(java.lang.String attribute)
          Adds an attribute to the set of entry attributes to return.
 boolean equals(java.lang.Object obj)
          Checks to see if two search requests are equal.
 java.util.List<java.lang.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.
 InternalResultResponse getResultResponse()
          The result containing response for this 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.
 void removeAttribute(java.lang.String attribute)
          Removes an attribute to the set of entry attributes to return.
 void setBase(DN base)
          Sets the search base as a distinguished name.
 void setDerefAliases(AliasDerefMode aliasDerefAliases)
          Sets the alias handling parameter.
 void setFilter(ExprNode filter)
          Sets the search filter associated with this search request.
 void setScope(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.
 java.lang.String toString()
          Return a string the represent a SearchRequest
 
Methods inherited from class org.apache.directory.shared.ldap.message.AbstractAbandonableRequest
abandon, addAbandonListener, isAbandoned
 
Methods inherited from class org.apache.directory.shared.ldap.message.internal.InternalAbstractRequest
hashCode, hasResponse
 
Methods inherited from class org.apache.directory.shared.ldap.message.internal.InternalAbstractMessage
add, addAll, get, getControls, getMessageId, getType, hasControl, put, remove
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.directory.shared.ldap.message.internal.InternalRequest
hasResponse
 
Methods inherited from interface org.apache.directory.shared.ldap.message.internal.InternalMessage
add, addAll, get, getControls, getMessageId, getType, hasControl, put, remove
 
Methods inherited from interface org.apache.directory.shared.ldap.message.internal.InternalAbandonableRequest
abandon, addAbandonListener, isAbandoned
 

Constructor Detail

SearchRequestImpl

public SearchRequestImpl(int id)
Creates a Lockable SearcRequest implementing object used to search the DIT.

Parameters:
id - the sequential message identifier
Method Detail

getAttributes

public java.util.List<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.

Specified by:
getAttributes in interface InternalSearchRequest
Returns:
the collection of attributes to return for each entry

getBase

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

Specified by:
getBase in interface InternalSearchRequest
Returns:
the search base

setBase

public void setBase(DN base)
Sets the search base as a distinguished name.

Specified by:
setBase in interface InternalSearchRequest
Parameters:
base - the search base

getDerefAliases

public AliasDerefMode getDerefAliases()
Gets the alias handling parameter.

Specified by:
getDerefAliases in interface InternalSearchRequest
Returns:
the alias handling parameter enumeration.

setDerefAliases

public void setDerefAliases(AliasDerefMode aliasDerefAliases)
Sets the alias handling parameter.

Specified by:
setDerefAliases in interface InternalSearchRequest
Parameters:
aliasDerefAliases - the alias handling parameter enumeration.

getFilter

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

Specified by:
getFilter in interface InternalSearchRequest
Returns:
the expression node for the root of the filter expression tree.

setFilter

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

Specified by:
setFilter in interface InternalSearchRequest
Parameters:
filter - the expression node for the root of the filter expression tree.

getResponseTypes

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

Specified by:
getResponseTypes in interface InternalSearchRequest
Specified by:
getResponseTypes in interface ManyReplyRequest
Returns:
the RESPONSE_TYPES array
See Also:
InternalSearchRequest.RESPONSE_TYPES

getScope

public SearchScope getScope()
Gets the search scope parameter enumeration.

Specified by:
getScope in interface InternalSearchRequest
Returns:
the scope enumeration parameter.

setScope

public void setScope(SearchScope scope)
Sets the search scope parameter enumeration.

Specified by:
setScope in interface InternalSearchRequest
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.

Specified by:
getSizeLimit in interface InternalSearchRequest
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.

Specified by:
setSizeLimit in interface InternalSearchRequest
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.

Specified by:
getTimeLimit in interface InternalSearchRequest
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.

Specified by:
setTimeLimit in interface InternalSearchRequest
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.

Specified by:
getTypesOnly in interface InternalSearchRequest
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.

Specified by:
setTypesOnly in interface InternalSearchRequest
Parameters:
typesOnly - true for only types, false for types and values.

addAttribute

public void addAttribute(java.lang.String attribute)
Adds an attribute to the set of entry attributes to return.

Specified by:
addAttribute in interface InternalSearchRequest
Parameters:
attribute - the attribute description or identifier.

removeAttribute

public void removeAttribute(java.lang.String attribute)
Removes an attribute to the set of entry attributes to return.

Specified by:
removeAttribute in interface InternalSearchRequest
Parameters:
attribute - the attribute description or identifier.

getResultResponse

public InternalResultResponse getResultResponse()
The result containing response for this request.

Specified by:
getResultResponse in interface InternalResultResponseRequest
Returns:
the result containing response for this request

equals

public boolean equals(java.lang.Object obj)
Checks to see if two search requests are equal. The Lockable properties and the get/set context specific parameters are not consulted to determine equality. The filter expression tree comparison will normalize the child order of filter branch nodes then generate a string representation which is comparable. For the time being this is a very costly operation.

Overrides:
equals in class InternalAbstractMessage
Parameters:
obj - the object to check for equality to this SearchRequest
Returns:
true if the obj is a SearchRequest and equals this SearchRequest, false otherwise

toString

public java.lang.String toString()
Return a string the represent a SearchRequest

Overrides:
toString in class java.lang.Object


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