Class EntryChangeNotificationControl

  • All Implemented Interfaces:
    DecodeableControl, java.io.Serializable

    @NotMutable
    @ThreadSafety(level=COMPLETELY_THREADSAFE)
    public final class EntryChangeNotificationControl
    extends Control
    implements DecodeableControl
    This class provides an implementation of the entry change notification control as defined in draft-ietf-ldapext-psearch. It will be returned in search result entries that match the criteria associated with a persistent search (see the PersistentSearchRequestControl class) and have been changed in a way associated with the registered change types for that search.

    The information that can be included in an entry change notification control includes:
    • A change type, which indicates the type of operation that was performed to trigger this entry change notification control. It will be one of the values of the PersistentSearchChangeType enum.
    • An optional previous DN, which indicates the DN that the entry had before the associated operation was processed. It will only be present if the associated operation was a modify DN operation.
    • An optional change number, which may be used to retrieve additional information about the associated operation from the server. This may not be available in all directory server implementations.
    Note that the entry change notification control should only be included in search result entries that are associated with a search request that included the persistent search request control, and only if that persistent search request control had the returnECs flag set to true to indicate that entry change notification controls should be included in resulting entries. Further, the entry change notification control will only be included in entries that are returned as the result of a change in the server and not any of the preliminary entries that may be returned if the corresponding persistent search request had the changesOnly flag set to false.
    See Also:
    Serialized Form
    • Constructor Detail

      • EntryChangeNotificationControl

        public EntryChangeNotificationControl​(@NotNull
                                              PersistentSearchChangeType changeType,
                                              @Nullable
                                              java.lang.String previousDN,
                                              long changeNumber)
        Creates a new entry change notification control with the provided information. It will not be critical.
        Parameters:
        changeType - The change type for the change. It must not be null.
        previousDN - The previous DN of the entry, if applicable.
        changeNumber - The change number to include in this control, or -1 if there should not be a change number.
      • EntryChangeNotificationControl

        public EntryChangeNotificationControl​(@NotNull
                                              PersistentSearchChangeType changeType,
                                              @Nullable
                                              java.lang.String previousDN,
                                              long changeNumber,
                                              boolean isCritical)
        Creates a new entry change notification control with the provided information.
        Parameters:
        changeType - The change type for the change. It must not be null.
        previousDN - The previous DN of the entry, if applicable.
        changeNumber - The change number to include in this control, or -1 if there should not be a change number.
        isCritical - Indicates whether this control should be marked critical. Response controls should generally not be critical.
      • EntryChangeNotificationControl

        public EntryChangeNotificationControl​(@NotNull
                                              java.lang.String oid,
                                              boolean isCritical,
                                              @Nullable
                                              ASN1OctetString value)
                                       throws LDAPException
        Creates a new entry change notification control with the provided information.
        Parameters:
        oid - The OID for the control.
        isCritical - Indicates whether the control should be marked critical.
        value - The encoded value for the control. This may be null if no value was provided.
        Throws:
        LDAPException - If the provided control cannot be decoded as an entry change notification control.
    • Method Detail

      • decodeControl

        @NotNull
        public EntryChangeNotificationControl decodeControl​(@NotNull
                                                            java.lang.String oid,
                                                            boolean isCritical,
                                                            @Nullable
                                                            ASN1OctetString value)
                                                     throws LDAPException
        Creates a new instance of this decodeable control from the provided information.
        Specified by:
        decodeControl in interface DecodeableControl
        Parameters:
        oid - The OID for the control.
        isCritical - Indicates whether the control should be marked critical.
        value - The encoded value for the control. This may be null if no value was provided.
        Returns:
        The decoded representation of this control.
        Throws:
        LDAPException - If the provided information cannot be decoded as a valid instance of this decodeable control.
      • get

        @Nullable
        public static EntryChangeNotificationControl get​(@NotNull
                                                         SearchResultEntry entry)
                                                  throws LDAPException
        Extracts an entry change notification control from the provided search result entry.
        Parameters:
        entry - The search result entry from which to retrieve the entry change notification control.
        Returns:
        The entry change notification control contained in the provided search result entry, or null if the entry did not contain an entry change notification control.
        Throws:
        LDAPException - If a problem is encountered while attempting to decode the entry change notification control contained in the provided entry.
      • getPreviousDN

        @Nullable
        public java.lang.String getPreviousDN()
        Retrieves the previous DN for the entry, if applicable.
        Returns:
        The previous DN for the entry, or null if there is none.
      • getChangeNumber

        public long getChangeNumber()
        Retrieves the change number for the associated change, if available.
        Returns:
        The change number for the associated change, or -1 if none was provided.
      • getControlName

        @NotNull
        public java.lang.String getControlName()
        Retrieves the user-friendly name for this control, if available. If no user-friendly name has been defined, then the OID will be returned.
        Overrides:
        getControlName in class Control
        Returns:
        The user-friendly name for this control, or the OID if no user-friendly name is available.
      • toString

        public void toString​(@NotNull
                             java.lang.StringBuilder buffer)
        Appends a string representation of this LDAP control to the provided buffer.
        Overrides:
        toString in class Control
        Parameters:
        buffer - The buffer to which to append the string representation of this buffer.