Package org.ldaptive
Class SearchOperation
- java.lang.Object
-
- org.ldaptive.AbstractOperation<SearchRequest,SearchResponse>
-
- org.ldaptive.SearchOperation
-
- All Implemented Interfaces:
Operation<SearchRequest,SearchResponse>
public class SearchOperation extends AbstractOperation<SearchRequest,SearchResponse>
Executes an ldap search operation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSearchOperation.BuilderSearch operation builder.-
Nested classes/interfaces inherited from class org.ldaptive.AbstractOperation
AbstractOperation.AbstractBuilder<B,T extends AbstractOperation>
-
-
Field Summary
Fields Modifier and Type Field Description private LdapEntryHandler[]entryHandlersFunctions to handle response entries.private FilterTemplatefilterTemplateFilter template.private SearchReferenceHandler[]referenceHandlersFunctions to handle response references.private SearchRequestrequestSearch request to execute.private SearchResultHandler[]searchResultHandlersFunctions to handle response results.
-
Constructor Summary
Constructors Constructor Description SearchOperation()Default constructor.SearchOperation(ConnectionFactory factory)Creates a new search operation.SearchOperation(ConnectionFactory factory, String baseDN)Creates a new search operation.SearchOperation(ConnectionFactory factory, SearchRequest req)Creates a new search operation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SearchOperation.Builderbuilder()Creates a builder for this class.protected SearchOperationHandleconfigureHandle(SearchOperationHandle handle)Adds configured functions to the supplied handle.private SearchRequestconfigureRequest(String baseDN, Filter filter, String[] returnAttributes)Creates a new request fromgetRequest()and applies any non-null supplied properties.static SearchOperationcopy(SearchOperation operation)Returns a new search operation with the same properties as the supplied operation.static SearchOperationcopy(SearchOperation operation, boolean deep)Returns a new search operation with the same properties as the supplied operation.SearchResponseexecute()Executes a search request usinggetRequest().SearchResponseexecute(String filter)Executes a search request.SearchResponseexecute(String filter, String... returnAttributes)Executes a search request.SearchResponseexecute(String filter, String[] returnAttributes, LdapEntryHandler... handlers)Executes a search request.SearchResponseexecute(String baseDN, String filter, String[] returnAttributes, LdapEntryHandler... handlers)Executes a search request.SearchResponseexecute(String baseDN, Filter filter, String[] returnAttributes, LdapEntryHandler... handlers)Executes a search request.SearchResponseexecute(String baseDN, FilterTemplate template, String[] returnAttributes, LdapEntryHandler... handlers)Executes a search request.static SearchResponseexecute(ConnectionFactory factory, SearchRequest req)Executes a search request.SearchResponseexecute(Filter filter)Executes a search request.SearchResponseexecute(Filter filter, String... returnAttributes)Executes a search request.SearchResponseexecute(Filter filter, String[] returnAttributes, LdapEntryHandler... handlers)Executes a search request.SearchResponseexecute(FilterTemplate template)Executes a search request.SearchResponseexecute(FilterTemplate template, String... returnAttributes)Executes a search request.SearchResponseexecute(FilterTemplate template, String[] returnAttributes, LdapEntryHandler... handlers)Executes a search request.SearchResponseexecute(SearchRequest req)Sends an asynchronous request and waits for the response.LdapEntryHandler[]getEntryHandlers()SearchReferenceHandler[]getReferenceHandlers()SearchRequestgetRequest()SearchResultHandler[]getSearchResultHandlers()FilterTemplategetTemplate()SearchOperationHandlesend()Sends a search request.SearchOperationHandlesend(String filter)Sends a search request.SearchOperationHandlesend(String filter, String... returnAttributes)Sends a search request.SearchOperationHandlesend(String filter, String[] returnAttributes, LdapEntryHandler... handlers)Sends a search request.SearchOperationHandlesend(String baseDN, String filter, String[] returnAttributes, LdapEntryHandler... handlers)Sends a search request.SearchOperationHandlesend(String baseDN, Filter filter, String[] returnAttributes, LdapEntryHandler... handlers)Sends a search request.SearchOperationHandlesend(String baseDN, FilterTemplate template, String[] returnAttributes, LdapEntryHandler... handlers)Sends a search request.static SearchOperationHandlesend(ConnectionFactory factory, SearchRequest req)Sends a search request.SearchOperationHandlesend(Filter filter)Sends a search request.SearchOperationHandlesend(Filter filter, String... returnAttributes)Sends a search request.SearchOperationHandlesend(Filter filter, String[] returnAttributes, LdapEntryHandler... handlers)Sends a search request.SearchOperationHandlesend(FilterTemplate template)Sends a search request.SearchOperationHandlesend(FilterTemplate template, String... returnAttributes)Sends a search request.SearchOperationHandlesend(FilterTemplate template, String[] returnAttributes, LdapEntryHandler... handlers)Sends a search request.SearchOperationHandlesend(SearchRequest req)Sends the supplied search request.voidsetEntryHandlers(LdapEntryHandler... handlers)voidsetReferenceHandlers(SearchReferenceHandler... handlers)voidsetRequest(SearchRequest req)voidsetSearchResultHandlers(SearchResultHandler... handlers)voidsetTemplate(FilterTemplate template)StringtoString()-
Methods inherited from class org.ldaptive.AbstractOperation
configureHandle, configureRequest, copy, getConnectionFactory, getControlHandlers, getExceptionHandler, getIntermediateResponseHandlers, getReferralHandlers, getReferralResultHandler, getRequestHandlers, getResultHandlers, getThrowCondition, getUnsolicitedNotificationHandlers, setConnectionFactory, setControlHandlers, setExceptionHandler, setIntermediateResponseHandlers, setReferralHandlers, setReferralResultHandler, setRequestHandlers, setResultHandlers, setThrowCondition, setUnsolicitedNotificationHandlers
-
-
-
-
Field Detail
-
request
private SearchRequest request
Search request to execute.
-
filterTemplate
private FilterTemplate filterTemplate
Filter template.
-
entryHandlers
private LdapEntryHandler[] entryHandlers
Functions to handle response entries.
-
referenceHandlers
private SearchReferenceHandler[] referenceHandlers
Functions to handle response references.
-
searchResultHandlers
private SearchResultHandler[] searchResultHandlers
Functions to handle response results.
-
-
Constructor Detail
-
SearchOperation
public SearchOperation()
Default constructor.
-
SearchOperation
public SearchOperation(ConnectionFactory factory)
Creates a new search operation.- Parameters:
factory- connection factory
-
SearchOperation
public SearchOperation(ConnectionFactory factory, SearchRequest req)
Creates a new search operation.- Parameters:
factory- connection factoryreq- search request
-
SearchOperation
public SearchOperation(ConnectionFactory factory, String baseDN)
Creates a new search operation.- Parameters:
factory- connection factorybaseDN- to search from
-
-
Method Detail
-
getRequest
public SearchRequest getRequest()
-
setRequest
public void setRequest(SearchRequest req)
-
getTemplate
public FilterTemplate getTemplate()
-
setTemplate
public void setTemplate(FilterTemplate template)
-
getEntryHandlers
public LdapEntryHandler[] getEntryHandlers()
-
setEntryHandlers
public void setEntryHandlers(LdapEntryHandler... handlers)
-
getReferenceHandlers
public SearchReferenceHandler[] getReferenceHandlers()
-
setReferenceHandlers
public void setReferenceHandlers(SearchReferenceHandler... handlers)
-
getSearchResultHandlers
public SearchResultHandler[] getSearchResultHandlers()
-
setSearchResultHandlers
public void setSearchResultHandlers(SearchResultHandler... handlers)
-
send
public SearchOperationHandle send(String filter) throws LdapException
Sends a search request. SeeSearchOperationHandle.send().- Parameters:
filter- search filter- Returns:
- search operation handle
- Throws:
FilterParseException- if the filter cannot be parsedLdapException- if the connection cannot be opened
-
send
public SearchOperationHandle send(FilterTemplate template) throws LdapException
Sends a search request. SeeSearchOperationHandle.send().- Parameters:
template- filter template- Returns:
- search operation handle
- Throws:
FilterParseException- if the filter cannot be parsedLdapException- if the connection cannot be opened
-
send
public SearchOperationHandle send(Filter filter) throws LdapException
Sends a search request. SeeSearchOperationHandle.send().- Parameters:
filter- search filter- Returns:
- search operation handle
- Throws:
LdapException- if the connection cannot be opened
-
send
public SearchOperationHandle send(String filter, String... returnAttributes) throws LdapException
Sends a search request. SeeSearchOperationHandle.send().- Parameters:
filter- search filterreturnAttributes- attributes to return- Returns:
- search operation handle
- Throws:
FilterParseException- if the filter cannot be parsedLdapException- if the connection cannot be opened
-
send
public SearchOperationHandle send(FilterTemplate template, String... returnAttributes) throws LdapException
Sends a search request. SeeSearchOperationHandle.send().- Parameters:
template- filter templatereturnAttributes- attributes to return- Returns:
- search operation handle
- Throws:
FilterParseException- if the filter cannot be parsedLdapException- if the connection cannot be opened
-
send
public SearchOperationHandle send(Filter filter, String... returnAttributes) throws LdapException
Sends a search request. SeeSearchOperationHandle.send().- Parameters:
filter- search filterreturnAttributes- attributes to return- Returns:
- search operation handle
- Throws:
LdapException- if the connection cannot be opened
-
send
public SearchOperationHandle send(String filter, String[] returnAttributes, LdapEntryHandler... handlers) throws LdapException
Sends a search request. SeeSearchOperationHandle.send().- Parameters:
filter- search filterreturnAttributes- attributes to returnhandlers- entry handlers- Returns:
- search operation handle
- Throws:
FilterParseException- if the filter cannot be parsedLdapException- if the connection cannot be opened
-
send
public SearchOperationHandle send(FilterTemplate template, String[] returnAttributes, LdapEntryHandler... handlers) throws LdapException
Sends a search request. SeeSearchOperationHandle.send().- Parameters:
template- filter templatereturnAttributes- attributes to returnhandlers- entry handlers- Returns:
- search operation handle
- Throws:
FilterParseException- if the filter cannot be parsedLdapException- if the connection cannot be opened
-
send
public SearchOperationHandle send(Filter filter, String[] returnAttributes, LdapEntryHandler... handlers) throws LdapException
Sends a search request. SeeSearchOperationHandle.send().- Parameters:
filter- search filterreturnAttributes- attributes to returnhandlers- entry handlers- Returns:
- search operation handle
- Throws:
LdapException- if the connection cannot be opened
-
send
public SearchOperationHandle send(String baseDN, String filter, String[] returnAttributes, LdapEntryHandler... handlers) throws LdapException
Sends a search request. SeeSearchOperationHandle.send().- Parameters:
baseDN- base DNfilter- search filterreturnAttributes- attributes to returnhandlers- entry handlers- Returns:
- search operation handle
- Throws:
FilterParseException- if the filter cannot be parsedLdapException- if the connection cannot be opened
-
send
public SearchOperationHandle send(String baseDN, FilterTemplate template, String[] returnAttributes, LdapEntryHandler... handlers) throws LdapException
Sends a search request. SeeSearchOperationHandle.send().- Parameters:
baseDN- base DNtemplate- filter templatereturnAttributes- attributes to returnhandlers- entry handlers- Returns:
- search operation handle
- Throws:
FilterParseException- if the filter cannot be parsedLdapException- if the connection cannot be opened
-
send
public SearchOperationHandle send(String baseDN, Filter filter, String[] returnAttributes, LdapEntryHandler... handlers) throws LdapException
Sends a search request. SeeSearchOperationHandle.send().- Parameters:
baseDN- base DNfilter- search filterreturnAttributes- attributes to returnhandlers- entry handlers- Returns:
- search operation handle
- Throws:
LdapException- if the connection cannot be opened
-
send
public SearchOperationHandle send(SearchRequest req) throws LdapException
Sends the supplied search request.- Parameters:
req- search request to send- Returns:
- search operation handle
- Throws:
LdapException- if the connection cannot be opened
-
send
public SearchOperationHandle send() throws LdapException
Sends a search request. SeeSearchOperationHandle.send().- Returns:
- search operation handle
- Throws:
LdapException- if the connection cannot be opened
-
send
public static SearchOperationHandle send(ConnectionFactory factory, SearchRequest req) throws LdapException
Sends a search request. SeeSearchOperationHandle.send().- Parameters:
factory- connection factoryreq- search request- Returns:
- search operation handle
- Throws:
LdapException- if the connection cannot be opened
-
execute
public SearchResponse execute(String filter) throws LdapException
Executes a search request. SeeSearchOperationHandle.execute().- Parameters:
filter- search filter- Returns:
- search result
- Throws:
FilterParseException- if the filter cannot be parsedLdapException- if the connection cannot be opened
-
execute
public SearchResponse execute(FilterTemplate template) throws LdapException
Executes a search request. SeeSearchOperationHandle.execute().- Parameters:
template- filter template- Returns:
- search result
- Throws:
FilterParseException- if the filter cannot be parsedLdapException- if the connection cannot be opened
-
execute
public SearchResponse execute(Filter filter) throws LdapException
Executes a search request. SeeSearchOperationHandle.execute().- Parameters:
filter- search filter- Returns:
- search result
- Throws:
LdapException- if the connection cannot be opened
-
execute
public SearchResponse execute(String filter, String... returnAttributes) throws LdapException
Executes a search request. SeeSearchOperationHandle.execute().- Parameters:
filter- search filterreturnAttributes- attributes to return- Returns:
- search result
- Throws:
FilterParseException- if the filter cannot be parsedLdapException- if the connection cannot be opened
-
execute
public SearchResponse execute(FilterTemplate template, String... returnAttributes) throws LdapException
Executes a search request. SeeSearchOperationHandle.execute().- Parameters:
template- filter templatereturnAttributes- attributes to return- Returns:
- search result
- Throws:
FilterParseException- if the filter cannot be parsedLdapException- if the connection cannot be opened
-
execute
public SearchResponse execute(Filter filter, String... returnAttributes) throws LdapException
Executes a search request. SeeSearchOperationHandle.execute().- Parameters:
filter- search filterreturnAttributes- attributes to return- Returns:
- search result
- Throws:
LdapException- if the connection cannot be opened
-
execute
public SearchResponse execute(String filter, String[] returnAttributes, LdapEntryHandler... handlers) throws LdapException
Executes a search request. SeeSearchOperationHandle.execute().- Parameters:
filter- search filterreturnAttributes- attributes to returnhandlers- entry handlers- Returns:
- search result
- Throws:
FilterParseException- if the filter cannot be parsedLdapException- if the connection cannot be opened
-
execute
public SearchResponse execute(FilterTemplate template, String[] returnAttributes, LdapEntryHandler... handlers) throws LdapException
Executes a search request. SeeSearchOperationHandle.execute().- Parameters:
template- filter templatereturnAttributes- attributes to returnhandlers- entry handlers- Returns:
- search result
- Throws:
FilterParseException- if the filter cannot be parsedLdapException- if the connection cannot be opened
-
execute
public SearchResponse execute(Filter filter, String[] returnAttributes, LdapEntryHandler... handlers) throws LdapException
Executes a search request. SeeSearchOperationHandle.execute().- Parameters:
filter- search filterreturnAttributes- attributes to returnhandlers- entry handlers- Returns:
- search result
- Throws:
LdapException- if the connection cannot be opened
-
execute
public SearchResponse execute(String baseDN, String filter, String[] returnAttributes, LdapEntryHandler... handlers) throws LdapException
Executes a search request. SeeSearchOperationHandle.execute().- Parameters:
baseDN- base DNfilter- search filterreturnAttributes- attributes to returnhandlers- entry handlers- Returns:
- search result
- Throws:
FilterParseException- if the filter cannot be parsedLdapException- if the connection cannot be opened
-
execute
public SearchResponse execute(String baseDN, FilterTemplate template, String[] returnAttributes, LdapEntryHandler... handlers) throws LdapException
Executes a search request. SeeSearchOperationHandle.execute().- Parameters:
baseDN- base DNtemplate- filter templatereturnAttributes- attributes to returnhandlers- entry handlers- Returns:
- search result
- Throws:
FilterParseException- if the filter cannot be parsedLdapException- if the connection cannot be opened
-
execute
public SearchResponse execute(String baseDN, Filter filter, String[] returnAttributes, LdapEntryHandler... handlers) throws LdapException
Executes a search request. SeeSearchOperationHandle.execute().- Parameters:
baseDN- base DNfilter- search filterreturnAttributes- attributes to returnhandlers- entry handlers- Returns:
- search result
- Throws:
LdapException- if the connection cannot be opened
-
execute
public SearchResponse execute(SearchRequest req) throws LdapException
Description copied from interface:OperationSends an asynchronous request and waits for the response.- Parameters:
req- operation request- Returns:
- operation result
- Throws:
LdapException- if the operation fails
-
execute
public SearchResponse execute() throws LdapException
Executes a search request usinggetRequest(). SeeSearchOperationHandle.execute().- Returns:
- search result
- Throws:
LdapException- if the connection cannot be opened
-
execute
public static SearchResponse execute(ConnectionFactory factory, SearchRequest req) throws LdapException
Executes a search request. SeeSearchOperationHandle.execute().- Parameters:
factory- connection factoryreq- search request- Returns:
- search result
- Throws:
LdapException- if the connection cannot be opened
-
configureRequest
private SearchRequest configureRequest(String baseDN, Filter filter, String[] returnAttributes)
Creates a new request fromgetRequest()and applies any non-null supplied properties.- Parameters:
baseDN- base DNfilter- search filterreturnAttributes- attributes to return- Returns:
- configured search request
-
configureHandle
protected SearchOperationHandle configureHandle(SearchOperationHandle handle)
Adds configured functions to the supplied handle.- Parameters:
handle- to configure- Returns:
- configured handle
-
copy
public static SearchOperation copy(SearchOperation operation)
Returns a new search operation with the same properties as the supplied operation.- Parameters:
operation- to copy- Returns:
- copy of the supplied search operation
-
copy
public static SearchOperation copy(SearchOperation operation, boolean deep)
Returns a new search operation with the same properties as the supplied operation.- Parameters:
operation- to copydeep- whether to make a deep copy- Returns:
- copy of the supplied search operation
-
toString
public String toString()
- Overrides:
toStringin classAbstractOperation<SearchRequest,SearchResponse>
-
builder
public static SearchOperation.Builder builder()
Creates a builder for this class.- Returns:
- new builder
-
-