Search in sources :

Example 1 with GroupResourceStatus

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

the class ResourcesManagerBlImpl method activateGroupResourceAssignment.

@Override
public void activateGroupResourceAssignment(PerunSession sess, Group group, Resource resource, boolean async) throws WrongReferenceAttributeValueException, GroupResourceMismatchException, WrongAttributeValueException, GroupNotDefinedOnResourceException {
    GroupResourceStatus status = getResourcesManagerImpl().getGroupResourceStatus(sess, group, resource);
    if (status == GroupResourceStatus.ACTIVE) {
        // silently skip
        return;
    }
    if (async) {
        getResourcesManagerImpl().setGroupResourceStatus(sess, group, resource, GroupResourceStatus.PROCESSING);
        getPerunBl().getResourcesManagerBl().processGroupResourceActivationAsync(sess, group, resource);
    } else {
        processGroupResourceActivation(sess, group, resource);
    }
}
Also used : GroupResourceStatus(cz.metacentrum.perun.core.api.GroupResourceStatus)

Example 2 with GroupResourceStatus

use of cz.metacentrum.perun.core.api.GroupResourceStatus 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

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