Class SearchResult

    • Constructor Detail

      • SearchResult

        public SearchResult​(int messageID,
                            ResultCode resultCode,
                            java.lang.String diagnosticMessage,
                            java.lang.String matchedDN,
                            java.lang.String[] referralURLs,
                            int numEntries,
                            int numReferences,
                            Control[] responseControls)
        Creates a new search result object with the provided information. This version of the constructor should be used if the search result entries and references were returned to the client via the SearchResultListener interface.
        Parameters:
        messageID - The message ID for the LDAP message that is associated with this LDAP result.
        resultCode - The result code from the search result done response.
        diagnosticMessage - The diagnostic message from the search result done response, if available.
        matchedDN - The matched DN from the search result done response, if available.
        referralURLs - The set of referral URLs from the search result done response, if available.
        numEntries - The number of search result entries returned for this search.
        numReferences - The number of search result references returned for this search.
        responseControls - The set of controls from the search result done response, if available.
      • SearchResult

        public SearchResult​(int messageID,
                            ResultCode resultCode,
                            java.lang.String diagnosticMessage,
                            java.lang.String matchedDN,
                            java.lang.String[] referralURLs,
                            java.util.List<SearchResultEntry> searchEntries,
                            java.util.List<SearchResultReference> searchReferences,
                            int numEntries,
                            int numReferences,
                            Control[] responseControls)
        Creates a new search result object with the provided information. This version of the constructor should be used if the search result entries and references were collected in lists rather than returned to the requester through the SearchResultListener interface.
        Parameters:
        messageID - The message ID for the LDAP message that is associated with this LDAP result.
        resultCode - The result code from the search result done response.
        diagnosticMessage - The diagnostic message from the search result done response, if available.
        matchedDN - The matched DN from the search result done response, if available.
        referralURLs - The set of referral URLs from the search result done response, if available.
        searchEntries - A list containing the set of search result entries returned by the server. It may only be null if the search result entries were returned through the SearchResultListener interface.
        searchReferences - A list containing the set of search result references returned by the server. It may only be null if the search result entries were returned through the SearchResultListener interface.
        numEntries - The number of search result entries returned for this search.
        numReferences - The number of search result references returned for this search.
        responseControls - The set of controls from the search result done response, if available.
      • SearchResult

        public SearchResult​(LDAPResult ldapResult)
        Creates a new search result object with the information from the provided LDAP result.
        Parameters:
        ldapResult - The LDAP result to use to create the contents of this search result.
      • SearchResult

        public SearchResult​(LDAPException ldapException)
        Creates a new search result object with the information from the provided LDAP exception.
        Parameters:
        ldapException - The LDAP exception to use to create the contents of this search result.
    • Method Detail

      • getEntryCount

        public int getEntryCount()
        Retrieves the number of matching entries returned for the search operation.
        Returns:
        The number of matching entries returned for the search operation.
      • getReferenceCount

        public int getReferenceCount()
        Retrieves the number of search references returned for the search operation. This may be zero even if search references were received if the connection used when processing the search was configured to automatically follow referrals.
        Returns:
        The number of search references returned for the search operation.
      • getSearchEntries

        public java.util.List<SearchResultEntrygetSearchEntries()
        Retrieves a list containing the matching entries returned from the search operation. This will only be available if a SearchResultListener was not used during the search.
        Returns:
        A list containing the matching entries returned from the search operation, or null if a SearchResultListener was used during the search.
      • getSearchEntry

        public SearchResultEntry getSearchEntry​(java.lang.String dn)
                                         throws LDAPException
        Retrieves the search result entry with the specified DN from the set of entries returned. This will only be available if a SearchResultListener was not used during the search.
        Parameters:
        dn - The DN of the search result entry to retrieve. It must not be null.
        Returns:
        The search result entry with the provided DN, or null if the specified entry was not returned, or if a SearchResultListener was used for the search.
        Throws:
        LDAPException - If a problem is encountered while attempting to parse the provided DN or a search entry DN.
      • getSearchReferences

        public java.util.List<SearchResultReferencegetSearchReferences()
        Retrieves a list containing the search references returned from the search operation. This will only be available if a SearchResultListener was not used during the search, and may be empty even if search references were received if the connection used when processing the search was configured to automatically follow referrals.
        Returns:
        A list containing the search references returned from the search operation, or null if a SearchResultListener was used during the search.
      • toString

        public void toString​(java.lang.StringBuilder buffer)
        Appends a string representation of this LDAP result to the provided buffer.
        Specified by:
        toString in interface LDAPResponse
        Overrides:
        toString in class LDAPResult
        Parameters:
        buffer - The buffer to which to append a string representation of this LDAP result.