Search in sources :

Example 6 with NotFoundException

use of com.sequenceiq.cloudbreak.controller.NotFoundException in project cloudbreak by hortonworks.

the class FlexSubscriptionRequestToFlexSubscriptionConverter method convert.

@Override
public FlexSubscription convert(FlexSubscriptionRequest source) {
    FlexSubscription subscription = new FlexSubscription();
    subscription.setName(source.getName());
    subscription.setSubscriptionId(source.getSubscriptionId());
    subscription.setDefault(source.getUsedAsDefault());
    subscription.setUsedForController(source.isUsedForController());
    Long smartSenseSubscriptionId = source.getSmartSenseSubscriptionId();
    try {
        SmartSenseSubscription smartSenseSubscription = smartSenseSubscriptionService.findOneById(smartSenseSubscriptionId);
        subscription.setSmartSenseSubscription(smartSenseSubscription);
    } catch (NotFoundException ignored) {
        throw new BadRequestException("SmartSense subscription could not be found with id: " + smartSenseSubscriptionId);
    }
    return subscription;
}
Also used : FlexSubscription(com.sequenceiq.cloudbreak.domain.FlexSubscription) SmartSenseSubscription(com.sequenceiq.cloudbreak.domain.SmartSenseSubscription) NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException) BadRequestException(com.sequenceiq.cloudbreak.controller.BadRequestException)

Example 7 with NotFoundException

use of com.sequenceiq.cloudbreak.controller.NotFoundException in project cloudbreak by hortonworks.

the class TemplateService method get.

public Template get(Long id) {
    Template template = templateRepository.findOne(id);
    if (template == null) {
        throw new NotFoundException(String.format(TEMPLATE_NOT_FOUND_MSG, id));
    }
    authorizationService.hasReadPermission(template);
    return template;
}
Also used : NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException) Template(com.sequenceiq.cloudbreak.domain.Template)

Example 8 with NotFoundException

use of com.sequenceiq.cloudbreak.controller.NotFoundException in project cloudbreak by hortonworks.

the class TemplateService method delete.

public void delete(String templateName, IdentityUser user) {
    Template template = templateRepository.findByNameInAccount(templateName, user.getAccount(), user.getUserId());
    if (template == null) {
        throw new NotFoundException(String.format(TEMPLATE_NOT_FOUND_MSG, templateName));
    }
    delete(template);
}
Also used : NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException) Template(com.sequenceiq.cloudbreak.domain.Template)

Example 9 with NotFoundException

use of com.sequenceiq.cloudbreak.controller.NotFoundException in project cloudbreak by hortonworks.

the class TemplateService method delete.

public void delete(Long templateId, IdentityUser user) {
    Template template = templateRepository.findByIdInAccount(templateId, user.getAccount());
    if (template == null) {
        throw new NotFoundException(String.format(TEMPLATE_NOT_FOUND_MSG, templateId));
    }
    delete(template);
}
Also used : NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException) Template(com.sequenceiq.cloudbreak.domain.Template)

Example 10 with NotFoundException

use of com.sequenceiq.cloudbreak.controller.NotFoundException in project cloudbreak by hortonworks.

the class TopologyService method delete.

public void delete(Long topologyId, IdentityUser user) {
    Topology topology = topologyRepository.findByIdInAccount(topologyId, user.getAccount());
    if (topology == null) {
        throw new NotFoundException(String.format(TOPOLOGY_NOT_FOUND_MSG, topologyId));
    }
    delete(topology);
}
Also used : NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException) Topology(com.sequenceiq.cloudbreak.domain.Topology)

Aggregations

NotFoundException (com.sequenceiq.cloudbreak.controller.NotFoundException)50 CloudbreakImageNotFoundException (com.sequenceiq.cloudbreak.core.CloudbreakImageNotFoundException)9 Stack (com.sequenceiq.cloudbreak.domain.Stack)8 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)5 ProxyConfig (com.sequenceiq.cloudbreak.domain.ProxyConfig)5 ClusterTemplate (com.sequenceiq.cloudbreak.domain.ClusterTemplate)4 ConstraintTemplate (com.sequenceiq.cloudbreak.domain.ConstraintTemplate)4 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)4 Template (com.sequenceiq.cloudbreak.domain.Template)4 LdapConfig (com.sequenceiq.cloudbreak.domain.LdapConfig)3 AmbariClient (com.sequenceiq.ambari.client.AmbariClient)2 AutoscaleStackResponse (com.sequenceiq.cloudbreak.api.model.AutoscaleStackResponse)2 StackResponse (com.sequenceiq.cloudbreak.api.model.StackResponse)2 BadRequestException (com.sequenceiq.cloudbreak.controller.BadRequestException)2 InstanceMetaData (com.sequenceiq.cloudbreak.domain.InstanceMetaData)2 Recipe (com.sequenceiq.cloudbreak.domain.Recipe)2 SecurityGroup (com.sequenceiq.cloudbreak.domain.SecurityGroup)2 CertificateResponse (com.sequenceiq.cloudbreak.api.model.CertificateResponse)1 HttpClientConfig (com.sequenceiq.cloudbreak.client.HttpClientConfig)1 CloudConnectorException (com.sequenceiq.cloudbreak.cloud.exception.CloudConnectorException)1