use of org.apache.directory.fortress.core.RemoveException in project directory-fortress-core by apache.
the class UserDAO method remove.
/**
* @param user
* @throws RemoveException
*/
String remove(User user) throws RemoveException {
LdapConnection ld = null;
String userDn = getDn(user.getUserId(), user.getContextId());
try {
ld = getAdminConnection();
delete(ld, userDn, user);
} catch (LdapException e) {
String error = "remove userId [" + user.getUserId() + "] caught LDAPException=" + e.getMessage();
throw new RemoveException(GlobalErrIds.USER_DELETE_FAILED, error, e);
} finally {
closeAdminConnection(ld);
}
return userDn;
}
use of org.apache.directory.fortress.core.RemoveException in project directory-fortress-core by apache.
the class RoleDAO method remove.
/**
* @param role
* @throws RemoveException
*/
void remove(Role role) throws RemoveException {
LdapConnection ld = null;
String dn = getDn(role.getName(), role.getContextId());
try {
ld = getAdminConnection();
delete(ld, dn, role);
} catch (LdapException e) {
String error = "remove role name=" + role.getName() + " LdapException=" + e.getMessage();
throw new RemoveException(GlobalErrIds.ROLE_DELETE_FAILED, error, e);
} finally {
closeAdminConnection(ld);
}
}
use of org.apache.directory.fortress.core.RemoveException in project directory-fortress-core by apache.
the class ExampleDAO method remove.
/**
* @param name
* @throws org.apache.directory.fortress.core.RemoveException
*/
public void remove(String name) throws RemoveException {
LdapConnection ld = null;
String dn = SchemaConstants.CN_AT + "=" + name + "," + Config.getInstance().getProperty(EIds.EXAMPLE_ROOT);
if (LOG.isDebugEnabled()) {
LOG.debug("remove dn [" + dn + "]");
}
try {
ld = getAdminConnection();
delete(ld, dn);
} catch (LdapException e) {
String error = "remove [" + name + "] caught LDAPException=" + e;
LOG.error(error);
throw new RemoveException(EErrIds.EXAMPLE_DELETE_FAILED, error);
} finally {
closeAdminConnection(ld);
}
}
use of org.apache.directory.fortress.core.RemoveException in project directory-fortress-core by apache.
the class SdDAO method remove.
/**
* @param entity
* @throws org.apache.directory.fortress.core.RemoveException
*/
SDSet remove(SDSet entity) throws RemoveException {
LdapConnection ld = null;
String dn = getDn(entity.getName(), entity.getContextId());
try {
ld = getAdminConnection();
delete(ld, dn, entity);
} catch (LdapException e) {
String error = "remove SD name=" + entity.getName() + " type [" + entity.getType() + "] LdapException=" + e.getMessage();
int errCode;
if (entity.getType() == SDSet.SDType.DYNAMIC) {
errCode = GlobalErrIds.DSD_DELETE_FAILED;
} else {
errCode = GlobalErrIds.SSD_DELETE_FAILED;
}
throw new RemoveException(errCode, error, e);
} finally {
closeAdminConnection(ld);
}
return entity;
}
use of org.apache.directory.fortress.core.RemoveException in project directory-fortress-core by apache.
the class SuffixDAO method remove.
/**
* <p>
* <font size="4" color="red">
* This method is destructive as it will remove all nodes below the suffix using recursive delete function.<BR>
* Extreme care should be taken during execution to ensure target directory is correct and permanent removal of data is intended. There is no
* 'undo' for this operation.
* </font>
*
* @param se
* @throws org.apache.directory.fortress.core.RemoveException
*/
void remove(Suffix se) throws RemoveException {
LdapConnection ld = null;
String nodeDn = getDn(se);
LOG.info("remove suffix dn [{}]", nodeDn);
try {
ld = getAdminConnection();
deleteRecursive(ld, nodeDn);
} catch (CursorException e) {
String error = "remove suffix node dn [" + nodeDn + "] caught CursorException=" + e.getMessage();
throw new RemoveException(GlobalErrIds.SUFX_DELETE_FAILED, error, e);
} catch (LdapException e) {
String error = "remove suffix node dn [" + nodeDn + "] caught LDAPException=" + e.getMessage();
throw new RemoveException(GlobalErrIds.SUFX_DELETE_FAILED, error, e);
} finally {
closeAdminConnection(ld);
}
}
Aggregations