Search in sources :

Example 71 with DatasetEntity

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));
}
Also used : DatasetEntity(org.n52.series.db.beans.DatasetEntity)

Aggregations

DatasetEntity (org.n52.series.db.beans.DatasetEntity)49 Criteria (org.hibernate.Criteria)21 DataEntity (org.n52.series.db.beans.DataEntity)13 NoApplicableCodeException (org.n52.shetland.ogc.ows.exception.NoApplicableCodeException)13 ProcedureEntity (org.n52.series.db.beans.ProcedureEntity)11 Session (org.hibernate.Session)10 DetachedCriteria (org.hibernate.criterion.DetachedCriteria)10 OfferingEntity (org.n52.series.db.beans.OfferingEntity)9 HashSet (java.util.HashSet)8 OmObservationConstellation (org.n52.shetland.ogc.om.OmObservationConstellation)8 LinkedHashSet (java.util.LinkedHashSet)7 Set (java.util.Set)7 HibernateException (org.hibernate.HibernateException)7 FormatEntity (org.n52.series.db.beans.FormatEntity)7 DatastreamEntity (org.n52.series.db.beans.sta.DatastreamEntity)7 OwsExceptionReport (org.n52.shetland.ogc.ows.exception.OwsExceptionReport)7 Collection (java.util.Collection)6 LinkedList (java.util.LinkedList)6 AbstractFeatureEntity (org.n52.series.db.beans.AbstractFeatureEntity)6 PhenomenonEntity (org.n52.series.db.beans.PhenomenonEntity)6