Search in sources :

Example 1 with ImageResponse

use of com.sequenceiq.cloudbreak.api.model.imagecatalog.ImageResponse 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;
}
Also used : ArrayList(java.util.ArrayList) BaseImageResponse(com.sequenceiq.cloudbreak.api.model.imagecatalog.BaseImageResponse) ImageResponse(com.sequenceiq.cloudbreak.api.model.imagecatalog.ImageResponse) BaseImageResponse(com.sequenceiq.cloudbreak.api.model.imagecatalog.BaseImageResponse) Image(com.sequenceiq.cloudbreak.cloud.model.catalog.Image) ImagesResponse(com.sequenceiq.cloudbreak.api.model.imagecatalog.ImagesResponse)

Aggregations

BaseImageResponse (com.sequenceiq.cloudbreak.api.model.imagecatalog.BaseImageResponse)1 ImageResponse (com.sequenceiq.cloudbreak.api.model.imagecatalog.ImageResponse)1 ImagesResponse (com.sequenceiq.cloudbreak.api.model.imagecatalog.ImagesResponse)1 Image (com.sequenceiq.cloudbreak.cloud.model.catalog.Image)1 ArrayList (java.util.ArrayList)1