private GanttTaskImpl createActivity(final int durationDays) { final GanttTaskImpl activity = new GanttTaskImpl(); if (durationDays >= 0) { activity.setDuration(new BigDecimal(durationDays)); } activity.setId(counter++); return activity; }
assertDates("2010-09-06", "2010-09-08", a2_2); assertDates("2010-09-02", "2010-09-08", a2); a2.setDuration(TWO); assertDates("Start date calculated from children and duration is fixed", "2010-09-02", "2010-09-06", a2); a2.setStartDate(day.getDate()); assertDates("Start date and duration are fixed", "2010-09-01", "2010-09-03", a2); a2.setStartDate(null).setDuration(null).setPredecessor(a1).setPredecessorOffset(1); assertDates("Start date is calculated from predecessor.", "2010-09-03", "2010-09-08", a2); a2.setDuration(TWO); assertDates("Start date is calculated from predecessor and duration is fixed.", "2010-09-03", "2010-09-07", a2); a2.setRelationType(GanttRelationType.FINISH_START).setDuration(null); // Default -> same results: assertDates("Start date is calculated from predecessor.", "2010-09-03", "2010-09-08", a2); a2.setDuration(TWO); assertDates("Start date is calculated from predecessor and duration is fixed.", "2010-09-03", "2010-09-07", a2); a2.setRelationType(GanttRelationType.START_START).setDuration(null); assertDates("Start date is calculated from predecessor.", "2010-09-02", "2010-09-08", a2); a2.setDuration(TWO); assertDates("Start date is calculated from predecessor and duration is fixed.", "2010-09-02", "2010-09-06", a2); a2.setRelationType(GanttRelationType.START_FINISH).setDuration(null).setPredecessorOffset(4); assertDates("End date is calculated from predecessor.", "2010-09-02", "2010-09-07", a2); a2.setDuration(TWO);
final GanttTask rootObject = data.getRootObject(); final GanttChartDO ganttChartDO = new GanttChartDO().setTask(rootTask); findById(rootObject, id1).setDuration(new BigDecimal("10.000")).setProgress(10); // Modified. findById(rootObject, id3).setDuration(new BigDecimal("2")).setProgress(2); // Modified. findById(rootObject, id4).setDuration(new BigDecimal("10.000")).setProgress(10); // Unmodified findById(rootObject, id5).setDuration(null).setProgress(null); // Modified ganttChartDao.writeGanttObjects(ganttChartDO, rootObject); final String xml = transform(prefix, "<ganttObject id='{}'>"
private GanttTaskImpl createGanttObject(final GanttTaskImpl parent, final String workpackageCode, final String title, final String durationDays, final GanttTask dependsOnGanttObject, final GanttRelationType type, final int dependDayOffset) { final GanttTaskImpl node = new GanttTaskImpl(); node.setTitle(title); node.setWorkpackageCode(workpackageCode); node.setDuration(new BigDecimal(durationDays)); node.setVisible(true); if (dependsOnGanttObject != null) { node.setPredecessor(dependsOnGanttObject); } if (type != null) { node.setRelationType(type); } if (dependDayOffset != 0) { node.setPredecessorOffset(dependDayOffset); } if (parent != null) { parent.addChild(node); } node.setPredecessor(dependsOnGanttObject); return node; }
/** * Creates a new GanttTask and copies all fields from the given task (excluding the predecessor and any children). * @param task * @return */ public static final GanttTask convertToGanttObject(final TaskDO task) { final GanttTaskImpl ganttObject = new GanttTaskImpl(); ganttObject.setId(task.getId()); ganttObject.setPredecessorOffset(task.getGanttPredecessorOffset()); ganttObject.setRelationType(task.getGanttRelationType()); ganttObject.setDuration(task.getDuration()); ganttObject.setStartDate(task.getStartDate()); ganttObject.setEndDate(task.getEndDate()); ganttObject.setProgress(task.getProgress()); ganttObject.setType(task.getGanttObjectType()); ganttObject.setDescription(task.getDescription()); ganttObject.setTitle(task.getTitle()); return ganttObject; }
assertEquals("No output because there is no further information in the GanttObject tree.", "", ganttChartDO.getGanttObjectsAsXml()); findById(rootObject, getTask(prefix + "2").getId()).setPredecessorOffset(5).setDuration(new BigDecimal("12")); findById(rootObject, getTask(prefix + "1.1").getId()).setDuration(new BigDecimal("2")); ganttChartDao.writeGanttObjects(ganttChartDO, rootObject); String xml = transform(prefix, "<ganttObject id='{}'>"