try {
DBConnection dbConnection = getConnection();
try {
int userId = lookupInternalId(STATEMENT_FIND_AUTHOR_ID,alias);
if (userId<0) {
throw new AuthException("User "+alias+" cannot be found.");
}
int groupId = lookupInternalId(STATEMENT_FIND_GROUP_ID,name);
if (groupId<0) {
throw new AuthException("Group "+name+" cannot be found.");
}
PreparedStatement s = dbConnection.getStatement(STATEMENT_DELETE_GROUP_MEMBER);
s.setInt(1,groupId);
s.setInt(2,userId);
int count = s.executeUpdate();
release(s);
return count>0;
} catch (SQLException ex) {
throw new AuthException("Cannot delete user "+alias+" from group "+name,ex);
} finally {
release(dbConnection);
}
} catch (SQLException ex) {
throw new AuthException("Cannot get database connection.",ex);
}
}