use of org.n52.sos.ds.hibernate.values.series.HibernateChunkSeriesStreamingValue in project SOS by 52North.
the class GetObservationByIdDaoImpl method querySeriesObservation.
/**
* Query the series observations for streaming datasource
*
* @param request
* The GetObservation request
* @param session
* Hibernate Session
* @return List of internal observations
* @throws OwsExceptionReport
* If an error occurs.
* @throws ConverterException
* If an error occurs during sensor description creation.
*/
private List<OmObservation> querySeriesObservation(GetObservationByIdRequest request, final Session session) throws OwsExceptionReport, ConverterException {
final long start = System.currentTimeMillis();
final List<OmObservation> result = new LinkedList<OmObservation>();
// get valid featureOfInterest identifier
List<DatasetEntity> serieses = daoFactory.getSeriesDAO().getSeries(request, session);
checkMaxNumberOfReturnedSeriesSize(serieses.size());
for (DatasetEntity series : serieses) {
ObservationStream createSosObservationFromSeries = HibernateObservationUtilities.createSosObservationFromSeries(series, request, getProcedureDescriptionFormat(request.getResponseFormat()), observationCreatorContext, session);
OmObservation observationTemplate = createSosObservationFromSeries.next();
HibernateSeriesStreamingValue streamingValue = new HibernateChunkSeriesStreamingValue(sessionHolder.getConnectionProvider(), daoFactory, request, series.getId(), observationCreatorContext.getBindingRepository(), getChunkSize());
streamingValue.setResponseFormat(request.getResponseFormat());
streamingValue.setObservationTemplate(observationTemplate);
observationTemplate.setValue(streamingValue);
result.add(observationTemplate);
}
LOGGER.debug("Time to query observations needs {} ms!", System.currentTimeMillis() - start);
return result;
}
use of org.n52.sos.ds.hibernate.values.series.HibernateChunkSeriesStreamingValue in project SOS by 52North.
the class GetObservationDaoImpl method querySeriesObservationForStreaming.
/**
* Query the series observations for streaming datasource
*
* @param request
* The GetObservation request
* @param session
* Hibernate Session
* @return List of internal observations
* @throws OwsExceptionReport
* If an error occurs.
* @throws ConverterException
* If an error occurs during sensor description creation.
*/
private List<OmObservation> querySeriesObservationForStreaming(GetObservationRequest request, GetObservationResponse response, Session session) throws OwsExceptionReport, ConverterException {
final long start = System.currentTimeMillis();
final List<OmObservation> result = new LinkedList<OmObservation>();
List<String> features = request.getFeatureIdentifiers();
Criterion temporalFilterCriterion = getTemporalFilterCriterion(request);
List<DatasetEntity> serieses = daoFactory.getSeriesDAO().getSeries(request, features, session);
checkMaxNumberOfReturnedSeriesSize(serieses.size());
int maxNumberOfValuesPerSeries = getMaxNumberOfValuesPerSeries(serieses.size());
for (DatasetEntity series : serieses) {
ObservationStream createSosObservationFromSeries = HibernateObservationUtilities.createSosObservationFromSeries(series, request, getRequestedLocale(request), getProcedureDescriptionFormat(request.getResponseFormat()), observationCreatorContext, session);
OmObservation observationTemplate = createSosObservationFromSeries.next();
HibernateSeriesStreamingValue streamingValue = new HibernateChunkSeriesStreamingValue(sessionHolder.getConnectionProvider(), daoFactory, request, series.getId(), observationCreatorContext.getBindingRepository(), getChunkSize());
streamingValue.setResponseFormat(request.getResponseFormat());
streamingValue.setTemporalFilterCriterion(temporalFilterCriterion);
streamingValue.setObservationTemplate(observationTemplate);
streamingValue.setMaxNumberOfValues(maxNumberOfValuesPerSeries);
observationTemplate.setValue(streamingValue);
result.add(observationTemplate);
}
ObservationTimeExtrema timeExtrema = daoFactory.getValueTimeDAO().getTimeExtremaForSeries(serieses, temporalFilterCriterion, session);
if (timeExtrema.isSetPhenomenonTimes()) {
response.setGlobalObservationValues(new GlobalObservationResponseValues().setPhenomenonTime(timeExtrema.getPhenomenonTime()));
}
LOGGER.debug(LOG_TIME_TO_QUERY, System.currentTimeMillis() - start);
return result;
}
Aggregations