Search in sources :

Example 1 with GeneralizingQuantityService

use of org.n52.io.type.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.type.quantity.generalize.GeneralizingQuantityService in project series-rest-api by 52North.

the class QuantityIoProcessChain method getData.

@Override
public DataCollection<Data<QuantityValue>> getData() {
    boolean generalize = parameters.isGeneralize();
    DataService<Data<QuantityValue>> service = generalize ? new GeneralizingQuantityService(dataService) : dataService;
    return service.getData(parameters);
}
Also used : GeneralizingQuantityService(org.n52.io.type.quantity.generalize.GeneralizingQuantityService) ResultTimeClassifiedData(org.n52.io.format.ResultTimeClassifiedData) Data(org.n52.io.response.dataset.Data)

Example 3 with GeneralizingQuantityService

use of org.n52.io.type.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)

Example 4 with GeneralizingQuantityService

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

the class TimeseriesDataController method getTimeseriesData.

private DataCollection<Data<QuantityValue>> getTimeseriesData(IoParameters parameters) {
    Stopwatch stopwatch = Stopwatch.startStopwatch();
    DataCollection<Data<QuantityValue>> 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.type.quantity.generalize.GeneralizingQuantityService) Data(org.n52.io.response.dataset.Data)

Aggregations

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