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