use of org.apache.directory.fortress.core.model.OrganizationalUnit in project directory-fortress-core by apache.
the class FortressAntTask method addContainers.
/**
* @throws BuildException An error occurred while building
*/
private void addContainers() throws BuildException {
if (addcontainers == null) {
return;
}
// Loop through the entityclass elements
for (Addcontainer addcontainer : addcontainers) {
List<OrganizationalUnit> containers = addcontainer.getContainers();
for (OrganizationalUnit ou : containers) {
LOG.info("addContainers tenant={} name={} description={}", getTenant(), ou.getName(), ou.getDescription());
try {
OrganizationalUnitP op = new OrganizationalUnitP();
// Normally this info would be passed in via a manager constructor. Since these methods aren't implemented by a manager, we must do this here:
if (!StringUtils.isEmpty(TENANT) && !TENANT.equals("${tenant}")) {
ou.setContextId(TENANT);
}
op.add(ou);
} catch (SecurityException se) {
LOG.warn("addContainers tenant={} name [{}] caught SecurityException={}", getTenant(), ou.getName(), se.getMessage());
}
}
}
}
use of org.apache.directory.fortress.core.model.OrganizationalUnit in project directory-fortress-core by apache.
the class TestAddOrgunit method test.
@Test
public void test() throws SecurityException {
OrganizationalUnitP op = new OrganizationalUnitP();
OrganizationalUnit ou = new OrganizationalUnit("Client123", "Client 123 test context");
ou.setContextId("012");
op.add(ou);
}
use of org.apache.directory.fortress.core.model.OrganizationalUnit in project directory-fortress-core by apache.
the class FortressAntTask method deleteContainers.
/**
* @throws BuildException An error occurred while building
*/
private void deleteContainers() throws BuildException {
if (delcontainers == null) {
return;
}
// Loop through the entityclass elements
for (Delcontainer delcontainer : delcontainers) {
List<OrganizationalUnit> containers = delcontainer.getContainers();
for (OrganizationalUnit ou : containers) {
LOG.info("deleteContainers tenant={} name={}", getTenant(), ou.getName());
try {
OrganizationalUnitP op = new OrganizationalUnitP();
// Normally this info would be passed in via a manager constructor. Since these methods aren't implemented by a manager, we must do this here:
if (!StringUtils.isEmpty(TENANT) && !TENANT.equals("${tenant}")) {
ou.setContextId(TENANT);
}
op.delete(ou);
} catch (SecurityException se) {
LOG.warn("deleteContainers tenant={} name [{}] caught SecurityException={}", getTenant(), ou.getName(), se);
}
}
}
}
Aggregations