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