Class SearchRequestDsml
- java.lang.Object
-
- org.apache.directory.api.dsmlv2.AbstractDsmlMessageDecorator<E>
-
- org.apache.directory.api.dsmlv2.request.AbstractRequestDsml<E>
-
- org.apache.directory.api.dsmlv2.request.AbstractResultResponseRequestDsml<SearchRequest,SearchResultDone>
-
- org.apache.directory.api.dsmlv2.request.SearchRequestDsml
-
- All Implemented Interfaces:
DsmlDecorator<SearchRequest>,AbandonableRequest,ManyReplyRequest,Message,Request,ResultResponseRequest,SearchRequest
public class SearchRequestDsml extends AbstractResultResponseRequestDsml<SearchRequest,SearchResultDone> implements SearchRequest
DSML Decorator for SearchRequest- Author:
- Apache Directory Project
-
-
Field Summary
-
Fields inherited from interface org.apache.directory.api.ldap.model.message.SearchRequest
RESPONSE_TYPES
-
-
Constructor Summary
Constructors Constructor Description SearchRequestDsml(LdapApiService codec)Creates a new getDecoratedMessage() of SearchRequestDsml.SearchRequestDsml(LdapApiService codec, SearchRequest ldapMessage)Creates a new getDecoratedMessage() of SearchRequestDsml.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SearchRequestaddAllControls(Control[] controls)Adds an array of controls to this Message.SearchRequestaddAttributes(String... attributes)Adds some attributes to the set of entry attributes to return.SearchRequestaddControl(Control control)Adds a control to this Message.voidaddCurrentFilter(Filter localFilter)Add a current filter.voidendCurrentConnectorFilter()set the currentFilter to its parentSearchRequestfollowReferrals()Tells the client to follow referrals instead of throwing exceptionsList<String>getAttributes()Gets a list of the attributes to be returned from each entry which matches the search filter.DngetBase()Gets the search base as a distinguished name.FiltergetCodecFilter()Gets the search filter associated with this search request.AliasDerefModegetDerefAliases()Gets the alias handling parameter.ExprNodegetFilter()Gets the search filter associated with this search request.ExprNodegetFilterNode()Gets the search filter associated with this search request.MessageTypeEnum[]getResponseTypes()Gets the different response types generated by a search request.SearchScopegetScope()Gets the search scope parameter enumeration.longgetSizeLimit()A sizelimit that restricts the maximum number of entries to be returned as a result of the search.FiltergetTerminalFilter()Get the terminal filterintgetTimeLimit()Gets the timelimit that restricts the maximum time (in seconds) allowed for a search.MessageTypeEnumgetType()Gets the LDAP message type code associated with this Message.booleangetTypesOnly()An indicator as to whether search results will contain both attribute types and values, or just attribute types.SearchRequestignoreReferrals()Tells the client to ignore referrals instead of throwing exceptions.booleanisFollowReferrals()Tells the client if it should follow referrals instead of throwing exceptionsbooleanisIgnoreReferrals()Tells the client if it should ignore referrals instead of throwing exceptionsSearchRequestremoveAttribute(String attribute)Removes an attribute to the set of entry attributes to return.SearchRequestremoveControl(Control control)Deletes a control removing it from this Message.SearchRequestsetBase(Dn baseDn)Sets the search base as a distinguished name.SearchRequestsetDerefAliases(AliasDerefMode aliasDerefAliases)Sets the alias handling parameter.SearchRequestsetFilter(String filter)Sets the search filter associated with this search request.SearchRequestsetFilter(ExprNode filter)Sets the search filter associated with this search request.SearchRequestsetMessageId(int messageId)Sets the Message ID for this requestSearchRequestsetScope(SearchScope scope)Sets the search scope parameter enumeration.SearchRequestsetSizeLimit(long entriesMax)Sets sizelimit that restricts the maximum number of entries to be returned as a result of the search.voidsetTerminalFilter(Filter terminalFilter)Set the terminal filterSearchRequestsetTimeLimit(int secondsMax)Sets the timelimit that restricts the maximum time (in seconds) allowed for a search.SearchRequestsetTypesOnly(boolean typesOnly)An indicator as to whether search results will contain both attribute types and values, or just attribute types.ElementtoDsml(Element root)Creates the Request Element and adds RequestID and Controls.-
Methods inherited from class org.apache.directory.api.dsmlv2.request.AbstractResultResponseRequestDsml
abandon, addAbandonListener, computeLength, encode, getResultResponse, isAbandoned
-
Methods inherited from class org.apache.directory.api.dsmlv2.request.AbstractRequestDsml
getRequestName, hasResponse
-
Methods inherited from class org.apache.directory.api.dsmlv2.AbstractDsmlMessageDecorator
get, getCodecService, getControl, getControls, getCurrentControl, getDecorated, getMessageId, hasControl, put
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.directory.api.ldap.model.message.AbandonableRequest
abandon, addAbandonListener, isAbandoned
-
Methods inherited from interface org.apache.directory.api.ldap.model.message.Message
get, getControl, getControls, getMessageId, hasControl, put
-
Methods inherited from interface org.apache.directory.api.ldap.model.message.Request
hasResponse
-
Methods inherited from interface org.apache.directory.api.ldap.model.message.ResultResponseRequest
getResultResponse
-
-
-
-
Constructor Detail
-
SearchRequestDsml
public SearchRequestDsml(LdapApiService codec)
Creates a new getDecoratedMessage() of SearchRequestDsml.- Parameters:
codec- The LDAP Service to use
-
SearchRequestDsml
public SearchRequestDsml(LdapApiService codec, SearchRequest ldapMessage)
Creates a new getDecoratedMessage() of SearchRequestDsml.- Parameters:
codec- The LDAP Service to useldapMessage- the message to decorate
-
-
Method Detail
-
getCodecFilter
public Filter getCodecFilter()
Gets the search filter associated with this search request.- Returns:
- the expression node for the root of the filter expression tree.
-
getFilterNode
public ExprNode getFilterNode() throws LdapSchemaException
Gets the search filter associated with this search request.- Returns:
- the expression node for the root of the filter expression tree.
- Throws:
LdapSchemaException- If the filter is invalid
-
getTerminalFilter
public Filter getTerminalFilter()
Get the terminal filter- Returns:
- Returns the terminal filter.
-
setTerminalFilter
public void setTerminalFilter(Filter terminalFilter)
Set the terminal filter- Parameters:
terminalFilter- the teminalFilter.
-
endCurrentConnectorFilter
public void endCurrentConnectorFilter()
set the currentFilter to its parent
-
addCurrentFilter
public void addCurrentFilter(Filter localFilter) throws DecoderException
Add a current filter. We have two cases :- there is no previous current filter : the filter is the top level filter
- there is a previous current filter : the filter is added to the currentFilter set, and the current filter is changed
- Parameters:
localFilter- The filter to set.- Throws:
DecoderException- If the added filter is invalid
-
getType
public MessageTypeEnum getType()
Gets the LDAP message type code associated with this Message. Each request and response type has a unique message type code defined by the protocol in RFC 2251.- Specified by:
getTypein interfaceMessage- Overrides:
getTypein classAbstractDsmlMessageDecorator<SearchRequest>- Returns:
- the message type code.
-
toDsml
public Element toDsml(Element root)
Creates the Request Element and adds RequestID and Controls.- Specified by:
toDsmlin interfaceDsmlDecorator<SearchRequest>- Overrides:
toDsmlin classAbstractResultResponseRequestDsml<SearchRequest,SearchResultDone>- Parameters:
root- the root element- Returns:
- the Request Element of the given name containing
-
getResponseTypes
public MessageTypeEnum[] getResponseTypes()
Gets the different response types generated by a search request.- Specified by:
getResponseTypesin interfaceManyReplyRequest- Specified by:
getResponseTypesin interfaceSearchRequest- Returns:
- the RESPONSE_TYPES array
- See Also:
SearchRequest.RESPONSE_TYPES
-
getBase
public Dn getBase()
Gets the search base as a distinguished name.- Specified by:
getBasein interfaceSearchRequest- Returns:
- the search base
-
setBase
public SearchRequest setBase(Dn baseDn)
Sets the search base as a distinguished name.- Specified by:
setBasein interfaceSearchRequest- Parameters:
baseDn- the search base- Returns:
- The SearchRequest instance
-
getScope
public SearchScope getScope()
Gets the search scope parameter enumeration.- Specified by:
getScopein interfaceSearchRequest- Returns:
- the scope enumeration parameter.
-
setScope
public SearchRequest setScope(SearchScope scope)
Sets the search scope parameter enumeration.- Specified by:
setScopein interfaceSearchRequest- Parameters:
scope- the scope enumeration parameter.- Returns:
- The SearchRequest instance
-
getDerefAliases
public AliasDerefMode getDerefAliases()
Gets the alias handling parameter.- Specified by:
getDerefAliasesin interfaceSearchRequest- Returns:
- the alias handling parameter enumeration.
-
setDerefAliases
public SearchRequest setDerefAliases(AliasDerefMode aliasDerefAliases)
Sets the alias handling parameter.- Specified by:
setDerefAliasesin interfaceSearchRequest- Parameters:
aliasDerefAliases- the alias handling parameter enumeration.- Returns:
- The SearchRequest instance
-
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:
getSizeLimitin interfaceSearchRequest- Returns:
- search size limit.
-
setSizeLimit
public 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.- Specified by:
setSizeLimitin interfaceSearchRequest- Parameters:
entriesMax- maximum search result entries to return.- Returns:
- The SearchRequest instance
-
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:
getTimeLimitin interfaceSearchRequest- Returns:
- the search time limit in seconds.
-
setTimeLimit
public 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.- Specified by:
setTimeLimitin interfaceSearchRequest- Parameters:
secondsMax- the search time limit in seconds.- Returns:
- The SearchRequest instance
-
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:
getTypesOnlyin interfaceSearchRequest- Returns:
- true for only types, false for types and values.
-
setTypesOnly
public 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.- Specified by:
setTypesOnlyin interfaceSearchRequest- Parameters:
typesOnly- true for only types, false for types and values.- Returns:
- The SearchRequest instance
-
getFilter
public ExprNode getFilter()
Gets the search filter associated with this search request.- Specified by:
getFilterin interfaceSearchRequest- Returns:
- the expression node for the root of the filter expression tree.
-
setFilter
public SearchRequest setFilter(ExprNode filter)
Sets the search filter associated with this search request.- Specified by:
setFilterin interfaceSearchRequest- Parameters:
filter- the expression node for the root of the filter expression tree.- Returns:
- The SearchRequest instance
-
setFilter
public SearchRequest setFilter(String filter) throws LdapException
Sets the search filter associated with this search request.- Specified by:
setFilterin interfaceSearchRequest- Parameters:
filter- the expression node for the root of the filter expression tree.- Returns:
- The SearchRequest instance
- Throws:
LdapException- If the filter can't be added
-
getAttributes
public 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.- Specified by:
getAttributesin interfaceSearchRequest- Returns:
- the attributes to return for this request
-
addAttributes
public SearchRequest addAttributes(String... attributes)
Adds some attributes to the set of entry attributes to return.- Specified by:
addAttributesin interfaceSearchRequest- Parameters:
attributes- the attributes description or identifier.- Returns:
- The SearchRequest instance
-
removeAttribute
public SearchRequest removeAttribute(String attribute)
Removes an attribute to the set of entry attributes to return.- Specified by:
removeAttributein interfaceSearchRequest- Parameters:
attribute- the attribute description or identifier.- Returns:
- The SearchRequest instance
-
setMessageId
public SearchRequest setMessageId(int messageId)
Sets the Message ID for this request- Specified by:
setMessageIdin interfaceMessage- Specified by:
setMessageIdin interfaceSearchRequest- Overrides:
setMessageIdin classAbstractDsmlMessageDecorator<SearchRequest>- Parameters:
messageId- The message Id- Returns:
- A Message reference
-
addControl
public SearchRequest addControl(Control control)
Adds a control to this Message.- Specified by:
addControlin interfaceMessage- Specified by:
addControlin interfaceSearchRequest- Overrides:
addControlin classAbstractDsmlMessageDecorator<SearchRequest>- Parameters:
control- the control to add.- Returns:
- A Message reference
-
addAllControls
public SearchRequest addAllControls(Control[] controls)
Adds an array of controls to this Message.- Specified by:
addAllControlsin interfaceMessage- Specified by:
addAllControlsin interfaceSearchRequest- Overrides:
addAllControlsin classAbstractDsmlMessageDecorator<SearchRequest>- Parameters:
controls- the controls to add.- Returns:
- A Message reference
-
removeControl
public SearchRequest removeControl(Control control)
Deletes a control removing it from this Message.- Specified by:
removeControlin interfaceMessage- Specified by:
removeControlin interfaceSearchRequest- Overrides:
removeControlin classAbstractDsmlMessageDecorator<SearchRequest>- Parameters:
control- the control to remove.- Returns:
- A Message reference
-
isFollowReferrals
public boolean isFollowReferrals()
Tells the client if it should follow referrals instead of throwing exceptions- Specified by:
isFollowReferralsin interfaceSearchRequest- Returns:
- true if we should follow the referrals
-
followReferrals
public SearchRequest followReferrals()
Tells the client to follow referrals instead of throwing exceptions- Specified by:
followReferralsin interfaceSearchRequest- Returns:
- The SearchRequest instance
-
isIgnoreReferrals
public boolean isIgnoreReferrals()
Tells the client if it should ignore referrals instead of throwing exceptions- Specified by:
isIgnoreReferralsin interfaceSearchRequest- Returns:
- true if we should ignore the referrals
-
ignoreReferrals
public SearchRequest ignoreReferrals()
Tells the client to ignore referrals instead of throwing exceptions. The entry will contain the referral attributeType with the link.- Specified by:
ignoreReferralsin interfaceSearchRequest- Returns:
- The SearchRequest instance
-
-