Search in sources :

Example 1 with StackRepoDetailsJson

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

the class ImagesToImagesResponseJsonConverter method getDefaultStackInfos.

private List<StackDetailsJson> getDefaultStackInfos(Iterable<? extends StackInfo> defaultStackInfos) {
    List<StackDetailsJson> result = new ArrayList<>();
    for (StackInfo info : defaultStackInfos) {
        StackDetailsJson json = new StackDetailsJson();
        StackRepoDetailsJson repoJson = new StackRepoDetailsJson();
        Map<String, String> stackRepo = info.getRepo().getStack();
        if (stackRepo != null) {
            repoJson.setStack(stackRepo);
        }
        Map<String, String> utilRepo = info.getRepo().getUtil();
        if (utilRepo != null) {
            repoJson.setUtil(utilRepo);
        }
        Map<String, String> knoxRepo = info.getRepo().getKnox();
        if (knoxRepo != null) {
            repoJson.setKnox(knoxRepo);
        }
        json.setRepo(repoJson);
        json.setVersion(info.getVersion());
        result.add(json);
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) StackDetailsJson(com.sequenceiq.cloudbreak.api.model.imagecatalog.StackDetailsJson) StackInfo(com.sequenceiq.cloudbreak.cloud.model.component.StackInfo) StackRepoDetailsJson(com.sequenceiq.cloudbreak.api.model.imagecatalog.StackRepoDetailsJson)

Example 2 with StackRepoDetailsJson

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

the class ImagesToImagesResponseJsonConverter method convertStackRepoDetailsToJson.

private StackRepoDetailsJson convertStackRepoDetailsToJson(StackRepoDetails repo) {
    StackRepoDetailsJson json = new StackRepoDetailsJson();
    json.setStack(new HashMap<>(repo.getStack()));
    json.setUtil(new HashMap<>(repo.getUtil()));
    if (repo.getKnox() != null && !repo.getKnox().isEmpty()) {
        json.setKnox(repo.getKnox());
    }
    return json;
}
Also used : StackRepoDetailsJson(com.sequenceiq.cloudbreak.api.model.imagecatalog.StackRepoDetailsJson)

Aggregations

StackRepoDetailsJson (com.sequenceiq.cloudbreak.api.model.imagecatalog.StackRepoDetailsJson)2 StackDetailsJson (com.sequenceiq.cloudbreak.api.model.imagecatalog.StackDetailsJson)1 StackInfo (com.sequenceiq.cloudbreak.cloud.model.component.StackInfo)1 ArrayList (java.util.ArrayList)1