Java Code Examples for net.sf.mpxj.Task

The following examples show how to use net.sf.mpxj.Task. These examples are extracted from open source projects. 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 Project: mpxj   Source File: TaskCostsTest.java    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Test an individual project.
 *
 * @param file project file
 */
private void testTaskCosts(File file) throws MPXJException
{
   ProjectReader reader = ProjectReaderUtility.getProjectReader(file.getName());
   if (reader instanceof MPDDatabaseReader)
   {
      assumeJvm();
   }

   int maxIndex = reader instanceof MPXReader ? 3 : 10;
   ProjectFile project = reader.read(file);
   for (int index = 1; index <= maxIndex; index++)
   {
      Task task = project.getTaskByID(Integer.valueOf(index));
      assertEquals("Cost" + index, task.getName());
      testTaskCosts(file, task, index, maxIndex);
   }
}
 
Example 2
/**
 * Test baseline estimated starts.
 *
 * @param project project
 * @param startTaskID initial task ID
 * @param maxBaselines maximum baselines to test
 * @return task ID for next tests
 */
private int testEstimatedStarts(ProjectFile project, int startTaskID, int maxBaselines)
{
   int taskID = startTaskID;

   for (int index = 0; index < maxBaselines; index++)
   {
      Task task = project.getTaskByID(Integer.valueOf(taskID));
      taskID++;
      Date value;

      if (index == 0)
      {
         value = task.getBaselineEstimatedStart();
      }
      else
      {
         value = task.getBaselineEstimatedStart(index);
      }

      assertEquals(ESTIMATED_STARTS[index], m_dateFormat.format(value));
   }

   return taskID;
}
 
Example 3
Source Project: mpxj   Source File: SynchroReader.java    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * 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 4
/**
 * Test baseline costs.
 *
 * @param project project
 * @param startTaskID initial task ID
 * @param maxBaselines maximum baselines to test
 * @return task ID for next tests
 */
private int testCosts(ProjectFile project, int startTaskID, int maxBaselines)
{
   int taskID = startTaskID;

   for (int index = 0; index < maxBaselines; index++)
   {
      Task task = project.getTaskByID(Integer.valueOf(taskID));
      taskID++;
      Number value;

      if (index == 0)
      {
         value = task.getBaselineCost();
      }
      else
      {
         value = task.getBaselineCost(index);
      }

      assertEquals(COSTS[index], value.toString());
   }

   return taskID;
}
 
Example 5
Source Project: mpxj   Source File: BasicTest.java    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Test to ensure that the basic task hierarchy is
 * represented correctly.
 *
 * @throws Exception
 */
@Test public void testStructure() throws Exception
{
   ProjectFile file = new ProjectFile();

   Task task1 = file.addTask();
   assertNull(task1.getParentTask());

   Task task2 = task1.addTask();
   assertEquals(task2.getParentTask(), task1);

   task1.addTask();
   List<Task> children = task1.getChildTasks();
   assertEquals(children.size(), 2);

   List<Task> toplevel = file.getChildTasks();
   assertEquals(toplevel.size(), 1);
}
 
Example 6
Source Project: mpxj   Source File: MSPDIReader.java    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * When projectmanager.com exports schedules as MSPDI (via Aspose tasks)
 * they do not have finish dates, just a start date and a duration.
 * This method populates finish dates.
 *
 * @param task task to validate
 */
private void validateFinishDate(Task task)
{
   if (task.getFinish() == null)
   {
      Date startDate = task.getStart();
      if (startDate != null)
      {
         if (task.getMilestone())
         {
            task.setFinish(startDate);
         }
         else
         {
            Duration duration = task.getDuration();
            if (duration != null)
            {
               ProjectCalendar calendar = task.getEffectiveCalendar();
               task.setFinish(calendar.getDate(startDate, duration, false));
            }
         }
      }
   }
}
 
Example 7
/**
 * Test baseline estimated finishes.
 *
 * @param project project
 * @param startTaskID initial task ID
 * @param maxBaselines maximum baselines to test
 * @return task ID for next tests
 */
private int testEstimatedFinishes(ProjectFile project, int startTaskID, int maxBaselines)
{
   int taskID = startTaskID;

   for (int index = 0; index < maxBaselines; index++)
   {
      Task task = project.getTaskByID(Integer.valueOf(taskID));
      taskID++;
      Date value;

      if (index == 0)
      {
         value = task.getBaselineEstimatedFinish();
      }
      else
      {
         value = task.getBaselineEstimatedFinish(index);
      }

      assertEquals(ESTIMATED_FINISHES[index], m_dateFormat.format(value));
   }

   return taskID;
}
 
Example 8
Source Project: mpxj   Source File: MSPDIWriter.java    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * This method writes extended attribute data for a task.
 *
 * @param xml MSPDI task
 * @param mpx MPXJ task
 */
private void writeTaskExtendedAttributes(Project.Tasks.Task xml, Task mpx)
{
   Project.Tasks.Task.ExtendedAttribute attrib;
   List<Project.Tasks.Task.ExtendedAttribute> extendedAttributes = xml.getExtendedAttribute();

   for (TaskField mpxFieldID : getAllTaskExtendedAttributes())
   {
      Object value = mpx.getCachedValue(mpxFieldID);

      if (FieldTypeHelper.valueIsNotDefault(mpxFieldID, value))
      {
         m_extendedAttributesInUse.add(mpxFieldID);

         Integer xmlFieldID = Integer.valueOf(MPPTaskField.getID(mpxFieldID) | MPPTaskField.TASK_FIELD_BASE);

         attrib = m_factory.createProjectTasksTaskExtendedAttribute();
         extendedAttributes.add(attrib);
         attrib.setFieldID(xmlFieldID.toString());
         attrib.setValue(DatatypeConverter.printExtendedAttribute(this, value, mpxFieldID.getDataType()));
         attrib.setDurationFormat(printExtendedAttributeDurationFormat(value));
      }
   }
}
 
Example 9
/**
 * Add tasks to the tree.
 *
 * @param parentNode parent tree node
 * @param parent parent task container
 */
private void addTasks(MpxjTreeNode parentNode, ChildTaskContainer parent)
{
   for (Task task : parent.getChildTasks())
   {
      final Task t = task;
      MpxjTreeNode childNode = new MpxjTreeNode(task, TASK_EXCLUDED_METHODS)
      {
         @Override public String toString()
         {
            return t.getName();
         }
      };
      parentNode.add(childNode);
      addTasks(childNode, task);
   }
}
 
Example 10
/**
 * Test an individual project.
 *
 * @param file project file
 */
private void testAssignmentText(File file) throws MPXJException
{
   ProjectReader reader = ProjectReaderUtility.getProjectReader(file.getName());
   if (reader instanceof MPDDatabaseReader)
   {
      assumeJvm();
   }

   int maxIndex = 30;
   ProjectFile project = reader.read(file);
   for (int index = 1; index <= maxIndex; index++)
   {
      Task task = project.getTaskByID(Integer.valueOf(index));
      assertEquals("Task " + index, task.getName());
      testAssignmentText(file, task, index, maxIndex);
   }
}
 
Example 11
/**
 * Read task baseline values.
 *
 * @param row result set row
 */
protected void processTaskBaseline(Row row)
{
   Integer id = row.getInteger("TASK_UID");
   Task task = m_project.getTaskByUniqueID(id);
   if (task != null)
   {
      int index = row.getInt("TB_BASE_NUM");

      task.setBaselineDuration(index, MPDUtility.getAdjustedDuration(m_project, row.getInt("TB_BASE_DUR"), MPDUtility.getDurationTimeUnits(row.getInt("TB_BASE_DUR_FMT"))));
      task.setBaselineStart(index, row.getDate("TB_BASE_START"));
      task.setBaselineFinish(index, row.getDate("TB_BASE_FINISH"));
      task.setBaselineWork(index, row.getDuration("TB_BASE_WORK"));
      task.setBaselineCost(index, row.getCurrency("TB_BASE_COST"));
   }
}
 
Example 12
Source Project: mpxj   Source File: BasicTest.java    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * This test reads flags from an MPP9 file where each set of 20 tasks has
 * a single flag from 1-20 set. The next set of 20 tasks increases by
 * one outline level.
 *
 * @throws Exception
 */
@Test public void testMPP9Flags2() throws Exception
{
   File in = new File(MpxjTestData.filePath("legacy/mpp9flags2.mpp"));
   ProjectFile mpp = new MPPReader().read(in);
   int index = 0;
   boolean[] flags;

   for (Task task : mpp.getTasks())
   {
      if (task.getUniqueID().intValue() != 0 && task.getName().startsWith("Parent") == false)
      {
         flags = getFlagArray(task);
         assertTrue("Incorrect flag set in task " + task.getName(), testSingleFlagTrue(flags, index));
         ++index;
         if (index == 20)
         {
            index = 0;
         }
      }
   }
}
 
Example 13
Source Project: mpxj   Source File: AstaReader.java    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Adds a leaf node, which could be a task or a milestone.
 *
 * @param parentName parent bar name
 * @param row row to add
 * @param task task to populate with data from the row
 */
private void populateLeaf(String parentName, Row row, Task task)
{
   if (row.getInteger("TASKID") != null)
   {
      populateTask(row, task);
   }
   else
   {
      populateMilestone(row, task);
   }

   String name = task.getName();
   if (name == null || name.isEmpty())
   {
      task.setName(parentName);
   }
}
 
Example 14
Source Project: mpxj   Source File: TaskNumbersTest.java    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Test an individual project.
 *
 * @param file project file
 */
private void testTaskNumbers(File file) throws MPXJException
{
   ProjectReader reader = ProjectReaderUtility.getProjectReader(file.getName());
   if (reader instanceof MPDDatabaseReader)
   {
      assumeJvm();
   }

   int maxIndex = reader instanceof MPXReader ? 5 : 20;
   ProjectFile project = reader.read(file);
   for (int index = 1; index <= maxIndex; index++)
   {
      Task task = project.getTaskByID(Integer.valueOf(index));
      assertEquals("Number" + index, task.getName());
      testTaskNumbers(file, task, index, maxIndex);
   }
}
 
Example 15
/**
 * Read relationship data from a PEP file.
 */
private void readRelationships()
{
   for (MapRow row : getTable("CONTAB"))
   {
      Task task1 = m_projectFile.getTaskByUniqueID(row.getInteger("TASK_ID_1"));
      Task task2 = m_projectFile.getTaskByUniqueID(row.getInteger("TASK_ID_2"));

      if (task1 != null && task2 != null)
      {
         RelationType type = row.getRelationType("TYPE");
         Duration lag = row.getDuration("LAG");
         Relation relation = task2.addPredecessor(task1, type, lag);
         m_eventManager.fireRelationReadEvent(relation);
      }
   }
}
 
Example 16
/**
 * Writes task predecessor links to a PM XML file.
 *
 * @param task MPXJ Task instance
 */
private void writePredecessors(Task task)
{
   List<Relation> relations = task.getPredecessors();
   for (Relation mpxj : relations)
   {
      RelationshipType xml = m_factory.createRelationshipType();
      m_project.getRelationship().add(xml);

      xml.setLag(getDuration(mpxj.getLag()));
      xml.setObjectId(Integer.valueOf(++m_relationshipObjectID));
      xml.setPredecessorActivityObjectId(mpxj.getTargetTask().getUniqueID());
      xml.setSuccessorActivityObjectId(mpxj.getSourceTask().getUniqueID());
      xml.setPredecessorProjectObjectId(PROJECT_OBJECT_ID);
      xml.setSuccessorProjectObjectId(PROJECT_OBJECT_ID);
      xml.setType(RELATION_TYPE_MAP.get(mpxj.getType()));
   }
}
 
Example 17
/**
 * Read an individual remark type from a Gantt Designer file.
 *
 * @param remark remark type
 */
private void processRemarks(GanttDesignerRemark remark)
{
   for (GanttDesignerRemark.Task remarkTask : remark.getTask())
   {
      Integer id = remarkTask.getRow();
      Task task = m_projectFile.getTaskByID(id);
      String notes = task.getNotes();
      if (notes.isEmpty())
      {
         notes = remarkTask.getContent();
      }
      else
      {
         notes = notes + '\n' + remarkTask.getContent();
      }
      task.setNotes(notes);
   }
}
 
Example 18
Source Project: mpxj   Source File: MerlinReader.java    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Extract a duration amount from the assignment, converting a percentage
 * into an actual duration.
 *
 * @param task parent task
 * @param work duration from assignment
 * @return Duration instance
 */
private Duration assignmentDuration(Task task, Duration work)
{
   Duration result = work;

   if (result != null)
   {
      if (result.getUnits() == TimeUnit.PERCENT)
      {
         Duration taskWork = task.getWork();
         if (taskWork != null)
         {
            result = Duration.getInstance(taskWork.getDuration() * result.getDuration(), taskWork.getUnits());
         }
      }
   }
   return result;
}
 
Example 19
Source Project: mpxj   Source File: PhoenixReader.java    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Locates a task within a child task container which matches the supplied UUID.
 *
 * @param parent child task container
 * @param uuid required UUID
 * @return Task instance or null if the task is not found
 */
private Task findChildTaskByUUID(ChildTaskContainer parent, UUID uuid)
{
   Task result = null;

   for (Task task : parent.getChildTasks())
   {
      if (uuid.equals(task.getGUID()))
      {
         result = task;
         break;
      }
   }

   return result;
}
 
Example 20
/**
 * 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 21
@Override
public Pair<TimeDuration, TimeDuration> apply(Task t) {
  if (t.getMilestone()) {
    return Pair.create(getTaskManager().createLength(1), null);
  }
  Duration dayUnits = t.getDuration().convertUnits(TimeUnit.DAYS, myProjectFile.getProjectProperties());
  TimeDuration gpDuration = getTaskManager().createLength(GPTimeUnitStack.DAY, (float) dayUnits.getDuration());
  Date endDate = getTaskManager().shift(t.getStart(), gpDuration);
  return getDurations(t.getStart(), endDate);
}
 
Example 22
private static Integer foreignId(Task mpxjTask) {
  Integer result = mpxjTask.getID();
  if (result != null) {
    return result;
  }
  result = mpxjTask.getUniqueID();
  if (result != null) {
    return result;
  }
  throw new IllegalStateException("No ID found in task=" + mpxjTask);
}
 
Example 23
/**
 * Read task data from a Gantt Designer file.
 *
 * @param gantt Gantt Designer file
 */
private void processTasks(Gantt gantt)
{
   ProjectCalendar calendar = m_projectFile.getDefaultCalendar();

   for (Gantt.Tasks.Task ganttTask : gantt.getTasks().getTask())
   {
      String wbs = ganttTask.getID();
      ChildTaskContainer parentTask = getParentTask(wbs);

      Task task = parentTask.addTask();
      //ganttTask.getB() // bar type
      //ganttTask.getBC() // bar color
      task.setCost(ganttTask.getC());
      task.setName(ganttTask.getContent());
      task.setDuration(ganttTask.getD());
      task.setDeadline(ganttTask.getDL());
      //ganttTask.getH() // height
      //ganttTask.getIn(); // indent
      task.setWBS(wbs);
      task.setPercentageComplete(ganttTask.getPC());
      task.setStart(ganttTask.getS());
      //ganttTask.getU(); // Unknown
      //ganttTask.getVA(); // Valign

      task.setFinish(calendar.getDate(task.getStart(), task.getDuration(), false));
      m_taskMap.put(wbs, task);
   }
}
 
Example 24
Source Project: mpxj   Source File: MSPDIReader.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Reads baseline values for the current task.
 *
 * @param xmlTask MSPDI task instance
 * @param mpxjTask MPXJ task instance
 * @param durationFormat duration format to use
 */
private void readTaskBaselines(Project.Tasks.Task xmlTask, Task mpxjTask, TimeUnit durationFormat)
{
   for (Project.Tasks.Task.Baseline baseline : xmlTask.getBaseline())
   {
      int number = NumberHelper.getInt(baseline.getNumber());

      Double cost = DatatypeConverter.parseCurrency(baseline.getCost());
      Duration duration = DatatypeConverter.parseDuration(m_projectFile, durationFormat, baseline.getDuration());
      Date finish = baseline.getFinish();
      Date start = baseline.getStart();
      Duration work = DatatypeConverter.parseDuration(m_projectFile, TimeUnit.HOURS, baseline.getWork());

      if (number == 0)
      {
         mpxjTask.setBaselineCost(cost);
         mpxjTask.setBaselineDuration(duration);
         mpxjTask.setBaselineFinish(finish);
         mpxjTask.setBaselineStart(start);
         mpxjTask.setBaselineWork(work);
      }
      else
      {
         mpxjTask.setBaselineCost(number, cost);
         mpxjTask.setBaselineDuration(number, duration);
         mpxjTask.setBaselineFinish(number, finish);
         mpxjTask.setBaselineStart(number, start);
         mpxjTask.setBaselineWork(number, work);
      }
   }
}
 
Example 25
Source Project: mpxj   Source File: MSPDIReader.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * This method is used to retrieve the calendar associated
 * with a task. If no calendar is associated with a task, this method
 * returns null.
 *
 * @param task MSPDI task
 * @return calendar instance
 */
private ProjectCalendar getTaskCalendar(Project.Tasks.Task task)
{
   ProjectCalendar calendar = null;

   BigInteger calendarID = task.getCalendarUID();
   if (calendarID != null)
   {
      calendar = m_projectFile.getCalendarByUniqueID(Integer.valueOf(calendarID.intValue()));
   }

   return (calendar);
}
 
Example 26
Source Project: mpxj   Source File: MpxjQuery.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * This method lists any notes attached to tasks.
 *
 * @param file MPX file
 */
private static void listTaskNotes(ProjectFile file)
{
   for (Task task : file.getTasks())
   {
      String notes = task.getNotes();

      if (notes.length() != 0)
      {
         System.out.println("Notes for " + task.getName() + ": " + notes);
      }
   }

   System.out.println();
}
 
Example 27
Source Project: mpxj   Source File: PrecedenceRecord.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override public void process(Context context)
{
   Task currentTask = context.getTask(getString(0));
   Task previousTask = context.getTask(getString(1));
   if (currentTask != null && previousTask != null)
   {
      Relation relation = currentTask.addPredecessor(previousTask, getRelationType(2), getDuration(3));
      context.getEventManager().fireRelationReadEvent(relation);
   }
}
 
Example 28
Source Project: mpxj   Source File: DurationTest.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Validates duration values.
 *
 * @param mpp project file
 */
private void testDurations(ProjectFile mpp)
{
   Task task = mpp.getTaskByID(Integer.valueOf(1));
   assertEquals(Duration.getInstance(1, TimeUnit.MINUTES), task.getDuration());

   task = mpp.getTaskByID(Integer.valueOf(2));
   assertEquals(Duration.getInstance(1, TimeUnit.HOURS), task.getDuration());

   task = mpp.getTaskByID(Integer.valueOf(3));
   assertEquals(Duration.getInstance(1, TimeUnit.DAYS), task.getDuration());

   task = mpp.getTaskByID(Integer.valueOf(4));
   assertEquals(Duration.getInstance(1, TimeUnit.WEEKS), task.getDuration());

   task = mpp.getTaskByID(Integer.valueOf(5));
   assertEquals(Duration.getInstance(1, TimeUnit.MONTHS), task.getDuration());

   task = mpp.getTaskByID(Integer.valueOf(6));
   assertEquals(Duration.getInstance(1, TimeUnit.ELAPSED_MINUTES), task.getDuration());

   task = mpp.getTaskByID(Integer.valueOf(7));
   assertEquals(Duration.getInstance(1, TimeUnit.ELAPSED_HOURS), task.getDuration());

   task = mpp.getTaskByID(Integer.valueOf(8));
   assertEquals(Duration.getInstance(1, TimeUnit.ELAPSED_DAYS), task.getDuration());

   task = mpp.getTaskByID(Integer.valueOf(9));
   assertEquals(Duration.getInstance(1, TimeUnit.ELAPSED_WEEKS), task.getDuration());

   task = mpp.getTaskByID(Integer.valueOf(10));
   assertEquals(Duration.getInstance(1, TimeUnit.ELAPSED_MONTHS), task.getDuration());
}
 
Example 29
Source Project: mpxj   Source File: MSPDIWriter.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * This method writes a single predecessor link to the MSPDI file.
 *
 * @param taskID The task UID
 * @param type The predecessor type
 * @param lag The lag duration
 * @return A new link to be added to the MSPDI file
 */
private Project.Tasks.Task.PredecessorLink writePredecessor(Integer taskID, RelationType type, Duration lag)
{
   Project.Tasks.Task.PredecessorLink link = m_factory.createProjectTasksTaskPredecessorLink();

   link.setPredecessorUID(NumberHelper.getBigInteger(taskID));
   link.setType(BigInteger.valueOf(type.getValue()));
   link.setCrossProject(Boolean.FALSE); // SF-300: required to keep P6 happy when importing MSPDI files

   if (lag != null && lag.getDuration() != 0)
   {
      double linkLag = lag.getDuration();
      if (lag.getUnits() != TimeUnit.PERCENT && lag.getUnits() != TimeUnit.ELAPSED_PERCENT)
      {
         linkLag = 10.0 * Duration.convertUnits(linkLag, lag.getUnits(), TimeUnit.MINUTES, m_projectFile.getProjectProperties()).getDuration();
      }
      link.setLinkLag(BigInteger.valueOf((long) linkLag));
      link.setLagFormat(DatatypeConverter.printDurationTimeUnits(lag.getUnits(), false));
   }
   else
   {
      // SF-329: default required to keep Powerproject happy when importing MSPDI files
      link.setLinkLag(BIGINTEGER_ZERO);
      link.setLagFormat(DatatypeConverter.printDurationTimeUnits(m_projectFile.getProjectProperties().getDefaultDurationUnits(), false));
   }

   return (link);
}
 
Example 30
/**
 * Writes a WBS entity to the PM XML file.
 *
 * @param mpxj MPXJ Task entity
 */
private void writeWBS(Task mpxj)
{
   if (mpxj.getUniqueID().intValue() != 0)
   {
      WBSType xml = m_factory.createWBSType();
      m_project.getWBS().add(xml);
      String code = mpxj.getWBS();
      code = code == null || code.length() == 0 ? DEFAULT_WBS_CODE : code;

      Task parentTask = mpxj.getParentTask();
      Integer parentObjectID = parentTask == null ? null : parentTask.getUniqueID();

      xml.setCode(code);
      xml.setGUID(DatatypeConverter.printUUID(mpxj.getGUID()));
      xml.setName(mpxj.getName());

      xml.setObjectId(mpxj.getUniqueID());
      xml.setParentObjectId(parentObjectID);
      xml.setProjectObjectId(PROJECT_OBJECT_ID);
      xml.setSequenceNumber(Integer.valueOf(m_wbsSequence++));

      xml.setStatus("Active");
   }

   writeChildTasks(mpxj);
}