Search in sources :

Example 1 with ClusterTemplate

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

the class ClusterTemplateController method getPublic.

@Override
public ClusterTemplateResponse getPublic(String name) {
    IdentityUser user = authenticatedUserService.getCbUser();
    ClusterTemplate clusterTemplate = clusterTemplateService.getPublicClusterTemplate(name, user);
    return conversionService.convert(clusterTemplate, ClusterTemplateResponse.class);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) ClusterTemplate(com.sequenceiq.cloudbreak.domain.ClusterTemplate)

Example 2 with ClusterTemplate

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

the class ClusterTemplateController method getPublics.

@Override
public Set<ClusterTemplateResponse> getPublics() {
    IdentityUser user = authenticatedUserService.getCbUser();
    Set<ClusterTemplate> clusterTemplates = clusterTemplateService.retrieveAccountClusterTemplates(user);
    return toJsonList(clusterTemplates);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) ClusterTemplate(com.sequenceiq.cloudbreak.domain.ClusterTemplate)

Example 3 with ClusterTemplate

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

the class ClusterTemplateController method getPrivates.

@Override
public Set<ClusterTemplateResponse> getPrivates() {
    IdentityUser user = authenticatedUserService.getCbUser();
    Set<ClusterTemplate> clusterTemplates = clusterTemplateService.retrievePrivateClusterTemplates(user);
    return toJsonList(clusterTemplates);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) ClusterTemplate(com.sequenceiq.cloudbreak.domain.ClusterTemplate)

Example 4 with ClusterTemplate

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

the class ClusterTemplateService method delete.

public void delete(Long id, IdentityUser user) {
    ClusterTemplate clusterTemplate = clusterTemplateRepository.findByIdInAccount(id, user.getAccount());
    if (clusterTemplate == null) {
        throw new NotFoundException(String.format("ClusterTemplate '%s' not found.", id));
    }
    delete(clusterTemplate);
}
Also used : ClusterTemplate(com.sequenceiq.cloudbreak.domain.ClusterTemplate) NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException)

Example 5 with ClusterTemplate

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

the class ClusterTemplateService method delete.

public void delete(String name, IdentityUser user) {
    ClusterTemplate clusterTemplate = clusterTemplateRepository.findByNameInAccount(name, user.getAccount(), user.getUserId());
    if (clusterTemplate == null) {
        throw new NotFoundException(String.format("ClusterTemplate '%s' not found.", name));
    }
    delete(clusterTemplate);
}
Also used : ClusterTemplate(com.sequenceiq.cloudbreak.domain.ClusterTemplate) NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException)

Aggregations

ClusterTemplate (com.sequenceiq.cloudbreak.domain.ClusterTemplate)11 IdentityUser (com.sequenceiq.cloudbreak.common.model.user.IdentityUser)4 NotFoundException (com.sequenceiq.cloudbreak.controller.NotFoundException)4 BadRequestException (com.sequenceiq.cloudbreak.controller.BadRequestException)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 Json (com.sequenceiq.cloudbreak.domain.json.Json)1 Transactional (javax.transaction.Transactional)1 DataIntegrityViolationException (org.springframework.dao.DataIntegrityViolationException)1