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