Search in sources :

Example 1 with Product

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

the class HostDeviceMapper method map.

@Mapping(from = org.ovirt.engine.core.common.businessentities.HostDevice.class, to = HostDevice.class)
public static HostDevice map(org.ovirt.engine.core.common.businessentities.HostDevice entity, HostDevice model) {
    if (model == null) {
        model = new HostDevice();
    }
    if (!model.isSetHost()) {
        model.setHost(new Host());
    }
    model.getHost().setId(entity.getHostId().toString());
    model.setId(HexUtils.string2hex(entity.getDeviceName()));
    model.setName(entity.getDeviceName());
    model.setCapability(entity.getCapability());
    model.setParentDevice(getSameHostDeviceReference(entity.getHostId(), entity.getParentDeviceName()));
    model.setDriver(entity.getDriver());
    if (entity.getProductId() != null || entity.getProductName() != null) {
        if (!model.isSetProduct()) {
            model.setProduct(new Product());
        }
        model.getProduct().setId(entity.getProductId());
        model.getProduct().setName(entity.getProductName());
    }
    if (entity.getVendorId() != null || entity.getVendorName() != null) {
        if (!model.isSetVendor()) {
            model.setVendor(new Vendor());
        }
        model.getVendor().setId(entity.getVendorId());
        model.getVendor().setName(entity.getVendorName());
    }
    model.setIommuGroup(entity.getIommuGroup());
    if (entity.getParentPhysicalFunction() != null) {
        model.setPhysicalFunction(getSameHostDeviceReference(entity.getHostId(), entity.getParentPhysicalFunction()));
    }
    model.setVirtualFunctions(entity.getTotalVirtualFunctions());
    if (entity.getVmId() != null) {
        model.setVm(new Vm());
        model.getVm().setId(entity.getVmId().toString());
    }
    return model;
}
Also used : HostDevice(org.ovirt.engine.api.model.HostDevice) Vm(org.ovirt.engine.api.model.Vm) Product(org.ovirt.engine.api.model.Product) Host(org.ovirt.engine.api.model.Host) Vendor(org.ovirt.engine.api.model.Vendor)

Aggregations

Host (org.ovirt.engine.api.model.Host)1 HostDevice (org.ovirt.engine.api.model.HostDevice)1 Product (org.ovirt.engine.api.model.Product)1 Vendor (org.ovirt.engine.api.model.Vendor)1 Vm (org.ovirt.engine.api.model.Vm)1