Class EntryChangeNotificationResponseControl
- java.lang.Object
-
- org.forgerock.opendj.ldap.controls.EntryChangeNotificationResponseControl
-
- All Implemented Interfaces:
Control
public final class EntryChangeNotificationResponseControl extends Object implements 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
Fields Modifier and Type Field Description static ControlDecoder<EntryChangeNotificationResponseControl>
DECODER
A decoder which can be used for decoding the entry change notification response control.static String
OID
The OID for the entry change notification response control.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getChangeNumber()
Returns the change number for this entry change notification control.PersistentSearchChangeType
getChangeType()
Returns the change type for this entry change notification control.String
getOid()
Returns the numeric OID associated with this control.Dn
getPreviousName()
Returns the distinguished name that the entry had prior to a modify DN operation, ornull
if the operation was not a modify DN.ByteString
getValue()
Returns the value, if any, associated with this control.boolean
hasValue()
Returnstrue
if this control has a value.boolean
isCritical()
Returnstrue
if it is unacceptable to perform the operation without applying the semantics of this control.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.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.String
toString()
-
-
-
Field Detail
-
OID
public static final String OID
The OID for the entry change notification response control.- See Also:
- Constant Field Values
-
DECODER
public static final ControlDecoder<EntryChangeNotificationResponseControl> DECODER
A decoder which can be used for decoding the entry change notification response control.
-
-
Method Detail
-
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
public PersistentSearchChangeType getChangeType()
Returns the change type for this entry change notification control.- Returns:
- The change type for this entry change notification control.
-
getOid
public String getOid()
Description copied from interface:Control
Returns the numeric OID associated with this control.
-
getPreviousName
public Dn 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
public ByteString 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.
-
-