Search in sources :

Example 1 with ResourceTagAlreadyAssignedException

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

the class ResourcesManagerBlImpl method deleteAllResourcesTagsForVo.

@Override
public void deleteAllResourcesTagsForVo(PerunSession perunSession, Vo vo) throws ResourceTagAlreadyAssignedException {
    List<ResourceTag> resourcesTagForVo = this.getAllResourcesTagsForVo(perunSession, vo);
    for (ResourceTag rt : resourcesTagForVo) {
        List<Resource> tagResources = this.getAllResourcesByResourceTag(perunSession, rt);
        if (!tagResources.isEmpty())
            throw new ResourceTagAlreadyAssignedException("The resourceTag is alreadyUsed for some resources.", rt);
    }
    getResourcesManagerImpl().deleteAllResourcesTagsForVo(perunSession, vo);
}
Also used : ResourceTagAlreadyAssignedException(cz.metacentrum.perun.core.api.exceptions.ResourceTagAlreadyAssignedException) ResourceTag(cz.metacentrum.perun.core.api.ResourceTag) BanSetForResource(cz.metacentrum.perun.audit.events.ResourceManagerEvents.BanSetForResource) AssignedResource(cz.metacentrum.perun.core.api.AssignedResource) BanUpdatedForResource(cz.metacentrum.perun.audit.events.ResourceManagerEvents.BanUpdatedForResource) BanRemovedForResource(cz.metacentrum.perun.audit.events.ResourceManagerEvents.BanRemovedForResource) Resource(cz.metacentrum.perun.core.api.Resource) ServiceRemovedFromResource(cz.metacentrum.perun.audit.events.ResourceManagerEvents.ServiceRemovedFromResource) GroupAssignedToResource(cz.metacentrum.perun.audit.events.ResourceManagerEvents.GroupAssignedToResource) ServiceAssignedToResource(cz.metacentrum.perun.audit.events.ResourceManagerEvents.ServiceAssignedToResource) GroupRemovedFromResource(cz.metacentrum.perun.audit.events.ResourceManagerEvents.GroupRemovedFromResource) BanOnResource(cz.metacentrum.perun.core.api.BanOnResource) RichResource(cz.metacentrum.perun.core.api.RichResource) EnrichedResource(cz.metacentrum.perun.core.api.EnrichedResource)

Example 2 with ResourceTagAlreadyAssignedException

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

the class ResourcesManagerBlImpl method deleteResourceTag.

@Override
public void deleteResourceTag(PerunSession perunSession, ResourceTag resourceTag) throws ResourceTagAlreadyAssignedException {
    List<Resource> tagResources = this.getAllResourcesByResourceTag(perunSession, resourceTag);
    if (!tagResources.isEmpty())
        throw new ResourceTagAlreadyAssignedException("The resourceTag is alreadyUsed for some resources.", resourceTag);
    getResourcesManagerImpl().deleteResourceTag(perunSession, resourceTag);
}
Also used : ResourceTagAlreadyAssignedException(cz.metacentrum.perun.core.api.exceptions.ResourceTagAlreadyAssignedException) BanSetForResource(cz.metacentrum.perun.audit.events.ResourceManagerEvents.BanSetForResource) AssignedResource(cz.metacentrum.perun.core.api.AssignedResource) BanUpdatedForResource(cz.metacentrum.perun.audit.events.ResourceManagerEvents.BanUpdatedForResource) BanRemovedForResource(cz.metacentrum.perun.audit.events.ResourceManagerEvents.BanRemovedForResource) Resource(cz.metacentrum.perun.core.api.Resource) ServiceRemovedFromResource(cz.metacentrum.perun.audit.events.ResourceManagerEvents.ServiceRemovedFromResource) GroupAssignedToResource(cz.metacentrum.perun.audit.events.ResourceManagerEvents.GroupAssignedToResource) ServiceAssignedToResource(cz.metacentrum.perun.audit.events.ResourceManagerEvents.ServiceAssignedToResource) GroupRemovedFromResource(cz.metacentrum.perun.audit.events.ResourceManagerEvents.GroupRemovedFromResource) BanOnResource(cz.metacentrum.perun.core.api.BanOnResource) RichResource(cz.metacentrum.perun.core.api.RichResource) EnrichedResource(cz.metacentrum.perun.core.api.EnrichedResource)

Example 3 with ResourceTagAlreadyAssignedException

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

the class ResourcesManagerBlImpl method assignResourceTagToResource.

@Override
public void assignResourceTagToResource(PerunSession perunSession, ResourceTag resourceTag, Resource resource) throws ResourceTagAlreadyAssignedException {
    List<ResourceTag> allResourceTags = this.getAllResourcesTagsForResource(perunSession, resource);
    if (allResourceTags.contains(resourceTag))
        throw new ResourceTagAlreadyAssignedException(resourceTag);
    getResourcesManagerImpl().assignResourceTagToResource(perunSession, resourceTag, resource);
}
Also used : ResourceTagAlreadyAssignedException(cz.metacentrum.perun.core.api.exceptions.ResourceTagAlreadyAssignedException) ResourceTag(cz.metacentrum.perun.core.api.ResourceTag)

Aggregations

ResourceTagAlreadyAssignedException (cz.metacentrum.perun.core.api.exceptions.ResourceTagAlreadyAssignedException)3 BanRemovedForResource (cz.metacentrum.perun.audit.events.ResourceManagerEvents.BanRemovedForResource)2 BanSetForResource (cz.metacentrum.perun.audit.events.ResourceManagerEvents.BanSetForResource)2 BanUpdatedForResource (cz.metacentrum.perun.audit.events.ResourceManagerEvents.BanUpdatedForResource)2 GroupAssignedToResource (cz.metacentrum.perun.audit.events.ResourceManagerEvents.GroupAssignedToResource)2 GroupRemovedFromResource (cz.metacentrum.perun.audit.events.ResourceManagerEvents.GroupRemovedFromResource)2 ServiceAssignedToResource (cz.metacentrum.perun.audit.events.ResourceManagerEvents.ServiceAssignedToResource)2 ServiceRemovedFromResource (cz.metacentrum.perun.audit.events.ResourceManagerEvents.ServiceRemovedFromResource)2 AssignedResource (cz.metacentrum.perun.core.api.AssignedResource)2 BanOnResource (cz.metacentrum.perun.core.api.BanOnResource)2 EnrichedResource (cz.metacentrum.perun.core.api.EnrichedResource)2 Resource (cz.metacentrum.perun.core.api.Resource)2 ResourceTag (cz.metacentrum.perun.core.api.ResourceTag)2 RichResource (cz.metacentrum.perun.core.api.RichResource)2