private boolean isRelationTypeModified(final GanttTask ganttObject, final TaskDO task) { return task != null && ganttObject.getRelationType() != task.getGanttRelationType(); }
@Override protected void onSave() { task.setGanttRelationType(ganttObject.getRelationType()); taskDao.update(task); }
private static void setPredecessors(final Map<Serializable, Task> taskMap, final GanttTask ganttTask) { if (ganttTask.getPredecessor() != null) { final Task task = taskMap.get(ganttTask.getId()); final Task predecessor = taskMap.get(ganttTask.getPredecessorId()); if (task == null) { log.error("Oups, task with id '" + ganttTask.getId() + "' not found."); } else if (predecessor == null) { log.error("Oups, predecessor task with id '" + ganttTask.getPredecessorId() + "' not found."); } else { final Integer predecessorOffset = ganttTask.getPredecessorOffset(); final int value; if (predecessorOffset == null) { value = 0; } else { value = predecessorOffset.intValue(); } task.addPredecessor(predecessor, getRelationType(ganttTask.getRelationType()), Duration.getInstance(value, TimeUnit.DAYS)); } } final List<GanttTask> children = ganttTask.getChildren(); if (children == null) { return; } for (final GanttTask child : children) { setPredecessors(taskMap, child); } }
final GanttTask predecessor = node.getPredecessor(); if (predecessor != null) { startDate = getPredecessorRelDate(node.getRelationType(), predecessor, startDateSet, endDateSet); if (startDate != null) { if (NumberHelper.isNotZero(node.getPredecessorOffset()) == true) { startDate = calculateDate(startDate, node.getPredecessorOffset()); if (node.getRelationType() == GanttRelationType.START_FINISH || node.getRelationType() == GanttRelationType.FINISH_FINISH) { if (durationDays > 0) { startDate = calculateDate(startDate, -durationDays); if ((predecessor == null || (node.getRelationType() != null && node.getRelationType().isIn(GanttRelationType.FINISH_FINISH, GanttRelationType.START_FINISH) == true)) && node.getChildren() != null) {
final GanttTask predecessor = node.getPredecessor(); if (predecessor != null) { endDate = getPredecessorRelDate(node.getRelationType(), predecessor, startDateSet, endDateSet); if (endDate != null) { if (NumberHelper.isNotZero(node.getPredecessorOffset()) == true) { endDate = calculateDate(endDate, node.getPredecessorOffset()); if (node.getRelationType() != GanttRelationType.START_FINISH && node.getRelationType() != GanttRelationType.FINISH_FINISH) { if (durationDays > 0) { endDate = calculateDate(endDate, durationDays); if ((predecessor == null || (node.getRelationType() == null || node.getRelationType().isIn(GanttRelationType.FINISH_FINISH, GanttRelationType.START_FINISH) == false)) && node.getChildren() != null
final GanttRelationType type = node.getRelationType() != null ? node.getRelationType() : GanttRelationType.FINISH_START; final double depX1; final double depX2;
/** * Creates a new GanttTask and copies all fields from the given task (excluding the predecessor and any children). * @param task * @return */ public static final TaskDO convertToTask(final GanttTask ganttObject) { final TaskDO task = new TaskDO(); // Do not copy the id! The id is given by the data base. task.setGanttPredecessorOffset(ganttObject.getPredecessorOffset()); task.setGanttRelationType(ganttObject.getRelationType()); task.setDuration(ganttObject.getDuration()); task.setStartDate(ganttObject.getStartDate()); task.setEndDate(ganttObject.getEndDate()); task.setProgress(ganttObject.getProgress()); task.setGanttObjectType(ganttObject.getType()); task.setDescription(ganttObject.getDescription()); task.setTitle(ganttObject.getTitle()); return task; }