Package com.unboundid.ldap.sdk
Class LDAPResult
java.lang.Object
com.unboundid.ldap.sdk.LDAPResult
- All Implemented Interfaces:
LDAPResponse,Serializable
- Direct Known Subclasses:
BindResult,CompareResult,ExtendedResult,SearchResult
@Extensible
@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public class LDAPResult
extends Object
implements Serializable, LDAPResponse
This class provides a data structure for holding the elements that are common
to most types of LDAP responses. The elements contained in an LDAP result
include:
Note that even though this class is marked with the @Extensible annotation type, it should not be directly subclassed by third-party code. Only the
- Result Code -- An integer value that provides information about the
status of the operation. See the
ResultCodeclass for information about a number of result codes defined in LDAP. - Diagnostic Message -- An optional string that may provide additional information about the operation. For example, if the operation failed, it may include information about the reason for the failure. It will often (but not always) be absent in the result for successful operations, and it may be absent in the result for failed operations.
- Matched DN -- An optional DN which specifies the entry that most closely matched the DN of a non-existent entry in the server. For example, if an operation failed because the target entry did not exist, then the matched DN field may specify the DN of the closest ancestor to that entry that does exist in the server.
- Referral URLs -- An optional set of LDAP URLs which refer to other directories and/or locations within the DIT in which the operation may be attempted. If multiple referral URLs are provided, then they should all be considered equivalent for the purpose of attempting the operation (e.g., the different URLs may simply refer to different servers in which the operation could be processed).
- Response Controls -- An optional set of controls included in the response from the server. If any controls are included, then they may provide additional information about the processing that was performed by the server.
Note that even though this class is marked with the @Extensible annotation type, it should not be directly subclassed by third-party code. Only the
BindResult and ExtendedResult subclasses are actually
intended to be extended by third-party code.- See Also:
-
Field Summary
Fields inherited from interface com.unboundid.ldap.protocol.LDAPResponse
NO_CONTROLS -
Constructor Summary
ConstructorsModifierConstructorDescriptionLDAPResult(int messageID, ResultCode resultCode) Creates a new LDAP result object with the provided message ID and result code, and no other information.LDAPResult(int messageID, ResultCode resultCode, String diagnosticMessage, String matchedDN, String[] referralURLs, Control[] responseControls) Creates a new LDAP result object with the provided information.LDAPResult(int messageID, ResultCode resultCode, String diagnosticMessage, String matchedDN, List<String> referralURLs, List<Control> responseControls) Creates a new LDAP result object with the provided information.protectedLDAPResult(LDAPResult result) Creates a new LDAP result object based on the provided result. -
Method Summary
Modifier and TypeMethodDescriptionfinal StringRetrieves the diagnostic message from the response, if available.final StringRetrieves the matched DN from the response, if available.final intRetrieves the message ID for the LDAP message with which this LDAP result is associated.final OperationTypeRetrieves the type of operation that triggered this result, if available.final String[]Retrieves the set of referral URLs from the response, if available.final ControlgetResponseControl(String oid) Retrieves the response control with the specified OID.final Control[]Retrieves the set of controls from the response, if available.final ResultCodeRetrieves the result code from the response.Retrieves a string representation of this LDAP result, consisting of the result code, diagnostic message (if present), matched DN (if present), and referral URLs (if present).final booleanIndicates whether this result contains at least one control.final booleanhasResponseControl(String oid) Indicates whether this result contains at least one control with the specified OID.toString()Retrieves a string representation of this LDAP result.voidtoString(StringBuilder buffer) Appends a string representation of this LDAP result to the provided buffer.
-
Constructor Details
-
LDAPResult
Creates a new LDAP result object based on the provided result.- Parameters:
result- The LDAP result object to use to initialize this result.
-
LDAPResult
Creates a new LDAP result object with the provided message ID and result code, and no other information.- Parameters:
messageID- The message ID for the LDAP message that is associated with this LDAP result.resultCode- The result code from the response.
-
LDAPResult
public LDAPResult(int messageID, @NotNull ResultCode resultCode, @Nullable String diagnosticMessage, @Nullable String matchedDN, @Nullable String[] referralURLs, @Nullable Control[] responseControls) Creates a new LDAP result object with the provided information.- Parameters:
messageID- The message ID for the LDAP message that is associated with this LDAP result.resultCode- The result code from the response.diagnosticMessage- The diagnostic message from the response, if available.matchedDN- The matched DN from the response, if available.referralURLs- The set of referral URLs from the response, if available.responseControls- The set of controls from the response, if available.
-
LDAPResult
public LDAPResult(int messageID, @NotNull ResultCode resultCode, @Nullable String diagnosticMessage, @Nullable String matchedDN, @Nullable List<String> referralURLs, @Nullable List<Control> responseControls) Creates a new LDAP result object with the provided information.- Parameters:
messageID- The message ID for the LDAP message that is associated with this LDAP result.resultCode- The result code from the response.diagnosticMessage- The diagnostic message from the response, if available.matchedDN- The matched DN from the response, if available.referralURLs- The set of referral URLs from the response, if available.responseControls- The set of controls from the response, if available.
-
-
Method Details
-
getMessageID
Retrieves the message ID for the LDAP message with which this LDAP result is associated.- Specified by:
getMessageIDin interfaceLDAPResponse- Returns:
- The message ID for the LDAP message with which this LDAP result is associated.
-
getOperationType
Retrieves the type of operation that triggered this result, if available.- Returns:
- The type of operation that triggered this result, or
nullif the operation type is not available. Retrieves the BER type for the LDAP protocol op from which this
-
getResultCode
Retrieves the result code from the response.- Returns:
- The result code from the response.
-
getDiagnosticMessage
Retrieves the diagnostic message from the response, if available.- Returns:
- The diagnostic message from the response, or
nullif none was provided.
-
getMatchedDN
Retrieves the matched DN from the response, if available.- Returns:
- The matched DN from the response, or
nullif none was provided.
-
getReferralURLs
Retrieves the set of referral URLs from the response, if available.- Returns:
- The set of referral URLs from the response. The array returned may be empty if the response did not include any referral URLs.
-
getResponseControls
Retrieves the set of controls from the response, if available. Individual response controls of a specific type may be retrieved and decoded using thegetmethod in the response control class.- Returns:
- The set of controls from the response. The array returned may be empty if the response did not include any controls.
-
hasResponseControl
Indicates whether this result contains at least one control.- Returns:
trueif this result contains at least one control, orfalseif not.
-
hasResponseControl
Indicates whether this result contains at least one control with the specified OID.- Parameters:
oid- The object identifier for which to make the determination. It must not benull.- Returns:
trueif this result contains at least one control with the specified OID, orfalseif not.
-
getResponseControl
Retrieves the response control with the specified OID. If there is more than one response control with the specified OID, then the first will be returned.- Parameters:
oid- The OID for the response control to retrieve.- Returns:
- The requested response control, or
nullif there is no such response control.
-
getResultString
Retrieves a string representation of this LDAP result, consisting of the result code, diagnostic message (if present), matched DN (if present), and referral URLs (if present).- Returns:
- A string representation of this LDAP result.
-
toString
Retrieves a string representation of this LDAP result. -
toString
Appends a string representation of this LDAP result to the provided buffer.- Specified by:
toStringin interfaceLDAPResponse- Parameters:
buffer- The buffer to which to append a string representation of this LDAP result.
-