use of org.apache.directory.fortress.core.RemoveException in project directory-fortress-core by apache.
the class OrgUnitDAO method remove.
/**
* @param entity
* @return
* @throws org.apache.directory.fortress.core.RemoveException
*/
OrgUnit remove(OrgUnit entity) throws RemoveException {
LdapConnection ld = null;
Dn dn = getDn(entity);
try {
ld = getAdminConnection();
delete(ld, dn, entity);
} catch (LdapException e) {
String error = "remove orgUnit name [" + entity.getName() + "] type [" + entity.getType() + "] root [" + dn + "] caught LdapException=" + e;
int errCode;
if (entity.getType() == OrgUnit.Type.PERM) {
errCode = GlobalErrIds.ORG_DELETE_FAILED_PERM;
} else {
errCode = GlobalErrIds.ORG_DELETE_FAILED_USER;
}
throw new RemoveException(errCode, error, e);
} finally {
closeAdminConnection(ld);
}
return entity;
}
Aggregations