use of com.sequenceiq.cloudbreak.controller.NotFoundException in project cloudbreak by hortonworks.
the class ClusterTemplateService method get.
public ClusterTemplate get(Long id) {
ClusterTemplate clusterTemplate = clusterTemplateRepository.findOne(id);
if (clusterTemplate == null) {
throw new NotFoundException(String.format("ClusterTemplate '%s' not found.", id));
}
authorizationService.hasReadPermission(clusterTemplate);
return clusterTemplate;
}
use of com.sequenceiq.cloudbreak.controller.NotFoundException in project cloudbreak by hortonworks.
the class ConstraintTemplateService method getPublicTemplate.
public ConstraintTemplate getPublicTemplate(String name, IdentityUser user) {
ConstraintTemplate constraintTemplate = constraintTemplateRepository.findOneByName(name, user.getAccount());
if (constraintTemplate == null) {
throw new NotFoundException(String.format(CONSTRAINT_NOT_FOUND_MSG, name));
}
authorizationService.hasReadPermission(constraintTemplate);
return constraintTemplate;
}
use of com.sequenceiq.cloudbreak.controller.NotFoundException in project cloudbreak by hortonworks.
the class ConstraintTemplateService method delete.
public void delete(String name, IdentityUser user) {
ConstraintTemplate constraintTemplate = constraintTemplateRepository.findByNameInAccount(name, user.getAccount(), user.getUserId());
if (constraintTemplate == null) {
throw new NotFoundException(String.format(CONSTRAINT_NOT_FOUND_MSG, name));
}
delete(constraintTemplate);
}
use of com.sequenceiq.cloudbreak.controller.NotFoundException in project cloudbreak by hortonworks.
the class ConstraintTemplateService method get.
public ConstraintTemplate get(Long id) {
ConstraintTemplate constraintTemplate = constraintTemplateRepository.findOne(id);
if (constraintTemplate == null) {
throw new NotFoundException(String.format(CONSTRAINT_NOT_FOUND_MSG, id));
}
authorizationService.hasReadPermission(constraintTemplate);
return constraintTemplate;
}
use of com.sequenceiq.cloudbreak.controller.NotFoundException in project cloudbreak by hortonworks.
the class TemplateService method getPublicTemplate.
public Template getPublicTemplate(String name, IdentityUser user) {
Template template = templateRepository.findOneByName(name, user.getAccount());
if (template == null) {
throw new NotFoundException(String.format(TEMPLATE_NOT_FOUND_MSG, name));
}
authorizationService.hasReadPermission(template);
return template;
}
Aggregations