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);
}
}
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);
}
Aggregations