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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations