Search in sources :

Example 1 with WorkflowHistDataHelper

use of net.sourceforge.processdash.tool.db.WorkflowHistDataHelper in project processdash by dtuma.

the class WorkflowPlanSummary method writeContents.

@Override
protected void writeContents() throws IOException {
    ChartData chartData = AnalysisPage.getChartData((HttpServletRequest) env.get(HttpServletRequest.class), true);
    WorkflowHistDataHelper hist = chartData.histData;
    if (hist.getWorkflowName() == null)
        throw new TinyCGIException(404, "The requested workflow was not found.");
    String title = resources.getString("Workflow.Analysis.Title") + " - " + hist.getWorkflowName();
    out.print("<html><head><title>");
    out.print(esc(title));
    out.print("</title>\n");
    out.print(cssLinkHTML());
    if (hist.isFiltering())
        out.write("<link rel='stylesheet' type='text/css' href='filter-style.css'>\n");
    out.print(HTMLUtils.scriptLinkHtml("/lib/overlib.js"));
    out.print("<style>\n");
    out.print(" .rowLabel { padding-right: 10px }\n");
    out.print(" th.plan, th.act { width: 70px; }\n");
    out.print(" td.plan, td.act { padding-right: 4px; border: 1px solid gray; text-align: right }\n");
    out.print(" #filter.collapsed .filterItem { display: none }\n");
    out.print(" #filter.expanded .filterLink { display: none }\n");
    out.print(" #defects th.plan, #defects td.plan { display: none }\n");
    out.print("</style>\n");
    out.print("<script>\n");
    out.print("    function showFilter() {\n");
    out.print("      document.getElementById('filter').className = 'expanded';\n");
    out.print("    }\n");
    out.print("</script>\n");
    out.print("</head>\n");
    out.print("<body><h1>");
    out.print(esc(title));
    out.print("</h1>\n");
    out.write("<table><tr>\n<td style='vertical-align:baseline'><h2>");
    out.print(esc(res("Summary.Title")));
    out.write("&nbsp;</td>\n");
    if (!isExporting())
        writePageSubtitle(hist);
    out.write("</tr></table>\n");
    Map<String, DataPair> sizes = hist.getAddedAndModifiedSizes();
    Map<String, DataPair> timeInPhase = hist.getTotalTimeInPhase();
    Map<String, DataPair>[] defectsByPhase = hist.getDefectsByPhase();
    for (Iterator<String> i = sizes.keySet().iterator(); i.hasNext(); ) {
        if (AnalysisPage.isTimeUnits(i.next()))
            i.remove();
    }
    writeOverallMetrics(sizes, timeInPhase, hist.getPhaseTypes());
    printTable("Size", "Added_&_Modified", sizes, Format.Number, false);
    printTable("Time_in_Phase", null, timeInPhase, Format.Time, true);
    printTimeInPhaseCharts(timeInPhase);
    if (defectsByPhase[1].get(TOTAL_KEY).actual > 0) {
        out.print("<div id=\"defects\">\n");
        setBeforeAndAfterRowLabels(timeInPhase);
        printTable("Defects_Injected", null, defectsByPhase[0], Format.Number, true);
        printTable("Defects_Removed", null, defectsByPhase[1], Format.Number, true);
        printDefectsByPhaseCharts(defectsByPhase);
        writeAdvancedDefectMetrics(hist, defectsByPhase, timeInPhase);
        out.print("</div>\n");
    }
    if (!isExportingToExcel()) {
        out.print("<hr>\n");
        out.print("<a href=\"excel.iqy?fullPage\">");
        out.print(resources.getHTML("Export_to_Excel"));
        out.print("</a>");
    }
    out.print("</body></html>\n");
    if (parameters.containsKey("debug"))
        hist.debugPrintEnactments();
}
Also used : WorkflowHistDataHelper(net.sourceforge.processdash.tool.db.WorkflowHistDataHelper) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) TinyCGIException(net.sourceforge.processdash.net.http.TinyCGIException) DataPair(net.sourceforge.processdash.util.DataPair)

Example 2 with WorkflowHistDataHelper

use of net.sourceforge.processdash.tool.db.WorkflowHistDataHelper in project processdash by dtuma.

the class ProbeDatabaseUtil method getWorkflowData.

private void getWorkflowData() {
    // retrieve the workflow phase ID of the current task
    String projectID = require(getString(PROJECT_ID, true));
    String phaseNumericID = require(getString(WORKFLOW_SOURCE_ID, false));
    String workflowPhaseID = DatabasePluginUtils.getWorkflowPhaseIdentifier(projectID, phaseNumericID);
    // retrieve the name and key of the process that owns this phase
    Object[] workflowData = (Object[]) require(QueryUtils.singleValue(query.queryHql(WORKFLOW_PROCESS_QUERY, workflowPhaseID)));
    String workflowID = (String) workflowData[0];
    workflowName = (String) workflowData[1];
    // retrieve an object for querying historical workflow data
    histData = new WorkflowHistDataHelper(query, workflowID);
    histData.setIncludedEnactments(onlyInclude);
}
Also used : WorkflowHistDataHelper(net.sourceforge.processdash.tool.db.WorkflowHistDataHelper)

Example 3 with WorkflowHistDataHelper

use of net.sourceforge.processdash.tool.db.WorkflowHistDataHelper in project processdash by dtuma.

the class AnalysisPage method getChartData.

protected static ChartData getChartData(HttpServletRequest req, boolean applyFilter) {
    ChartData result = new ChartData();
    String workflowID = req.getParameter("workflow");
    if (!StringUtils.hasValue(workflowID))
        return null;
    DashboardContext ctx = (DashboardContext) PDashServletUtils.buildEnvironment(req).get(TinyCGI.DASHBOARD_CONTEXT);
    DatabasePlugin databasePlugin = ctx.getDatabasePlugin();
    QueryUtils.waitForAllProjects(databasePlugin);
    QueryRunner query = databasePlugin.getObject(QueryRunner.class);
    result.histData = new WorkflowHistDataHelper(query, workflowID);
    if (result.histData.getWorkflowName() == null)
        return null;
    if (applyFilter)
        configureFilter(result.histData, req);
    configureSizeUnits(result, ctx);
    return result;
}
Also used : DashboardContext(net.sourceforge.processdash.DashboardContext) DatabasePlugin(net.sourceforge.processdash.tool.db.DatabasePlugin) WorkflowHistDataHelper(net.sourceforge.processdash.tool.db.WorkflowHistDataHelper) QueryRunner(net.sourceforge.processdash.tool.db.QueryRunner)

Example 4 with WorkflowHistDataHelper

use of net.sourceforge.processdash.tool.db.WorkflowHistDataHelper in project processdash by dtuma.

the class FilterAnalysisPage method doGet.

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    ChartData chartData = getChartData(req, false);
    if (chartData == null) {
        resp.sendError(HttpServletResponse.SC_NOT_FOUND, "The requested workflow was not found.");
        return;
    }
    WorkflowHistDataHelper histData = chartData.histData;
    req.setAttribute("hist", histData);
    req.setAttribute("filt", getFilter(req));
    req.setAttribute("projects", getProjects(histData));
    req.setAttribute("sizeUnits", getSizeUnits(histData));
    req.setAttribute("labels", histData.getLabels());
    req.setAttribute("personalMode", Settings.isPersonalMode());
    req.setAttribute("resources", filtRes.asJSTLMap());
    req.getRequestDispatcher("/WEB-INF/jsp/workflowAnalysisFilter.jsp").forward(req, resp);
}
Also used : WorkflowHistDataHelper(net.sourceforge.processdash.tool.db.WorkflowHistDataHelper)

Example 5 with WorkflowHistDataHelper

use of net.sourceforge.processdash.tool.db.WorkflowHistDataHelper in project processdash by dtuma.

the class AnalysisPage method saveSizeUnits.

protected void saveSizeUnits(HttpServletRequest req, String units) {
    WorkflowHistDataHelper histData = getChartData(req, false).histData;
    DataRepository data = (DataRepository) PDashServletUtils.buildEnvironment(req).get(TinyCGI.DATA_REPOSITORY);
    StringData sd = StringData.create(units);
    data.putValue("/Workflow_Prefs/" + histData.getWorkflowID() + "/Size_Units", sd);
    data.putValue("/Workflow_Prefs/" + histData.getWorkflowName() + "/Size_Units", sd);
}
Also used : DataRepository(net.sourceforge.processdash.data.repository.DataRepository) WorkflowHistDataHelper(net.sourceforge.processdash.tool.db.WorkflowHistDataHelper) StringData(net.sourceforge.processdash.data.StringData)

Aggregations

WorkflowHistDataHelper (net.sourceforge.processdash.tool.db.WorkflowHistDataHelper)5 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 DashboardContext (net.sourceforge.processdash.DashboardContext)1 StringData (net.sourceforge.processdash.data.StringData)1 DataRepository (net.sourceforge.processdash.data.repository.DataRepository)1 TinyCGIException (net.sourceforge.processdash.net.http.TinyCGIException)1 DatabasePlugin (net.sourceforge.processdash.tool.db.DatabasePlugin)1 QueryRunner (net.sourceforge.processdash.tool.db.QueryRunner)1 DataPair (net.sourceforge.processdash.util.DataPair)1