Class ExcludeEntryTransformation

java.lang.Object
com.unboundid.ldap.sdk.transformations.ExcludeEntryTransformation
All Implemented Interfaces:
EntryTransformation, LDIFReaderEntryTranslator, LDIFWriterEntryTranslator, Serializable

This class provides an implementation of an entry transformation that will return null for any entry that matches (or alternately, does not match) a given set of criteria and should therefore be excluded from the data set.
See Also:
  • Constructor Details

    • ExcludeEntryTransformation

      public ExcludeEntryTransformation(@Nullable Schema schema, @Nullable DN baseDN, @Nullable SearchScope scope, @Nullable Filter filter, boolean excludeMatching, @Nullable AtomicLong excludedCount)
      Creates a new exclude entry transformation with the provided information.
      Parameters:
      schema - The schema to use in processing. It may be null if a default standard schema should be used.
      baseDN - The base DN to use to identify which entries to suppress. If this is null, it will be assumed to be the null DN.
      scope - The scope to use to identify which entries to suppress. If this is null, it will be assumed to be SearchScope.SUB.
      filter - An optional filter to use to identify which entries to suppress. If this is null, then a default LDAP true filter (which will match any entry) will be used.
      excludeMatching - Indicates whether to exclude entries that match the criteria (if true) or to exclude entries that do not match the criteria (if false).
      excludedCount - An optional counter that will be incremented for each entry that is excluded.
  • Method Details

    • transformEntry

      Applies an appropriate transformation to the provided entry.
      Specified by:
      transformEntry in interface EntryTransformation
      Parameters:
      e - The entry to transform.
      Returns:
      A copy of the entry with any appropriate transformation applied, the original entry if no transformations were necessary, or null if the entry should be suppressed.
    • translate

      @Nullable public Entry translate(@NotNull Entry original, long firstLineNumber)
      Applies some special transformation or filtering to the original Entry.
      Specified by:
      translate in interface LDIFReaderEntryTranslator
      Parameters:
      original - The original Entry that was read and parsed from the input file.
      firstLineNumber - The first line number of the LDIF record corresponding to the read Entry. This is most useful when throwing an LDIFException.
      Returns:
      The Entry that should be returned in the call to LDIFReader.readEntry(). This can be the original parameter Entry, a newly constructed Entry, or null to signal that the provided Entry should be skipped.
    • translateEntryToWrite

      Applies some special transformation or filtering to the original Entry.
      Specified by:
      translateEntryToWrite in interface LDIFWriterEntryTranslator
      Parameters:
      original - The original Entry that was to be written.
      Returns:
      The Entry that should be written. This can be the original parameter Entry, a newly-constructed Entry, or null to signal that this Entry should not be written. Note, however, that if the original entry provided as a parameter is altered, then the change will be visible to anything that references that entry. If you are not sure about whether changes to the original entry are acceptable, it is recommended that you use the duplicate() method to create a copy of the original and make the necessary changes to that duplicate.