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;
}
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;
}
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);
}
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;
}
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;
}
Aggregations