use of com.emc.storageos.db.client.model.ComputeImageServer in project coprhd-controller by CoprHD.
the class ComputeMapper method map.
public static ComputeImageRestRep map(ComputeImage from, List<ComputeImageServer> availableServers, List<ComputeImageServer> failedServers) {
if (from == null) {
return null;
}
ComputeImageRestRep to = new ComputeImageRestRep();
mapDataObjectFields(from, to);
to.setImageName(from.getImageName());
to.setImageUrl(ImageServerControllerImpl.maskImageURLPassword(from.getImageUrl()));
to.setImageType(from.getImageType());
to.setComputeImageStatus(from.getComputeImageStatus());
to.setLastImportStatusMessage(from.getLastImportStatusMessage());
List<NamedRelatedResourceRep> availableServersList = new ArrayList<NamedRelatedResourceRep>();
List<NamedRelatedResourceRep> failedServersList = new ArrayList<NamedRelatedResourceRep>();
for (ComputeImageServer server : availableServers) {
NamedRelatedResourceRep serverRep = new NamedRelatedResourceRep();
serverRep.setId(server.getId());
serverRep.setName(server.getLabel());
availableServersList.add(serverRep);
}
for (ComputeImageServer server : failedServers) {
NamedRelatedResourceRep serverRep = new NamedRelatedResourceRep();
serverRep.setId(server.getId());
serverRep.setName(server.getLabel());
failedServersList.add(serverRep);
}
to.setAvailableImageServers(availableServersList);
to.setFailedImageServers(failedServersList);
return to;
}
Aggregations