Class RedactAttributeTransformation
java.lang.Object
com.unboundid.ldap.sdk.transformations.RedactAttributeTransformation
- All Implemented Interfaces:
EntryTransformation,LDIFChangeRecordTransformation,LDIFReaderChangeRecordTranslator,LDIFReaderEntryTranslator,LDIFWriterChangeRecordTranslator,LDIFWriterEntryTranslator
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class RedactAttributeTransformation
extends Object
implements EntryTransformation, LDIFChangeRecordTransformation
This class provides an implementation of an entry and LDIF change record
transformation that will redact the values of a specified set of attributes
so that it will be possible to determine whether the attribute had been
present in an entry or change record, but not what the values were for that
attribute.
-
Constructor Summary
ConstructorsConstructorDescriptionRedactAttributeTransformation(Schema schema, boolean redactDNAttributes, boolean preserveValueCount, String... attributes) Creates a new redact attribute transformation that will redact the values of the specified attributes.RedactAttributeTransformation(Schema schema, boolean redactDNAttributes, boolean preserveValueCount, Collection<String> attributes) Creates a new redact attribute transformation that will redact the values of the specified attributes. -
Method Summary
Modifier and TypeMethodDescriptionApplies an appropriate transformation to the provided LDIF change record.Applies an appropriate transformation to the provided entry.Applies some special transformation or filtering to the original Entry.translate(LDIFChangeRecord original, long firstLineNumber) Applies some special transformation or filtering to the original change record.translateChangeRecordToWrite(LDIFChangeRecord original) Applies some special transformation or filtering to the original change record.translateEntryToWrite(Entry original) Applies some special transformation or filtering to the original Entry.
-
Constructor Details
-
RedactAttributeTransformation
public RedactAttributeTransformation(@Nullable Schema schema, boolean redactDNAttributes, boolean preserveValueCount, @NotNull String... attributes) Creates a new redact attribute transformation that will redact the values of the specified attributes.- Parameters:
schema- The schema to use to identify alternate names that may be used to reference the attributes to redact. It may benullto use a default standard schema.redactDNAttributes- Indicates whether to redact values of the target attributes that appear in DNs. This includes the DNs of the entries to process as well as the values of attributes with a DN syntax.preserveValueCount- Indicates whether to preserve the number of values in redacted attributes. If this istrue, then multivalued attributes that are redacted will have the same number of values but each value will be replaced with "***REDACTED{num}***" where "{num}" is a counter that increments for each value. If this isfalse, then the set of values will always be replaced with a single value of "***REDACTED***" regardless of whether the original attribute had one or multiple values.attributes- The names of the attributes whose values should be redacted. It must must not benullor empty.
-
RedactAttributeTransformation
public RedactAttributeTransformation(@Nullable Schema schema, boolean redactDNAttributes, boolean preserveValueCount, @NotNull Collection<String> attributes) Creates a new redact attribute transformation that will redact the values of the specified attributes.- Parameters:
schema- The schema to use to identify alternate names that may be used to reference the attributes to redact. It may benullto use a default standard schema.redactDNAttributes- Indicates whether to redact values of the target attributes that appear in DNs. This includes the DNs of the entries to process as well as the values of attributes with a DN syntax.preserveValueCount- Indicates whether to preserve the number of values in redacted attributes. If this istrue, then multivalued attributes that are redacted will have the same number of values but each value will be replaced with "***REDACTED{num}***" where "{num}" is a counter that increments for each value. If this isfalse, then the set of values will always be replaced with a single value of "***REDACTED***" regardless of whether the original attribute had one or multiple values.attributes- The names of the attributes whose values should be redacted. It must must not benullor empty.
-
-
Method Details
-
transformEntry
Applies an appropriate transformation to the provided entry.- Specified by:
transformEntryin interfaceEntryTransformation- 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
nullif the entry should be suppressed.
-
transformChangeRecord
Applies an appropriate transformation to the provided LDIF change record.- Specified by:
transformChangeRecordin interfaceLDIFChangeRecordTransformation- Parameters:
r- The LDIF change record to transform.- Returns:
- A copy of the change record with any appropriate transformation
applied, the original change record if no transformations were
necessary, or
nullif the change record should be suppressed.
-
translate
Applies some special transformation or filtering to the original Entry.- Specified by:
translatein interfaceLDIFReaderEntryTranslator- 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, ornullto signal that the provided Entry should be skipped.
-
translate
@Nullable public LDIFChangeRecord translate(@NotNull LDIFChangeRecord original, long firstLineNumber) Applies some special transformation or filtering to the original change record.- Specified by:
translatein interfaceLDIFReaderChangeRecordTranslator- Parameters:
original- The original change record that was read and parsed from the input file.firstLineNumber- The first line number of the LDIF change record. This is most useful when throwing anLDIFException.- Returns:
- The LDIF change record that should be returned in the call to
LDIFReader.readChangeRecord(). This can be the original parameter change record, a newly constructed change record, ornullto signal that the provided change record should be skipped.
-
translateEntryToWrite
Applies some special transformation or filtering to the original Entry.- Specified by:
translateEntryToWritein interfaceLDIFWriterEntryTranslator- 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
nullto 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 theduplicate()method to create a copy of the original and make the necessary changes to that duplicate.
-
translateChangeRecordToWrite
Applies some special transformation or filtering to the original change record.- Specified by:
translateChangeRecordToWritein interfaceLDIFWriterChangeRecordTranslator- Parameters:
original- The original change record that was to be written.- Returns:
- The change record that should be written. This can be the
original parameter change record, a newly-constructed change
record, or
nullto signal that the change record should not be written. Note, however, that if the original record provided as a parameter is altered, then the change will be visible to anything that references that change record. If you are not sure about whether changes to the original change record are acceptable, it is recommended that you use theduplicate()method to create a copy of the original and make the necessary changes to that duplicate.
-