use of org.ovirt.engine.api.model.TransportType in project ovirt-engine by oVirt.
the class GlusterVolumeMapper method map.
@Mapping(from = GlusterVolumeEntity.class, to = GlusterVolume.class)
public static GlusterVolume map(GlusterVolumeEntity fromVolume, GlusterVolume toVolume) {
GlusterVolume volume = toVolume != null ? toVolume : new GlusterVolume();
if (fromVolume.getId() != null) {
volume.setId(fromVolume.getId().toString());
}
if (fromVolume.getName() != null) {
volume.setName(fromVolume.getName());
}
if (fromVolume.getVolumeType() != null) {
volume.setVolumeType(map(fromVolume.getVolumeType(), null));
}
if (fromVolume.getTransportTypes() != null) {
ArrayList<TransportType> transportTypeList = new ArrayList<>();
for (org.ovirt.engine.core.common.businessentities.gluster.TransportType transportType : fromVolume.getTransportTypes()) {
transportTypeList.add(map(transportType, null));
}
volume.setTransportTypes(new GlusterVolume.TransportTypesList());
volume.getTransportTypes().getTransportTypes().addAll(transportTypeList);
}
volume.setReplicaCount(fromVolume.getReplicaCount());
volume.setStripeCount(fromVolume.getStripeCount());
volume.setDisperseCount(fromVolume.getDisperseCount());
volume.setRedundancyCount(fromVolume.getRedundancyCount());
if (fromVolume.getStatus() != null) {
volume.setStatus(mapVolumeStatus(fromVolume.getStatus()));
}
if (fromVolume.getOptions() != null) {
Options glusterOptions = new Options();
List<Option> options = glusterOptions.getOptions();
for (GlusterVolumeOptionEntity option : fromVolume.getOptions()) {
options.add(mapOption(option));
}
volume.setOptions(glusterOptions);
}
return volume;
}
Aggregations