@ThreadSafety(level=COMPLETELY_THREADSAFE) public final class ScrambleAttributeTransformation extends java.lang.Object implements EntryTransformation, LDIFChangeRecordTransformation
Constructor and Description |
---|
ScrambleAttributeTransformation(java.util.Collection<java.lang.String> attributes)
Creates a new scramble attribute transformation that will scramble the
values of the specified attributes.
|
ScrambleAttributeTransformation(Schema schema,
java.lang.Long randomSeed,
boolean scrambleEntryDNs,
java.util.Collection<java.lang.String> attributes,
java.util.Collection<java.lang.String> jsonFields)
Creates a new scramble attribute transformation that will scramble the
values of a specified set of attributes.
|
ScrambleAttributeTransformation(Schema schema,
java.lang.Long randomSeed,
java.lang.String... attributes)
Creates a new scramble attribute transformation that will scramble the
values of a specified set of attributes.
|
ScrambleAttributeTransformation(java.lang.String... attributes)
Creates a new scramble attribute transformation that will scramble the
values of the specified attributes.
|
Modifier and Type | Method and Description |
---|---|
Attribute |
scrambleAttribute(Attribute a)
Creates a copy of the provided attribute with its values scrambled if
appropriate.
|
byte[] |
scrambleBinaryValue(byte[] value)
Scrambles the provided value, which may contain non-ASCII characters.
|
DN |
scrambleDN(DN dn)
Creates a scrambled copy of the provided DN.
|
java.lang.String |
scrambleDN(java.lang.String dn)
Creates a scrambled copy of the provided DN.
|
java.lang.String |
scrambleEncodedPassword(java.lang.String s)
Scrambles the provided encoded password value.
|
java.lang.String |
scrambleGeneralizedTime(java.lang.String s)
Scrambles the provided generalized time value.
|
java.lang.String |
scrambleJSONObject(java.lang.String s)
Scrambles the provided JSON object value.
|
java.lang.String |
scrambleNumericValue(java.lang.String s)
Scrambles the provided value, which is expected to be largely numeric.
|
RDN |
scrambleRDN(RDN rdn)
Creates a scrambled copy of the provided RDN.
|
java.lang.String |
scrambleString(java.lang.String s)
Scrambles the provided string.
|
LDIFChangeRecord |
transformChangeRecord(LDIFChangeRecord r)
Applies an appropriate transformation to the provided LDIF change record.
|
Entry |
transformEntry(Entry e)
Applies an appropriate transformation to the provided entry.
|
Entry |
translate(Entry original,
long firstLineNumber)
Applies some special transformation or filtering to the original Entry.
|
LDIFChangeRecord |
translate(LDIFChangeRecord original,
long firstLineNumber)
Applies some special transformation or filtering to the original change
record.
|
LDIFChangeRecord |
translateChangeRecordToWrite(LDIFChangeRecord original)
Applies some special transformation or filtering to the original change
record.
|
Entry |
translateEntryToWrite(Entry original)
Applies some special transformation or filtering to the original Entry.
|
public ScrambleAttributeTransformation(@NotNull java.lang.String... attributes)
attributes
- The names or OIDs of the attributes to scramble.public ScrambleAttributeTransformation(@NotNull java.util.Collection<java.lang.String> attributes)
attributes
- The names or OIDs of the attributes to scramble.public ScrambleAttributeTransformation(@Nullable Schema schema, @Nullable java.lang.Long randomSeed, @NotNull java.lang.String... attributes)
schema
- The schema to use when processing. This may be
null
if a default standard schema should be
used. The schema will be used to identify alternate
names that may be used to reference the attributes, and
to determine the expected syntax for more accurate
scrambling.randomSeed
- The seed to use for the random number generator when
scrambling each value. It may be null
if the
random seed should be automatically selected.attributes
- The names or OIDs of the attributes to scramble.public ScrambleAttributeTransformation(@Nullable Schema schema, @Nullable java.lang.Long randomSeed, boolean scrambleEntryDNs, @NotNull java.util.Collection<java.lang.String> attributes, @Nullable java.util.Collection<java.lang.String> jsonFields)
schema
- The schema to use when processing. This may be
null
if a default standard schema should
be used. The schema will be used to identify
alternate names that may be used to reference the
attributes, and to determine the expected syntax
for more accurate scrambling.randomSeed
- The seed to use for the random number generator
when scrambling each value. It may be
null
if the random seed should be
automatically selected.scrambleEntryDNs
- Indicates whether to scramble any appropriate
attributes contained in entry DNs and the values
of attributes with a DN syntax.attributes
- The names or OIDs of the attributes to scramble.jsonFields
- The names of the JSON fields whose values should
be scrambled. If any field names are specified,
then any JSON objects to be scrambled will only
have those fields scrambled (with field names
treated in a case-insensitive manner) and all
other fields will be preserved without
scrambling. If this is null
or empty,
then scrambling will be applied for all values in
all fields.@Nullable public Entry transformEntry(@NotNull Entry e)
transformEntry
in interface EntryTransformation
e
- The entry to transform.null
if the entry should be suppressed.@Nullable public LDIFChangeRecord transformChangeRecord(@NotNull LDIFChangeRecord r)
transformChangeRecord
in interface LDIFChangeRecordTransformation
r
- The LDIF change record to transform.null
if the change record should be
suppressed.@Nullable public java.lang.String scrambleDN(@Nullable java.lang.String dn)
dn
- The DN to be scrambled.@Nullable public DN scrambleDN(@Nullable DN dn)
dn
- The DN to be scrambled.@NotNull public RDN scrambleRDN(@NotNull RDN rdn)
rdn
- The RDN to be scrambled. It must not be null
.@Nullable public Attribute scrambleAttribute(@NotNull Attribute a)
a
- The attribute to scramble.@Nullable public java.lang.String scrambleGeneralizedTime(@Nullable java.lang.String s)
s
- The value to scramble.@Nullable public java.lang.String scrambleNumericValue(@Nullable java.lang.String s)
s
- The value to scramble.@Nullable public byte[] scrambleBinaryValue(@Nullable byte[] value)
value
- The value to scramble.@Nullable public java.lang.String scrambleEncodedPassword(@Nullable java.lang.String s)
s
- The encoded password to scramble.@Nullable public java.lang.String scrambleJSONObject(@Nullable java.lang.String s)
AttributeScrambler
was created with a set of
JSON fields, then only the values of those fields will be scrambled;
otherwise, all field values will be scrambled.s
- The time value to scramble.@Nullable public java.lang.String scrambleString(@Nullable java.lang.String s)
s
- The value to scramble.@Nullable public Entry translate(@NotNull Entry original, long firstLineNumber)
translate
in interface LDIFReaderEntryTranslator
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.LDIFReader.readEntry()
. This can be the original parameter
Entry, a newly constructed Entry, or null
to signal that
the provided Entry should be skipped.@Nullable public LDIFChangeRecord translate(@NotNull LDIFChangeRecord original, long firstLineNumber)
translate
in interface LDIFReaderChangeRecordTranslator
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 an
LDIFException
.LDIFReader.readChangeRecord()
. This can be the original
parameter change record, a newly constructed change record, or
null
to signal that the provided change record should be
skipped.@Nullable public Entry translateEntryToWrite(@NotNull Entry original)
translateEntryToWrite
in interface LDIFWriterEntryTranslator
original
- The original Entry that was to be written.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.@Nullable public LDIFChangeRecord translateChangeRecordToWrite(@NotNull LDIFChangeRecord original)
translateChangeRecordToWrite
in interface LDIFWriterChangeRecordTranslator
original
- The original change record that was to be written.null
to 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 the
duplicate()
method to create a copy of the original and
make the necessary changes to that duplicate.