use of com.sequenceiq.cloudbreak.api.model.PlatformVmtypesResponse in project cloudbreak by hortonworks.
the class CloudVmTypesToPlatformVmTypesResponseConverter method convert.
@Override
public PlatformVmtypesResponse convert(CloudVmTypes source) {
Map<String, VirtualMachinesResponse> result = new HashMap<>();
for (Entry<String, Set<VmType>> entry : source.getCloudVmResponses().entrySet()) {
Set<VmTypeJson> vmTypeJsons = new HashSet<>();
for (VmType vmType : entry.getValue()) {
vmTypeJsons.add(getConversionService().convert(vmType, VmTypeJson.class));
}
VmTypeJson defaultVmType = getConversionService().convert(source.getDefaultCloudVmResponses().get(entry.getKey()), VmTypeJson.class);
VirtualMachinesResponse virtualMachinesResponse = new VirtualMachinesResponse();
virtualMachinesResponse.setDefaultVirtualMachine(defaultVmType);
virtualMachinesResponse.setVirtualMachines(vmTypeJsons);
result.put(entry.getKey(), virtualMachinesResponse);
}
return new PlatformVmtypesResponse(result);
}
Aggregations