Java Code Examples for net.sf.mpxj.Task#hasChildTasks()
The following examples show how to use
net.sf.mpxj.Task#hasChildTasks() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProjectCommanderReader.java From mpxj with GNU Lesser General Public License v2.1 | 6 votes |
/** * Propagate start and end dates to summary tasks. * * @param parentTask parent task */ private void updateDates(Task parentTask) { if (parentTask.hasChildTasks()) { Date plannedStartDate = parentTask.getStart(); Date plannedFinishDate = parentTask.getFinish(); for (Task task : parentTask.getChildTasks()) { updateDates(task); plannedStartDate = DateHelper.min(plannedStartDate, task.getStart()); plannedFinishDate = DateHelper.max(plannedFinishDate, task.getFinish()); } parentTask.setStart(plannedStartDate); parentTask.setFinish(plannedFinishDate); } }
Example 2
Source File: SynchroReader.java From mpxj with GNU Lesser General Public License v2.1 | 6 votes |
/** * Recursively update parent task dates. * * @param parentTask parent task */ private void updateDates(Task parentTask) { if (parentTask.hasChildTasks()) { Date plannedStartDate = null; Date plannedFinishDate = null; for (Task task : parentTask.getChildTasks()) { updateDates(task); plannedStartDate = DateHelper.min(plannedStartDate, task.getStart()); plannedFinishDate = DateHelper.max(plannedFinishDate, task.getFinish()); } parentTask.setStart(plannedStartDate); parentTask.setFinish(plannedFinishDate); } }
Example 3
Source File: AstaReader.java From mpxj with GNU Lesser General Public License v2.1 | 5 votes |
/** * Retrieve all child tasks below this task to the bottom of the hierarchy. * If the task has no child tasks then just add it to the array. * * @param tasks array to collect child tasks * @param task current task */ private void gatherChildTasks(List<Task> tasks, Task task) { if (task.hasChildTasks()) { task.getChildTasks().forEach(child -> gatherChildTasks(tasks, child)); } else { tasks.add(task); } }
Example 4
Source File: PrimaveraReader.java From mpxj with GNU Lesser General Public License v2.1 | 5 votes |
/** * See the notes above. * * @param parentTask parent task. */ private void updateWork(Task parentTask) { if (parentTask.hasChildTasks()) { ProjectProperties properties = m_project.getProjectProperties(); Duration actualWork = null; Duration baselineWork = null; Duration remainingWork = null; Duration work = null; for (Task task : parentTask.getChildTasks()) { updateWork(task); actualWork = Duration.add(actualWork, task.getActualWork(), properties); baselineWork = Duration.add(baselineWork, task.getBaselineWork(), properties); remainingWork = Duration.add(remainingWork, task.getRemainingWork(), properties); work = Duration.add(work, task.getWork(), properties); } parentTask.setActualWork(actualWork); parentTask.setBaselineWork(baselineWork); parentTask.setRemainingWork(remainingWork); parentTask.setWork(work); } }
Example 5
Source File: AstaReader.java From mpxj with GNU Lesser General Public License v2.1 | 4 votes |
/** * Populate summary task dates. * * @param parentTask summary task */ private void updateDates(Task parentTask) { if (parentTask.hasChildTasks()) { int finished = 0; Date actualStartDate = parentTask.getActualStart(); Date actualFinishDate = parentTask.getActualFinish(); Date earlyStartDate = parentTask.getEarlyStart(); Date earlyFinishDate = parentTask.getEarlyFinish(); Date lateStartDate = parentTask.getLateStart(); Date lateFinishDate = parentTask.getLateFinish(); for (Task task : parentTask.getChildTasks()) { updateDates(task); actualStartDate = DateHelper.min(actualStartDate, task.getActualStart()); actualFinishDate = DateHelper.max(actualFinishDate, task.getActualFinish()); earlyStartDate = DateHelper.min(earlyStartDate, task.getEarlyStart()); earlyFinishDate = DateHelper.max(earlyFinishDate, task.getEarlyFinish()); lateStartDate = DateHelper.min(lateStartDate, task.getLateStart()); lateFinishDate = DateHelper.max(lateFinishDate, task.getLateFinish()); if (task.getActualFinish() != null) { ++finished; } } parentTask.setActualStart(actualStartDate); parentTask.setEarlyStart(earlyStartDate); parentTask.setEarlyFinish(earlyFinishDate); parentTask.setLateStart(lateStartDate); parentTask.setLateFinish(lateFinishDate); // // Only if all child tasks have actual finish dates do we // set the actual finish date on the parent task. // if (finished == parentTask.getChildTasks().size()) { parentTask.setActualFinish(actualFinishDate); } } }
Example 6
Source File: PhoenixReader.java From mpxj with GNU Lesser General Public License v2.1 | 4 votes |
/** * See the notes above. * * @param parentTask parent task. */ private void updateDates(Task parentTask) { if (parentTask.hasChildTasks()) { int finished = 0; Date plannedStartDate = parentTask.getStart(); Date plannedFinishDate = parentTask.getFinish(); Date actualStartDate = parentTask.getActualStart(); Date actualFinishDate = parentTask.getActualFinish(); Date earlyStartDate = parentTask.getEarlyStart(); Date earlyFinishDate = parentTask.getEarlyFinish(); Date lateStartDate = parentTask.getLateStart(); Date lateFinishDate = parentTask.getLateFinish(); for (Task task : parentTask.getChildTasks()) { updateDates(task); plannedStartDate = DateHelper.min(plannedStartDate, task.getStart()); plannedFinishDate = DateHelper.max(plannedFinishDate, task.getFinish()); actualStartDate = DateHelper.min(actualStartDate, task.getActualStart()); actualFinishDate = DateHelper.max(actualFinishDate, task.getActualFinish()); earlyStartDate = DateHelper.min(earlyStartDate, task.getEarlyStart()); earlyFinishDate = DateHelper.max(earlyFinishDate, task.getEarlyFinish()); lateStartDate = DateHelper.min(lateStartDate, task.getLateStart()); lateFinishDate = DateHelper.max(lateFinishDate, task.getLateFinish()); if (task.getActualFinish() != null) { ++finished; } } parentTask.setStart(plannedStartDate); parentTask.setFinish(plannedFinishDate); parentTask.setActualStart(actualStartDate); parentTask.setEarlyStart(earlyStartDate); parentTask.setEarlyFinish(earlyFinishDate); parentTask.setLateStart(lateStartDate); parentTask.setLateFinish(lateFinishDate); // // Only if all child tasks have actual finish dates do we // set the actual finish date on the parent task. // if (finished == parentTask.getChildTasks().size()) { parentTask.setActualFinish(actualFinishDate); } Duration duration = null; if (plannedStartDate != null && plannedFinishDate != null) { duration = m_projectFile.getDefaultCalendar().getWork(plannedStartDate, plannedFinishDate, TimeUnit.DAYS); parentTask.setDuration(duration); } } }
Example 7
Source File: SureTrakDatabaseReader.java From mpxj with GNU Lesser General Public License v2.1 | 4 votes |
/** * See the notes above. * * @param parentTask parent task. */ private void updateDates(Task parentTask) { if (parentTask.hasChildTasks()) { int finished = 0; Date startDate = parentTask.getStart(); Date finishDate = parentTask.getFinish(); Date actualStartDate = parentTask.getActualStart(); Date actualFinishDate = parentTask.getActualFinish(); Date earlyStartDate = parentTask.getEarlyStart(); Date earlyFinishDate = parentTask.getEarlyFinish(); Date lateStartDate = parentTask.getLateStart(); Date lateFinishDate = parentTask.getLateFinish(); for (Task task : parentTask.getChildTasks()) { updateDates(task); startDate = DateHelper.min(startDate, task.getStart()); finishDate = DateHelper.max(finishDate, task.getFinish()); actualStartDate = DateHelper.min(actualStartDate, task.getActualStart()); actualFinishDate = DateHelper.max(actualFinishDate, task.getActualFinish()); earlyStartDate = DateHelper.min(earlyStartDate, task.getEarlyStart()); earlyFinishDate = DateHelper.max(earlyFinishDate, task.getEarlyFinish()); lateStartDate = DateHelper.min(lateStartDate, task.getLateStart()); lateFinishDate = DateHelper.max(lateFinishDate, task.getLateFinish()); if (task.getActualFinish() != null) { ++finished; } } parentTask.setStart(startDate); parentTask.setFinish(finishDate); parentTask.setActualStart(actualStartDate); parentTask.setEarlyStart(earlyStartDate); parentTask.setEarlyFinish(earlyFinishDate); parentTask.setLateStart(lateStartDate); parentTask.setLateFinish(lateFinishDate); // // Only if all child tasks have actual finish dates do we // set the actual finish date on the parent task. // if (finished == parentTask.getChildTasks().size()) { parentTask.setActualFinish(actualFinishDate); } } }
Example 8
Source File: P3DatabaseReader.java From mpxj with GNU Lesser General Public License v2.1 | 4 votes |
/** * See the notes above. * * @param parentTask parent task. */ private void updateDates(Task parentTask) { if (parentTask.hasChildTasks()) { int finished = 0; Date startDate = parentTask.getStart(); Date finishDate = parentTask.getFinish(); Date actualStartDate = parentTask.getActualStart(); Date actualFinishDate = parentTask.getActualFinish(); Date earlyStartDate = parentTask.getEarlyStart(); Date earlyFinishDate = parentTask.getEarlyFinish(); Date lateStartDate = parentTask.getLateStart(); Date lateFinishDate = parentTask.getLateFinish(); for (Task task : parentTask.getChildTasks()) { updateDates(task); startDate = DateHelper.min(startDate, task.getStart()); finishDate = DateHelper.max(finishDate, task.getFinish()); actualStartDate = DateHelper.min(actualStartDate, task.getActualStart()); actualFinishDate = DateHelper.max(actualFinishDate, task.getActualFinish()); earlyStartDate = DateHelper.min(earlyStartDate, task.getEarlyStart()); earlyFinishDate = DateHelper.max(earlyFinishDate, task.getEarlyFinish()); lateStartDate = DateHelper.min(lateStartDate, task.getLateStart()); lateFinishDate = DateHelper.max(lateFinishDate, task.getLateFinish()); if (task.getActualFinish() != null) { ++finished; } } parentTask.setStart(startDate); parentTask.setFinish(finishDate); parentTask.setActualStart(actualStartDate); parentTask.setEarlyStart(earlyStartDate); parentTask.setEarlyFinish(earlyFinishDate); parentTask.setLateStart(lateStartDate); parentTask.setLateFinish(lateFinishDate); // // Only if all child tasks have actual finish dates do we // set the actual finish date on the parent task. // if (finished == parentTask.getChildTasks().size()) { parentTask.setActualFinish(actualFinishDate); } } }