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