Search in sources :

Example 31 with DataRepository

use of net.sourceforge.processdash.data.repository.DataRepository in project processdash by dtuma.

the class DataNameSelectElem method init.

protected void init() {
    DataRepository data = getDataRepository();
    if (data == null)
        return;
    TreeSet s = new TreeSet(DataComboBox.getAllDataNames(data));
    s.add("");
    OptionList opt = new OptionList(s);
    String html = opt.getAsHTML(BIZZARE_NAME);
    int pos = html.indexOf(BIZZARE_NAME);
    initialPart = html.substring(0, pos);
    finalPart = html.substring(pos + BIZZARE_NAME.length());
}
Also used : TreeSet(java.util.TreeSet) DataRepository(net.sourceforge.processdash.data.repository.DataRepository) OptionList(net.sourceforge.processdash.ui.OptionList)

Example 32 with DataRepository

use of net.sourceforge.processdash.data.repository.DataRepository 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)

Example 33 with DataRepository

use of net.sourceforge.processdash.data.repository.DataRepository in project processdash by dtuma.

the class AnalysisPage method configureSizeUnits.

private static void configureSizeUnits(ChartData chartData, DashboardContext ctx) {
    String workflowID = chartData.histData.getWorkflowID();
    String workflowName = chartData.histData.getWorkflowName();
    DataRepository data = ctx.getData();
    // check for an explicit setting for this workflow
    if (setSizeUnits(chartData, data, workflowID + "/Size_Units"))
        return;
    // check for a setting stored for another workflow with this name
    if (setSizeUnits(chartData, data, workflowName + "/Size_Units"))
        return;
    // check for the size unit we guessed during the current session
    if (setSizeUnits(chartData, data, workflowID + "//Size_Units_Guess"))
        return;
    // no luck so far; examine the historical data and make a best guess
    double bestSize = 0;
    String bestUnits = null;
    for (Entry<String, DataPair> e : chartData.histData.getAddedAndModifiedSizes().entrySet()) {
        double oneSize = Math.max(e.getValue().plan, e.getValue().actual);
        if (oneSize > bestSize && !isTimeUnits(e.getKey())) {
            bestSize = oneSize;
            bestUnits = e.getKey();
        }
    }
    if (bestUnits != null) {
        // if we find a good metric, use it and save our decision for the
        // rest of this session. This ensures that the charts won't silently
        // switch size units (for example, when different filters are in
        // effect), as that erratic behavior could confuse/mislead users.
        String dataName = "/Workflow_Prefs/" + workflowID + "//Size_Units_Guess";
        data.putValue(dataName, StringData.create(bestUnits));
        chartData.setPrimarySizeUnits(bestUnits);
        return;
    }
    // no actual size data is present. Use "Hours" as our guess.
    chartData.setPrimarySizeUnits("Hours");
}
Also used : DataRepository(net.sourceforge.processdash.data.repository.DataRepository) DataPair(net.sourceforge.processdash.util.DataPair)

Example 34 with DataRepository

use of net.sourceforge.processdash.data.repository.DataRepository in project processdash by dtuma.

the class AnalysisPage method loadFilter.

protected static Properties loadFilter(HttpServletRequest req) {
    DataRepository data = (DataRepository) PDashServletUtils.buildEnvironment(req).get(TinyCGI.DATA_REPOSITORY);
    SimpleData sd = data.getSimpleValue(getFilterDataName(req));
    Properties p = new Properties();
    if (sd != null && sd.test()) {
        try {
            p.load(new StringReader(sd.format()));
        } catch (IOException e) {
        // can't happen
        }
    }
    return p;
}
Also used : StringReader(java.io.StringReader) DataRepository(net.sourceforge.processdash.data.repository.DataRepository) SimpleData(net.sourceforge.processdash.data.SimpleData) IOException(java.io.IOException) Properties(java.util.Properties)

Example 35 with DataRepository

use of net.sourceforge.processdash.data.repository.DataRepository in project processdash by dtuma.

the class AnalysisPage method saveFilter.

protected void saveFilter(HttpServletRequest req, Properties filter) {
    StringWriter save = new StringWriter();
    try {
        filter.store(save, null);
    } catch (IOException ioe) {
    // can't happen
    }
    DataRepository data = (DataRepository) PDashServletUtils.buildEnvironment(req).get(TinyCGI.DATA_REPOSITORY);
    String dataName = getFilterDataName(req);
    data.putValue(dataName, StringData.create(save.toString()));
}
Also used : StringWriter(java.io.StringWriter) DataRepository(net.sourceforge.processdash.data.repository.DataRepository) IOException(java.io.IOException)

Aggregations

DataRepository (net.sourceforge.processdash.data.repository.DataRepository)37 SimpleData (net.sourceforge.processdash.data.SimpleData)11 DashHierarchy (net.sourceforge.processdash.hier.DashHierarchy)4 IOException (java.io.IOException)3 ListData (net.sourceforge.processdash.data.ListData)3 File (java.io.File)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 StringData (net.sourceforge.processdash.data.StringData)2 PropertyKey (net.sourceforge.processdash.hier.PropertyKey)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 InputStream (java.io.InputStream)1 StringReader (java.io.StringReader)1 StringWriter (java.io.StringWriter)1 URL (java.net.URL)1 URLConnection (java.net.URLConnection)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1