use of org.apache.directory.fortress.core.RemoveException in project directory-fortress-core by apache.
the class AdminRoleDAO method remove.
/**
* This method will completely remove the AdminRole from the directory. It will use {@link AdminRole#name} as key.
* This operation is performed on the {@link GlobalIds#ADMIN_ROLE_ROOT} container.
*
* @param role record contains {@link AdminRole#name}.
* @throws RemoveException in the event LDAP errors occur.
*/
void remove(AdminRole role) throws RemoveException {
LdapConnection ld = null;
String dn = getDn(role);
try {
ld = getAdminConnection();
delete(ld, dn, role);
} catch (LdapException e) {
String error = "remove role name=" + role.getName() + " LdapException=" + e.getMessage();
throw new RemoveException(GlobalErrIds.ARLE_DELETE_FAILED, error, e);
} finally {
closeAdminConnection(ld);
}
}
use of org.apache.directory.fortress.core.RemoveException in project directory-fortress-core by apache.
the class PermDAO method deleteAttributeSet.
/**
* @param entity
* @throws RemoveException
*/
void deleteAttributeSet(PermissionAttributeSet entity) throws RemoveException {
LdapConnection ld = null;
String dn = getDn(entity, entity.getContextId());
try {
ld = getAdminConnection();
deleteRecursive(ld, dn, entity);
} catch (LdapException e) {
String error = "deleteAttributeSet name [" + entity.getName() + "]" + " caught LdapException=" + e.getMessage();
throw new RemoveException(GlobalErrIds.PERM_ATTRIBUTE_SET_DELETE_FAILED, error, e);
} catch (CursorException e) {
String error = "deleteAttributeSet name [" + entity.getName() + "] " + " caught LdapException=" + e.getMessage();
throw new RemoveException(GlobalErrIds.PERM_ATTRIBUTE_SET_DELETE_FAILED, error, e);
} finally {
closeAdminConnection(ld);
}
}
use of org.apache.directory.fortress.core.RemoveException in project directory-fortress-core by apache.
the class ConfigDAO method remove.
/**
* @param name
* @throws org.apache.directory.fortress.core.RemoveException
*/
void remove(String name) throws RemoveException {
LdapConnection ld = null;
String dn = getDn(name);
LOG.info("remove dn [{}]", dn);
try {
ld = getAdminConnection();
delete(ld, dn);
} catch (LdapException e) {
String error = "remove dn [" + dn + "] LDAPException=" + e.getMessage();
throw new RemoveException(GlobalErrIds.FT_CONFIG_DELETE_FAILED, error, e);
} finally {
closeAdminConnection(ld);
}
}
use of org.apache.directory.fortress.core.RemoveException in project directory-fortress-core by apache.
the class GroupDAO method remove.
/**
* This method will remove group node from diretory.
*
* @param group
* @throws org.apache.directory.fortress.core.RemoveException
*/
Group remove(Group group) throws RemoveException {
LdapConnection ld = null;
String nodeDn = getDn(group.getName(), group.getContextId());
LOG.debug("remove group dn [{}]", nodeDn);
try {
ld = getAdminConnection();
delete(ld, nodeDn, group);
} catch (LdapException e) {
String error = "remove group node dn [" + nodeDn + "] caught LDAPException=" + e.getMessage();
throw new RemoveException(GlobalErrIds.GROUP_DELETE_FAILED, error, e);
} finally {
closeAdminConnection(ld);
}
return group;
}
use of org.apache.directory.fortress.core.RemoveException in project directory-fortress-core by apache.
the class OrganizationalUnitDAO method remove.
/**
* @param oe
* @throws org.apache.directory.fortress.core.RemoveException
*/
void remove(OrganizationalUnit oe) throws RemoveException {
LdapConnection ld = null;
String nodeDn = SchemaConstants.OU_AT + "=" + oe.getName() + ",";
if (StringUtils.isNotEmpty(oe.getParent())) {
nodeDn += SchemaConstants.OU_AT + "=" + oe.getParent() + ",";
}
nodeDn += getRootDn(oe.getContextId(), GlobalIds.SUFFIX);
LOG.info("remove container dn [{}]", nodeDn);
try {
ld = getAdminConnection();
deleteRecursive(ld, nodeDn);
} catch (CursorException e) {
String error = "remove container node dn [" + nodeDn + "] caught CursorException=" + e.getMessage();
throw new RemoveException(GlobalErrIds.CNTR_DELETE_FAILED, error, e);
} catch (LdapException e) {
String error = "remove container node dn [" + nodeDn + "] caught LDAPException=" + e.getMessage();
throw new RemoveException(GlobalErrIds.CNTR_DELETE_FAILED, error, e);
} finally {
closeAdminConnection(ld);
}
}
Aggregations