Search in sources :

Example 1 with LDIFImportConfig

use of org.opends.server.types.LDIFImportConfig 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)

Example 2 with LDIFImportConfig

use of org.opends.server.types.LDIFImportConfig in project midpoint by Evolveum.

the class OpenDJController method addEntryFromLdifFile.

public Entry addEntryFromLdifFile(String filename) throws IOException, LDIFException {
    LDIFImportConfig importConfig = new LDIFImportConfig(filename);
    LDIFReader ldifReader = new LDIFReader(importConfig);
    Entry ldifEntry = ldifReader.readEntry();
    addEntry(ldifEntry);
    return ldifEntry;
}
Also used : Entry(org.opends.server.types.Entry) ChangeRecordEntry(org.opends.server.util.ChangeRecordEntry) ModifyChangeRecordEntry(org.opends.server.util.ModifyChangeRecordEntry) SearchResultEntry(org.opends.server.types.SearchResultEntry) ModifyDNChangeRecordEntry(org.opends.server.util.ModifyDNChangeRecordEntry) JarEntry(java.util.jar.JarEntry) LDIFImportConfig(org.opends.server.types.LDIFImportConfig) LDIFReader(org.opends.server.util.LDIFReader)

Example 3 with LDIFImportConfig

use of org.opends.server.types.LDIFImportConfig in project midpoint by Evolveum.

the class TestLdap method createEntry.

private Entry createEntry(String uid, String name) throws IOException, LDIFException {
    StringBuilder sb = new StringBuilder();
    String dn = "uid=" + uid + "," + openDJController.getSuffixPeople();
    sb.append("dn: ").append(dn).append("\n");
    sb.append("objectClass: inetOrgPerson\n");
    sb.append("uid: ").append(uid).append("\n");
    sb.append("cn: ").append(name).append("\n");
    sb.append("sn: ").append(name).append("\n");
    LDIFImportConfig importConfig = new LDIFImportConfig(IOUtils.toInputStream(sb.toString(), "utf-8"));
    LDIFReader ldifReader = new LDIFReader(importConfig);
    Entry ldifEntry = ldifReader.readEntry();
    return ldifEntry;
}
Also used : Entry(org.opends.server.types.Entry) LDIFImportConfig(org.opends.server.types.LDIFImportConfig) LDIFReader(org.opends.server.util.LDIFReader)

Example 4 with LDIFImportConfig

use of org.opends.server.types.LDIFImportConfig in project midpoint by Evolveum.

the class TestLdapComplex method createEntry.

private Entry createEntry(String uid, String name) throws IOException, LDIFException {
    StringBuilder sb = new StringBuilder();
    String dn = "uid=" + uid + "," + openDJController.getSuffixPeople();
    sb.append("dn: ").append(dn).append("\n");
    sb.append("objectClass: inetOrgPerson\n");
    sb.append("uid: ").append(uid).append("\n");
    sb.append("cn: ").append(name).append("\n");
    sb.append("sn: ").append(name).append("\n");
    LDIFImportConfig importConfig = new LDIFImportConfig(IOUtils.toInputStream(sb.toString(), "utf-8"));
    LDIFReader ldifReader = new LDIFReader(importConfig);
    Entry ldifEntry = ldifReader.readEntry();
    return ldifEntry;
}
Also used : Entry(org.opends.server.types.Entry) LDIFImportConfig(org.opends.server.types.LDIFImportConfig) LDIFReader(org.opends.server.util.LDIFReader)

Example 5 with LDIFImportConfig

use of org.opends.server.types.LDIFImportConfig in project midpoint by Evolveum.

the class TestLdapUniversity method createEntry.

private Entry createEntry(String uid, String empno, String name) throws IOException, LDIFException {
    StringBuilder sb = new StringBuilder();
    String dn = "uid=" + uid + "," + openDJController.getSuffixPeople();
    sb.append("dn: ").append(dn).append("\n");
    sb.append("objectClass: inetOrgPerson\n");
    sb.append("uid: ").append(uid).append("\n");
    sb.append("employeenumber: ").append(empno).append("\n");
    sb.append("cn: ").append(name).append("\n");
    sb.append("sn: ").append(name).append("\n");
    LDIFImportConfig importConfig = new LDIFImportConfig(IOUtils.toInputStream(sb.toString(), "utf-8"));
    LDIFReader ldifReader = new LDIFReader(importConfig);
    Entry ldifEntry = ldifReader.readEntry();
    return ldifEntry;
}
Also used : Entry(org.opends.server.types.Entry) LDIFImportConfig(org.opends.server.types.LDIFImportConfig) LDIFReader(org.opends.server.util.LDIFReader)

Aggregations

LDIFImportConfig (org.opends.server.types.LDIFImportConfig)13 LDIFReader (org.opends.server.util.LDIFReader)13 Entry (org.opends.server.types.Entry)10 ChangeRecordEntry (org.opends.server.util.ChangeRecordEntry)6 ModifyChangeRecordEntry (org.opends.server.util.ModifyChangeRecordEntry)6 ModifyDNChangeRecordEntry (org.opends.server.util.ModifyDNChangeRecordEntry)6 JarEntry (java.util.jar.JarEntry)3 SearchResultEntry (org.opends.server.types.SearchResultEntry)3 SynchornizationServiceMock (com.evolveum.midpoint.provisioning.impl.mock.SynchornizationServiceMock)2 ResourceShadowDiscriminator (com.evolveum.midpoint.schema.ResourceShadowDiscriminator)2 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 Task (com.evolveum.midpoint.task.api.Task)2 AbstractIntegrationTest (com.evolveum.midpoint.test.AbstractIntegrationTest)2 AddOperation (org.opends.server.core.AddOperation)2 ModifyOperation (org.opends.server.core.ModifyOperation)2 Test (org.testng.annotations.Test)2 ResourceObjectShadowChangeDescription (com.evolveum.midpoint.provisioning.api.ResourceObjectShadowChangeDescription)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 MessageBuilder (org.opends.messages.MessageBuilder)1