Search in sources :

Example 1 with V3OperatingSystem

use of org.ovirt.engine.api.v3.types.V3OperatingSystem in project ovirt-engine by oVirt.

the class V3OperatingSystemOutAdapter method adapt.

@Override
public V3OperatingSystem adapt(OperatingSystem from) {
    V3OperatingSystem to = new V3OperatingSystem();
    Boot fromBoot = from.getBoot();
    if (fromBoot != null) {
        if (fromBoot.isSetDevices()) {
            List<V3Boot> toBoot = to.getBoot();
            fromBoot.getDevices().getDevices().forEach(device -> {
                V3Boot boot = new V3Boot();
                boot.setDev(device.value());
                toBoot.add(boot);
            });
        }
    }
    if (from.isSetCmdline()) {
        to.setCmdline(from.getCmdline());
    }
    if (from.isSetInitrd()) {
        to.setInitrd(from.getInitrd());
    }
    if (from.isSetKernel()) {
        to.setKernel(from.getKernel());
    }
    if (from.isSetType()) {
        to.setType(from.getType());
    }
    if (from.isSetVersion()) {
        to.setVersion(adaptOut(from.getVersion()));
    }
    return to;
}
Also used : V3Boot(org.ovirt.engine.api.v3.types.V3Boot) V3OperatingSystem(org.ovirt.engine.api.v3.types.V3OperatingSystem) V3Boot(org.ovirt.engine.api.v3.types.V3Boot) Boot(org.ovirt.engine.api.model.Boot)

Example 2 with V3OperatingSystem

use of org.ovirt.engine.api.v3.types.V3OperatingSystem in project ovirt-engine by oVirt.

the class V3OperatingSystemInAdapter method adapt.

@Override
public OperatingSystem adapt(V3OperatingSystem from) {
    OperatingSystem to = new OperatingSystem();
    if (from.isSetBoot()) {
        Boot toBoot = new Boot();
        Boot.DevicesList toDevicesList = new Boot.DevicesList();
        List<BootDevice> toDevices = toDevicesList.getDevices();
        from.getBoot().stream().map(V3Boot::getDev).map(BootDevice::fromValue).forEach(toDevices::add);
        toBoot.setDevices(toDevicesList);
        to.setBoot(toBoot);
    }
    if (from.isSetCmdline()) {
        to.setCmdline(from.getCmdline());
    }
    if (from.isSetInitrd()) {
        to.setInitrd(from.getInitrd());
    }
    if (from.isSetKernel()) {
        to.setKernel(from.getKernel());
    }
    if (from.isSetType()) {
        to.setType(from.getType());
    }
    if (from.isSetVersion()) {
        to.setVersion(adaptIn(from.getVersion()));
    }
    return to;
}
Also used : V3OperatingSystem(org.ovirt.engine.api.v3.types.V3OperatingSystem) OperatingSystem(org.ovirt.engine.api.model.OperatingSystem) V3Boot(org.ovirt.engine.api.v3.types.V3Boot) BootDevice(org.ovirt.engine.api.model.BootDevice) V3Boot(org.ovirt.engine.api.v3.types.V3Boot) Boot(org.ovirt.engine.api.model.Boot)

Aggregations

Boot (org.ovirt.engine.api.model.Boot)2 V3Boot (org.ovirt.engine.api.v3.types.V3Boot)2 V3OperatingSystem (org.ovirt.engine.api.v3.types.V3OperatingSystem)2 BootDevice (org.ovirt.engine.api.model.BootDevice)1 OperatingSystem (org.ovirt.engine.api.model.OperatingSystem)1