Search in sources :

Example 1 with PlatformImagesJson

use of com.sequenceiq.cloudbreak.api.model.PlatformImagesJson in project cloudbreak by hortonworks.

the class PlatformImagesToPlatformImagesJsonConverter method convert.

@Override
public PlatformImagesJson convert(PlatformImages source) {
    PlatformImagesJson json = new PlatformImagesJson();
    Map<String, Map<String, String>> images = new HashMap<>();
    for (Entry<Platform, Collection<CustomImage>> platformCollectionEntry : source.getImages().entrySet()) {
        Map<String, String> tmp = new HashMap<>();
        for (CustomImage customImage : platformCollectionEntry.getValue()) {
            tmp.put(customImage.value(), customImage.getImage());
        }
        images.put(platformCollectionEntry.getKey().value(), tmp);
    }
    Map<String, String> regex = new HashMap<>();
    for (Entry<Platform, String> platformStringEntry : source.getRegex().entrySet()) {
        regex.put(platformStringEntry.getKey().value(), platformStringEntry.getValue());
    }
    json.setImages(images);
    json.setImagesRegex(regex);
    return json;
}
Also used : Platform(com.sequenceiq.cloudbreak.cloud.model.Platform) HashMap(java.util.HashMap) PlatformImagesJson(com.sequenceiq.cloudbreak.api.model.PlatformImagesJson) CustomImage(com.sequenceiq.cloudbreak.cloud.model.CustomImage) Collection(java.util.Collection) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

PlatformImagesJson (com.sequenceiq.cloudbreak.api.model.PlatformImagesJson)1 CustomImage (com.sequenceiq.cloudbreak.cloud.model.CustomImage)1 Platform (com.sequenceiq.cloudbreak.cloud.model.Platform)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1