Class EntryChangeNotificationResponseControl
java.lang.Object
org.forgerock.opendj.ldap.controls.EntryChangeNotificationResponseControl
- All Implemented Interfaces:
Control
The entry change notification response control as defined in
draft-ietf-ldapext-psearch. This control provides additional information
about the change that caused a particular entry to be returned as the result
of a 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
Modifier and TypeFieldDescriptionstatic final ControlDecoder<EntryChangeNotificationResponseControl>
A decoder which can be used for decoding theEntryChangeNotificationResponseControl
.static final String
The OID for the entry change notification response control. -
Method Summary
Modifier and TypeMethodDescriptiongetAlias()
Returns the control "friendly name" alias for the control.long
Returns the change number for this entry change notification control.Returns the change type for this entry change notification control.getOid()
Returns the numeric OID associated with this control.Returns the distinguished name that the entry had prior to a modify DN operation, ornull
if the operation was not a modify DN.getValue()
Returns the value, if any, associated with this control.boolean
hasValue()
Returnstrue
if this control has a value.boolean
Returnstrue
if it is unacceptable to perform the operation without applying the semantics of this control.newControl
(PersistentSearchChangeType type, String previousName, long changeNumber) Creates a new entry change notification response control with the provided change type and optional previous distinguished name and change number.newControl
(PersistentSearchChangeType type, Dn previousName, long changeNumber) Creates a new entry change notification response control with the provided change type and optional previous distinguished name and change number.toString()
-
Field Details
-
OID
The OID for the entry change notification response control.- See Also:
-
DECODER
A decoder which can be used for decoding theEntryChangeNotificationResponseControl
.
-
-
Method Details
-
newControl
public static EntryChangeNotificationResponseControl newControl(PersistentSearchChangeType type, Dn previousName, long changeNumber) Creates a new entry change notification response control with the provided change type and optional previous distinguished name and change number.- Parameters:
type
- The change type for this change notification control.previousName
- The distinguished name that the entry had prior to a modify DN operation, ornull
if the operation was not a modify DN.changeNumber
- The change number for the associated change, or a negative value if no change number is available.- Returns:
- The new control.
- Throws:
NullPointerException
- Iftype
wasnull
.
-
newControl
public static EntryChangeNotificationResponseControl newControl(PersistentSearchChangeType type, String previousName, long changeNumber) Creates a new entry change notification response control with the provided change type and optional previous distinguished name and change number. The previous distinguished name, if provided, will be decoded using the default schema.- Parameters:
type
- The change type for this change notification control.previousName
- The distinguished name that the entry had prior to a modify DN operation, ornull
if the operation was not a modify DN.changeNumber
- The change number for the associated change, or a negative value if no change number is available.- Returns:
- The new control.
- Throws:
LocalizedIllegalArgumentException
- IfpreviousName
is not a valid LDAP string representation of a DN.NullPointerException
- Iftype
wasnull
.
-
getChangeNumber
public long getChangeNumber()Returns the change number for this entry change notification control.- Returns:
- The change number for this entry change notification control, or a negative value if no change number is available.
-
getChangeType
Returns the change type for this entry change notification control.- Returns:
- The change type for this entry change notification control.
-
getOid
Description copied from interface:Control
Returns the numeric OID associated with this control. -
getPreviousName
Returns the distinguished name that the entry had prior to a modify DN operation, ornull
if the operation was not a modify DN.- Returns:
- The distinguished name that the entry had prior to a modify DN operation.
-
getValue
Description copied from interface:Control
Returns 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:Control
Returnstrue
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. -
isCritical
public boolean isCritical()Description copied from interface:Control
Returnstrue
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 oftrue
indicates that it is unacceptable to perform the operation without applying the semantics of the control.- Specified by:
isCritical
in interfaceControl
- Returns:
true
if this control must be processed by the Directory Server, orfalse
if it can be ignored.
-
toString
-
getAlias
Description copied from interface:Control
Returns the control "friendly name" alias for the control.
-