use of org.n52.shetland.ogc.om.values.Value in project series-rest-api by 52North.
the class TimeseriesDataController method getCollectionData.
@RequestMapping(value = "/getData", produces = { "application/json" }, method = RequestMethod.POST)
public ModelAndView getCollectionData(HttpServletResponse response, @RequestHeader(value = Parameters.HttpHeader.ACCEPT_LANGUAGE) String locale, @RequestBody RequestSimpleParameterSet query) throws Exception {
RequestUtils.overrideQueryLocaleWhenSet(locale, query);
checkIfUnknownTimeseries(query, query.getDatasets());
if (query.isSetRawFormat()) {
getRawCollectionData(response, locale, query);
return null;
}
DataCollection<QuantityData> seriesData = getTimeseriesData(query);
DataCollection<?> formattedDataCollection = format(seriesData, query.getFormat());
return new ModelAndView().addObject(formattedDataCollection.getAllSeries());
}
use of org.n52.shetland.ogc.om.values.Value in project series-rest-api by 52North.
the class TimeseriesDataController method getAsZippedCsv.
@RequestMapping(value = "/{timeseriesId}/getData", produces = { "application/zip" }, method = RequestMethod.GET)
public void getAsZippedCsv(HttpServletResponse response, @PathVariable String timeseriesId, @RequestHeader(value = Parameters.HttpHeader.ACCEPT_LANGUAGE) String locale, @RequestParam(required = false) MultiValueMap<String, String> query) throws Exception {
RequestUtils.overrideQueryLocaleWhenSet(locale, query);
IoParameters map = QueryParameters.createFromQuery(query).extendWith(MimeType.APPLICATION_ZIP.name(), Boolean.TRUE.toString());
response.setContentType(MimeType.APPLICATION_ZIP.getMimeType());
getTimeseriesAsCsv(timeseriesId, map, response);
}
use of org.n52.shetland.ogc.om.values.Value in project series-rest-api by 52North.
the class TimeseriesDataController method getCollectionChart.
@RequestMapping(value = "/getData", produces = { "image/png" }, method = RequestMethod.POST)
public void getCollectionChart(HttpServletResponse response, @RequestHeader(value = Parameters.HttpHeader.ACCEPT_LANGUAGE) String locale, @RequestBody RequestStyledParameterSet query) throws Exception {
RequestUtils.overrideQueryLocaleWhenSet(locale, query);
IoParameters map = QueryParameters.createFromQuery(query);
checkIfUnknownTimeseries(map, query.getDatasets());
RequestSimpleParameterSet parameterSet = map.mergeToSimpleParameterSet(query);
checkAgainstTimespanRestriction(parameterSet.getTimespan());
parameterSet.setGeneralize(map.isGeneralize());
parameterSet.setExpanded(map.isExpanded());
parameterSet.setBase64(map.isBase64());
response.setContentType(MimeType.IMAGE_PNG.getMimeType());
createIoFactory(parameterSet).withStyledRequest(query).createHandler(MimeType.IMAGE_PNG.toString()).writeBinary(response.getOutputStream());
}
use of org.n52.shetland.ogc.om.values.Value in project series-rest-api by 52North.
the class DataController method getSeriesReport.
@RequestMapping(value = "/{seriesId}/data", produces = { "application/pdf" }, method = RequestMethod.GET)
public void getSeriesReport(HttpServletResponse response, @PathVariable String seriesId, @RequestHeader(value = Parameters.HttpHeader.ACCEPT_LANGUAGE) String locale, @RequestParam(required = false) MultiValueMap<String, String> query) throws Exception {
RequestUtils.overrideQueryLocaleWhenSet(locale, query);
IoParameters map = QueryParameters.createFromQuery(query);
LOGGER.debug("get data collection report for '{}' with query: {}", seriesId, map);
RequestSimpleParameterSet parameters = RequestSimpleParameterSet.createForSingleSeries(seriesId, map);
checkAgainstTimespanRestriction(parameters.getTimespan());
checkForUnknownDatasetIds(map, seriesId);
final String datasetType = parameters.getValueType();
String outputFormat = MimeType.APPLICATION_PDF.toString();
response.setContentType(outputFormat);
createIoFactory(datasetType).withSimpleRequest(parameters).createHandler(outputFormat).writeBinary(response.getOutputStream());
}
use of org.n52.shetland.ogc.om.values.Value in project series-rest-api by 52North.
the class DataController method getSeriesCollectionReport.
@RequestMapping(value = "/data", produces = { "application/pdf" }, method = RequestMethod.POST)
public void getSeriesCollectionReport(HttpServletResponse response, @RequestHeader(value = Parameters.HttpHeader.ACCEPT_LANGUAGE) String locale, @RequestBody RequestStyledParameterSet parameters) throws Exception {
RequestUtils.overrideQueryLocaleWhenSet(locale, parameters);
IoParameters map = QueryParameters.createFromQuery(parameters);
LOGGER.debug("get data collection report with query: {}", map);
checkForUnknownSeriesIds(parameters, parameters.getDatasets());
checkAgainstTimespanRestriction(parameters.getTimespan());
final String datasetType = parameters.getValueType();
String outputFormat = MimeType.APPLICATION_PDF.toString();
response.setContentType(outputFormat);
createIoFactory(datasetType).withStyledRequest(map.mergeToStyledParameterSet(parameters)).withSimpleRequest(map.mergeToSimpleParameterSet(parameters)).createHandler(outputFormat).writeBinary(response.getOutputStream());
}
Aggregations