public class SearchOperation extends Operation implements PreOperationSearchOperation, PreParseSearchOperation, PostOperationSearchOperation, PostResponseSearchOperation, InProgressSearchOperation
NO_RESPONSE_CONTROLS, requestContext
Constructor and Description |
---|
SearchOperation(org.forgerock.services.context.Context context,
SearchRequest request)
Creates a new search operation with the provided information.
|
Modifier and Type | Method and Description |
---|---|
void |
addResponseControl(Control control)
Adds the provided control to the set of controls to include in the response to the client.
|
Set<String> |
getAttributes()
Retrieves the set of requested attributes for this search operation.
|
Dn |
getBaseDN()
Retrieves the base DN for this search operation.
|
DereferenceAliasesPolicy |
getDerefPolicy()
Retrieves the alias dereferencing policy for this search operation.
|
int |
getEntriesSent()
Retrieves the number of entries sent to the client for this search operation.
|
Filter |
getFilter()
Retrieves the filter for this search operation.
|
Matcher |
getMatcher()
Retrieves the matcher derived from the search filter for this search operation.
|
OperationType |
getOperationType()
Retrieves the operation type for this operation.
|
Dn |
getProxiedAuthorizationDN()
Retrieves the proxied authorization DN for this operation if proxied authorization has been requested.
|
int |
getReferencesSent()
Retrieves the number of search references sent to the client for this search operation.
|
List<Control> |
getResponseControls()
Retrieves the set of controls to include in the response to the client.
|
SearchScope |
getScope()
Retrieves the scope for this search operation.
|
int |
getSizeLimit()
Retrieves the size limit for this search operation.
|
int |
getTimeLimit()
Retrieves the time limit for this search operation.
|
boolean |
getTypesOnly()
Retrieves the typesOnly flag for this search operation.
|
boolean |
isSendResponse()
Indicates whether the search result done message has to be sent to the client, or not.
|
void |
removeResponseControl(Control control)
Removes the provided control from the set of controls to include in the response to the client.
|
boolean |
returnEntry(Entry entry,
List<Control> controls)
Used as a callback for backends to indicate that the provided entry matches the search criteria and that
additional processing should be performed to potentially send it back to the client.
|
boolean |
returnReference(Dn dn,
SearchResultReference reference)
Used as a callback for backends to indicate that the provided search reference was encountered during processing
and that additional processing should be performed to potentially send it back to the client.
|
boolean |
returnReference(Dn dn,
SearchResultReference reference,
boolean evaluateAci)
Used as a callback for backends to indicate that the provided search reference was encountered during processing
and that additional processing should be performed to potentially send it back to the client.
|
void |
run()
Performs the work of actually processing this operation.
|
void |
sendSearchEntry(SearchResultEntry entry)
Sends the provided search result entry to the client.
|
boolean |
sendSearchReference(SearchResultReference reference)
Sends the provided search result reference to the client.
|
void |
sendSearchResultDone()
Sends the search result done message to the client.
|
void |
setAttributes(Set<String> attributes)
Specifies the set of requested attributes for this search operation.
|
void |
setBaseDN(Dn baseDN)
Specifies the base DN as included in the request from the client.
|
void |
setDerefPolicy(DereferenceAliasesPolicy derefPolicy)
Specifies the alias dereferencing policy for this search operation.
|
void |
setFilter(Filter filter)
Specifies the search filter as included in the request from the client.
|
void |
setProxiedAuthorizationDN(Dn proxiedAuthorizationDN)
Set the proxied authorization DN for this operation if proxied authorization has been requested.
|
void |
setScope(SearchScope scope)
Specifies the scope for this search operation.
|
void |
setSendResponse(boolean sendResponse)
Specify whether the search result done message has to be sent to the client, or not.
|
void |
setSizeLimit(int sizeLimit)
Specifies the size limit for this search operation.
|
void |
setTimeLimit(int timeLimit)
Specifies the time limit for this search operation.
|
void |
setTypesOnly(boolean typesOnly)
Specifies the typesOnly flag for this search operation.
|
void |
toString(StringBuilder buffer)
Appends a string representation of this operation to the provided buffer.
|
void |
updateOperationErrMsgAndResCode()
Updates the error message and the result code of the operation.
|
addAdditionalLogItem, addPostReadResponse, addPreReadResponse, addRequestControl, appendErrorMessage, appendMaskedErrorMessage, checkAttributeConformsToSyntax, checkIfBackendIsWritable, checkIfCanceled, createLdapException, disconnectClient, dontSynchronize, equals, evaluateProxyAuthControls, filterNonDisclosableMatchedDN, findMatchedDN, getAdditionalLogItems, getAttachment, getAttachments, getAuthorizationDN, getAuthorizationEntry, getClientConnection, getConnectionID, getContext, getErrorMessage, getLocalBackend, getMatchedDN, getMessageID, getOperationID, getProcessingNanoTime, getProcessingStartTime, getProcessingStopTime, getProcessingTime, getReferralURLs, getRequestControl, getRequestControls, getResultCode, hashCode, hasPrivilege, invokePostResponseCallbacks, isHumanReadable, isInnerOperation, isInternalOperation, isProxyAuthzControl, isSynchronizationOperation, mustCheckSchema, operationCompleted, processOperationResult, processOperationResult, registerPostResponseCallback, removeAllDisallowedControls, removeAttachment, setAttachment, setAttachments, setAuthorizationEntry, setDontSynchronize, setErrorMessage, setInnerOperation, setInternalOperation, setMatchedDN, setProcessingStartTime, setProcessingStopTime, setReferralURLs, setResponseData, setResult, setResultCode, setResultCodeAndMessageNoInfoDisclosure, setSynchronizationOperation, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAdditionalLogItem, appendErrorMessage, getAdditionalLogItems, getAuthorizationDN, getErrorMessage, setErrorMessage
addAdditionalLogItem, addRequestControl, appendErrorMessage, getAdditionalLogItems, getErrorMessage, setErrorMessage
addAdditionalLogItem, appendErrorMessage, getAdditionalLogItems, getAuthorizationDN, getErrorMessage, getMatchedDN, getReferralURLs, getResultCode, setErrorMessage, setMatchedDN, setReferralURLs, setResponseData, setResultCode
getAdditionalLogItems, getAuthorizationDN, getErrorMessage, getMatchedDN, getProcessingStopTime, getProcessingTime, getReferralURLs, getResultCode
addAdditionalLogItem, appendErrorMessage, getAdditionalLogItems, getAuthorizationDN, getErrorMessage, getMatchedDN, getReferralURLs, getResultCode, setErrorMessage, setMatchedDN, setReferralURLs, setResponseData, setResultCode
checkIfCanceled, disconnectClient, getAttachment, getAttachments, getClientConnection, getConnectionID, getMessageID, getOperationID, getProcessingStartTime, getRequestControl, getRequestControl, getRequestControls, isInternalOperation, isSynchronizationOperation, removeAttachment, setAttachment, toString
public SearchOperation(org.forgerock.services.context.Context context, SearchRequest request)
context
- The request context with which this operation is associated.request
- The search request.public final void setBaseDN(Dn baseDN)
This method should only be called by pre-parse plugins or for internal use.
setBaseDN
in interface PreParseSearchOperation
baseDN
- The non-null base DN as included in the request from the client.public final Dn getBaseDN()
PreOperationSearchOperation
getBaseDN
in interface InProgressSearchOperation
getBaseDN
in interface PostOperationSearchOperation
getBaseDN
in interface PostResponseSearchOperation
getBaseDN
in interface PreOperationSearchOperation
getBaseDN
in interface PreParseSearchOperation
public final SearchScope getScope()
getScope
in interface InProgressSearchOperation
getScope
in interface PostOperationSearchOperation
getScope
in interface PostResponseSearchOperation
getScope
in interface PreOperationSearchOperation
getScope
in interface PreParseSearchOperation
public final void setScope(SearchScope scope)
setScope
in interface PreParseSearchOperation
scope
- The scope for this search operation.public final DereferenceAliasesPolicy getDerefPolicy()
getDerefPolicy
in interface InProgressSearchOperation
getDerefPolicy
in interface PostOperationSearchOperation
getDerefPolicy
in interface PostResponseSearchOperation
getDerefPolicy
in interface PreOperationSearchOperation
getDerefPolicy
in interface PreParseSearchOperation
public final void setDerefPolicy(DereferenceAliasesPolicy derefPolicy)
setDerefPolicy
in interface PreParseSearchOperation
derefPolicy
- The alias dereferencing policy for this search operation.public final int getSizeLimit()
getSizeLimit
in interface InProgressSearchOperation
getSizeLimit
in interface PostOperationSearchOperation
getSizeLimit
in interface PostResponseSearchOperation
getSizeLimit
in interface PreOperationSearchOperation
getSizeLimit
in interface PreParseSearchOperation
public final void setSizeLimit(int sizeLimit)
setSizeLimit
in interface PreParseSearchOperation
sizeLimit
- The size limit for this search operation.public final int getTimeLimit()
getTimeLimit
in interface InProgressSearchOperation
getTimeLimit
in interface PostOperationSearchOperation
getTimeLimit
in interface PostResponseSearchOperation
getTimeLimit
in interface PreOperationSearchOperation
getTimeLimit
in interface PreParseSearchOperation
public final void setTimeLimit(int timeLimit)
setTimeLimit
in interface PreParseSearchOperation
timeLimit
- The time limit for this search operation.public final boolean getTypesOnly()
getTypesOnly
in interface InProgressSearchOperation
getTypesOnly
in interface PostOperationSearchOperation
getTypesOnly
in interface PostResponseSearchOperation
getTypesOnly
in interface PreOperationSearchOperation
getTypesOnly
in interface PreParseSearchOperation
public final void setTypesOnly(boolean typesOnly)
setTypesOnly
in interface PreParseSearchOperation
typesOnly
- The typesOnly flag for this search operation.public final void setFilter(Filter filter)
This method should only be called by pre-parse plugins.
setFilter
in interface PreParseSearchOperation
filter
- The non-null search filter as included in the request from the client.public final Filter getFilter()
Only use this method for logging. Prefer to use getMatcher()
for matching entries.
getFilter
in interface InProgressSearchOperation
getFilter
in interface PostOperationSearchOperation
getFilter
in interface PostResponseSearchOperation
getFilter
in interface PreOperationSearchOperation
getFilter
in interface PreParseSearchOperation
public final Matcher getMatcher()
public final Set<String> getAttributes()
getAttributes
in interface InProgressSearchOperation
getAttributes
in interface PostOperationSearchOperation
getAttributes
in interface PostResponseSearchOperation
getAttributes
in interface PreOperationSearchOperation
getAttributes
in interface PreParseSearchOperation
public final void setAttributes(Set<String> attributes)
setAttributes
in interface PreParseSearchOperation
attributes
- The set of requested attributes for this search operation.public final int getEntriesSent()
getEntriesSent
in interface PostOperationSearchOperation
getEntriesSent
in interface PostResponseSearchOperation
public final int getReferencesSent()
getReferencesSent
in interface PostOperationSearchOperation
getReferencesSent
in interface PostResponseSearchOperation
public boolean returnEntry(Entry entry, List<Control> controls)
returnEntry
in interface PreOperationSearchOperation
returnEntry
in interface PreParseSearchOperation
entry
- The entry that matches the search criteria and should be sent to the client.controls
- The set of controls to include with the entry (may be null
if none are needed).true
if the caller should continue processing the search request and sending additional entries
and references, or false
if not for some reason (e.g., the size limit has been reached or the
search has been abandoned).public boolean returnReference(Dn dn, SearchResultReference reference)
returnReference
in interface PreOperationSearchOperation
returnReference
in interface PreParseSearchOperation
reference
- The search reference to send to the client.dn
- The DN related to the specified search reference.true
if the caller should continue processing the search request and sending additional entries
and references , or false
if not for some reason (e.g., the size limit has been reached or the
search has been abandoned).public boolean returnReference(Dn dn, SearchResultReference reference, boolean evaluateAci)
reference
- The search reference to send to the client.dn
- The DN related to the specified search reference.evaluateAci
- Indicates whether the access rights to the entry should be evaluated.true
if the caller should continue processing the search request and sending additional entries
and references , or false
if not for some reason (e.g., the size limit has been reached or the
search has been abandoned).public void sendSearchResultDone()
public final OperationType getOperationType()
PluginOperation
getOperationType
in interface PluginOperation
public final Dn getProxiedAuthorizationDN()
Operation
getProxiedAuthorizationDN
in class Operation
null
if proxied authorization has not been requested.public final List<Control> getResponseControls()
PluginOperation
getResponseControls
in interface PluginOperation
public final void addResponseControl(Control control)
Operation
addResponseControl
in interface InProgressOperation
addResponseControl
in interface PostOperationOperation
addResponseControl
in interface PreOperationOperation
addResponseControl
in interface PreParseOperation
addResponseControl
in class Operation
control
- The control to add to the set of controls to include in the response to the client.public final void removeResponseControl(Control control)
Operation
removeResponseControl
in interface InProgressOperation
removeResponseControl
in interface PostOperationOperation
removeResponseControl
in interface PreOperationOperation
removeResponseControl
in interface PreParseOperation
removeResponseControl
in class Operation
control
- The control to remove from the set of controls to include in the response to the client.public void toString(StringBuilder buffer)
Operation
toString
in interface PluginOperation
toString
in class Operation
buffer
- The buffer into which a string representation of this operation should be appended.public final boolean isSendResponse()
public final void setSendResponse(boolean sendResponse)
sendResponse
- - boolean indicating whether the search result done message is to send to the clientpublic void sendSearchEntry(SearchResultEntry entry) throws LdapException
entry
- The search result entry to be sent to the client.LdapException
- If a problem occurs while attempting to send the entry to the client and the search should be
terminated.public boolean sendSearchReference(SearchResultReference reference) throws LdapException
reference
- The search result reference to be sent to the client.true
if the client is able to accept referrals, or false
if the client cannot handle
referrals and no more attempts should be made to send them for the associated search operation.LdapException
- If a problem occurs while attempting to send the reference to the client and the search should be
terminated.public final void setProxiedAuthorizationDN(Dn proxiedAuthorizationDN)
Operation
setProxiedAuthorizationDN
in class Operation
proxiedAuthorizationDN
- The proxied authorization DN for this operation if proxied authorization has been requested, or
null
if proxied authorization has not been requested.public void run()
Operation
public void updateOperationErrMsgAndResCode()
Operation
updateOperationErrMsgAndResCode
in class Operation
Copyright 2010-2022 ForgeRock AS.