use of org.n52.io.request.IoParameters 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.io.request.IoParameters in project series-rest-api by 52North.
the class RenderingHintsExtension method getExtras.
@Override
public Map<String, Object> getExtras(DatasetOutput output, IoParameters parameters) {
if (!hasExtrasToReturn(output, parameters)) {
return Collections.emptyMap();
}
if (hasSeriesConfiguration(output)) {
final StyleProperties style = createStyle(getSeriesStyle(output));
checkForBackwardCompatiblity(output, style);
return wrapSingleIntoMap(style);
} else if (hasPhenomenonConfiguration(output)) {
final StyleProperties style = createStyle(getPhenomenonStyle(output));
checkForBackwardCompatiblity(output, style);
return wrapSingleIntoMap(style);
}
LOGGER.error("No rendering style found for {} (id={})", output, output.getId());
return Collections.emptyMap();
}
use of org.n52.io.request.IoParameters in project series-rest-api by 52North.
the class IoStyleContext method createContextForSingleSeries.
public static IoStyleContext createContextForSingleSeries(DatasetOutput metadata, IoParameters ioConfig) {
RequestStyledParameterSet parameters = ioConfig.toStyledParameterSet();
parameters.addSeriesWithStyleOptions(metadata.getId(), ioConfig.getStyle());
return createContextWith(parameters, Collections.singletonList(metadata));
}
use of org.n52.io.request.IoParameters 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.io.request.IoParameters 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());
}
}
Aggregations