Class PersistentSearchRequestControl
- java.lang.Object
-
- org.forgerock.opendj.ldap.controls.PersistentSearchRequestControl
-
- All Implemented Interfaces:
Control
public final class PersistentSearchRequestControl extends Object implements Control
The persistent search request control as defined in draft-ietf-ldapext-psearch. This control allows a client to receive notification of changes that occur in an LDAP server.You can examine the entry change notification response control to get more information about a change returned by the persistent search.
Connection connection = ...; SearchRequest request = Requests.newSearchRequest( "dc=example,dc=com", SearchScope.WHOLE_SUBTREE, "(objectclass=inetOrgPerson)", "cn") .addControl(PersistentSearchRequestControl.newControl( true, true, true, // critical,changesOnly,returnECs PersistentSearchChangeType.ADD, PersistentSearchChangeType.DELETE, PersistentSearchChangeType.MODIFY, PersistentSearchChangeType.MODIFYDN)); ConnectionEntryReader reader = connection.search(request); while (reader.hasNext()) { if (!reader.isReference()) { SearchResultEntry entry = reader.readEntry(); // Entry that changed EntryChangeNotificationResponseControl control = entry.getControl( EntryChangeNotificationResponseControl.DECODER, new DecodeOptions()); PersistentSearchChangeType type = control.getChangeType(); if (type.equals(PersistentSearchChangeType.MODIFYDN)) { // Previous DN: control.getPreviousName() } // Change number: control.getChangeNumber()); } }
-
-
Field Summary
Fields Modifier and Type Field Description static ControlDecoder<PersistentSearchRequestControl>DECODERA decoder which can be used for decoding the persistent search request control.static StringOIDThe OID for the persistent search request control.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<PersistentSearchChangeType>getChangeTypes()Returns an unmodifiable set containing the types of update operation for which change notifications should be returned.StringgetOid()Returns the numeric OID associated with this control.ByteStringgetValue()Returns the value, if any, associated with this control.booleanhasValue()Returnstrueif this control has a value.booleanisChangesOnly()Returnstrueif only updated entries should be returned (added, modified, deleted, or subject to a modifyDN operation), otherwisefalseif the search will initially return all the existing entries which match the filter.booleanisCritical()Returnstrueif it is unacceptable to perform the operation without applying the semantics of this control.booleanisReturnEntryChangeNotificationControls()Returnstrueif the entry change notification response control should be included in updated entries that match the associated search criteria.static PersistentSearchRequestControlnewControl(boolean isCritical, boolean changesOnly, boolean returnEntryChangeNotificationControl, Collection<PersistentSearchChangeType> changeTypes)Creates a new persistent search request control.static PersistentSearchRequestControlnewControl(boolean isCritical, boolean changesOnly, boolean returnEntryChangeNotificationControl, PersistentSearchChangeType... changeTypes)Creates a new persistent search request control.StringtoString()
-
-
-
Field Detail
-
OID
public static final String OID
The OID for the persistent search request control.- See Also:
- Constant Field Values
-
DECODER
public static final ControlDecoder<PersistentSearchRequestControl> DECODER
A decoder which can be used for decoding the persistent search request control.
-
-
Method Detail
-
newControl
public static PersistentSearchRequestControl newControl(boolean isCritical, boolean changesOnly, boolean returnEntryChangeNotificationControl, Collection<PersistentSearchChangeType> changeTypes)
Creates a new persistent search request control.- Parameters:
isCritical-trueif it is unacceptable to perform the operation without applying the semantics of this control, orfalseif it can be ignoredchangesOnly- Indicates whether only updated entries should be returned (added, modified, deleted, or subject to a modifyDN operation). If this parameter isfalsethen the search will initially return all the existing entries which match the filter.returnEntryChangeNotificationControl- Indicates whether the entry change notification response control should be included in updated entries that match the associated search criteria.changeTypes- The types of update operation for which change notifications should be returned.- Returns:
- The new control.
- Throws:
NullPointerException- IfchangeTypeswasnull.
-
newControl
public static PersistentSearchRequestControl newControl(boolean isCritical, boolean changesOnly, boolean returnEntryChangeNotificationControl, PersistentSearchChangeType... changeTypes)
Creates a new persistent search request control.- Parameters:
isCritical-trueif it is unacceptable to perform the operation without applying the semantics of this control, orfalseif it can be ignoredchangesOnly- Indicates whether only updated entries should be returned (added, modified, deleted, or subject to a modifyDN operation). If this parameter isfalsethen the search will initially return all the existing entries which match the filter.returnEntryChangeNotificationControl- Indicates whether the entry change notification response control should be included in updated entries that match the associated search criteria.changeTypes- The types of update operation for which change notifications should be returned.- Returns:
- The new control.
- Throws:
NullPointerException- IfchangeTypeswasnull.
-
getChangeTypes
public Set<PersistentSearchChangeType> getChangeTypes()
Returns an unmodifiable set containing the types of update operation for which change notifications should be returned.- Returns:
- An unmodifiable set containing the types of update operation for which change notifications should be returned.
-
getOid
public String getOid()
Description copied from interface:ControlReturns the numeric OID associated with this control.
-
getValue
public ByteString 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.
-
isChangesOnly
public boolean isChangesOnly()
Returnstrueif only updated entries should be returned (added, modified, deleted, or subject to a modifyDN operation), otherwisefalseif the search will initially return all the existing entries which match the filter.- Returns:
trueif only updated entries should be returned (added, modified, deleted, or subject to a modifyDN operation), otherwisefalseif the search will initially return all the existing entries which match the filter.
-
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.
-
isReturnEntryChangeNotificationControls
public boolean isReturnEntryChangeNotificationControls()
Returnstrueif the entry change notification response control should be included in updated entries that match the associated search criteria.- Returns:
trueif the entry change notification response control should be included in updated entries that match the associated search criteria.
-
-