use of net.sourceforge.processdash.data.ListData in project processdash by dtuma.
the class MessageDispatcher method setKnownServerMessagesIDs.
public void setKnownServerMessagesIDs(Set<String> currentServerIDs) {
ListData oldList = ListData.asListData(data.getValue(SERVER_MESSAGES));
if (oldList != null) {
ListData newList = new ListData();
for (int i = 0; i < oldList.size(); i++) {
Object oneID = oldList.get(i);
if (currentServerIDs.contains(oneID))
newList.add(oneID);
}
if (newList.size() == 0)
newList = null;
data.putValue(SERVER_MESSAGES, newList);
}
}
use of net.sourceforge.processdash.data.ListData in project processdash by dtuma.
the class WorkflowTaskPlanSummary method doGet.
@Override
protected void doGet() throws IOException {
// retrieve information about the workflow this task is a part of.
DataContext data = getDataContext();
WorkflowEnactmentHelper workflow = new WorkflowEnactmentHelper(data, getPrefix());
Map<String, String> tasks = workflow.getEnactmentTasks(TaskMapType.PhaseID);
if (tasks == null || tasks.isEmpty()) {
out.write("Location: probeSummaryNA.shtm\r\n\r\n");
return;
}
String rootPath = workflow.getRootItemPath();
tasks.remove(rootPath);
String workflowName = workflow.getWorkflowProcessName();
String workflowID = workflow.getWorkflowProcessID();
// Gather up information about the tasks in this workflow enactment.
StringBuffer uri = new StringBuffer().append(env.get("SCRIPT_PATH")).append(".shtm");
ListData fullPaths = new ListData();
ListData orphanedTimePaths = new ListData();
Map<String, ListData> coqLists = new HashMap();
for (String coqType : COQ_TYPES) coqLists.put(coqType, new ListData());
int phaseNum = 0;
for (Entry<String, String> e : tasks.entrySet()) {
String taskPath = e.getKey();
TaskNodeType nodeType = workflow.getNodeType(taskPath);
if (nodeType == TaskNodeType.Leaf || nodeType == TaskNodeType.PSP)
fullPaths.add(taskPath);
if (nodeType != TaskNodeType.Parent || hasOrphanedTime(data, taskPath)) {
String shortName = taskPath.substring(rootPath.length() + 1);
HTMLUtils.appendQuery(uri, "phases", Integer.toString(phaseNum));
HTMLUtils.appendQuery(uri, phaseNum + "_Rel_Path", shortName);
HTMLUtils.appendQuery(uri, phaseNum + "_Abs_Path", taskPath);
if (nodeType == TaskNodeType.Parent) {
orphanedTimePaths.add(taskPath);
HTMLUtils.appendQuery(uri, phaseNum + "_Orphan", "t");
}
phaseNum++;
}
String phaseID = e.getValue();
String phaseType = workflow.getWorkflowPhaseTypes().get(phaseID);
if (phaseType != null && !"PSP".equals(phaseType)) {
ListData coqList = coqLists.get(phaseType);
if (coqList == null)
coqList = coqLists.get("Failure");
coqList.add(taskPath);
}
}
// Write data into the repository for use by the plan summary form
data.putValue("Workflow_Root_Path", StringData.create(rootPath));
data.putValue("Workflow_Name", StringData.create(workflowName));
data.putValue("Workflow_ID", StringData.create(workflowID));
data.putValue("Workflow_Task_Paths", fullPaths);
data.putValue("Workflow_Orphaned_Time_Paths", orphanedTimePaths);
for (String coqType : COQ_TYPES) data.putValue("Workflow_Task_Paths/" + coqType, coqLists.get(coqType));
String html = getRequestAsString(uri.toString());
writeHeader();
out.write(html);
}
use of net.sourceforge.processdash.data.ListData in project processdash by dtuma.
the class TeamMetricsStatus method writeContents.
@Override
protected void writeContents() throws IOException {
String prefixListName = getParameter("for");
ListData prefixList = ListData.asListData(getDataContext().getSimpleValue(prefixListName));
List<ImportData> importData = getImportData(prefixList);
if (parameters.get("xml") != null)
writeXml(importData);
else
writeHtml(importData);
}
use of net.sourceforge.processdash.data.ListData in project processdash by dtuma.
the class HistDataPage method parseFormData.
public boolean parseFormData() {
// From the posted data, create the effective list of projects.
ListData probeList = new ListData();
int r = 1;
while (true) {
String taskName = (String) params.get(TASK_FIELD + r);
if (taskName == null)
break;
if (params.get(EXCLUDE_FIELD + r) == null)
probeList.add(taskName);
r++;
}
// save that list to the PROBE_SUBSET for this project.
putValue(ProbeData.PROBE_LIST_NAME, probeList);
data.waitForCalculations();
return true;
}
use of net.sourceforge.processdash.data.ListData in project processdash by dtuma.
the class SizeEstimatingTemplate method configureSETList.
protected static ListData configureSETList(DataRepository data, String prefix, String[] dataElements, int minRows, int padRows, boolean saveList) {
String[] dataNames = new String[dataElements.length];
for (int e = dataElements.length; e-- > 0; ) dataNames[e] = prefix + "/" + dataElements[e];
ListData populatedRows = new ListData();
int rowNum, lastPopulatedRow, i;
rowNum = lastPopulatedRow = -1;
ROW: while (true) {
rowNum++;
i = dataNames.length;
while (i-- > 1) if (data.getValue(replaceNum(dataNames[i], rowNum)) != null) {
lastPopulatedRow = rowNum;
populatedRows.add(Integer.toString(rowNum));
continue ROW;
}
// we can safely conclude that there is no more data.
if (rowNum - lastPopulatedRow > 20)
break ROW;
}
int extraRows = Math.max(padRows, minRows - populatedRows.size());
for (int e = 0; e < extraRows; e++) populatedRows.add(Integer.toString(lastPopulatedRow + e + 1));
if (saveList) {
String listName = dataNames[0];
String activeName = listName + "//Active";
ListData currentActiveElements = ListData.asListData(data.getValue(activeName));
ListData newActiveElements = new ListData(populatedRows);
newActiveElements.setAddAll(currentActiveElements);
data.putValue(listName, newActiveElements);
data.putValue(activeName, newActiveElements);
}
return populatedRows;
}
Aggregations