コード例 #1
0
  @RequestMapping(
      value = "/{timeseriesId}/getData",
      produces = {"image/png"},
      method = GET)
  public void getTimeseriesChart(
      HttpServletResponse response,
      @PathVariable String timeseriesId,
      @RequestParam(required = false) MultiValueMap<String, String> query)
      throws Exception {

    checkIfUnknownTimeseries(timeseriesId);

    IoParameters map = createFromQuery(query);
    TimeseriesMetadataOutput metadata = timeseriesMetadataService.getParameter(timeseriesId, map);
    RenderingContext context =
        createContextForSingleTimeseries(metadata, map.getStyle(), map.getTimespan());
    context.setDimensions(map.getChartDimension());

    UndesignedParameterSet parameters = createForSingleTimeseries(timeseriesId, map.getTimespan());
    checkAgainstTimespanRestriction(parameters.getTimespan());

    parameters.setGeneralize(map.isGeneralize());
    parameters.setBase64(map.isBase64());
    parameters.setExpanded(map.isExpanded());

    IoHandler renderer = IoFactory.createWith(map).createIOHandler(context);
    handleBinaryResponse(response, parameters, renderer);
  }
コード例 #2
0
  @RequestMapping(
      value = "/getData",
      produces = {"image/png"},
      method = POST)
  public void getTimeseriesCollectionChart(
      HttpServletResponse response, @RequestBody DesignedParameterSet requestParameters)
      throws Exception {

    checkIfUnknownTimeseries(requestParameters.getTimeseries());

    IoParameters map = createFromQuery(requestParameters);
    UndesignedParameterSet parameters = createFromDesignedParameters(requestParameters);
    checkAgainstTimespanRestriction(parameters.getTimespan());
    parameters.setGeneralize(map.isGeneralize());
    parameters.setExpanded(map.isExpanded());
    parameters.setBase64(map.isBase64());

    String[] timeseriesIds = parameters.getTimeseries();
    TimeseriesMetadataOutput[] timeseriesMetadatas =
        timeseriesMetadataService.getParameters(timeseriesIds, map);
    RenderingContext context = createContextWith(requestParameters, timeseriesMetadatas);
    IoHandler renderer = IoFactory.createWith(map).createIOHandler(context);

    handleBinaryResponse(response, parameters, renderer);
  }