public final class ServerSideSortResponseControl extends Object implements Control
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. }
Modifier and Type | Field and Description |
---|---|
static ControlDecoder<ServerSideSortResponseControl> |
DECODER
A decoder which can be used for decoding the server side sort response control.
|
static String |
OID
The OID for the server-side sort response control.
|
Modifier and Type | Method and Description |
---|---|
AttributeDescription |
getAttributeDescription()
Returns the first attribute description specified in the list of sort
keys that was in error, or
null if the attribute description was
not included with this control. |
String |
getOID()
Returns the numeric OID associated with this control.
|
ResultCode |
getResult()
Returns a result code indicating the outcome of the server-side sort
request.
|
ByteString |
getValue()
Returns the value, if any, associated with this control.
|
boolean |
hasValue()
Returns
true if this control has a value. |
boolean |
isCritical()
Returns
true if it is unacceptable to perform the operation
without applying the semantics of this control. |
static ServerSideSortResponseControl |
newControl(ResultCode result)
Creates a new server-side response control with the provided sort result
and no attribute description.
|
static ServerSideSortResponseControl |
newControl(ResultCode result,
AttributeDescription attributeDescription)
Creates a new server-side response control with the provided sort result
and attribute description.
|
static ServerSideSortResponseControl |
newControl(ResultCode result,
String attributeDescription)
Creates a new server-side response control with the provided sort result
and attribute description.
|
String |
toString() |
public static final String OID
public static final ControlDecoder<ServerSideSortResponseControl> DECODER
public static ServerSideSortResponseControl newControl(ResultCode result)
result
- The result code indicating the outcome of the server-side sort
request. ResultCode.SUCCESS
if 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 as
ResultCode.NO_SUCH_ATTRIBUTE
or
ResultCode.INAPPROPRIATE_MATCHING
).NullPointerException
- If result
was null
.public static ServerSideSortResponseControl newControl(ResultCode result, AttributeDescription attributeDescription)
result
- The result code indicating the outcome of the server-side sort
request. ResultCode.SUCCESS
if 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 as
ResultCode.NO_SUCH_ATTRIBUTE
or
ResultCode.INAPPROPRIATE_MATCHING
).attributeDescription
- The first attribute description specified in the list of sort
keys that was in error, may be null
.NullPointerException
- If result
was null
.public static ServerSideSortResponseControl newControl(ResultCode result, String attributeDescription)
result
- The result code indicating the outcome of the server-side sort
request. ResultCode.SUCCESS
if 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 as
ResultCode.NO_SUCH_ATTRIBUTE
or
ResultCode.INAPPROPRIATE_MATCHING
).attributeDescription
- The first attribute description specified in the list of sort
keys that was in error, may be null
.LocalizedIllegalArgumentException
- If attributeDescription
could not be parsed using the
default schema.NullPointerException
- If result
was null
.public AttributeDescription getAttributeDescription()
null
if the attribute description was
not included with this control.public String getOID()
Control
public ResultCode getResult()
ResultCode.SUCCESS
if 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 as ResultCode.NO_SUCH_ATTRIBUTE
or
ResultCode.INAPPROPRIATE_MATCHING
).public ByteString getValue()
Control
public boolean hasValue()
Control
true
if 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.public boolean isCritical()
Control
true
if 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 of true
indicates that it is unacceptable to perform the
operation without applying the semantics of the control.
isCritical
in interface Control
true
if this control must be processed by the Directory
Server, or false
if it can be ignored.Copyright 2010-2017 ForgeRock AS.