Search in sources :

Example 41 with ResultSet

use of net.sourceforge.processdash.data.util.ResultSet in project processdash by dtuma.

the class AveragingMethod method buildXYChartParams.

@Override
protected String buildXYChartParams() {
    if (getRating() > CANNOT_CALCULATE) {
        ResultSet chartData = getChartData();
        String chartDataName = histData.storeChartData(chartData, this);
        StringBuffer url = new StringBuffer();
        addParam(url, "useData", chartDataName);
        addParam(url, "title", getMethodName());
        addTrendParam(url);
        return url.substring(1);
    } else
        return null;
}
Also used : ResultSet(net.sourceforge.processdash.data.util.ResultSet)

Example 42 with ResultSet

use of net.sourceforge.processdash.data.util.ResultSet in project processdash by dtuma.

the class HistDataPage method printDataTable.

private void printDataTable(ProbeData histData, boolean full) {
    ResultSet resultSet = histData.getResultSet();
    int numRows = resultSet.numRows();
    if (numRows == 0) {
        out.print("<p>");
        out.print(resources.getHTML("HistData.No_Data_Message"));
        out.println("</p>");
        return;
    }
    if (full) {
        out.print("<p>");
        out.print(resources.getString("HistData.Data_Table_Header_HTML"));
        out.print("</p>");
    }
    String timeFootnote = getTimeFootnote(histData);
    out.print("<table id='histData' border style='margin-left:1cm'><tr><th>");
    out.print(resources.getHTML("Project_Task"));
    for (int c = 1; c <= ProbeData.EXCLUDE; c++) {
        out.print("</th><th>");
        String colName = resultSet.getColName(c);
        String displayName;
        try {
            String key = "HistData.Columns." + colName.replace(' ', '_');
            displayName = resources.getString(key);
        } catch (Exception e) {
            displayName = Translator.translate(colName);
        }
        out.print(esc(displayName));
        if (c == ProbeData.EST_TIME || c == ProbeData.ACT_TIME)
            out.print(timeFootnote);
        else if (c == ProbeData.EXCLUDE && !histData.isReportMode())
            out.print(EXCLUDE_ALL_CHECKBOX);
    }
    out.println("</th></tr>");
    for (int r = 1; r <= resultSet.numRows(); r++) {
        out.print("<tr>");
        out.print("<td>");
        out.print(esc(resultSet.getRowName(r)));
        for (int c = 1; c < ProbeData.EXCLUDE; c++) {
            out.print("</td><td align=center>");
            out.print(resultSet.format(r, c));
        }
        out.println("<td align=center>");
        if (histData.isReportMode()) {
            if (resultSet.getData(r, ProbeData.EXCLUDE) != null)
                out.print("<b style='font-family: sans-serif'>X</b>");
            else
                out.print("&nbsp;");
        } else {
            printField(TASK_FIELD + r, histData.getRowId(r));
            out.println("<input type=checkbox name='" + EXCLUDE_FIELD + r + "'");
            if (resultSet.getData(r, ProbeData.EXCLUDE) != null)
                out.print(" checked");
            out.print(">");
        }
        out.println("</td></tr>");
    }
    out.print("</table>\n");
    if (full && histData.isDatabaseMode()) {
        String databaseNote = StringUtils.findAndReplace(//
        resources.getString("HistData.Database_Footer_HTML"), "<a>", "<a href='#' onclick='location.reload(true)'>");
        out.print("<p style='margin-left:1cm'><font size=-1><i>");
        out.print(databaseNote);
        out.print("</i></font></p>");
    }
    if (full) {
        out.print("<p style='margin-left:1cm'><font size=-1><i>");
        out.print(Tutorial.annotate(resources.getString("HistData.Data_Table_Footer_HTML")));
        out.print("</i></font></p>");
    }
}
Also used : ResultSet(net.sourceforge.processdash.data.util.ResultSet)

Example 43 with ResultSet

use of net.sourceforge.processdash.data.util.ResultSet in project processdash by dtuma.

the class ProbeItemSizeHistogram method buildData.

@Override
protected void buildData() {
    int[] histogram = new int[SIZE_NAMES.size()];
    DataContext data = getDataContext();
    ListData partsAdditions = ListData.asListData(data.getSimpleValue(PARTS_LIST));
    if (partsAdditions != null) {
        for (int i = 0; i < partsAdditions.size(); i++) {
            String path = asString(partsAdditions.get(i));
            double itemCount = asDoubleData(data.getSimpleValue(path + METHODS));
            String relSize = asString(data.getSimpleValue(path + REL_SIZE));
            if (!StringUtils.hasValue(relSize) && itemCount == 0)
                continue;
            int relSizePos = SIZE_NAMES.indexOf(relSize);
            if (relSizePos == -1)
                relSizePos = UNCATEGORIZED_POS;
            if (itemCount == 0)
                itemCount = 1;
            histogram[relSizePos]++;
        }
    }
    // if no items were present in the "[BLANK]" category, don't show it.
    int len = histogram.length;
    if (histogram[len - 1] == 0)
        len--;
    ResultSet result = new ResultSet(len, 1);
    result.setColName(0, "");
    result.setColName(1, "Total # Items");
    for (int i = 0; i < len; i++) {
        result.setRowName(i + 1, SIZE_NAMES.get(i));
        result.setData(i + 1, 1, new DoubleData(histogram[i]));
    }
    this.data = result;
}
Also used : DataContext(net.sourceforge.processdash.data.DataContext) ResultSet(net.sourceforge.processdash.data.util.ResultSet) DoubleData(net.sourceforge.processdash.data.DoubleData) ListData(net.sourceforge.processdash.data.ListData)

Example 44 with ResultSet

use of net.sourceforge.processdash.data.util.ResultSet in project processdash by dtuma.

the class AnalysisPage method invokeChart.

protected Map invokeChart(Entry<Chart, Method> chart, ChartData chartData) throws ServletException {
    ResultSet resultSet;
    try {
        resultSet = (ResultSet) chart.getValue().invoke(this, chartData);
        if (resultSet == null)
            return null;
    } catch (Exception e) {
        throw new ServletException(e);
    }
    Map result = new HashMap();
    result.put("resultSet", resultSet);
    Chart metadata = chart.getKey();
    result.put("title", chartData.getRes(metadata.titleKey()));
    result.putAll(parseFormatParams(chartData, metadata.format()));
    return result;
}
Also used : ServletException(javax.servlet.ServletException) HashMap(java.util.HashMap) ResultSet(net.sourceforge.processdash.data.util.ResultSet) HashMap(java.util.HashMap) Map(java.util.Map) ServletException(javax.servlet.ServletException) IOException(java.io.IOException)

Example 45 with ResultSet

use of net.sourceforge.processdash.data.util.ResultSet in project processdash by dtuma.

the class Report5 method buildData.

/** create the data upon which this chart is based. */
protected void buildData() {
    initValues();
    DefectAnalyzer.refineParams(parameters, getDataContext());
    DefectAnalyzer.run(getPSPProperties(), getDataRepository(), getPrefix(), parameters, this);
    int numRows = defectData.size();
    data = new ResultSet(numRows, 1);
    data.setColName(0, resources.getString("Defect_Type"));
    data.setColName(1, resources.getString(KEYS[reportType] + "_Axis"));
    if (parameters.get("title") == null)
        parameters.put("title", resources.getString(KEYS[reportType] + "_Title"));
    Iterator i = defectData.keySet().iterator();
    String defectType;
    while (i.hasNext()) {
        defectType = (String) i.next();
        data.setRowName(numRows, defectType);
        data.setData(numRows, 1, new DoubleData(getRow(defectType)[0]));
        numRows--;
    }
    data.sortBy(1, true);
}
Also used : ResultSet(net.sourceforge.processdash.data.util.ResultSet) Iterator(java.util.Iterator) DoubleData(net.sourceforge.processdash.data.DoubleData)

Aggregations

ResultSet (net.sourceforge.processdash.data.util.ResultSet)57 Enactment (net.sourceforge.processdash.tool.db.WorkflowHistDataHelper.Enactment)11 DoubleData (net.sourceforge.processdash.data.DoubleData)5 ArrayList (java.util.ArrayList)4 ListData (net.sourceforge.processdash.data.ListData)3 DataPair (net.sourceforge.processdash.util.DataPair)3 Iterator (java.util.Iterator)2 List (java.util.List)2 Map (java.util.Map)2 PDashQuery (net.sourceforge.processdash.api.PDashQuery)2 PhaseType (net.sourceforge.processdash.tool.db.WorkflowHistDataHelper.PhaseType)2 IOException (java.io.IOException)1 Calendar (java.util.Calendar)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 ServletException (javax.servlet.ServletException)1 DataContext (net.sourceforge.processdash.data.DataContext)1 StringData (net.sourceforge.processdash.data.StringData)1