Search in sources :

Example 1 with ServiceUsageException

use of org.alien4cloud.alm.service.exceptions.ServiceUsageException in project alien4cloud by alien4cloud.

the class ServiceResourceService method failIdUsed.

private void failIdUsed(String id) {
    ServiceUsageRequestEvent serviceUsageRequestEvent = new ServiceUsageRequestEvent(this, id);
    publisher.publishEvent(serviceUsageRequestEvent);
    Usage[] usages = serviceUsageRequestEvent.getUsages();
    if (usages.length > 0) {
        throw new ServiceUsageException("Used services cannot be updated or deleted.", usages);
    }
}
Also used : ServiceUsageException(org.alien4cloud.alm.service.exceptions.ServiceUsageException) Usage(alien4cloud.model.common.Usage) ServiceUsageRequestEvent(org.alien4cloud.alm.service.events.ServiceUsageRequestEvent)

Aggregations

Usage (alien4cloud.model.common.Usage)1 ServiceUsageRequestEvent (org.alien4cloud.alm.service.events.ServiceUsageRequestEvent)1 ServiceUsageException (org.alien4cloud.alm.service.exceptions.ServiceUsageException)1