Search in sources :

Example 1 with GroupAlreadyRemovedException

use of cz.metacentrum.perun.core.api.exceptions.GroupAlreadyRemovedException in project perun by CESNET.

the class GroupsManagerImpl method deleteGroup.

public void deleteGroup(PerunSession sess, Vo vo, Group group) throws InternalErrorException, GroupAlreadyRemovedException {
    Utils.notNull(group.getName(), "group.getName()");
    try {
        // Delete group's members
        jdbc.update("delete from groups_members where group_id=?", group.getId());
        // Delete authz entries for this group
        AuthzResolverBlImpl.removeAllAuthzForGroup(sess, group);
        int rowAffected = jdbc.update("delete from groups where id=?", group.getId());
        if (rowAffected == 0)
            throw new GroupAlreadyRemovedException("Group: " + group + " , Vo: " + vo);
    } catch (RuntimeException err) {
        throw new InternalErrorException(err);
    }
}
Also used : InternalErrorException(cz.metacentrum.perun.core.api.exceptions.InternalErrorException) GroupAlreadyRemovedException(cz.metacentrum.perun.core.api.exceptions.GroupAlreadyRemovedException)

Aggregations

GroupAlreadyRemovedException (cz.metacentrum.perun.core.api.exceptions.GroupAlreadyRemovedException)1 InternalErrorException (cz.metacentrum.perun.core.api.exceptions.InternalErrorException)1