Search in sources :

Example 11 with ConstraintTemplate

use of com.sequenceiq.cloudbreak.domain.ConstraintTemplate 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);
}
Also used : ConstraintTemplate(com.sequenceiq.cloudbreak.domain.ConstraintTemplate) NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException)

Example 12 with ConstraintTemplate

use of com.sequenceiq.cloudbreak.domain.ConstraintTemplate 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;
}
Also used : ConstraintTemplate(com.sequenceiq.cloudbreak.domain.ConstraintTemplate) NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException)

Aggregations

ConstraintTemplate (com.sequenceiq.cloudbreak.domain.ConstraintTemplate)12 IdentityUser (com.sequenceiq.cloudbreak.common.model.user.IdentityUser)4 NotFoundException (com.sequenceiq.cloudbreak.controller.NotFoundException)4 BadRequestException (com.sequenceiq.cloudbreak.controller.BadRequestException)1 InstanceGroup (com.sequenceiq.cloudbreak.domain.InstanceGroup)1