Search in sources :

Example 1 with ConstraintTemplate

use of com.sequenceiq.cloudbreak.domain.ConstraintTemplate in project cloudbreak by hortonworks.

the class ConstraintTemplateController method getPublic.

@Override
public ConstraintTemplateResponse getPublic(@PathVariable String name) {
    IdentityUser user = authenticatedUserService.getCbUser();
    ConstraintTemplate template = constraintTemplateService.getPublicTemplate(name, user);
    return convert(template);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) ConstraintTemplate(com.sequenceiq.cloudbreak.domain.ConstraintTemplate)

Example 2 with ConstraintTemplate

use of com.sequenceiq.cloudbreak.domain.ConstraintTemplate in project cloudbreak by hortonworks.

the class ConstraintTemplateController method getPrivates.

@Override
public Set<ConstraintTemplateResponse> getPrivates() {
    IdentityUser user = authenticatedUserService.getCbUser();
    Set<ConstraintTemplate> constraintTemplates = constraintTemplateService.retrievePrivateConstraintTemplates(user);
    return convert(constraintTemplates);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) ConstraintTemplate(com.sequenceiq.cloudbreak.domain.ConstraintTemplate)

Example 3 with ConstraintTemplate

use of com.sequenceiq.cloudbreak.domain.ConstraintTemplate in project cloudbreak by hortonworks.

the class ConstraintTemplateService method delete.

public void delete(Long id, IdentityUser user) {
    ConstraintTemplate constraintTemplate = constraintTemplateRepository.findByIdInAccount(id, user.getAccount());
    if (constraintTemplate == null) {
        throw new NotFoundException(String.format(CONSTRAINT_NOT_FOUND_MSG, id));
    }
    delete(constraintTemplate);
}
Also used : ConstraintTemplate(com.sequenceiq.cloudbreak.domain.ConstraintTemplate) NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException)

Example 4 with ConstraintTemplate

use of com.sequenceiq.cloudbreak.domain.ConstraintTemplate in project cloudbreak by hortonworks.

the class ConstraintTemplateController method getPrivate.

@Override
public ConstraintTemplateResponse getPrivate(String name) {
    IdentityUser user = authenticatedUserService.getCbUser();
    ConstraintTemplate template = constraintTemplateService.getPrivateTemplate(name, user);
    return convert(template);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) ConstraintTemplate(com.sequenceiq.cloudbreak.domain.ConstraintTemplate)

Example 5 with ConstraintTemplate

use of com.sequenceiq.cloudbreak.domain.ConstraintTemplate in project cloudbreak by hortonworks.

the class ConstraintTemplateController method convert.

private ConstraintTemplate convert(ConstraintTemplateRequest constraintTemplateRequest, boolean publicInAccount) {
    ConstraintTemplate converted = conversionService.convert(constraintTemplateRequest, ConstraintTemplate.class);
    converted.setPublicInAccount(publicInAccount);
    return converted;
}
Also used : ConstraintTemplate(com.sequenceiq.cloudbreak.domain.ConstraintTemplate)

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