Search in sources :

Example 1 with Options

use of org.ovirt.engine.api.model.Options in project ovirt-engine by oVirt.

the class V3GlusterVolumeInAdapter method adapt.

@Override
public GlusterVolume adapt(V3GlusterVolume from) {
    GlusterVolume to = new GlusterVolume();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetBricks()) {
        to.setBricks(new GlusterBricks());
        to.getBricks().getGlusterBricks().addAll(adaptIn(from.getBricks().getGlusterBricks()));
    }
    if (from.isSetCluster()) {
        to.setCluster(adaptIn(from.getCluster()));
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetDisperseCount()) {
        to.setDisperseCount(from.getDisperseCount());
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetOptions()) {
        to.setOptions(new Options());
        to.getOptions().getOptions().addAll(adaptIn(from.getOptions().getOptions()));
    }
    if (from.isSetRedundancyCount()) {
        to.setRedundancyCount(from.getRedundancyCount());
    }
    if (from.isSetReplicaCount()) {
        to.setReplicaCount(from.getReplicaCount());
    }
    if (from.isSetStatus() && from.getStatus().isSetState()) {
        to.setStatus(GlusterVolumeStatus.fromValue(from.getStatus().getState()));
    }
    if (from.isSetStripeCount()) {
        to.setStripeCount(from.getStripeCount());
    }
    if (from.isSetTransportTypes()) {
        to.setTransportTypes(new GlusterVolume.TransportTypesList());
        to.getTransportTypes().getTransportTypes().addAll(adaptTransportTypes(from));
    }
    if (from.isSetVolumeType()) {
        to.setVolumeType(GlusterVolumeType.fromValue(from.getVolumeType()));
    }
    return to;
}
Also used : Options(org.ovirt.engine.api.model.Options) V3GlusterVolume(org.ovirt.engine.api.v3.types.V3GlusterVolume) GlusterVolume(org.ovirt.engine.api.model.GlusterVolume) GlusterBricks(org.ovirt.engine.api.model.GlusterBricks)

Example 2 with Options

use of org.ovirt.engine.api.model.Options 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)

Example 3 with Options

use of org.ovirt.engine.api.model.Options in project ovirt-engine by oVirt.

the class FenceAgentMapper method addPortToOptions.

/**
 * Adds 'port' to options. The engine requires it this way, but conceptually this is wrong and the engine should
 * take care of it and not delegate this responsibility to clients (TODO).
 */
private static void addPortToOptions(Agent model) {
    if (!model.isSetOptions()) {
        model.setOptions(new Options());
    }
    Option option = new Option();
    option.setName(PORT_OPTION);
    option.setValue(String.valueOf(model.getPort()));
    model.getOptions().getOptions().add(option);
}
Also used : Options(org.ovirt.engine.api.model.Options) Option(org.ovirt.engine.api.model.Option)

Example 4 with Options

use of org.ovirt.engine.api.model.Options in project ovirt-engine by oVirt.

the class V3AgentInAdapter method adapt.

@Override
public Agent adapt(V3Agent from) {
    Agent to = new Agent();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetAddress()) {
        to.setAddress(from.getAddress());
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetConcurrent()) {
        to.setConcurrent(from.isConcurrent());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetEncryptOptions()) {
        to.setEncryptOptions(from.isEncryptOptions());
    }
    if (from.isSetHost()) {
        to.setHost(adaptIn(from.getHost()));
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetOptions()) {
        to.setOptions(new Options());
        to.getOptions().getOptions().addAll(adaptIn(from.getOptions().getOptions()));
    }
    if (from.isSetOrder()) {
        to.setOrder(from.getOrder());
    }
    if (from.isSetPassword()) {
        to.setPassword(from.getPassword());
    }
    if (from.isSetPort()) {
        to.setPort(from.getPort());
    }
    if (from.isSetType()) {
        to.setType(from.getType());
    }
    if (from.isSetUsername()) {
        to.setUsername(from.getUsername());
    }
    return to;
}
Also used : Agent(org.ovirt.engine.api.model.Agent) V3Agent(org.ovirt.engine.api.v3.types.V3Agent) Options(org.ovirt.engine.api.model.Options)

Example 5 with Options

use of org.ovirt.engine.api.model.Options in project ovirt-engine by oVirt.

the class V3BondingInAdapter method adapt.

@Override
public Bonding adapt(V3Bonding from) {
    Bonding to = new Bonding();
    if (from.isSetOptions()) {
        to.setOptions(new Options());
        to.getOptions().getOptions().addAll(adaptIn(from.getOptions().getOptions()));
    }
    if (from.isSetSlaves()) {
        to.setSlaves(new HostNics());
        to.getSlaves().getHostNics().addAll(adaptIn(from.getSlaves().getSlaves()));
    }
    return to;
}
Also used : Options(org.ovirt.engine.api.model.Options) V3Bonding(org.ovirt.engine.api.v3.types.V3Bonding) Bonding(org.ovirt.engine.api.model.Bonding) HostNics(org.ovirt.engine.api.model.HostNics)

Aggregations

Options (org.ovirt.engine.api.model.Options)6 GlusterVolume (org.ovirt.engine.api.model.GlusterVolume)2 Option (org.ovirt.engine.api.model.Option)2 ArrayList (java.util.ArrayList)1 Agent (org.ovirt.engine.api.model.Agent)1 Agents (org.ovirt.engine.api.model.Agents)1 Bonding (org.ovirt.engine.api.model.Bonding)1 GlusterBricks (org.ovirt.engine.api.model.GlusterBricks)1 HostNics (org.ovirt.engine.api.model.HostNics)1 PmProxies (org.ovirt.engine.api.model.PmProxies)1 PowerManagement (org.ovirt.engine.api.model.PowerManagement)1 TransportType (org.ovirt.engine.api.model.TransportType)1 V3Agent (org.ovirt.engine.api.v3.types.V3Agent)1 V3Bonding (org.ovirt.engine.api.v3.types.V3Bonding)1 V3GlusterVolume (org.ovirt.engine.api.v3.types.V3GlusterVolume)1 V3PowerManagement (org.ovirt.engine.api.v3.types.V3PowerManagement)1 GlusterVolumeOptionEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity)1