Class SearchOperation

    • Constructor Detail

      • SearchOperation

        public SearchOperation​(org.forgerock.services.context.Context context,
                               SearchRequest request)
        Creates a new search operation with the provided information.
        Parameters:
        context - The request context with which this operation is associated.
        request - The search request.
    • Method Detail

      • setBaseDN

        public final void setBaseDN​(Dn baseDN)
        Specifies the base DN as included in the request from the client.

        This method should only be called by pre-parse plugins or for internal use.

        Specified by:
        setBaseDN in interface PreParseSearchOperation
        Parameters:
        baseDN - The non-null base DN as included in the request from the client.
      • setScope

        public final void setScope​(SearchScope scope)
        Specifies the scope for this search operation. This should only be called by pre-parse plugins.
        Specified by:
        setScope in interface PreParseSearchOperation
        Parameters:
        scope - The scope for this search operation.
      • setDerefPolicy

        public final void setDerefPolicy​(DereferenceAliasesPolicy derefPolicy)
        Specifies the alias dereferencing policy for this search operation. This should only be called by pre-parse plugins.
        Specified by:
        setDerefPolicy in interface PreParseSearchOperation
        Parameters:
        derefPolicy - The alias dereferencing policy for this search operation.
      • setSizeLimit

        public final void setSizeLimit​(int sizeLimit)
        Specifies the size limit for this search operation. This should only be called by pre-parse plugins.
        Specified by:
        setSizeLimit in interface PreParseSearchOperation
        Parameters:
        sizeLimit - The size limit for this search operation.
      • setTimeLimit

        public final void setTimeLimit​(int timeLimit)
        Specifies the time limit for this search operation. This should only be called by pre-parse plugins.
        Specified by:
        setTimeLimit in interface PreParseSearchOperation
        Parameters:
        timeLimit - The time limit for this search operation.
      • getMaxCandidateSetSize

        public final int getMaxCandidateSetSize()
        Return the maximum candidate set size for this search operation.
        Returns:
        The maximum candidate set size for this search operation.
      • setMaxCandidateSetSize

        public final void setMaxCandidateSetSize​(int maxCandidateSetSize)
        Set the maximum candidate set size for this search operation.
        Parameters:
        maxCandidateSetSize - The maximum candidate set size for this search operation.
      • setTypesOnly

        public final void setTypesOnly​(boolean typesOnly)
        Specifies the typesOnly flag for this search operation. This should only be called by pre-parse plugins.
        Specified by:
        setTypesOnly in interface PreParseSearchOperation
        Parameters:
        typesOnly - The typesOnly flag for this search operation.
      • setFilter

        public final void setFilter​(Filter filter)
        Specifies the search filter as included in the request from the client.

        This method should only be called by pre-parse plugins.

        Specified by:
        setFilter in interface PreParseSearchOperation
        Parameters:
        filter - The non-null search filter as included in the request from the client.
      • getMatcher

        public final Matcher getMatcher()
        Retrieves the matcher derived from the search filter for this search operation.
        Returns:
        the matcher for this search operation.
      • setAttributes

        public final void setAttributes​(Set<String> attributes)
        Specifies the set of requested attributes for this search operation. It should only be called by pre-parse plugins.
        Specified by:
        setAttributes in interface PreParseSearchOperation
        Parameters:
        attributes - The set of requested attributes for this search operation.
      • returnEntry

        public 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.
        Specified by:
        returnEntry in interface PreOperationSearchOperation
        Specified by:
        returnEntry in interface PreParseSearchOperation
        Parameters:
        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).
        Returns:
        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).
      • timeLimitExpired

        public boolean timeLimitExpired()
        Returns whether the search operation has reached its time limit.
        Returns:
        whether the search operation has reached its time limit
      • returnReference

        public 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.
        Specified by:
        returnReference in interface PreOperationSearchOperation
        Specified by:
        returnReference in interface PreParseSearchOperation
        Parameters:
        reference - The search reference to send to the client.
        dn - The DN related to the specified search reference.
        Returns:
        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).
      • sendSearchResultDone

        public void sendSearchResultDone()
        Sends the search result done message to the client. Note that this method should only be called from external classes in special cases (e.g., persistent search) where they are sure that the result won't be sent by the core server. Also note that the result code and optionally the error message should have been set for this operation before this method is called.
      • getProxiedAuthorizationDN

        public final Dn getProxiedAuthorizationDN()
        Description copied from class: Operation
        Retrieves the proxied authorization DN for this operation if proxied authorization has been requested.
        Specified by:
        getProxiedAuthorizationDN in class Operation
        Returns:
        The proxied authorization DN for this operation if proxied authorization has been requested, or null if proxied authorization has not been requested.
      • getResponseControls

        public final List<Control> getResponseControls()
        Description copied from interface: PluginOperation
        Retrieves the set of controls to include in the response to the client. The contents of this list must not be altered.
        Specified by:
        getResponseControls in interface PluginOperation
        Returns:
        The set of controls to include in the response to the client.
      • toString

        public void toString​(StringBuilder buffer)
        Description copied from interface: PluginOperation
        Appends a string representation of this operation to the provided buffer.
        Specified by:
        toString in interface PluginOperation
        Specified by:
        toString in class Operation
        Parameters:
        buffer - The buffer into which a string representation of this operation should be appended.
      • getSimplePagedResultsControlOrNull

        public SimplePagedResultsControl getSimplePagedResultsControlOrNull()
        Return the Simple Paged Results Control of the search request or null if absent.
        Returns:
        the Simple Paged Results Control of the search request or null if absent
      • getServerSideSortControlOrNull

        public ServerSideSortRequestControl getServerSideSortControlOrNull()
        Return the Server Side Sort Control of the search request or null if absent.
        Returns:
        the Server Side Sort Control of the search request or null if absent
      • getVirtualListViewRequestControlOrNull

        public VirtualListViewRequestControl getVirtualListViewRequestControlOrNull()
        Return the Virtual List View Request Control of the search request or null if absent.
        Returns:
        the Virtual List View Request Control of the search request or null if absent
      • isSendResponse

        public final boolean isSendResponse()
        Indicates whether the search result done message has to be sent to the client, or not.
        Returns:
        true if the search result done message is to be sent to the client
      • setSendResponse

        public final void setSendResponse​(boolean sendResponse)
        Specify whether the search result done message has to be sent to the client, or not.
        Parameters:
        sendResponse - - boolean indicating whether the search result done message is to send to the client
      • sendSearchEntry

        public void sendSearchEntry​(SearchResultEntry entry)
                             throws LdapException
        Sends the provided search result entry to the client.
        Parameters:
        entry - The search result entry to be sent to the client.
        Throws:
        LdapException - If a problem occurs while attempting to send the entry to the client and the search should be terminated.
      • sendSearchReference

        public boolean sendSearchReference​(SearchResultReference reference)
                                    throws LdapException
        Sends the provided search result reference to the client.
        Parameters:
        reference - The search result reference to be sent to the client.
        Returns:
        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.
        Throws:
        LdapException - If a problem occurs while attempting to send the reference to the client and the search should be terminated.
      • setProxiedAuthorizationDN

        public final void setProxiedAuthorizationDN​(Dn proxiedAuthorizationDN)
        Description copied from class: Operation
        Set the proxied authorization DN for this operation if proxied authorization has been requested.
        Specified by:
        setProxiedAuthorizationDN in class Operation
        Parameters:
        proxiedAuthorizationDN - The proxied authorization DN for this operation if proxied authorization has been requested, or null if proxied authorization has not been requested.
      • run

        public void run()
        Description copied from class: Operation
        Performs the work of actually processing this operation. This should include all processing for the operation, including invoking pre-parse and post-response plugins, logging messages and any other work that might need to be done in the course of processing.
        Specified by:
        run in interface Runnable
        Specified by:
        run in class Operation