Search in sources :

Example 1 with BlueprintView

use of com.sequenceiq.cloudbreak.domain.view.BlueprintView in project cloudbreak by hortonworks.

the class BlueprintService method getAllAvailableViewInWorkspaceAndFilterBySdxReady.

public Set<BlueprintView> getAllAvailableViewInWorkspaceAndFilterBySdxReady(Long workspaceId, Boolean withSdx) {
    User user = getLoggedInUser();
    Workspace workspace = getWorkspaceService().get(workspaceId, user);
    updateDefaultBlueprintCollection(workspace);
    Set<BlueprintView> allByNotDeletedInWorkspace = blueprintViewRepository.findAllByNotDeletedInWorkspace(workspaceId);
    allByNotDeletedInWorkspace = allByNotDeletedInWorkspace.stream().filter(b -> blueprintListFilters.isDistroXDisplayed(b)).collect(Collectors.toSet());
    if (withSdx) {
        return allByNotDeletedInWorkspace;
    }
    return allByNotDeletedInWorkspace.stream().filter(it -> !blueprintListFilters.isDatalakeBlueprint(it)).collect(Collectors.toSet());
}
Also used : LoggerFactory(org.slf4j.LoggerFactory) ClusterService(com.sequenceiq.cloudbreak.service.cluster.ClusterService) StringUtils(org.apache.commons.lang3.StringUtils) ThreadBasedUserCrnProvider(com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider) TransactionService(com.sequenceiq.cloudbreak.common.service.TransactionService) CdpResourceType(com.sequenceiq.common.api.type.CdpResourceType) Pair(org.apache.commons.lang3.tuple.Pair) Map(java.util.Map) AuthorizationResourceType(com.sequenceiq.authorization.resource.AuthorizationResourceType) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) NotFoundException(com.sequenceiq.cloudbreak.common.exception.NotFoundException) EnumSet(java.util.EnumSet) CloudResourceAdvisor(com.sequenceiq.cloudbreak.service.stack.CloudResourceAdvisor) ConstraintViolationException(org.hibernate.exception.ConstraintViolationException) FieldError(org.springframework.validation.FieldError) WorkspaceResourceRepository(com.sequenceiq.cloudbreak.workspace.repository.workspace.WorkspaceResourceRepository) Collection(java.util.Collection) BlueprintView(com.sequenceiq.cloudbreak.domain.view.BlueprintView) Set(java.util.Set) DELETE_COMPLETED(com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status.DELETE_COMPLETED) NotNull(javax.validation.constraints.NotNull) Crn(com.sequenceiq.cloudbreak.auth.crn.Crn) Collectors(java.util.stream.Collectors) DEFAULT(com.sequenceiq.cloudbreak.api.endpoint.v4.common.ResourceStatus.DEFAULT) SERVICE_MANAGED(com.sequenceiq.cloudbreak.api.endpoint.v4.common.ResourceStatus.SERVICE_MANAGED) List(java.util.List) CmCloudStorageConfigProvider(com.sequenceiq.cloudbreak.cmtemplate.cloudstorage.CmCloudStorageConfigProvider) MapBindingResult(org.springframework.validation.MapBindingResult) MDCUtils(com.sequenceiq.cloudbreak.logger.MDCUtils) ConfigQueryEntry(com.sequenceiq.common.api.cloudstorage.query.ConfigQueryEntry) Optional(java.util.Optional) HueWorkaroundValidatorService(com.sequenceiq.cloudbreak.validation.HueWorkaroundValidatorService) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) BlueprintStatusView(com.sequenceiq.cloudbreak.domain.projection.BlueprintStatusView) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) PlatformRecommendation(com.sequenceiq.cloudbreak.cloud.model.PlatformRecommendation) ResourceStatus(com.sequenceiq.cloudbreak.api.endpoint.v4.common.ResourceStatus) ScaleRecommendation(com.sequenceiq.cloudbreak.cloud.model.ScaleRecommendation) BlueprintRepository(com.sequenceiq.cloudbreak.repository.BlueprintRepository) OwnerAssignmentService(com.sequenceiq.authorization.service.OwnerAssignmentService) MDCBuilder(com.sequenceiq.cloudbreak.logger.MDCBuilder) HashMap(java.util.HashMap) CompositeAuthResourcePropertyProvider(com.sequenceiq.authorization.service.CompositeAuthResourcePropertyProvider) BlueprintViewRepository(com.sequenceiq.cloudbreak.repository.BlueprintViewRepository) USER_MANAGED(com.sequenceiq.cloudbreak.api.endpoint.v4.common.ResourceStatus.USER_MANAGED) HashSet(java.util.HashSet) Inject(javax.inject.Inject) CrnResourceDescriptor(com.sequenceiq.cloudbreak.auth.crn.CrnResourceDescriptor) HueRoles(com.sequenceiq.cloudbreak.cmtemplate.configproviders.hue.HueRoles) ObjectUtils(org.apache.commons.lang3.ObjectUtils) Service(org.springframework.stereotype.Service) FileSystemConfigQueryObject(com.sequenceiq.cloudbreak.template.filesystem.FileSystemConfigQueryObject) Builder(com.sequenceiq.cloudbreak.template.filesystem.FileSystemConfigQueryObject.Builder) CentralBlueprintParameterQueryService(com.sequenceiq.cloudbreak.cmtemplate.CentralBlueprintParameterQueryService) NotFoundException.notFound(com.sequenceiq.cloudbreak.common.exception.NotFoundException.notFound) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) Logger(org.slf4j.Logger) AutoscaleRecommendation(com.sequenceiq.cloudbreak.cloud.model.AutoscaleRecommendation) BlueprintLoaderService(com.sequenceiq.cloudbreak.init.blueprint.BlueprintLoaderService) DEFAULT_DELETED(com.sequenceiq.cloudbreak.api.endpoint.v4.common.ResourceStatus.DEFAULT_DELETED) RegionAwareCrnGenerator(com.sequenceiq.cloudbreak.auth.crn.RegionAwareCrnGenerator) CompactView(com.sequenceiq.cloudbreak.domain.view.CompactView) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace) NameOrCrn(com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn) ClusterTemplateViewService(com.sequenceiq.cloudbreak.service.template.ClusterTemplateViewService) User(com.sequenceiq.cloudbreak.workspace.model.User) BlueprintUtils(com.sequenceiq.cloudbreak.cmtemplate.utils.BlueprintUtils) StackType(com.sequenceiq.cloudbreak.api.endpoint.v4.common.StackType) AbstractWorkspaceAwareResourceService(com.sequenceiq.cloudbreak.service.AbstractWorkspaceAwareResourceService) User(com.sequenceiq.cloudbreak.workspace.model.User) BlueprintView(com.sequenceiq.cloudbreak.domain.view.BlueprintView) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace)

Example 2 with BlueprintView

use of com.sequenceiq.cloudbreak.domain.view.BlueprintView in project cloudbreak by hortonworks.

the class BlueprintListFiltersTest method createBlueprintView.

private BlueprintView createBlueprintView(ResourceStatus status, String version, Boolean sdxReady) {
    BlueprintView blueprint = new BlueprintView();
    blueprint.setStatus(status);
    blueprint.setStackVersion(version);
    if (sdxReady != null) {
        blueprint.setTags(Json.silent(Map.of("shared_services_ready", sdxReady)));
    }
    return blueprint;
}
Also used : BlueprintView(com.sequenceiq.cloudbreak.domain.view.BlueprintView)

Example 3 with BlueprintView

use of com.sequenceiq.cloudbreak.domain.view.BlueprintView in project cloudbreak by hortonworks.

the class BlueprintServiceTest method getBlueprintView.

private BlueprintView getBlueprintView(String name, ResourceStatus status, Boolean sdxReady) {
    BlueprintView blueprint = new BlueprintView();
    blueprint.setName(name);
    blueprint.setWorkspace(getWorkspace());
    blueprint.setStatus(status);
    blueprint.setResourceCrn("someCrn");
    if (sdxReady != null) {
        blueprint.setTags(Json.silent(Map.of("shared_services_ready", sdxReady)));
    }
    return blueprint;
}
Also used : BlueprintView(com.sequenceiq.cloudbreak.domain.view.BlueprintView)

Example 4 with BlueprintView

use of com.sequenceiq.cloudbreak.domain.view.BlueprintView in project cloudbreak by hortonworks.

the class BlueprintServiceTest method getBlueprintView.

private BlueprintView getBlueprintView(String name, Json attribute) {
    BlueprintView blueprint = new BlueprintView();
    blueprint.setName(name);
    blueprint.setWorkspace(getWorkspace());
    blueprint.setStatus(DEFAULT);
    blueprint.setResourceCrn("someCrn");
    blueprint.setTags(attribute);
    return blueprint;
}
Also used : BlueprintView(com.sequenceiq.cloudbreak.domain.view.BlueprintView)

Example 5 with BlueprintView

use of com.sequenceiq.cloudbreak.domain.view.BlueprintView in project cloudbreak by hortonworks.

the class StackListItemToStackApiViewConverter method getBlueprintView.

private BlueprintView getBlueprintView(StackListItem item) {
    BlueprintView blueprintResponse = new BlueprintView();
    blueprintResponse.setId(item.getBlueprintId());
    blueprintResponse.setResourceCrn(item.getBlueprintCrn());
    blueprintResponse.setCreated(item.getBlueprintCreated());
    blueprintResponse.setName(item.getBlueprintName());
    blueprintResponse.setStackType(item.getStackType());
    blueprintResponse.setStackVersion(item.getStackVersion());
    blueprintResponse.setHostGroupCount(item.getHostGroupCount());
    blueprintResponse.setStatus(item.getBlueprintStatus());
    blueprintResponse.setTags(item.getBlueprintTags());
    blueprintResponse.setBlueprintUpgradeOption(item.getBlueprintUpgradeOption());
    return blueprintResponse;
}
Also used : BlueprintView(com.sequenceiq.cloudbreak.domain.view.BlueprintView)

Aggregations

BlueprintView (com.sequenceiq.cloudbreak.domain.view.BlueprintView)5 AuthorizationResourceType (com.sequenceiq.authorization.resource.AuthorizationResourceType)1 CompositeAuthResourcePropertyProvider (com.sequenceiq.authorization.service.CompositeAuthResourcePropertyProvider)1 OwnerAssignmentService (com.sequenceiq.authorization.service.OwnerAssignmentService)1 ResourceStatus (com.sequenceiq.cloudbreak.api.endpoint.v4.common.ResourceStatus)1 DEFAULT (com.sequenceiq.cloudbreak.api.endpoint.v4.common.ResourceStatus.DEFAULT)1 DEFAULT_DELETED (com.sequenceiq.cloudbreak.api.endpoint.v4.common.ResourceStatus.DEFAULT_DELETED)1 SERVICE_MANAGED (com.sequenceiq.cloudbreak.api.endpoint.v4.common.ResourceStatus.SERVICE_MANAGED)1 USER_MANAGED (com.sequenceiq.cloudbreak.api.endpoint.v4.common.ResourceStatus.USER_MANAGED)1 StackType (com.sequenceiq.cloudbreak.api.endpoint.v4.common.StackType)1 DELETE_COMPLETED (com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status.DELETE_COMPLETED)1 NameOrCrn (com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn)1 ThreadBasedUserCrnProvider (com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider)1 Crn (com.sequenceiq.cloudbreak.auth.crn.Crn)1 CrnResourceDescriptor (com.sequenceiq.cloudbreak.auth.crn.CrnResourceDescriptor)1 RegionAwareCrnGenerator (com.sequenceiq.cloudbreak.auth.crn.RegionAwareCrnGenerator)1 AutoscaleRecommendation (com.sequenceiq.cloudbreak.cloud.model.AutoscaleRecommendation)1 PlatformRecommendation (com.sequenceiq.cloudbreak.cloud.model.PlatformRecommendation)1 ScaleRecommendation (com.sequenceiq.cloudbreak.cloud.model.ScaleRecommendation)1 CentralBlueprintParameterQueryService (com.sequenceiq.cloudbreak.cmtemplate.CentralBlueprintParameterQueryService)1