Interface Result
-
- All Superinterfaces:
ProtocolOp
,Response
- All Known Subinterfaces:
BindResult
,CompareResult
,ExtendedResult
,GenericExtendedResult
,PasswordModifyExtendedResult
,StartTlsExtendedResult
,WhoAmIExtendedResult
- All Known Implementing Classes:
AbstractExtendedResult
public interface Result extends Response
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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Result
addControl(Control control)
Adds the provided control to this protocol-op.Result
addControls(Iterable<? extends Control> controls)
Adds the provided controls to this protocol-op.Result
addReferralUri(String uri)
Adds the provided referral URI to this result.default Result
copyFrom(Result result)
Copies the result code, cause, diagnostic message, matched DN and referral URIs from the provided result to this result.Throwable
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 protocol-op having an OID corresponding to the provided control decoder.List<Control>
getControls()
Returns aList
containing the controls included with this protocol-op.LocalizableMessage
getDiagnosticMessage()
Returns the diagnostic message associated with this result.String
getDiagnosticMessageAsString()
Returns the diagnostic message associated with this result as a string.String
getMatchedDn()
Returns the matched DN associated with this result.List<String>
getReferralUris()
Returns aList
containing the referral URIs included with this result.ResultCode
getResultCode()
Returns the result code associated with this result.boolean
isReferral()
Indicates whether a referral needs to be chased in order to complete the operation.boolean
isSuccess()
Indicates whether the request succeeded or not.Result
setCause(Throwable cause)
Sets the throwable cause associated with this result if available.Result
setDiagnosticMessage(CharSequence message)
Sets the diagnostic message associated with this result.Result
setMatchedDn(String dn)
Sets the matched DN associated with this result.Result
setMatchedDn(Dn dn)
Sets the matched DN associated with this result.Result
setResultCode(ResultCode resultCode)
Sets the result code associated with this result.-
Methods inherited from interface org.forgerock.opendj.ldap.messages.ProtocolOp
containsControl, getControl
-
-
-
-
Method Detail
-
addControl
Result addControl(Control control)
Description copied from interface:ProtocolOp
Adds the provided control to this protocol-op.- Specified by:
addControl
in interfaceProtocolOp
- Specified by:
addControl
in interfaceResponse
- Parameters:
control
- The control to be added to this protocol-op.- Returns:
- This protocol-op.
-
addControls
Result addControls(Iterable<? extends Control> controls)
Description copied from interface:ProtocolOp
Adds the provided controls to this protocol-op.- Specified by:
addControls
in interfaceProtocolOp
- Specified by:
addControls
in interfaceResponse
- Parameters:
controls
- The controls to be added to this protocol-op.- Returns:
- This protocol-op.
-
addReferralUri
Result addReferralUri(String uri)
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
- Ifuri
wasnull
.
-
getCause
Throwable 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
null
if none was provided.
-
getControl
<C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) throws DecodeException
Description copied from interface:ProtocolOp
Decodes and returns the first control in this protocol-op having an OID corresponding to the provided control decoder.- Specified by:
getControl
in interfaceProtocolOp
- 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
null
if the control is not included with this protocol-op. - 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
List<Control> getControls()
Description copied from interface:ProtocolOp
Returns aList
containing the controls included with this protocol-op. The returnedList
may be modified if permitted by this protocol-op.- Specified by:
getControls
in interfaceProtocolOp
- Returns:
- A
List
containing the controls.
-
getDiagnosticMessage
LocalizableMessage getDiagnosticMessage()
Returns the diagnostic message associated with this result.- Returns:
- The diagnostic message, which may be empty if none was provided
(never
null
).
-
getDiagnosticMessageAsString
String getDiagnosticMessageAsString()
Returns the diagnostic message associated with this result as a string.- Returns:
- The diagnostic message, which may be empty if none was provided
(never
null
).
-
getMatchedDn
String getMatchedDn()
Returns the matched DN associated with this result.- Returns:
- The matched DN, which may be empty if none was provided (never
null
).
-
getReferralUris
List<String> getReferralUris()
Returns aList
containing the referral URIs included with this result. The returnedList
may be modified if permitted by this result.- Returns:
- A
List
containing the referral URIs.
-
getResultCode
ResultCode 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
true
if the result code is equal toResultCode.REFERRAL
.- Returns:
true
if 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:
true
if the request succeeded, otherwisefalse
.
-
setCause
Result setCause(Throwable cause)
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 benull
indicating that none was provided.- Returns:
- This result.
- Throws:
UnsupportedOperationException
- If this result does not permit the cause to be set.
-
setDiagnosticMessage
Result setDiagnosticMessage(CharSequence message)
Sets the diagnostic message associated with this result.- Parameters:
message
- The diagnostic message, which may be empty ornull
indicating that none was provided.- Returns:
- This result.
- Throws:
UnsupportedOperationException
- If this result does not permit the diagnostic message to be set.
-
setMatchedDn
Result setMatchedDn(String dn)
Sets the matched DN associated with this result.- Parameters:
dn
- The matched DN associated, which may be empty ornull
indicating that none was provided.- Returns:
- This result.
- Throws:
UnsupportedOperationException
- If this result does not permit the matched DN to be set.
-
setMatchedDn
Result setMatchedDn(Dn dn)
Sets the matched DN associated with this result.- Parameters:
dn
- The matched DN associated, which may be empty ornull
indicating that none was provided.- Returns:
- This result.
- Throws:
UnsupportedOperationException
- If this result does not permit the matched DN to be set.
-
setResultCode
Result setResultCode(ResultCode resultCode)
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
- IfresultCode
wasnull
.
-
copyFrom
default Result copyFrom(Result result)
Copies the result code, cause, diagnostic message, matched DN and referral URIs from the provided result to this result. It does not copy the LDAP controls.The current result code, cause, diagnostic message and matched DN will be overwritten, while the provided referral URIs will be added to the list of referral URIs.
- Parameters:
result
- The result from which to copy the attributes.- Returns:
- This result.
-
-