Search in sources :

Example 1 with OrganizationalUnitP

use of org.apache.directory.fortress.core.impl.OrganizationalUnitP 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());
            }
        }
    }
}
Also used : OrganizationalUnitP(org.apache.directory.fortress.core.impl.OrganizationalUnitP) OrganizationalUnit(org.apache.directory.fortress.core.model.OrganizationalUnit) SecurityException(org.apache.directory.fortress.core.SecurityException)

Example 2 with OrganizationalUnitP

use of org.apache.directory.fortress.core.impl.OrganizationalUnitP 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);
}
Also used : OrganizationalUnitP(org.apache.directory.fortress.core.impl.OrganizationalUnitP) OrganizationalUnit(org.apache.directory.fortress.core.model.OrganizationalUnit) Test(org.junit.Test)

Example 3 with OrganizationalUnitP

use of org.apache.directory.fortress.core.impl.OrganizationalUnitP 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);
            }
        }
    }
}
Also used : OrganizationalUnitP(org.apache.directory.fortress.core.impl.OrganizationalUnitP) OrganizationalUnit(org.apache.directory.fortress.core.model.OrganizationalUnit) SecurityException(org.apache.directory.fortress.core.SecurityException)

Aggregations

OrganizationalUnitP (org.apache.directory.fortress.core.impl.OrganizationalUnitP)3 OrganizationalUnit (org.apache.directory.fortress.core.model.OrganizationalUnit)3 SecurityException (org.apache.directory.fortress.core.SecurityException)2 Test (org.junit.Test)1