Class RenameAttributeTransformation
- java.lang.Object
-
- com.unboundid.ldap.sdk.transformations.RenameAttributeTransformation
-
- All Implemented Interfaces:
EntryTransformation,LDIFChangeRecordTransformation,LDIFReaderChangeRecordTranslator,LDIFReaderEntryTranslator,LDIFWriterChangeRecordTranslator,LDIFWriterEntryTranslator
@ThreadSafety(level=COMPLETELY_THREADSAFE) public final class RenameAttributeTransformation extends java.lang.Object implements EntryTransformation, LDIFChangeRecordTransformation
This class provides an implementation of an entry and LDIF change record translator that will rename a specified attribute so that it uses a different name.
-
-
Constructor Summary
Constructors Constructor Description RenameAttributeTransformation(Schema schema, java.lang.String sourceAttribute, java.lang.String targetAttribute, boolean renameInDNs)Creates a new rename attribute transformation with the provided information.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LDIFChangeRecordtransformChangeRecord(LDIFChangeRecord r)Applies an appropriate transformation to the provided LDIF change record.EntrytransformEntry(Entry e)Applies an appropriate transformation to the provided entry.Entrytranslate(Entry original, long firstLineNumber)Applies some special transformation or filtering to the original Entry.LDIFChangeRecordtranslate(LDIFChangeRecord original, long firstLineNumber)Applies some special transformation or filtering to the original change record.LDIFChangeRecordtranslateChangeRecordToWrite(LDIFChangeRecord original)Applies some special transformation or filtering to the original change record.EntrytranslateEntryToWrite(Entry original)Applies some special transformation or filtering to the original Entry.
-
-
-
Constructor Detail
-
RenameAttributeTransformation
public RenameAttributeTransformation(Schema schema, java.lang.String sourceAttribute, java.lang.String targetAttribute, boolean renameInDNs)
Creates a new rename attribute transformation with the provided information.- Parameters:
schema- The schema to use in processing. If this isnull, a default standard schema will be used.sourceAttribute- The name of the source attribute to be replaced with the name of the target attribute. It must not benull.targetAttribute- The name of the target attribute to use in place of the source attribute. It must not benull.renameInDNs- Indicates whether to rename attributes contained in DNs. This includes both in the DN of an entry to be transformed, but also in the values of attributes with a DN syntax.
-
-
Method Detail
-
transformEntry
public Entry transformEntry(Entry e)
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
public LDIFChangeRecord transformChangeRecord(LDIFChangeRecord r)
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
public Entry translate(Entry original, long firstLineNumber)
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
public LDIFChangeRecord translate(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
public Entry translateEntryToWrite(Entry original)
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
public LDIFChangeRecord translateChangeRecordToWrite(LDIFChangeRecord original)
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.
-
-