use of org.n52.series.db.beans.DatasetEntity in project sensorweb-server-sta by 52North.
the class ObservationService method checkDataset.
private void checkDataset(ObservationEntity<?> observation) {
// TODO get the next first/last observation and set it
DatasetEntity dataset = observation.getDataset();
if (dataset.getFirstObservation() != null && dataset.getFirstObservation().getStaIdentifier().equals(observation.getStaIdentifier())) {
dataset.setFirstObservation(null);
dataset.setFirstQuantityValue(null);
dataset.setFirstValueAt(null);
}
if (dataset.getLastObservation() != null && dataset.getLastObservation().getStaIdentifier().equals(observation.getStaIdentifier())) {
dataset.setLastObservation(null);
dataset.setLastQuantityValue(null);
dataset.setLastValueAt(null);
}
observation.setDataset(datasetRepository.saveAndFlush(dataset));
}
Aggregations