/** * Returns whether the enable trend graph link should be shown. * * @param request the request to get the cookie from * @return the graph configuration */ public boolean canShowEnableTrendLink(final StaplerRequest request) { GraphConfigurationView configuration = createUserConfiguration(request); if (configuration.hasMeaningfulGraph()) { return !configuration.isDeactivated() && !configuration.isVisible(); } return false; }
/** * 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; } }
/** * Returns whether the trend graph is visible. * * @param request the request to get the cookie from * @return <code>true</code> if the trend is visible */ public boolean isTrendVisible(final StaplerRequest request) { GraphConfigurationView configuration = createUserConfiguration(request); return configuration.isVisible() && configuration.hasMeaningfulGraph(); }