use of net.sourceforge.processdash.tool.db.WorkflowEnactmentHelper.TaskNodeType 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);
}
Aggregations