Search in sources :

Example 1 with ModifyChangeRecordEntry

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

the class OpenDJController method executeLdifChange.

public ChangeRecordEntry executeLdifChange(File file) throws IOException, LDIFException {
    LDIFImportConfig importConfig = new LDIFImportConfig(file.getPath());
    LDIFReader ldifReader = new LDIFReader(importConfig);
    ChangeRecordEntry entry = ldifReader.readChangeRecord(false);
    ModifyOperation modifyOperation = getInternalConnection().processModify((ModifyChangeRecordEntry) entry);
    if (ResultCode.SUCCESS != modifyOperation.getResultCode()) {
        throw new RuntimeException("LDAP operation error: " + modifyOperation.getResultCode() + ": " + modifyOperation.getErrorMessage());
    }
    return entry;
}
Also used : 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) ModifyOperation(org.opends.server.core.ModifyOperation)

Example 2 with ModifyChangeRecordEntry

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

the class OpenDJController method executeLdifChange.

public ChangeRecordEntry executeLdifChange(String ldif) throws IOException, LDIFException {
    InputStream ldifInputStream = IOUtils.toInputStream(ldif, "UTF-8");
    LDIFImportConfig importConfig = new LDIFImportConfig(ldifInputStream);
    LDIFReader ldifReader = new LDIFReader(importConfig);
    ChangeRecordEntry entry = ldifReader.readChangeRecord(false);
    ModifyOperation modifyOperation = getInternalConnection().processModify((ModifyChangeRecordEntry) entry);
    if (ResultCode.SUCCESS != modifyOperation.getResultCode()) {
        throw new RuntimeException("LDAP operation error: " + modifyOperation.getResultCode() + ": " + modifyOperation.getErrorMessage());
    }
    return entry;
}
Also used : ChangeRecordEntry(org.opends.server.util.ChangeRecordEntry) ModifyChangeRecordEntry(org.opends.server.util.ModifyChangeRecordEntry) ModifyDNChangeRecordEntry(org.opends.server.util.ModifyDNChangeRecordEntry) InputStream(java.io.InputStream) LDIFImportConfig(org.opends.server.types.LDIFImportConfig) LDIFReader(org.opends.server.util.LDIFReader) ModifyOperation(org.opends.server.core.ModifyOperation)

Aggregations

ModifyOperation (org.opends.server.core.ModifyOperation)2 LDIFImportConfig (org.opends.server.types.LDIFImportConfig)2 ChangeRecordEntry (org.opends.server.util.ChangeRecordEntry)2 LDIFReader (org.opends.server.util.LDIFReader)2 ModifyChangeRecordEntry (org.opends.server.util.ModifyChangeRecordEntry)2 ModifyDNChangeRecordEntry (org.opends.server.util.ModifyDNChangeRecordEntry)2 InputStream (java.io.InputStream)1