@Override protected HostNic postPopulate(HostNic model) { HostNic hostNIC = super.postPopulate(model); Qos qos = hostNIC.getQos(); qos.setType(QosType.HOSTNETWORK); qos.setName(null); qos.setDataCenter(null); model.setBootProtocol(BootProtocol.STATIC); return hostNIC; } }
@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; }
entity.setQos((HostNetworkQos) QosMapper.map(model.getQos(), null));
to.setQos(adaptOut(from.getQos()));