use of org.n52.shetland.ogc.om.values.Value in project series-rest-api by 52North.
the class DataController method getRawSeriesData.
@RequestMapping(value = "/{seriesId}/data", method = RequestMethod.GET, params = { RawFormats.RAW_FORMAT })
public void getRawSeriesData(HttpServletResponse response, @PathVariable String seriesId, @RequestHeader(value = Parameters.HttpHeader.ACCEPT_LANGUAGE) String locale, @RequestParam MultiValueMap<String, String> query) {
RequestUtils.overrideQueryLocaleWhenSet(locale, query);
IoParameters map = QueryParameters.createFromQuery(query);
checkForUnknownDatasetIds(map, seriesId);
LOGGER.debug("getSeriesCollection() with query: {}", map);
RequestSimpleParameterSet parameters = RequestSimpleParameterSet.createForSingleSeries(seriesId, map);
writeRawData(parameters, response);
}
use of org.n52.shetland.ogc.om.values.Value in project series-rest-api by 52North.
the class StationsParameterController method getItem.
@RequestMapping(value = "/{item}", method = RequestMethod.GET)
public ModelAndView getItem(@PathVariable("item") String procedureId, @RequestHeader(value = Parameters.HttpHeader.ACCEPT_LANGUAGE) String locale, @RequestParam(required = false) MultiValueMap<String, String> query) {
RequestUtils.overrideQueryLocaleWhenSet(locale, query);
IoParameters map = QueryParameters.createFromQuery(query);
map = IoParameters.ensureBackwardsCompatibility(map);
// TODO check parameters and throw BAD_REQUEST if invalid
Stopwatch stopwatch = Stopwatch.startStopwatch();
Object result = parameterService.getParameter(procedureId, map);
logRequestTime(stopwatch);
if (result == null) {
throw new ResourceNotFoundException("Found no station with given id.");
}
return new ModelAndView().addObject(result);
}
use of org.n52.shetland.ogc.om.values.Value in project series-rest-api by 52North.
the class StationsParameterController method getCollection.
@RequestMapping(method = RequestMethod.GET)
public ModelAndView getCollection(@RequestHeader(value = Parameters.HttpHeader.ACCEPT_LANGUAGE) String locale, @RequestParam(required = false) MultiValueMap<String, String> query) {
RequestUtils.overrideQueryLocaleWhenSet(locale, query);
IoParameters map = QueryParameters.createFromQuery(query);
map = IoParameters.ensureBackwardsCompatibility(map);
if (map.isExpanded()) {
Stopwatch stopwatch = Stopwatch.startStopwatch();
OutputCollection<?> result = parameterService.getExpandedParameters(map);
logRequestTime(stopwatch);
// TODO add paging
return new ModelAndView().addObject(result.getItems());
} else {
Stopwatch stopwatch = Stopwatch.startStopwatch();
OutputCollection<?> result = parameterService.getCondensedParameters(map);
logRequestTime(stopwatch);
// TODO add paging
return new ModelAndView().addObject(result.getItems());
}
}
use of org.n52.shetland.ogc.om.values.Value in project series-rest-api by 52North.
the class TimeseriesDataController method getRawData.
@RequestMapping(value = "/{timeseriesId}/getData", method = RequestMethod.GET, params = { RawFormats.RAW_FORMAT })
public void getRawData(HttpServletResponse response, @PathVariable String timeseriesId, @RequestHeader(value = Parameters.HttpHeader.ACCEPT_LANGUAGE) String locale, @RequestParam MultiValueMap<String, String> query) {
RequestUtils.overrideQueryLocaleWhenSet(locale, query);
IoParameters map = QueryParameters.createFromQuery(query);
checkIfUnknownTimeseries(map, timeseriesId);
RequestSimpleParameterSet parameters = RequestSimpleParameterSet.createForSingleSeries(timeseriesId, map);
processRawDataRequest(response, parameters);
}
use of org.n52.shetland.ogc.om.values.Value in project series-rest-api by 52North.
the class TimeseriesDataController method getAsCsv.
@RequestMapping(value = "/{timeseriesId}/getData", produces = { "text/csv" }, method = RequestMethod.GET)
public void getAsCsv(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);
getTimeseriesAsCsv(timeseriesId, map, response);
}
Aggregations