/** * Get a sensor from database, associate the found readouts with it, and save them. * * @param sen * @param readouts */ private void addReadoutsToSensor(Sensor sen, Set<Readout> readouts) { Sensor sensor = sensorService.get(sen.getId()); readouts.forEach( r -> { r.setSensor(sensor); }); readoutService.save(readouts); }
/** * No need to add readouts to the same object, which could be the case when we first read an * source. * * @param s * @param sensor * @return */ private static boolean equalsButNotTheSameInstance(Sensor s, Sensor sensor) { return s.equals(sensor) && s != sensor; }