@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class SearchResult extends LDAPResult
LDAPResult
object, but also contains additional information specific
to the search operation. This includes:
SearchResultEntry
objects returned from the
server. This will be available regardless of whether the entries are
included in this search result object or were returned through a
SearchResultListener
.SearchResultReference
objects returned from the
server. This will be available regardless of whether the entries are
included in this search result object or were returned through a
SearchResultListener
.SearchResultEntry
objects returned from the
server. This will be null
if a SearchResultListener
was used to return the entries.SearchResultReference
objects returned from the
server. This will be null
if a SearchResultListener
was used to return the entries.NO_CONTROLS
Constructor and Description |
---|
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.
|
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.
|
SearchResult(LDAPException ldapException)
Creates a new search result object with the information from the provided
LDAP exception.
|
SearchResult(LDAPResult ldapResult)
Creates a new search result object with the information from the provided
LDAP result.
|
Modifier and Type | Method and Description |
---|---|
int |
getEntryCount()
Retrieves the number of matching entries returned for the search operation.
|
int |
getReferenceCount()
Retrieves the number of search references returned for the search
operation.
|
java.util.List<SearchResultEntry> |
getSearchEntries()
Retrieves a list containing the matching entries returned from the search
operation.
|
SearchResultEntry |
getSearchEntry(java.lang.String dn)
Retrieves the search result entry with the specified DN from the set of
entries returned.
|
java.util.List<SearchResultReference> |
getSearchReferences()
Retrieves a list containing the search references returned from the search
operation.
|
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP result to the provided buffer.
|
getDiagnosticMessage, getMatchedDN, getMessageID, getOperationType, getReferralURLs, getResponseControl, getResponseControls, getResultCode, getResultString, hasResponseControl, hasResponseControl, toString
public SearchResult(int messageID, @NotNull ResultCode resultCode, @Nullable java.lang.String diagnosticMessage, @Nullable java.lang.String matchedDN, @Nullable java.lang.String[] referralURLs, int numEntries, int numReferences, @Nullable Control[] responseControls)
SearchResultListener
interface.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.public SearchResult(int messageID, @NotNull ResultCode resultCode, @Nullable java.lang.String diagnosticMessage, @Nullable java.lang.String matchedDN, @Nullable java.lang.String[] referralURLs, @Nullable java.util.List<SearchResultEntry> searchEntries, @Nullable java.util.List<SearchResultReference> searchReferences, int numEntries, int numReferences, @Nullable Control[] responseControls)
SearchResultListener
interface.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.public SearchResult(@NotNull LDAPResult ldapResult)
ldapResult
- The LDAP result to use to create the contents of this
search result.public SearchResult(@NotNull LDAPException ldapException)
ldapException
- The LDAP exception to use to create the contents of
this search result.public int getEntryCount()
public int getReferenceCount()
@Nullable public java.util.List<SearchResultEntry> getSearchEntries()
SearchResultListener
was not used during the search.null
if a SearchResultListener
was
used during the search.@Nullable public SearchResultEntry getSearchEntry(@NotNull java.lang.String dn) throws LDAPException
SearchResultListener
was not used during the search.dn
- The DN of the search result entry to retrieve. It must not
be null
.null
if
the specified entry was not returned, or if a
SearchResultListener
was used for the search.LDAPException
- If a problem is encountered while attempting to
parse the provided DN or a search entry DN.@Nullable public java.util.List<SearchResultReference> getSearchReferences()
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.null
if a SearchResultListener
was
used during the search.public void toString(@NotNull java.lang.StringBuilder buffer)
toString
in interface LDAPResponse
toString
in class LDAPResult
buffer
- The buffer to which to append a string representation of
this LDAP result.