Search in sources :

Example 1 with LDIFException

use of org.opends.server.util.LDIFException in project midpoint by Evolveum.

the class OpenDJController method executeRenameChange.

public ChangeRecordEntry executeRenameChange(String filename) throws LDIFException, IOException {
    LDIFImportConfig importConfig = new LDIFImportConfig(filename);
    LDIFReader ldifReader = new LDIFReader(importConfig);
    ChangeRecordEntry entry = ldifReader.readChangeRecord(false);
    if (!(entry instanceof ModifyDNChangeRecordEntry)) {
        throw new LDIFException(new MessageBuilder("Could not execute rename..Bad change").toMessage());
    }
    ModifyDNOperation modifyOperation = getInternalConnection().processModifyDN((ModifyDNChangeRecordEntry) entry);
    if (ResultCode.SUCCESS != modifyOperation.getResultCode()) {
        throw new RuntimeException("LDAP operation error: " + modifyOperation.getResultCode() + ": " + modifyOperation.getErrorMessage());
    }
    return entry;
}
Also used : MessageBuilder(org.opends.messages.MessageBuilder) ChangeRecordEntry(org.opends.server.util.ChangeRecordEntry) ModifyChangeRecordEntry(org.opends.server.util.ModifyChangeRecordEntry) ModifyDNChangeRecordEntry(org.opends.server.util.ModifyDNChangeRecordEntry) LDIFImportConfig(org.opends.server.types.LDIFImportConfig) LDIFReader(org.opends.server.util.LDIFReader) LDIFException(org.opends.server.util.LDIFException) ModifyDNChangeRecordEntry(org.opends.server.util.ModifyDNChangeRecordEntry) ModifyDNOperation(org.opends.server.core.ModifyDNOperation)

Aggregations

MessageBuilder (org.opends.messages.MessageBuilder)1 ModifyDNOperation (org.opends.server.core.ModifyDNOperation)1 LDIFImportConfig (org.opends.server.types.LDIFImportConfig)1 ChangeRecordEntry (org.opends.server.util.ChangeRecordEntry)1 LDIFException (org.opends.server.util.LDIFException)1 LDIFReader (org.opends.server.util.LDIFReader)1 ModifyChangeRecordEntry (org.opends.server.util.ModifyChangeRecordEntry)1 ModifyDNChangeRecordEntry (org.opends.server.util.ModifyDNChangeRecordEntry)1