@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class VirtualListViewRequestControl extends Control
SimplePagedResultsControl
, with
the exception that the simple paged results control requires scrolling
through the results in sequential order, while the VLV control allows
starting and resuming at any arbitrary point in the result set. The starting
point may be specified using either a positional offset, or based on the
first entry with a value that is greater than or equal to a specified value.
targetOffset
-- The position in the result set of the entry to
target for the next page of results to return. Note that the offset is
one-based (so the first entry has offset 1, the second entry has offset
2, etc.).beforeCount
-- The number of entries before the entry specified
as the target offset that should be retrieved.afterCount
-- The number of entries after the entry specified
as the target offset that should be retrieved.contentCount
-- The estimated total number of entries that
are in the total result set. This should be zero for the first request
in a VLV search sequence, but should be the value returned by the
server in the corresponding response control for subsequent searches as
part of the VLV sequence.contextID
-- This is an optional cookie that may be used to
help the server resume processing on a VLV search. It should be absent
from the initial request, but for subsequent requests should be the
value returned in the previous VLV response control.assertionValue
-- The value that specifies the start of the
page of results to retrieve. The target entry will be the first entry
in which the value for the primary sort attribute is greater than or
equal to this assertion value.beforeCount
-- The number of entries before the entry specified
by the assertion value that should be retrieved.afterCount
-- The number of entries after the entry specified
by the assertion value that should be retrieved.contentCount
-- The estimated total number of entries that
are in the total result set. This should be zero for the first request
in a VLV search sequence, but should be the value returned by the
server in the corresponding response control for subsequent searches as
part of the VLV sequence.contextID
-- This is an optional cookie that may be used to
help the server resume processing on a VLV search. It should be absent
from the initial request, but for subsequent requests should be the
value returned in the previous VLV response control.ServerSideSortRequestControl
. This is necessary to ensure that a
consistent order is used for the resulting entries.
VirtualListViewResponseControl
to provide information about the
state of the virtual list view processing.
// Perform a search to retrieve all users in the server, but only retrieving // ten at a time. Ensure that the users are sorted in ascending order by // last name, then first name. int numSearches = 0; int totalEntriesReturned = 0; SearchRequest searchRequest = new SearchRequest("dc=example,dc=com", SearchScope.SUB, Filter.createEqualityFilter("objectClass", "person")); int vlvOffset = 1; int vlvContentCount = 0; ASN1OctetString vlvContextID = null; while (true) { // Note that the VLV control always requires the server-side sort // control. searchRequest.setControls( new ServerSideSortRequestControl(new SortKey("sn"), new SortKey("givenName")), new VirtualListViewRequestControl(vlvOffset, 0, 9, vlvContentCount, vlvContextID)); SearchResult searchResult = connection.search(searchRequest); numSearches++; totalEntriesReturned += searchResult.getEntryCount(); for (SearchResultEntry e : searchResult.getSearchEntries()) { // Do something with each entry... } LDAPTestUtils.assertHasControl(searchResult, VirtualListViewResponseControl.VIRTUAL_LIST_VIEW_RESPONSE_OID); VirtualListViewResponseControl vlvResponseControl = VirtualListViewResponseControl.get(searchResult); vlvContentCount = vlvResponseControl.getContentCount(); vlvOffset += 10; vlvContextID = vlvResponseControl.getContextID(); if (vlvOffset > vlvContentCount) { break; } }
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
VIRTUAL_LIST_VIEW_REQUEST_OID
The OID (2.16.840.1.113730.3.4.9) for the virtual list view request
control.
|
Constructor and Description |
---|
VirtualListViewRequestControl(ASN1OctetString assertionValue,
int beforeCount,
int afterCount,
ASN1OctetString contextID)
Creates a new virtual list view request control that will identify the
beginning of the result set by an assertion value.
|
VirtualListViewRequestControl(ASN1OctetString assertionValue,
int beforeCount,
int afterCount,
ASN1OctetString contextID,
boolean isCritical)
Creates a new virtual list view request control that will identify the
beginning of the result set by an assertion value.
|
VirtualListViewRequestControl(byte[] assertionValue,
int beforeCount,
int afterCount,
ASN1OctetString contextID)
Creates a new virtual list view request control that will identify the
beginning of the result set by an assertion value.
|
VirtualListViewRequestControl(byte[] assertionValue,
int beforeCount,
int afterCount,
ASN1OctetString contextID,
boolean isCritical)
Creates a new virtual list view request control that will identify the
beginning of the result set by an assertion value.
|
VirtualListViewRequestControl(Control control)
Creates a new virtual list view request control which is decoded from the
provided generic control.
|
VirtualListViewRequestControl(int targetOffset,
int beforeCount,
int afterCount,
int contentCount,
ASN1OctetString contextID)
Creates a new virtual list view request control that will identify the
beginning of the result set by a target offset.
|
VirtualListViewRequestControl(int targetOffset,
int beforeCount,
int afterCount,
int contentCount,
ASN1OctetString contextID,
boolean isCritical)
Creates a new virtual list view request control that will identify the
beginning of the result set by a target offset.
|
VirtualListViewRequestControl(java.lang.String assertionValue,
int beforeCount,
int afterCount,
ASN1OctetString contextID)
Creates a new virtual list view request control that will identify the
beginning of the result set by an assertion value.
|
VirtualListViewRequestControl(java.lang.String assertionValue,
int beforeCount,
int afterCount,
ASN1OctetString contextID,
boolean isCritical)
Creates a new virtual list view request control that will identify the
beginning of the result set by an assertion value.
|
Modifier and Type | Method and Description |
---|---|
int |
getAfterCount()
Retrieves the number of entries that should be retrieved after the target
entry.
|
ASN1OctetString |
getAssertionValue()
Retrieves the assertion value for this virtual list view request control,
if applicable.
|
byte[] |
getAssertionValueBytes()
Retrieves the byte array representation of the assertion value for this
virtual list view request control, if applicable.
|
java.lang.String |
getAssertionValueString()
Retrieves the string representation of the assertion value for this virtual
list view request control, if applicable.
|
int |
getBeforeCount()
Retrieves the number of entries that should be retrieved before the target
entry.
|
int |
getContentCount()
Retrieves the estimated number of entries in the result set, if applicable.
|
ASN1OctetString |
getContextID()
Retrieves the context ID for this virtual list view request control, if
available.
|
java.lang.String |
getControlName()
Retrieves the user-friendly name for this control, if available.
|
int |
getTargetOffset()
Retrieves the target offset position for this virtual list view request
control, if applicable.
|
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP control to the provided
buffer.
|
decode, decode, decodeControls, deregisterDecodeableControl, encode, encodeControls, equals, getOID, getValue, hashCode, hasValue, isCritical, readFrom, registerDecodeableControl, toString, writeTo
public static final java.lang.String VIRTUAL_LIST_VIEW_REQUEST_OID
public VirtualListViewRequestControl(int targetOffset, int beforeCount, int afterCount, int contentCount, ASN1OctetString contextID)
targetOffset
- The position of the entry that should be used as the
start of the result set.beforeCount
- The maximum number of entries that should be returned
before the entry with the specified target offset.afterCount
- The maximum number of entries that should be returned
after the entry with the specified target offset.contentCount
- The estimated number of entries in the result set.
For the first request in a series of searches with
the VLV control, it should be zero. For subsequent
searches in the VLV sequence, it should be the
content count included in the response control from
the previous search.contextID
- The context ID that may be used to help the server
continue in the same result set for subsequent
searches. For the first request in a series of
searches with the VLV control, it should be
null
. For subsequent searches in the VLV
sequence, it should be the (possibly null
context ID included in the response control from the
previous search.public VirtualListViewRequestControl(java.lang.String assertionValue, int beforeCount, int afterCount, ASN1OctetString contextID)
assertionValue
- The assertion value that will be used to identify
the start of the result set. The target entry will
be the first entry with a value for the primary
sort attribute that is greater than or equal to
this assertion value. It must not be null
.beforeCount
- The maximum number of entries that should be
returned before the first entry with a value
greater than or equal to the provided assertion
value.afterCount
- The maximum number of entries that should be
returned after the first entry with a value
greater than or equal to the provided assertion
value.contextID
- The context ID that may be used to help the server
continue in the same result set for subsequent
searches. For the first request in a series of
searches with the VLV control, it should be
null
. For subsequent searches in the VLV
sequence, it should be the (possibly null
context ID included in the response control from
the previous search.public VirtualListViewRequestControl(byte[] assertionValue, int beforeCount, int afterCount, ASN1OctetString contextID)
assertionValue
- The assertion value that will be used to identify
the start of the result set. The target entry will
be the first entry with a value for the primary
sort attribute that is greater than or equal to
this assertion value. It must not be null
.beforeCount
- The maximum number of entries that should be
returned before the first entry with a value
greater than or equal to the provided assertion
value.afterCount
- The maximum number of entries that should be
returned after the first entry with a value
greater than or equal to the provided assertion
value.contextID
- The context ID that may be used to help the server
continue in the same result set for subsequent
searches. For the first request in a series of
searches with the VLV control, it should be
null
. For subsequent searches in the VLV
sequence, it should be the (possibly null
context ID included in the response control from
the previous search.public VirtualListViewRequestControl(ASN1OctetString assertionValue, int beforeCount, int afterCount, ASN1OctetString contextID)
assertionValue
- The assertion value that will be used to identify
the start of the result set. The target entry will
be the first entry with a value for the primary
sort attribute that is greater than or equal to
this assertion value. It must not be null
.beforeCount
- The maximum number of entries that should be
returned before the first entry with a value
greater than or equal to the provided assertion
value.afterCount
- The maximum number of entries that should be
returned after the first entry with a value
greater than or equal to the provided assertion
value.contextID
- The context ID that may be used to help the server
continue in the same result set for subsequent
searches. For the first request in a series of
searches with the VLV control, it should be
null
. For subsequent searches in the VLV
sequence, it should be the (possibly null
context ID included in the response control from
the previous search.public VirtualListViewRequestControl(int targetOffset, int beforeCount, int afterCount, int contentCount, ASN1OctetString contextID, boolean isCritical)
targetOffset
- The position of the entry that should be used as the
start of the result set.beforeCount
- The maximum number of entries that should be returned
before the entry with the specified target offset.afterCount
- The maximum number of entries that should be returned
after the entry with the specified target offset.contentCount
- The estimated number of entries in the result set.
For the first request in a series of searches with
the VLV control, it should be zero. For subsequent
searches in the VLV sequence, it should be the
content count included in the response control from
the previous search.contextID
- The context ID that may be used to help the server
continue in the same result set for subsequent
searches. For the first request in a series of
searches with the VLV control, it should be
null
. For subsequent searches in the VLV
sequence, it should be the (possibly null
context ID included in the response control from the
previous search.isCritical
- Indicates whether this control should be marked
critical.public VirtualListViewRequestControl(java.lang.String assertionValue, int beforeCount, int afterCount, ASN1OctetString contextID, boolean isCritical)
assertionValue
- The assertion value that will be used to identify
the start of the result set. The target entry will
be the first entry with a value for the primary
sort attribute that is greater than or equal to
this assertion value. It must not be null
.beforeCount
- The maximum number of entries that should be
returned before the first entry with a value
greater than or equal to the provided assertion
value.afterCount
- The maximum number of entries that should be
returned after the first entry with a value
greater than or equal to the provided assertion
value.contextID
- The context ID that may be used to help the server
continue in the same result set for subsequent
searches. For the first request in a series of
searches with the VLV control, it should be
null
. For subsequent searches in the VLV
sequence, it should be the (possibly null
context ID included in the response control from
the previous search.isCritical
- Indicates whether this control should be marked
critical.public VirtualListViewRequestControl(byte[] assertionValue, int beforeCount, int afterCount, ASN1OctetString contextID, boolean isCritical)
assertionValue
- The assertion value that will be used to identify
the start of the result set. The target entry will
be the first entry with a value for the primary
sort attribute that is greater than or equal to
this assertion value. It must not be null
.beforeCount
- The maximum number of entries that should be
returned before the first entry with a value
greater than or equal to the provided assertion
value.afterCount
- The maximum number of entries that should be
returned after the first entry with a value
greater than or equal to the provided assertion
value.contextID
- The context ID that may be used to help the server
continue in the same result set for subsequent
searches. For the first request in a series of
searches with the VLV control, it should be
null
. For subsequent searches in the VLV
sequence, it should be the (possibly null
context ID included in the response control from
the previous search.isCritical
- Indicates whether this control should be marked
critical.public VirtualListViewRequestControl(ASN1OctetString assertionValue, int beforeCount, int afterCount, ASN1OctetString contextID, boolean isCritical)
assertionValue
- The assertion value that will be used to identify
the start of the result set. The target entry will
be the first entry with a value for the primary
sort attribute that is greater than or equal to
this assertion value. It must not be null
.beforeCount
- The maximum number of entries that should be
returned before the first entry with a value
greater than or equal to the provided assertion
value.afterCount
- The maximum number of entries that should be
returned after the first entry with a value
greater than or equal to the provided assertion
value.contextID
- The context ID that may be used to help the server
continue in the same result set for subsequent
searches. For the first request in a series of
searches with the VLV control, it should be
null
. For subsequent searches in the VLV
sequence, it should be the (possibly null
context ID included in the response control from
the previous search.isCritical
- Indicates whether this control should be marked
critical.public VirtualListViewRequestControl(Control control) throws LDAPException
control
- The generic control to be decoded as a virtual list view
request control.LDAPException
- If the provided control cannot be decoded as a
virtual list view request control.public int getTargetOffset()
public java.lang.String getAssertionValueString()
null
if the target is
specified by offset.public byte[] getAssertionValueBytes()
null
if the target
is specified by offset.public ASN1OctetString getAssertionValue()
null
if the target is specified by offset.public int getBeforeCount()
public int getAfterCount()
public int getContentCount()
public ASN1OctetString getContextID()
null
if there is none.public java.lang.String getControlName()
getControlName
in class Control