Search in sources :

Example 1 with GeneralizingQuantityService

use of org.n52.io.quantity.generalize.GeneralizingQuantityService in project series-rest-api by 52North.

the class TimeseriesDataController method getTimeseriesData.

private DataCollection<QuantityData> getTimeseriesData(RequestSimpleParameterSet parameters) {
    Stopwatch stopwatch = Stopwatch.startStopwatch();
    DataCollection<QuantityData> timeseriesData = parameters.isGeneralize() ? new GeneralizingQuantityService(timeseriesDataService).getData(parameters) : timeseriesDataService.getData(parameters);
    LOGGER.debug("Processing request took {} seconds.", stopwatch.stopInSeconds());
    return timeseriesData;
}
Also used : Stopwatch(org.n52.web.common.Stopwatch) GeneralizingQuantityService(org.n52.io.quantity.generalize.GeneralizingQuantityService) QuantityData(org.n52.io.response.dataset.quantity.QuantityData)

Example 2 with GeneralizingQuantityService

use of org.n52.io.quantity.generalize.GeneralizingQuantityService in project series-rest-api by 52North.

the class QuantityIoFactory method createProcessChain.

@Override
public IoProcessChain<QuantityData> createProcessChain() {
    return new IoProcessChain<QuantityData>() {

        @Override
        public DataCollection<QuantityData> getData() {
            final boolean generalize = getParameters().isGeneralize();
            DataService<QuantityData> dataService = generalize ? new GeneralizingQuantityService(getDataService()) : getDataService();
            return dataService.getData(getRequestParameters());
        }

        @Override
        public DataCollection<?> getProcessedData() {
            String format = getParameters().getFormat();
            return FormatterFactory.createFormatterFactory(format).create().format(getData());
        }
    };
}
Also used : IoProcessChain(org.n52.io.IoProcessChain) GeneralizingQuantityService(org.n52.io.quantity.generalize.GeneralizingQuantityService) QuantityData(org.n52.io.response.dataset.quantity.QuantityData)

Aggregations

GeneralizingQuantityService (org.n52.io.quantity.generalize.GeneralizingQuantityService)2 QuantityData (org.n52.io.response.dataset.quantity.QuantityData)2 IoProcessChain (org.n52.io.IoProcessChain)1 Stopwatch (org.n52.web.common.Stopwatch)1