Search in sources :

Example 1 with TransportType

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;
}
Also used : Options(org.ovirt.engine.api.model.Options) GlusterVolume(org.ovirt.engine.api.model.GlusterVolume) ArrayList(java.util.ArrayList) GlusterVolumeOptionEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity) Option(org.ovirt.engine.api.model.Option) TransportType(org.ovirt.engine.api.model.TransportType)

Aggregations

ArrayList (java.util.ArrayList)1 GlusterVolume (org.ovirt.engine.api.model.GlusterVolume)1 Option (org.ovirt.engine.api.model.Option)1 Options (org.ovirt.engine.api.model.Options)1 TransportType (org.ovirt.engine.api.model.TransportType)1 GlusterVolumeOptionEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity)1