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());
}
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);
}
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");
}
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;
}
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()));
}
Aggregations