@Override protected ReportedDevice postPopulate(ReportedDevice model) { model.setType(ReportedDeviceType.NETWORK); for (Ip ip : model.getIps().getIps()) { ip.setVersion(IpVersion.V4); ip.setGateway(null); ip.setNetmask(null); } return model; }
@Mapping(from = VmGuestAgentInterface.class, to = ReportedDevice.class) public static ReportedDevice map(VmGuestAgentInterface entity, ReportedDevice model) { model = model == null ? new ReportedDevice() : model; if (entity.getVmId() != null) { model.setVm(new Vm()); model.getVm().setId(entity.getVmId().toString()); } if (entity.getMacAddress() != null) { Mac mac = new Mac(); mac.setAddress(entity.getMacAddress()); model.setMac(mac); } model.setName(entity.getInterfaceName()); model.setDescription("guest reported data"); model.setId(generateDeviceId(entity).toString()); model.setType(ReportedDeviceType.NETWORK); mapIps(entity, model); return model; }
to.setType(ReportedDeviceType.fromValue(from.getType()));