Search in sources :

Example 1 with SeverityTypeDataSet

use of hudson.plugins.violations.graph.SeverityTypeDataSet in project violations-plugin by jenkinsci.

the class AbstractViolationsBuildAction method doGraph.

/**
     * This corresponds to the url ./graph.
     *
     * @param req
     *            the request parameters.
     * @param rsp
     *            the response.
     * @throws IOException
     *             if there is an error writing the graph
     */
public void doGraph(StaplerRequest req, StaplerResponse rsp) throws IOException {
    String type = req.getParameter("type");
    if (ChartUtil.awtProblemCause != null) {
        // not available. send out error message
        rsp.sendRedirect2(req.getContextPath() + "/images/headless.png");
        return;
    }
    getBuild().getTimestamp();
    if (!StringUtil.isBlank(type)) {
        ChartUtil.generateGraph(req, rsp, new SeverityTypeDataSet(getReport(), type).createChart(), X_SIZE, Y_SIZE);
        return;
    }
    DataSetBuilder<String, ChartUtil.NumberOnlyBuildLabel> dsb = new DataSetBuilder<String, ChartUtil.NumberOnlyBuildLabel>();
    for (ViolationsReport r : ViolationsReport.iteration(getBuild())) {
        for (String ty : r.getViolations().keySet()) {
            dsb.add(roundUp(r.getViolations().get(ty)), ty, new ChartUtil.NumberOnlyBuildLabel((Run) r.getBuild()));
        }
    }
    ChartUtil.generateGraph(req, rsp, createChart(dsb.build()), X_SIZE, Y_SIZE);
}
Also used : ChartUtil(hudson.util.ChartUtil) DataSetBuilder(hudson.util.DataSetBuilder) ViolationsReport(hudson.plugins.violations.ViolationsReport) Run(hudson.model.Run) SeverityTypeDataSet(hudson.plugins.violations.graph.SeverityTypeDataSet)

Aggregations

Run (hudson.model.Run)1 ViolationsReport (hudson.plugins.violations.ViolationsReport)1 SeverityTypeDataSet (hudson.plugins.violations.graph.SeverityTypeDataSet)1 ChartUtil (hudson.util.ChartUtil)1 DataSetBuilder (hudson.util.DataSetBuilder)1