Interface Result
- All Superinterfaces:
Response
- All Known Subinterfaces:
BindResult,CompareResult,ExtendedResult,GenericExtendedResult,PasswordModifyExtendedResult,WhoAmIExtendedResult
- All Known Implementing Classes:
AbstractExtendedResult
A Result is used to indicate the status of an operation performed by the
server. A Result is comprised of several fields:
- The result code can be retrieved using the method
getResultCode(). This indicates the overall outcome of the operation. In particular, whether it succeeded which is indicated using a value ofResultCode.SUCCESS. - The optional diagnostic message can be retrieved using the method
getDiagnosticMessage(). At the server's discretion, a diagnostic message may be included in a Result in order to supplement the result code with additional human-readable information. - The optional matched DN can be retrieved using the method
getMatchedDN(). For certain result codes, this is used to indicate to the client the last entry used in finding the Request's target (or base) entry. - The optional referrals can be retrieved using the method
getReferralURIs(). Referrals are present in a Result if the result code is set toResultCode.REFERRAL, and it are absent with all other result codes.
-
Method Summary
Modifier and TypeMethodDescriptionaddControl(Control control) Adds the provided control to this response.addReferralURI(String uri) Adds the provided referral URI to this result.getCause()Returns the throwable cause associated with this result if available.<C extends Control>
CgetControl(ControlDecoder<C> decoder, DecodeOptions options) Decodes and returns the first control in this response having an OID corresponding to the provided control decoder.Returns aListcontaining the controls included with this response.Returns the diagnostic message associated with this result.Returns the matched DN associated with this result.Returns aListcontaining the referral URIs included with this result.Returns the result code associated with this result.booleanIndicates whether a referral needs to be chased in order to complete the operation.booleanIndicates whether the request succeeded or not.Sets the throwable cause associated with this result if available.setDiagnosticMessage(String message) Sets the diagnostic message associated with this result.setMatchedDN(String dn) Sets the matched DN associated with this result.setResultCode(ResultCode resultCode) Sets the result code associated with this result.Methods inherited from interface org.forgerock.opendj.ldap.responses.Response
containsControl
-
Method Details
-
addControl
Description copied from interface:ResponseAdds the provided control to this response.- Specified by:
addControlin interfaceResponse- Parameters:
control- The control to be added.- Returns:
- This response.
-
addReferralURI
Adds the provided referral URI to this result.- Parameters:
uri- The referral URI to be added.- Returns:
- This result.
- Throws:
UnsupportedOperationException- If this result does not permit referrals to be added.NullPointerException- Ifuriwasnull.
-
getCause
Returns the throwable cause associated with this result if available. A cause may be provided in cases where a result indicates a failure due to a client-side error.- Returns:
- The throwable cause, or
nullif none was provided.
-
getControl
<C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) throws DecodeException Description copied from interface:ResponseDecodes and returns the first control in this response having an OID corresponding to the provided control decoder.- Specified by:
getControlin interfaceResponse- Type Parameters:
C- The type of control to be decoded and returned.- Parameters:
decoder- The control decoder.options- The set of decode options which should be used when decoding the control.- Returns:
- The decoded control, or
nullif the control is not included with this response. - Throws:
DecodeException- If the control could not be decoded because it was malformed in some way (e.g. the control value was missing, or its content could not be decoded).
-
getControls
Description copied from interface:ResponseReturns aListcontaining the controls included with this response. The returnedListmay be modified if permitted by this response.- Specified by:
getControlsin interfaceResponse- Returns:
- A
Listcontaining the controls.
-
getDiagnosticMessage
Returns the diagnostic message associated with this result.- Returns:
- The diagnostic message, which may be empty if none was provided
(never
null).
-
getMatchedDN
Returns the matched DN associated with this result.- Returns:
- The matched DN, which may be empty if none was provided (never
null).
-
getReferralURIs
Returns aListcontaining the referral URIs included with this result. The returnedListmay be modified if permitted by this result.- Returns:
- A
Listcontaining the referral URIs.
-
getResultCode
Returns the result code associated with this result.- Returns:
- The result code.
-
isReferral
boolean isReferral()Indicates whether a referral needs to be chased in order to complete the operation.Specifically, this method returns
trueif the result code is equal toResultCode.REFERRAL.- Returns:
trueif a referral needs to be chased, otherwisefalse.
-
isSuccess
boolean isSuccess()Indicates whether the request succeeded or not. This method will return {code true} for all non-error responses.- Returns:
trueif the request succeeded, otherwisefalse.
-
setCause
Sets the throwable cause associated with this result if available. A cause may be provided in cases where a result indicates a failure due to a client-side error.- Parameters:
cause- The throwable cause, which may benullindicating that none was provided.- Returns:
- This result.
- Throws:
UnsupportedOperationException- If this result does not permit the cause to be set.
-
setDiagnosticMessage
Sets the diagnostic message associated with this result.- Parameters:
message- The diagnostic message, which may be empty ornullindicating that none was provided.- Returns:
- This result.
- Throws:
UnsupportedOperationException- If this result does not permit the diagnostic message to be set.
-
setMatchedDN
Sets the matched DN associated with this result.- Parameters:
dn- The matched DN associated, which may be empty ornullindicating that none was provided.- Returns:
- This result.
- Throws:
UnsupportedOperationException- If this result does not permit the matched DN to be set.
-
setResultCode
Sets the result code associated with this result.- Parameters:
resultCode- The result code.- Returns:
- This result.
- Throws:
UnsupportedOperationException- If this result does not permit the result code to be set.NullPointerException- IfresultCodewasnull.
-