コード例 #1
0
  /**
   * Returns the configured trend graph.
   *
   * @param request Stapler request
   * @param response Stapler response
   * @return the trend graph
   */
  public Graph getTrendGraph(final StaplerRequest request, final StaplerResponse response) {
    GraphConfigurationView configuration = createUserConfiguration(request);
    if (configuration.hasMeaningfulGraph()) {
      return configuration.getGraphRenderer(getUrlName());
    } else {
      BuildResultGraph graphType = configuration.getGraphType();
      try {
        response.sendRedirect2(request.getContextPath() + graphType.getExampleImage());
      } catch (IOException exception) {
        LOGGER.log(Level.SEVERE, "Can't create graph: " + graphType, exception);
      }

      return null;
    }
  }