use of org.n52.sos.ds.hibernate.util.ObservationTimeExtrema in project SOS by 52North.
the class EReportingValueTimeDAO method parseMinMaxPhenomenonTime.
private ObservationTimeExtrema parseMinMaxPhenomenonTime(Object[] result) {
ObservationTimeExtrema ote = new ObservationTimeExtrema();
if (result != null) {
ote.setMinPhenomenonTime(DateTimeHelper.makeDateTime(result[0]));
ote.setMaxPhenomenonTime(DateTimeHelper.makeDateTime(result[1]));
}
return ote;
}
use of org.n52.sos.ds.hibernate.util.ObservationTimeExtrema in project SOS by 52North.
the class HibernateSeriesStreamingValue method queryTimes.
@Override
protected void queryTimes() {
Session session = null;
try {
session = getSession();
ObservationTimeExtrema timeExtrema = seriesValueTimeDAO.getTimeExtremaForSeries((GetObservationRequest) request, series, temporalFilterCriterion, session);
if (timeExtrema.isSetPhenomenonTimes()) {
setPhenomenonTime(GmlHelper.createTime(timeExtrema.getMinPhenomenonTime(), timeExtrema.getMaxPhenomenonTime()));
}
if (timeExtrema.isSetResultTimes()) {
setResultTime(new TimeInstant(timeExtrema.getMaxResultTime()));
}
if (timeExtrema.isSetValidTime()) {
setValidTime(GmlHelper.createTime(timeExtrema.getMinValidTime(), timeExtrema.getMaxValidTime()));
}
} catch (OwsExceptionReport owse) {
LOGGER.error("Error while querying times", owse);
} finally {
returnSession(session);
}
}
use of org.n52.sos.ds.hibernate.util.ObservationTimeExtrema in project SOS by 52North.
the class AbstractSeriesValueTimeDAO method parseMinMaxPhenomenonTime.
private ObservationTimeExtrema parseMinMaxPhenomenonTime(Object[] result) {
ObservationTimeExtrema ote = new ObservationTimeExtrema();
if (result != null) {
ote.setMinPhenomenonTime(DateTimeHelper.makeDateTime(result[0]));
ote.setMaxPhenomenonTime(DateTimeHelper.makeDateTime(result[1]));
}
return ote;
}
use of org.n52.sos.ds.hibernate.util.ObservationTimeExtrema in project SOS by 52North.
the class AbstractSeriesValueTimeDAO method getTimeExtremaForSeries.
/**
* Get {@link ObservationTimeExtrema} for a dataset id with temporal
* filter.
*
* @param request
* {@link AbstractObservationRequest} request
* @param series
* {@link Set} of dataset ids to get time extrema for
* @param temporalFilterCriterion
* Temporal filter
* @param session
* Hibernate session
* @return Time extrema for dataset ids
* @throws OwsExceptionReport
* If an error occurs
*/
public ObservationTimeExtrema getTimeExtremaForSeries(AbstractObservationRequest request, Set<Long> series, Criterion temporalFilterCriterion, Session session) throws OwsExceptionReport {
if (request instanceof GetObservationRequest && ((GetObservationRequest) request).hasResultFilter()) {
ObservationTimeExtrema ote = new ObservationTimeExtrema();
for (SubQueryIdentifier identifier : ResultFilterRestrictions.getSubQueryIdentifier(getResultFilterClasses())) {
Criteria c = getSeriesValueCriteriaFor(request, series, temporalFilterCriterion, null, session);
checkAndAddResultFilterCriterion(c, (GetObservationRequest) request, identifier, session, new StringBuilder());
addMinMaxTimeProjection(c);
ote.expand(parseMinMaxTime((Object[]) c.uniqueResult()));
}
return ote;
} else {
Criteria c = getSeriesValueCriteriaFor(request, series, temporalFilterCriterion, null, session);
addMinMaxTimeProjection(c);
LOGGER.trace(LOG_QUERY_TIME_EXTREMA, HibernateHelper.getSqlString(c));
return parseMinMaxTime((Object[]) c.uniqueResult());
}
}
use of org.n52.sos.ds.hibernate.util.ObservationTimeExtrema in project SOS by 52North.
the class AbstractSeriesValueTimeDAO method parseMinMaxTime.
private ObservationTimeExtrema parseMinMaxTime(Object[] result) {
ObservationTimeExtrema ote = new ObservationTimeExtrema();
if (result != null) {
ote.setMinPhenomenonTime(DateTimeHelper.makeDateTime(result[0]));
ote.setMaxPhenomenonTime(DateTimeHelper.makeDateTime(result[1]));
ote.setMaxResultTime(DateTimeHelper.makeDateTime(result[2]));
if (result.length == 5) {
ote.setMinValidTime(DateTimeHelper.makeDateTime(result[3]));
ote.setMaxValidTime(DateTimeHelper.makeDateTime(result[4]));
}
}
return ote;
}
Aggregations