Search in sources :

Example 1 with RngSource

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

the class RngDeviceMapper method map.

@Mapping(from = VmRngDevice.class, to = RngDevice.class)
public static RngDevice map(VmRngDevice entity, RngDevice template) {
    RngDevice model = (template == null) ? new RngDevice() : template;
    if (entity.getBytes() != null) {
        model.setRate(new Rate());
        model.getRate().setBytes(entity.getBytes());
        if (entity.getPeriod() != null) {
            model.getRate().setPeriod(entity.getPeriod());
        }
    }
    RngSource restSource = map(entity.getSource(), null);
    model.setSource(restSource);
    return model;
}
Also used : RngSource(org.ovirt.engine.api.model.RngSource) Rate(org.ovirt.engine.api.model.Rate) VmRngDevice(org.ovirt.engine.core.common.businessentities.VmRngDevice) RngDevice(org.ovirt.engine.api.model.RngDevice)

Example 2 with RngSource

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

the class RngDeviceMapper method mapRngSources.

public static List<RngSource> mapRngSources(Collection<VmRngDevice.Source> entity) {
    List<RngSource> result = new ArrayList<>(entity != null ? entity.size() : 0);
    if (entity != null) {
        for (VmRngDevice.Source source : entity) {
            RngSource restSource = map(source, null);
            result.add(restSource);
        }
    }
    return result;
}
Also used : RngSource(org.ovirt.engine.api.model.RngSource) ArrayList(java.util.ArrayList) VmRngDevice(org.ovirt.engine.core.common.businessentities.VmRngDevice)

Aggregations

RngSource (org.ovirt.engine.api.model.RngSource)2 VmRngDevice (org.ovirt.engine.core.common.businessentities.VmRngDevice)2 ArrayList (java.util.ArrayList)1 Rate (org.ovirt.engine.api.model.Rate)1 RngDevice (org.ovirt.engine.api.model.RngDevice)1