use of net.sourceforge.processdash.ev.EVTask in project processdash by dtuma.
the class EVReport method createCsvColumns.
private List createCsvColumns() {
List result = new LinkedList();
final Map idNumbers = new HashMap();
final Map taskIDs = new HashMap();
result.add(new CsvColumn("ID") {
int id = 1;
public void doPrepWork(EVTask root, EVTask node, int depth) {
idNumbers.put(node, new Integer(id++));
}
public void write(EVTask node, int depth) {
out.print(idNumbers.get(node));
}
});
result.add(new CsvColumn("Name") {
public void write(EVTask node, int depth) {
writeStringCsvField(node.getName());
}
});
result.add(new CsvColumn("Outline_Level") {
public void write(EVTask node, int depth) {
out.print(depth);
}
});
result.add(new CsvColumn("Predecessors") {
public void doPrepWork(EVTask root, EVTask node, int depth) {
// populate the taskIDs map so we can look up dashboard tasks
// by their taskID later.
List nodeIDs = node.getTaskIDs();
if (nodeIDs != null)
for (Iterator i = nodeIDs.iterator(); i.hasNext(); ) {
String id = (String) i.next();
taskIDs.put(id, node);
}
}
public void write(EVTask node, int depth) {
List dependencies = node.getDependencies();
if (dependencies == null || dependencies.isEmpty())
return;
List predIDs = new LinkedList();
for (Iterator i = dependencies.iterator(); i.hasNext(); ) {
// find the dashboard task named by each dependency.
EVTaskDependency d = (EVTaskDependency) i.next();
String dashTaskID = d.getTaskID();
Object predTask = taskIDs.get(dashTaskID);
if (predTask == null)
continue;
// look up the ID number we assigned to it in this CSV
// export file, and add that ID number to our list.
Object csvIdNumber = idNumbers.get(predTask);
if (csvIdNumber == null)
continue;
predIDs.add(csvIdNumber);
}
if (!predIDs.isEmpty())
writeStringCsvField(StringUtils.join(predIDs, ","));
}
});
// result.add(new CsvDateColumn("Start_Date") {
// public Date getNodeDate(EVTask node) {
// return node.getPlanStartDate();
// }
// });
result.add(new CsvDateColumn("Finish_Date") {
public Date getNodeDate(EVTask node) {
Date result = node.getActualDate();
if (result == null)
result = node.getPlanDate();
return result;
}
});
result.add(new CsvColumn("Percent_Complete") {
public void writeNode(EVTask node, int depth) {
out.print("0");
}
public void writeLeaf(EVTask node, int depth) {
out.print(cleanupPercentComplete(node.getPercentCompleteText()));
}
});
// result.add(new CsvDateColumn("Actual_Start") {
// public Date getNodeDate(EVTask node) {
// return nullToNA(node.getActualStartDate());
// }
// });
//
// result.add(new CsvDateColumn("Actual_Finish") {
// public Date getNodeDate(EVTask node) {
// return nullToNA(node.getActualDate());
// }
// });
result.add(new // "Scheduled_Work") {
CsvHoursColumn(// "Scheduled_Work") {
"Duration") {
public double getNodeMinutes(EVTask node) {
return node.getPlanValue();
}
});
result.add(new // "Actual_Work") {
CsvHoursColumn(// "Actual_Work") {
"Actual_Duration") {
public double getNodeMinutes(EVTask node) {
return node.getActualDirectTime();
}
});
result.add(new CsvColumn("Resource_Names") {
public void writeLeaf(EVTask node, int depth) {
writeStringCsvField(node.getAssignedToText());
}
});
return result;
}
use of net.sourceforge.processdash.ev.EVTask in project processdash by dtuma.
the class EVCostConfidenceInterval method getTasksForTaskLists.
private static List getTasksForTaskLists(Object[] taskLists) {
Map<String, EVTaskList> uniqueLists = new HashMap<String, EVTaskList>();
getUniqueTaskLists(taskLists, uniqueLists);
ArrayList result = new ArrayList();
for (EVTaskList taskList : uniqueLists.values()) {
List<EVTask> evLeaves = taskList.getFilteredLeaves(null);
result.addAll(evLeaves);
}
return result;
}
use of net.sourceforge.processdash.ev.EVTask in project processdash by dtuma.
the class EVReport method writeCsv.
/** Generate a file of comma-separated data for use by MS Project.
*/
private void writeCsv() throws IOException {
if (evModel == null || evModel.isEmpty()) {
out.print("Status: 404 Not Found\r\n\r\n");
out.flush();
return;
}
writeContentDispositionHeader(".csv");
out.print("Content-type: text/plain\r\n\r\n");
boolean simpleCsv = Settings.getBool("ev.simpleCsvOutput", false);
List columns = null;
if (simpleCsv) {
columns = createSimpleCsvColumns();
} else {
columns = createCsvColumns();
writeCsvColumnHeaders(columns);
}
TreeTableModel merged = evModel.getMergedModel(false, false, null);
EVTask root = (EVTask) merged.getRoot();
prepCsvColumns(columns, root, root, 1);
writeCsvRows(columns, root, 1);
}
use of net.sourceforge.processdash.ev.EVTask in project processdash by dtuma.
the class EVWeekReport method getActualTimeForTask.
private double getActualTimeForTask(TableModel tasks, int i, Map<String, Map<String, Double>> actualTime) {
Object assignedTo = tasks.getValueAt(i, EVTaskList.ASSIGNED_TO_COLUMN);
Map<String, Double> timeForPerson = actualTime.get(assignedTo);
if (timeForPerson == null)
return 0;
try {
if (Settings.isPersonalMode()) {
Object taskPath = tasks.getValueAt(i, EVTaskList.TASK_FULLNAME_COLUMN);
Double timeFromPath = timeForPerson.remove(taskPath);
if (timeFromPath != null)
return timeFromPath;
}
EVTask task = (EVTask) tasks.getValueAt(i, EVTaskList.EVTASK_NODE_COLUMN);
String taskId = task.getFullTaskID();
Double timeFromId = timeForPerson.remove(taskId);
return (timeFromId == null ? 0 : timeFromId);
} finally {
if (timeForPerson.isEmpty())
actualTime.remove(assignedTo);
}
}
use of net.sourceforge.processdash.ev.EVTask in project processdash by dtuma.
the class TaskScheduleDialog method getSelectedTasks.
private List<EVTask> getSelectedTasks() {
List<EVTask> result = new ArrayList<EVTask>();
TreePath[] selectedPaths = treeTable.getTree().getSelectionPaths();
if (selectedPaths != null) {
for (TreePath path : selectedPaths) result.add((EVTask) path.getLastPathComponent());
}
return result;
}
Aggregations