Search in sources :

Example 1 with GroupResourceStatusException

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

the class ResourcesManagerBlImpl method deactivateGroupResourceAssignment.

@Override
public void deactivateGroupResourceAssignment(PerunSession sess, Group group, Resource resource) throws GroupNotDefinedOnResourceException, GroupResourceStatusException {
    GroupResourceStatus status = getResourcesManagerImpl().getGroupResourceStatus(sess, group, resource);
    if (status == GroupResourceStatus.PROCESSING) {
        throw new GroupResourceStatusException("Cannot deactivate an assignment in PROCESSING state.");
    }
    getResourcesManagerImpl().setGroupResourceStatus(sess, group, resource, GroupResourceStatus.INACTIVE);
    getPerunBl().getAuditer().log(sess, new GroupRemovedFromResource(group, resource));
    // reset assignment failure cause
    getResourcesManagerImpl().setFailedGroupResourceAssignmentCause(sess, group, resource, null);
}
Also used : GroupRemovedFromResource(cz.metacentrum.perun.audit.events.ResourceManagerEvents.GroupRemovedFromResource) GroupResourceStatusException(cz.metacentrum.perun.core.api.exceptions.GroupResourceStatusException) GroupResourceStatus(cz.metacentrum.perun.core.api.GroupResourceStatus)

Aggregations

GroupRemovedFromResource (cz.metacentrum.perun.audit.events.ResourceManagerEvents.GroupRemovedFromResource)1 GroupResourceStatus (cz.metacentrum.perun.core.api.GroupResourceStatus)1 GroupResourceStatusException (cz.metacentrum.perun.core.api.exceptions.GroupResourceStatusException)1