Class MoveSubtreeTransformation
- java.lang.Object
-
- com.unboundid.ldap.sdk.transformations.MoveSubtreeTransformation
-
- All Implemented Interfaces:
EntryTransformation
,LDIFChangeRecordTransformation
,LDIFReaderChangeRecordTranslator
,LDIFReaderEntryTranslator
,LDIFWriterChangeRecordTranslator
,LDIFWriterEntryTranslator
@ThreadSafety(level=COMPLETELY_THREADSAFE) public final class MoveSubtreeTransformation extends java.lang.Object implements EntryTransformation, LDIFChangeRecordTransformation
This class provides an implementation of an entry and LDIF change record transformation that will alter DNs at or below a specified base DN to replace that base DN with a different base DN. This replacement will be applied to the DNs of entries that are transformed, as well as in any attribute values that represent DNs at or below the specified base DN.
-
-
Constructor Summary
Constructors Constructor Description MoveSubtreeTransformation(DN sourceDN, DN targetDN)
Creates a new move subtree transformation with the provided information.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
Constructor Detail
-
MoveSubtreeTransformation
public MoveSubtreeTransformation(DN sourceDN, DN targetDN)
Creates a new move subtree transformation with the provided information.- Parameters:
sourceDN
- The source base DN to be replaced with the target base DN. It must not benull
.targetDN
- The target base DN to use to replace the source base DN. It must not benull
.
-
-
Method Detail
-
transformEntry
public Entry transformEntry(Entry e)
Applies an appropriate transformation to the provided entry.- Specified by:
transformEntry
in 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
null
if the entry should be suppressed.
-
transformChangeRecord
public LDIFChangeRecord transformChangeRecord(LDIFChangeRecord r)
Applies an appropriate transformation to the provided LDIF change record.- Specified by:
transformChangeRecord
in 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
null
if the change record should be suppressed.
-
translate
public Entry translate(Entry original, long firstLineNumber)
Applies some special transformation or filtering to the original Entry.- Specified by:
translate
in 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, ornull
to signal that the provided Entry should be skipped.
-
translate
public LDIFChangeRecord translate(LDIFChangeRecord original, long firstLineNumber)
Applies some special transformation or filtering to the original change record.- Specified by:
translate
in 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, ornull
to signal that the provided change record should be skipped.
-
translateEntryToWrite
public Entry translateEntryToWrite(Entry original)
Applies some special transformation or filtering to the original Entry.- Specified by:
translateEntryToWrite
in 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
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 theduplicate()
method to create a copy of the original and make the necessary changes to that duplicate.
-
translateChangeRecordToWrite
public LDIFChangeRecord translateChangeRecordToWrite(LDIFChangeRecord original)
Applies some special transformation or filtering to the original change record.- Specified by:
translateChangeRecordToWrite
in 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
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 theduplicate()
method to create a copy of the original and make the necessary changes to that duplicate.
-
-