use of com.sequenceiq.cloudbreak.api.model.imagecatalog.BaseImageResponse 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;
}
use of com.sequenceiq.cloudbreak.api.model.imagecatalog.BaseImageResponse in project cloudbreak by hortonworks.
the class ImagesToImagesResponseJsonConverter method convert.
@Override
public ImagesResponse convert(Images source) {
ImagesResponse res = new ImagesResponse();
List<BaseImageResponse> baseImages = getBaseImageResponses(source);
res.setBaseImages(baseImages);
List<ImageResponse> hdpImages = new ArrayList<>();
for (Image hdpImg : source.getHdpImages()) {
ImageResponse hdpImgJson = new ImageResponse();
copyImageFieldsToJson(hdpImg, hdpImgJson);
hdpImgJson.setStackDetails(convertStackDetailsToJson(hdpImg.getStackDetails()));
hdpImages.add(hdpImgJson);
}
res.setHdpImages(hdpImages);
List<ImageResponse> hdfImages = new ArrayList<>();
for (Image hdfImg : source.getHdfImages()) {
ImageResponse hdfImgJson = new ImageResponse();
copyImageFieldsToJson(hdfImg, hdfImgJson);
hdfImgJson.setStackDetails(convertStackDetailsToJson(hdfImg.getStackDetails()));
hdfImages.add(hdfImgJson);
}
res.setHdfImages(hdfImages);
return res;
}
Aggregations