Search in sources :

Example 1 with ResourceAlreadyRemovedException

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

the class ResourcesManagerImpl method deleteResource.

@Override
public void deleteResource(PerunSession sess, Vo vo, Resource resource) throws ResourceAlreadyRemovedException {
    try {
        // Delete authz entries for this resource
        AuthzResolverBlImpl.removeAllAuthzForResource(sess, resource);
        int numAffected = jdbc.update("delete from resources where id=?", resource.getId());
        if (numAffected == 0)
            throw new ResourceAlreadyRemovedException("Resource: " + resource + " , Vo: " + vo);
    } catch (RuntimeException e) {
        throw new InternalErrorException(e);
    }
}
Also used : ResourceAlreadyRemovedException(cz.metacentrum.perun.core.api.exceptions.ResourceAlreadyRemovedException) InternalErrorException(cz.metacentrum.perun.core.api.exceptions.InternalErrorException)

Aggregations

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