@Override protected ReportedDevice addParents(ReportedDevice model) { model.setVm(new Vm()); model.getVm().setId(vmId.toString()); 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.setVm(adaptIn(from.getVm()));