Package net.sf.mpxj

Examples of net.sf.mpxj.Task


  }

  private static void addTask(final ProjectFile file, final Map<Serializable, Task> taskMap, final Task parentTask,
      final GanttTask ganttTask)
  {
    final Task task;
    if (parentTask == null) {
      task = file.addTask();
    } else {
      task = parentTask.addTask();
    }
    taskMap.put(ganttTask.getId(), task);
    task.setName(ganttTask.getTitle());
    if (ganttTask.getStartDate() != null) {
      task.setStart(ganttTask.getStartDate());
    }
    if (ganttTask.getEndDate() != null) {
      task.setFinish(ganttTask.getEndDate());
    }
    final BigDecimal duration = ganttTask.getDuration();
    final double value;
    if (duration == null) {
      value = 0.0;
    } else {
      value = duration.doubleValue();
    }
    task.setDuration(Duration.getInstance(value, TimeUnit.DAYS));
    if (ganttTask.getProgress() != null) {
      task.setPercentageComplete(ganttTask.getProgress());
    }
    // task2.setActualStart(df.parse("01/01/2003"));
    // milestone1.setDuration(Duration.getInstance(0, TimeUnit.DAYS));

    final List<GanttTask> children = ganttTask.getChildren();
View Full Code Here


  }

  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 {
View Full Code Here

      //
      // Read WBS entries and create tasks
      //
      for (WBSType row : wbs)
      {
         Task task = m_projectFile.addTask();
         Integer uniqueID = row.getObjectId();
         uniqueIDs.add(uniqueID);

         task.setUniqueID(uniqueID);
         task.setName(row.getName());
         task.setBaselineCost(getValue(row.getSummaryBaselineTotalCost()));
         task.setRemainingCost(getValue(row.getSummaryRemainingTotalCost()));
         task.setRemainingDuration(getDuration(row.getSummaryRemainingDuration()));
         task.setStart(getValue(row.getAnticipatedStartDate()));
         task.setFinish(getValue(row.getAnticipatedFinishDate()));
         task.setText1(row.getCode());
      }

      //
      // Create hierarchical structure
      //
      m_projectFile.getChildTasks().clear();
      for (WBSType row : wbs)
      {
         Task task = m_projectFile.getTaskByUniqueID(row.getObjectId());
         Task parentTask = m_projectFile.getTaskByUniqueID(getValue(row.getParentObjectId()));
         if (parentTask == null)
         {
            m_projectFile.getChildTasks().add(task);
         }
         else
         {
            m_projectFile.getChildTasks().remove(task);
            parentTask.getChildTasks().add(task);
         }
      }

      //
      // Read Task entries and create tasks
      //
      int nextID = 1;
      m_clashMap.clear();
      for (ActivityType row : tasks)
      {
         Integer uniqueID = row.getObjectId();
         if (uniqueIDs.contains(uniqueID))
         {
            while (uniqueIDs.contains(Integer.valueOf(nextID)))
            {
               ++nextID;
            }
            Integer newUniqueID = Integer.valueOf(nextID);
            m_clashMap.put(uniqueID, newUniqueID);
            uniqueID = newUniqueID;
         }
         uniqueIDs.add(uniqueID);

         Task task;
         Integer parentTaskID = getValue(row.getWBSObjectId());
         Task parentTask = m_projectFile.getTaskByUniqueID(parentTaskID);
         if (parentTask == null)
         {
            task = m_projectFile.addTask();
         }
         else
         {
            task = parentTask.addTask();
         }

         task.setUniqueID(uniqueID);
         task.setPercentageComplete(row.getPhysicalPercentComplete());
         task.setName(row.getName());
View Full Code Here

      if (predecessors != null)
      {
         ArrayList<Relation> invalid = new ArrayList<Relation>();
         for (Relation relation : predecessors)
         {
            Task sourceTask = relation.getSourceTask();
            Task targetTask = relation.getTargetTask();

            String sourceOutlineNumber = sourceTask.getOutlineNumber();
            String targetOutlineNumber = targetTask.getOutlineNumber();
           
            if (sourceOutlineNumber != null && targetOutlineNumber != null && sourceOutlineNumber.startsWith(targetOutlineNumber + '.'))
            {
               invalid.add(relation);
            }
View Full Code Here

   private void processPredecessors(ProjectType project)
   {
      for (RelationshipType row : project.getRelationship())
      {

         Task currentTask = m_projectFile.getTaskByUniqueID(mapTaskID(row.getSuccessorActivityObjectId()));
         Task predecessorTask = m_projectFile.getTaskByUniqueID(mapTaskID(row.getPredecessorActivityObjectId()));
         if (currentTask != null && predecessorTask != null)
         {
            RelationType type = RELATION_TYPE_MAP.get(row.getType());
            Duration lag = getDuration(row.getLag());
            Relation relation = currentTask.addPredecessor(predecessorTask, type, lag);
View Full Code Here

   private void processAssignments(ProjectType project)
   {
      List<ResourceAssignmentType> assignments = project.getResourceAssignment();
      for (ResourceAssignmentType row : assignments)
      {
         Task task = m_projectFile.getTaskByUniqueID(mapTaskID(row.getActivityObjectId()));
         Resource resource = m_projectFile.getResourceByUniqueID(getValue(row.getResourceObjectId()));
         if (task != null && resource != null)
         {
            ResourceAssignment assignment = task.addResourceAssignment(resource);

            assignment.setUniqueID(row.getObjectId());
            assignment.setRemainingWork(getDuration(row.getRemainingUnits()));
            assignment.setBaselineWork(getDuration(row.getPlannedUnits()));
            assignment.setActualWork(getDuration(row.getActualUnits()));
View Full Code Here

    * @throws MPXJException
    */
   private void processDeferredRelationship(DeferredRelationship dr) throws MPXJException
   {
      String data = dr.getData();
      Task task = dr.getTask();

      int length = data.length();

      if (length != 0)
      {
View Full Code Here

      }

      //
      // Now find the task, so we can extract the unique ID
      //
      Task targetTask;
      if (field == TaskField.PREDECESSORS)
      {
         targetTask = m_projectFile.getTaskByID(taskID);
      }
      else
View Full Code Here

      // Read WBS entries and create tasks
      //

      for (Row row : wbs)
      {
         Task task = m_project.addTask();
         Integer uniqueID = row.getInteger("wbs_id");
         uniqueIDs.add(uniqueID);

         task.setUniqueID(uniqueID);
         task.setName(row.getString("wbs_name"));
         task.setBaselineCost(row.getDouble("orig_cost"));
         task.setRemainingCost(row.getDouble("indep_remain_total_cost"));
         task.setRemainingWork(row.getDuration("indep_remain_work_qty"));
         task.setStart(row.getDate("anticip_start_date"));
         task.setFinish(row.getDate("anticip_end_date"));
         task.setDate1(row.getDate("suspend_date"));
         task.setDate2(row.getDate("resume_date"));
         task.setText1(row.getString("task_code"));
         task.setWBS(row.getString("wbs_short_name"));
         //task.setNotes(getNotes(wbsmemos, "wbs_id", uniqueID.intValue(), "wbs_memo"));

         //
         // When reading from the database it appears that we could join
         // the PROJWBS table to the TASKSUM table to retrieve the
         // additional summarise values noted below. Before adding this
         // functionality it would be helpful to understand from a real
         // Primavera user if this is a valid thing to do?
         //
         //task.setActualDuration(val); // act_drtn_hr_cnt
         //task.setActualWork(val); // act_work_qty
         //task.setDuration(val); // total_drtn_hr_cnt
         //task.setBaselineDuration(val); // base_drtn_hr_cnt
         //task.setBaselineWork(val); // base_work_qty
         //task.setRemainingDuration(val); // remain_drtn_hr_cnt
         //task.setRemainingWork(val); // remain_work_qty
         //task.setTotalSlack(val); // total_float_hr_cnt
         //task.setBCWP(val); // bcwp
         //task.setBCWS(val); // bcws
         //task.setActualCost(val); // act_expense_cost+act_work_cost+ act_equip_cost+act_mat_cost
         //task.setBaselineCost(val); // base_expense_cost+base_work_cost+base_equip_cost+base_mat_cost
         //task.setRemainingCost(val); // remain_expense_cost+remain_work_cost+remain_equip_cost+remain_mat_cost         
      }

      //
      // Create hierarchical structure
      //
      m_project.getChildTasks().clear();
      for (Row row : wbs)
      {
         Task task = m_project.getTaskByUniqueID(row.getInteger("wbs_id"));
         Task parentTask = m_project.getTaskByUniqueID(row.getInteger("parent_wbs_id"));
         if (parentTask == null)
         {
            m_project.getChildTasks().add(task);
         }
         else
         {
            m_project.getChildTasks().remove(task);
            parentTask.getChildTasks().add(task);
            task.setWBS(parentTask.getWBS() + "." + task.getWBS());
         }
      }

      //
      // Read Task entries and create tasks
      //
      int nextID = 1;
      m_clashMap.clear();
      for (Row row : tasks)
      {
         Integer uniqueID = row.getInteger("task_id");
         if (uniqueIDs.contains(uniqueID))
         {
            while (uniqueIDs.contains(Integer.valueOf(nextID)))
            {
               ++nextID;
            }
            Integer newUniqueID = Integer.valueOf(nextID);
            m_clashMap.put(uniqueID, newUniqueID);
            uniqueID = newUniqueID;
         }
         uniqueIDs.add(uniqueID);

         Task task;
         Integer parentTaskID = row.getInteger("wbs_id");
         Task parentTask = m_project.getTaskByUniqueID(parentTaskID);
         if (parentTask == null)
         {
            task = m_project.addTask();
         }
         else
         {
            task = parentTask.addTask();
         }

         task.setUniqueID(uniqueID);
         task.setPercentageComplete(row.getDouble("phys_complete_pct"));
         task.setName(row.getString("task_name"));
View Full Code Here

    */
   public void processPredecessors(List<Row> rows)
   {
      for (Row row : rows)
      {
         Task currentTask = m_project.getTaskByUniqueID(mapTaskID(row.getInteger("task_id")));
         Task predecessorTask = m_project.getTaskByUniqueID(mapTaskID(row.getInteger("pred_task_id")));
         if (currentTask != null && predecessorTask != null)
         {
            RelationType type = RELATION_TYPE_MAP.get(row.getString("pred_type"));
            Duration lag = row.getDuration("lag_hr_cnt");
            Relation relation = currentTask.addPredecessor(predecessorTask, type, lag);
View Full Code Here

TOP

Related Classes of net.sf.mpxj.Task

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.