public CreateOrUpdateBond mapBonds(BusinessEntityMap<Bond> bonds, HostNic model) { Mapper<HostNic, Bond> hostNicMapper = getMapper(HostNic.class, Bond.class); Bond bond; if (model.isSetId()) { Guid nicId = asGuid(model.getId()); bond = hostNicMapper.map(model, bonds.get(nicId)); } else { Bond template = model.isSetName() ? bonds.get(model.getName()) : null; bond = hostNicMapper.map(model, template); } return CreateOrUpdateBond.fromBond(bond); }
private void completeSlaveNames(BusinessEntityMap<VdsNetworkInterface> nicsFromBackend, HostNic bond) { if (bond.isSetBonding() && bond.getBonding().isSetSlaves()) { for (HostNic slave : bond.getBonding().getSlaves().getHostNics()) { if (!slave.isSetName() && slave.isSetId()){ Guid slaveId = new Guid(slave.getId()); String slaveNameFromBackend = nicsFromBackend.get(slaveId).getName(); slave.setName(slaveNameFromBackend); } } } }
@Mapping(from = HostNic.class, to = Bond.class) public static Bond map(HostNic model, Bond template) { Bond entity = template == null ? new Bond() : template; if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId())); } if (model.isSetName()) { entity.setName(model.getName()); } if (model.isSetBonding()) { entity.setBonded(true); if (model.getBonding().isSetSlaves()) { entity.getSlaves().clear(); for (HostNic slave : model.getBonding().getSlaves().getHostNics()) { if (slave.isSetName()) { entity.getSlaves().add(slave.getName()); } } } if (model.getBonding().isSetOptions()) { entity.setBondOptions(calculateBondingOptionsString(model)); } } if (model.isSetQos()) { entity.setQos((HostNetworkQos) QosMapper.map(model.getQos(), null)); } return entity; }
if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId()));
nicLabel.setLabel(label.getId()); if (label.isSetHostNic()) { nicLabel.setNicId(label.getHostNic().isSetId() ? asGuid(label.getHostNic().getId()) : null); nicLabel.setNicName(label.getHostNic().getName());
@Mapping(from = UnmanagedNetwork.class, to = org.ovirt.engine.core.common.businessentities.UnmanagedNetwork.class) public static org.ovirt.engine.core.common.businessentities.UnmanagedNetwork map(UnmanagedNetwork model, org.ovirt.engine.core.common.businessentities.UnmanagedNetwork template) { if (model == null) { return template; } org.ovirt.engine.core.common.businessentities.UnmanagedNetwork entity = template == null ? new org.ovirt.engine.core.common.businessentities.UnmanagedNetwork() : template; if (model.isSetId()) { entity.setId(HexUtils.hex2string(model.getId())); } if (model.isSetName()) { entity.setNetworkName(model.getName()); } if (model.isSetHostNic()) { HostNic hostNic = model.getHostNic(); if (hostNic.isSetId()) { entity.setNicId(GuidUtils.asGuid(hostNic.getId())); } if (hostNic.isSetName()) { entity.setNicName(hostNic.getName()); } } return entity; }
if (hostNic.isSetId()) { entity.setNicId(GuidUtils.asGuid(hostNic.getId())); } else {
to.setHost(adaptOut(from.getHost())); if (from.isSetId()) { to.setId(from.getId());