Search in sources :

Example 1 with ServiceException

use of org.guvnor.ala.ui.exceptions.ServiceException in project kie-wb-common by kiegroup.

the class RuntimeServiceImpl method validateForCreateRuntime.

private void validateForCreateRuntime(final ProviderKey providerKey, final String runtimeName) {
    final Provider provider = providerService.getProvider(providerKey);
    if (provider == null) {
        // uncommon case
        logger.error("No provider was found for providerKey: " + providerKey);
        throw new ServiceException("No provider was found for providerKey: " + providerKey);
    }
    final Collection<RuntimeQueryResultItem> items = runtimeProvisioningService.executeQuery(RuntimeQueryBuilder.newInstance().withRuntimeName(runtimeName).build());
    if (!items.isEmpty()) {
        throw new ServiceException("A runtime with the given name already exists: " + runtimeName);
    }
}
Also used : ServiceException(org.guvnor.ala.ui.exceptions.ServiceException) RuntimeQueryResultItem(org.guvnor.ala.services.api.RuntimeQueryResultItem) Provider(org.guvnor.ala.ui.model.Provider)

Aggregations

RuntimeQueryResultItem (org.guvnor.ala.services.api.RuntimeQueryResultItem)1 ServiceException (org.guvnor.ala.ui.exceptions.ServiceException)1 Provider (org.guvnor.ala.ui.model.Provider)1