Interface CompareResult
-
- All Superinterfaces:
ProtocolOp,Response,Result
public interface CompareResult extends Result
An Compare result indicates the final status of an Compare operation.If the attribute value assertion in the Compare request matched a value of the attribute or sub-type according to the attribute's equality matching rule then the result code is set to
ResultCode.COMPARE_TRUEand can be determined by invoking thematched()method.The following excerpt shows how to use the Compare operation to check whether a member belongs to a (possibly large) static group.
Connection connection = ...; String groupDN = ...; String memberDN = ...; CompareRequest request = Requests.newCompareRequest(groupDN, "member", memberDN); CompareResult result = connection.compare(request); if (result.matched()) { // The member belongs to the group. }
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CompareResultaddControl(Control control)Adds the provided control to this protocol-op.CompareResultaddControls(Iterable<? extends Control> controls)Adds the provided controls to this protocol-op.CompareResultaddReferralUri(String uri)Adds the provided referral URI to this result.ThrowablegetCause()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 aListcontaining the controls included with this protocol-op.LocalizableMessagegetDiagnosticMessage()Returns the diagnostic message associated with this result.StringgetDiagnosticMessageAsString()Returns the diagnostic message associated with this result as a string.StringgetMatchedDn()Returns the matched DN associated with this result.List<String>getReferralUris()Returns aListcontaining the referral URIs included with this result.ResultCodegetResultCode()Returns the result code associated with this result.booleanisReferral()Indicates whether a referral needs to be chased in order to complete the operation.booleanisSuccess()Indicates whether the request succeeded or not.booleanmatched()Indicates whether the attribute value assertion in the Compare request matched a value of the attribute or sub-type according to the attribute's equality matching rule.CompareResultsetCause(Throwable cause)Sets the throwable cause associated with this result if available.CompareResultsetDiagnosticMessage(CharSequence message)Sets the diagnostic message associated with this result.CompareResultsetMatchedDn(String dn)Sets the matched DN associated with this result.CompareResultsetMatchedDn(Dn dn)Sets the matched DN associated with this result.CompareResultsetResultCode(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
CompareResult addControl(Control control)
Description copied from interface:ProtocolOpAdds the provided control to this protocol-op.- Specified by:
addControlin interfaceProtocolOp- Specified by:
addControlin interfaceResponse- Specified by:
addControlin interfaceResult- Parameters:
control- The control to be added to this protocol-op.- Returns:
- This protocol-op.
-
addControls
CompareResult addControls(Iterable<? extends Control> controls)
Description copied from interface:ProtocolOpAdds the provided controls to this protocol-op.- Specified by:
addControlsin interfaceProtocolOp- Specified by:
addControlsin interfaceResponse- Specified by:
addControlsin interfaceResult- Parameters:
controls- The controls to be added to this protocol-op.- Returns:
- This protocol-op.
-
addReferralUri
CompareResult addReferralUri(String uri)
Description copied from interface:ResultAdds the provided referral URI to this result.- Specified by:
addReferralUriin interfaceResult- Parameters:
uri- The referral URI to be added.- Returns:
- This result.
-
getCause
Throwable getCause()
Description copied from interface:ResultReturns 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.
-
getControl
<C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) throws DecodeException
Description copied from interface:ProtocolOpDecodes and returns the first control in this protocol-op having an OID corresponding to the provided control decoder.- Specified by:
getControlin interfaceProtocolOp- Specified by:
getControlin interfaceResult- 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 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:ProtocolOpReturns aListcontaining the controls included with this protocol-op. The returnedListmay be modified if permitted by this protocol-op.- Specified by:
getControlsin interfaceProtocolOp- Specified by:
getControlsin interfaceResult- Returns:
- A
Listcontaining the controls.
-
getDiagnosticMessage
LocalizableMessage getDiagnosticMessage()
Description copied from interface:ResultReturns the diagnostic message associated with this result.- Specified by:
getDiagnosticMessagein interfaceResult- Returns:
- The diagnostic message, which may be empty if none was provided
(never
null).
-
getDiagnosticMessageAsString
String getDiagnosticMessageAsString()
Description copied from interface:ResultReturns the diagnostic message associated with this result as a string.- Specified by:
getDiagnosticMessageAsStringin interfaceResult- Returns:
- The diagnostic message, which may be empty if none was provided
(never
null).
-
getMatchedDn
String getMatchedDn()
Description copied from interface:ResultReturns the matched DN associated with this result.- Specified by:
getMatchedDnin interfaceResult- Returns:
- The matched DN, which may be empty if none was provided (never
null).
-
getReferralUris
List<String> getReferralUris()
Description copied from interface:ResultReturns aListcontaining the referral URIs included with this result. The returnedListmay be modified if permitted by this result.- Specified by:
getReferralUrisin interfaceResult- Returns:
- A
Listcontaining the referral URIs.
-
getResultCode
ResultCode getResultCode()
Description copied from interface:ResultReturns the result code associated with this result.- Specified by:
getResultCodein interfaceResult- Returns:
- The result code.
-
isReferral
boolean isReferral()
Description copied from interface:ResultIndicates 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.- Specified by:
isReferralin interfaceResult- Returns:
trueif a referral needs to be chased, otherwisefalse.
-
isSuccess
boolean isSuccess()
Description copied from interface:ResultIndicates whether the request succeeded or not. This method will return {code true} for all non-error responses.
-
matched
boolean matched()
Indicates whether the attribute value assertion in the Compare request matched a value of the attribute or sub-type according to the attribute's equality matching rule.Specifically, this method returns
trueif the result code is equal toResultCode.COMPARE_TRUE.- Returns:
trueif the attribute value assertion matched, otherwisefalse.
-
setCause
CompareResult setCause(Throwable cause)
Description copied from interface:ResultSets 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
CompareResult setDiagnosticMessage(CharSequence message)
Description copied from interface:ResultSets the diagnostic message associated with this result.- Specified by:
setDiagnosticMessagein interfaceResult- Parameters:
message- The diagnostic message, which may be empty ornullindicating that none was provided.- Returns:
- This result.
-
setMatchedDn
CompareResult setMatchedDn(String dn)
Description copied from interface:ResultSets the matched DN associated with this result.- Specified by:
setMatchedDnin interfaceResult- Parameters:
dn- The matched DN associated, which may be empty ornullindicating that none was provided.- Returns:
- This result.
-
setMatchedDn
CompareResult setMatchedDn(Dn dn)
Description copied from interface:ResultSets the matched DN associated with this result.- Specified by:
setMatchedDnin interfaceResult- Parameters:
dn- The matched DN associated, which may be empty ornullindicating that none was provided.- Returns:
- This result.
-
setResultCode
CompareResult setResultCode(ResultCode resultCode)
Description copied from interface:ResultSets the result code associated with this result.- Specified by:
setResultCodein interfaceResult- Parameters:
resultCode- The result code.- Returns:
- This result.
-
-