Search in sources :

Example 6 with Images

use of com.sequenceiq.cloudbreak.cloud.model.catalog.Images in project cloudbreak by hortonworks.

the class ImagesToImagesResponseJsonConverter method getBaseImageResponses.

private List<BaseImageResponse> getBaseImageResponses(Images source) {
    List<StackDetailsJson> defaultHdpStacks = getDefaultStackInfos(defaultHDPEntries.getEntries().values());
    List<StackDetailsJson> defaultHdfStacks = getDefaultStackInfos(defaultHDFEntries.getEntries().values());
    List<BaseImageResponse> baseImages = source.getBaseImages().stream().filter(i -> defaultAmbariRepoService.getDefault(i.getOsType()) != null).map(i -> {
        BaseImageResponse imgJson = new BaseImageResponse();
        copyImageFieldsToJson(i, imgJson);
        imgJson.setHdpStacks(defaultHdpStacks);
        imgJson.setHdfStacks(defaultHdfStacks);
        imgJson.setVersion(defaultAmbariRepoService.getVersion());
        AmbariRepo ambariRepo = defaultAmbariRepoService.getDefault(i.getOsType());
        Map<String, String> repoJson = new HashMap<>();
        repoJson.put("baseurl", ambariRepo.getBaseUrl());
        repoJson.put("gpgkey", ambariRepo.getGpgKeyUrl());
        imgJson.setRepo(repoJson);
        return imgJson;
    }).collect(Collectors.toList());
    return baseImages;
}
Also used : AmbariRepo(com.sequenceiq.cloudbreak.cloud.model.AmbariRepo) DefaultHDFEntries(com.sequenceiq.cloudbreak.cloud.model.component.DefaultHDFEntries) StackRepoDetails(com.sequenceiq.cloudbreak.cloud.model.catalog.StackRepoDetails) HashMap(java.util.HashMap) StackDetails(com.sequenceiq.cloudbreak.cloud.model.catalog.StackDetails) Collectors(java.util.stream.Collectors) Image(com.sequenceiq.cloudbreak.cloud.model.catalog.Image) StackDetailsJson(com.sequenceiq.cloudbreak.api.model.imagecatalog.StackDetailsJson) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) ImagesResponse(com.sequenceiq.cloudbreak.api.model.imagecatalog.ImagesResponse) List(java.util.List) Component(org.springframework.stereotype.Component) BaseImageResponse(com.sequenceiq.cloudbreak.api.model.imagecatalog.BaseImageResponse) StackRepoDetailsJson(com.sequenceiq.cloudbreak.api.model.imagecatalog.StackRepoDetailsJson) DefaultHDPEntries(com.sequenceiq.cloudbreak.cloud.model.component.DefaultHDPEntries) ImageResponse(com.sequenceiq.cloudbreak.api.model.imagecatalog.ImageResponse) Map(java.util.Map) Images(com.sequenceiq.cloudbreak.cloud.model.catalog.Images) StackInfo(com.sequenceiq.cloudbreak.cloud.model.component.StackInfo) DefaultAmbariRepoService(com.sequenceiq.cloudbreak.service.DefaultAmbariRepoService) StackDetailsJson(com.sequenceiq.cloudbreak.api.model.imagecatalog.StackDetailsJson) AmbariRepo(com.sequenceiq.cloudbreak.cloud.model.AmbariRepo) BaseImageResponse(com.sequenceiq.cloudbreak.api.model.imagecatalog.BaseImageResponse) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

Images (com.sequenceiq.cloudbreak.cloud.model.catalog.Images)6 Image (com.sequenceiq.cloudbreak.cloud.model.catalog.Image)3 List (java.util.List)3 ImmutableSet (com.google.common.collect.ImmutableSet)2 ImagesResponse (com.sequenceiq.cloudbreak.api.model.imagecatalog.ImagesResponse)2 CloudbreakImageCatalogV2 (com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakImageCatalogV2)2 IdentityUser (com.sequenceiq.cloudbreak.common.model.user.IdentityUser)2 AuthenticatedUserService (com.sequenceiq.cloudbreak.controller.AuthenticatedUserService)2 BadRequestException (com.sequenceiq.cloudbreak.controller.BadRequestException)2 CloudbreakImageNotFoundException (com.sequenceiq.cloudbreak.core.CloudbreakImageNotFoundException)2 ImageCatalog (com.sequenceiq.cloudbreak.domain.ImageCatalog)2 UserProfile (com.sequenceiq.cloudbreak.domain.UserProfile)2 ImageCatalogRepository (com.sequenceiq.cloudbreak.repository.ImageCatalogRepository)2 AuthorizationService (com.sequenceiq.cloudbreak.service.AuthorizationService)2 AccountPreferencesService (com.sequenceiq.cloudbreak.service.account.AccountPreferencesService)2 StatedImages.statedImages (com.sequenceiq.cloudbreak.service.image.StatedImages.statedImages)2 UserProfileService (com.sequenceiq.cloudbreak.service.user.UserProfileService)2 ArrayList (java.util.ArrayList)2 Collectors (java.util.stream.Collectors)2 Inject (javax.inject.Inject)2