use of org.ovirt.engine.api.model.PmProxy in project ovirt-engine by oVirt.
the class HostMapper method map.
@Mapping(from = PowerManagement.class, to = VdsStatic.class)
public static VdsStatic map(PowerManagement model, VdsStatic template) {
VdsStatic entity = template != null ? template : new VdsStatic();
if (model.isSetEnabled()) {
entity.setPmEnabled(model.isEnabled());
}
if (model.isSetAutomaticPmEnabled()) {
entity.setDisablePowerManagementPolicy(!model.isAutomaticPmEnabled());
}
if (model.isSetPmProxies()) {
List<FenceProxySourceType> fenceProxySources = model.getPmProxies().getPmProxies().stream().map(pmProxy -> FenceProxySourceType.forValue(pmProxy.getType().toString())).collect(toCollection(LinkedList::new));
entity.setFenceProxySources(fenceProxySources);
}
if (model.isSetKdumpDetection()) {
entity.setPmKdumpDetection(model.isKdumpDetection());
}
return entity;
}
use of org.ovirt.engine.api.model.PmProxy in project ovirt-engine by oVirt.
the class HostMapper method map.
@Mapping(from = VDS.class, to = PowerManagement.class)
public static PowerManagement map(VDS entity, PowerManagement template) {
PowerManagement model = template != null ? template : new PowerManagement();
if (entity.getFenceProxySources() != null) {
PmProxies pmProxies = new PmProxies();
for (FenceProxySourceType fenceProxySource : entity.getFenceProxySources()) {
PmProxy pmProxy = new PmProxy();
pmProxy.setType(map(fenceProxySource, null));
pmProxies.getPmProxies().add(pmProxy);
}
model.setPmProxies(pmProxies);
}
model.setKdumpDetection(entity.isPmKdumpDetection());
model.setEnabled(entity.isPmEnabled());
model.setAutomaticPmEnabled(!entity.isDisablePowerManagementPolicy());
return model;
}
Aggregations