Class ServerSideSortResponseControl
java.lang.Object
org.forgerock.opendj.ldap.controls.ServerSideSortResponseControl
- All Implemented Interfaces:
Control
The server-side sort response control as defined in RFC 2891. This control is
included with a search result in response to a server-side sort request
included with a search request. The client application is assured that the
search results are sorted in the specified key order if and only if the
result code in this control is success. If the server omits this control from
the search result, the client SHOULD assume that the sort control was ignored
by the server.
The following example demonstrates how to work with a server-side sort.
Connection connection = ...;
SearchRequest request = Requests.newSearchRequest(
"ou=People,dc=example,dc=com", SearchScope.WHOLE_SUBTREE, "(sn=Jensen)", "cn")
.addControl(ServerSideSortRequestControl.newControl(true, new SortKey("cn")));
SearchResultHandler resultHandler = new MySearchResultHandler();
Result result = connection.search(request, resultHandler);
ServerSideSortResponseControl control = result.getControl(
ServerSideSortResponseControl.DECODER, new DecodeOptions());
if (control != null && control.getResult() == ResultCode.SUCCESS) {
// Entries are sorted.
} else {
// Entries not sorted.
}
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ControlDecoder<ServerSideSortResponseControl>A decoder which can be used for decoding theServerSideSortResponseControl.static final StringThe OID for the server-side sort response control. -
Method Summary
Modifier and TypeMethodDescriptiongetAlias()Returns the control "friendly name" alias for the control.Returns the first attribute description specified in the list of sort keys that was in error, ornullif the attribute description was not included with this control.getOid()Returns the numeric OID associated with this control.Returns a result code indicating the outcome of the server-side sort request.getValue()Returns the value, if any, associated with this control.booleanhasValue()Returnstrueif this control has a value.booleanReturnstrueif it is unacceptable to perform the operation without applying the semantics of this control.newControl(ResultCode result) Creates a new server-side response control with the provided sort result and no attribute description.newControl(ResultCode result, String attributeDescription) Creates a new server-side response control with the provided sort result and attribute description.newControl(ResultCode result, AttributeDescription attributeDescription) Creates a new server-side response control with the provided sort result and attribute description.toString()
-
Field Details
-
OID
The OID for the server-side sort response control.- See Also:
-
DECODER
A decoder which can be used for decoding theServerSideSortResponseControl.
-
-
Method Details
-
newControl
Creates a new server-side response control with the provided sort result and no attribute description.- Parameters:
result- The result code indicating the outcome of the server-side sort request.ResultCode.SUCCESSif the search results were sorted in accordance with the keys specified in the server-side sort request control, or an error code indicating why the results could not be sorted (such asResultCode.NO_SUCH_ATTRIBUTEorResultCode.INAPPROPRIATE_MATCHING).- Returns:
- The new control.
- Throws:
NullPointerException- Ifresultwasnull.
-
newControl
public static ServerSideSortResponseControl newControl(ResultCode result, AttributeDescription attributeDescription) Creates a new server-side response control with the provided sort result and attribute description.- Parameters:
result- The result code indicating the outcome of the server-side sort request.ResultCode.SUCCESSif the search results were sorted in accordance with the keys specified in the server-side sort request control, or an error code indicating why the results could not be sorted (such asResultCode.NO_SUCH_ATTRIBUTEorResultCode.INAPPROPRIATE_MATCHING).attributeDescription- The first attribute description specified in the list of sort keys that was in error, may benull.- Returns:
- The new control.
- Throws:
NullPointerException- Ifresultwasnull.
-
newControl
public static ServerSideSortResponseControl newControl(ResultCode result, String attributeDescription) Creates a new server-side response control with the provided sort result and attribute description. The attribute description will be decoded using the default schema.- Parameters:
result- The result code indicating the outcome of the server-side sort request.ResultCode.SUCCESSif the search results were sorted in accordance with the keys specified in the server-side sort request control, or an error code indicating why the results could not be sorted (such asResultCode.NO_SUCH_ATTRIBUTEorResultCode.INAPPROPRIATE_MATCHING).attributeDescription- The first attribute description specified in the list of sort keys that was in error, may benull.- Returns:
- The new control.
- Throws:
LocalizedIllegalArgumentException- IfattributeDescriptioncould not be parsed using the default schema.NullPointerException- Ifresultwasnull.
-
getAttributeDescription
Returns the first attribute description specified in the list of sort keys that was in error, ornullif the attribute description was not included with this control.- Returns:
- The first attribute description specified in the list of sort keys that was in error.
-
getOid
Description copied from interface:ControlReturns the numeric OID associated with this control. -
getResult
Returns a result code indicating the outcome of the server-side sort request. This will beResultCode.SUCCESSif the search results were sorted in accordance with the keys specified in the server-side sort request control, or an error code indicating why the results could not be sorted (such asResultCode.NO_SUCH_ATTRIBUTEorResultCode.INAPPROPRIATE_MATCHING).- Returns:
- The result code indicating the outcome of the server-side sort request.
-
getValue
Description copied from interface:ControlReturns the value, if any, associated with this control. Its format is defined by the specification of this control. -
hasValue
public boolean hasValue()Description copied from interface:ControlReturnstrueif this control has a value. In some circumstances it may be useful to determine if a control has a value, without actually calculating the value and incurring any performance costs. -
isCritical
public boolean isCritical()Description copied from interface:ControlReturnstrueif it is unacceptable to perform the operation without applying the semantics of this control.The criticality field only has meaning in controls attached to request messages (except UnbindRequest). For controls attached to response messages and the UnbindRequest, the criticality field SHOULD be
false, and MUST be ignored by the receiving protocol peer. A value oftrueindicates that it is unacceptable to perform the operation without applying the semantics of the control.- Specified by:
isCriticalin interfaceControl- Returns:
trueif this control must be processed by the Directory Server, orfalseif it can be ignored.
-
toString
-
getAlias
Description copied from interface:ControlReturns the control "friendly name" alias for the control.
-