Class AbstractExtendedResult<S extends ExtendedResult>
java.lang.Object
org.forgerock.opendj.ldap.messages.AbstractExtendedResult<S>
- Type Parameters:
S
- The type of Extended result.
- All Implemented Interfaces:
ExtendedResult
,ProtocolOp
,Response
,Result
public abstract class AbstractExtendedResult<S extends ExtendedResult>
extends Object
implements ExtendedResult
An abstract Extended result which can be used as the basis for implementing
new Extended operations.
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractExtendedResult
(ExtendedResult extendedResult) Creates a new extended result that is an exact copy of the provided result.protected
AbstractExtendedResult
(ResultCode resultCode) Creates a new extended result using the provided result code. -
Method Summary
Modifier and TypeMethodDescriptionfinal S
addControl
(Control control) Adds the provided control to this protocol-op.final S
addControls
(Iterable<? extends Control> controls) Adds the provided controls to this protocol-op.final S
addReferralUri
(String uri) Adds the provided referral URI to this result.final boolean
containsControl
(String oid) Returnstrue
if this protocol-op contains the specified control.final Throwable
getCause()
Returns the throwable cause associated with this result if available.final <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.Returns aList
containing the controls included with this protocol-op.final LocalizableMessage
Returns the diagnostic message associated with this result.final String
Returns the diagnostic message associated with this result as a string.final String
Returns the matched DN associated with this result.abstract String
getOid()
Returns the numeric OID, if any, associated with this extended result.Returns aList
containing the referral URIs included with this result.final ResultCode
Returns the result code associated with this result.abstract ByteString
getValue()
Returns the value, if any, associated with this extended result.abstract boolean
hasValue()
Returnstrue
if this extended result has a value.final boolean
Indicates whether a referral needs to be chased in order to complete the operation.final boolean
Indicates whether the request succeeded or not.final S
removeControls
(String oid) Removes all the controls having the specified OID.final S
Sets the throwable cause associated with this result if available.final S
setDiagnosticMessage
(CharSequence message) Sets the diagnostic message associated with this result.final S
setMatchedDn
(String dn) Sets the matched DN associated with this result.final S
setMatchedDn
(Dn dn) Sets the matched DN associated with this result.final S
setResultCode
(ResultCode resultCode) Sets the result code associated with this result.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.forgerock.opendj.ldap.messages.ExtendedResult
addControl, addControls, addReferralUri, getCause, getControl, getControls, getDiagnosticMessage, getDiagnosticMessageAsString, getMatchedDn, getReferralUris, getResultCode, isReferral, isSuccess, setCause, setDiagnosticMessage, setMatchedDn, setMatchedDn, setResultCode
Methods inherited from interface org.forgerock.opendj.ldap.messages.ProtocolOp
containsControl, getControl
Methods inherited from interface org.forgerock.opendj.ldap.messages.Result
copyFrom, removeControls
-
Constructor Details
-
AbstractExtendedResult
Creates a new extended result that is an exact copy of the provided result.- Parameters:
extendedResult
- The extended result to be copied.- Throws:
NullPointerException
- IfextendedResult
wasnull
.
-
AbstractExtendedResult
Creates a new extended result using the provided result code.- Parameters:
resultCode
- The result code.- Throws:
NullPointerException
- IfresultCode
wasnull
.
-
-
Method Details
-
getOid
Description copied from interface:ExtendedResult
Returns the numeric OID, if any, associated with this extended result.- Specified by:
getOid
in interfaceExtendedResult
- Returns:
- The numeric OID associated with this extended result, or
null
if there is no OID.
-
getValue
Description copied from interface:ExtendedResult
Returns the value, if any, associated with this extended result. Its format is defined by the specification of this extended result.- Specified by:
getValue
in interfaceExtendedResult
- Returns:
- The value associated with this extended result, or
null
if there is no value.
-
hasValue
public abstract boolean hasValue()Description copied from interface:ExtendedResult
Returnstrue
if this extended result has a value. In some circumstances it may be useful to determine if a extended result has a value, without actually calculating the value and incurring any performance costs.- Specified by:
hasValue
in interfaceExtendedResult
- Returns:
true
if this extended result has a value, orfalse
if there is no value.
-
toString
-
addReferralUri
Description copied from interface:Result
Adds the provided referral URI to this result.- Specified by:
addReferralUri
in interfaceResult
- Parameters:
uri
- The referral URI to be added.- Returns:
- This result.
-
getCause
Description copied from interface:Result
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. -
getDiagnosticMessage
Description copied from interface:Result
Returns the diagnostic message associated with this result.- Specified by:
getDiagnosticMessage
in interfaceResult
- Returns:
- The diagnostic message, which may be empty if none was provided
(never
null
).
-
getDiagnosticMessageAsString
Description copied from interface:Result
Returns the diagnostic message associated with this result as a string.- Specified by:
getDiagnosticMessageAsString
in interfaceResult
- Returns:
- The diagnostic message, which may be empty if none was provided
(never
null
).
-
getMatchedDn
Description copied from interface:Result
Returns the matched DN associated with this result.- Specified by:
getMatchedDn
in interfaceResult
- Returns:
- The matched DN, which may be empty if none was provided (never
null
).
-
getReferralUris
Description copied from interface:Result
Returns aList
containing the referral URIs included with this result. The returnedList
may be modified if permitted by this result.- Specified by:
getReferralUris
in interfaceResult
- Returns:
- A
List
containing the referral URIs.
-
getResultCode
Description copied from interface:Result
Returns the result code associated with this result.- Specified by:
getResultCode
in interfaceResult
- Returns:
- The result code.
-
isReferral
public final boolean isReferral()Description copied from interface:Result
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
.- Specified by:
isReferral
in interfaceResult
- Returns:
true
if a referral needs to be chased, otherwisefalse
.
-
isSuccess
public final boolean isSuccess()Description copied from interface:Result
Indicates whether the request succeeded or not. This method will return {code true} for all non-error responses. -
setCause
Description copied from interface:Result
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. -
setDiagnosticMessage
Description copied from interface:Result
Sets the diagnostic message associated with this result.- Specified by:
setDiagnosticMessage
in interfaceResult
- Parameters:
message
- The diagnostic message, which may be empty ornull
indicating that none was provided.- Returns:
- This result.
-
setMatchedDn
Description copied from interface:Result
Sets the matched DN associated with this result.- Specified by:
setMatchedDn
in interfaceResult
- Parameters:
dn
- The matched DN associated, which may be empty ornull
indicating that none was provided.- Returns:
- This result.
-
setMatchedDn
Description copied from interface:Result
Sets the matched DN associated with this result.- Specified by:
setMatchedDn
in interfaceResult
- Parameters:
dn
- The matched DN associated, which may be empty ornull
indicating that none was provided.- Returns:
- This result.
-
setResultCode
Description copied from interface:Result
Sets the result code associated with this result.- Specified by:
setResultCode
in interfaceResult
- Parameters:
resultCode
- The result code.- Returns:
- This result.
-
addControl
Description copied from interface:ProtocolOp
Adds the provided control to this protocol-op.- Specified by:
addControl
in interfaceProtocolOp
- Parameters:
control
- The control to be added to this protocol-op.- Returns:
- This protocol-op.
-
addControls
Description copied from interface:ProtocolOp
Adds the provided controls to this protocol-op.- Specified by:
addControls
in interfaceProtocolOp
- Parameters:
controls
- The controls to be added to this protocol-op.- Returns:
- This protocol-op.
-
removeControls
Description copied from interface:ProtocolOp
Removes all the controls having the specified OID.- Specified by:
removeControls
in interfaceProtocolOp
- Parameters:
oid
- The numeric OID of the protocol-op control to remove.- Returns:
- This protocol-op.
-
containsControl
Description copied from interface:ProtocolOp
Returnstrue
if this protocol-op contains the specified control.- Specified by:
containsControl
in interfaceProtocolOp
- Parameters:
oid
- The numeric OID of the protocol-op control.- Returns:
true
if this protocol-op contains the specified control.
-
getControl
public final <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
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.
-