Java Code Examples for net.sf.mpxj.Task#setBaselineStart()

The following examples show how to use net.sf.mpxj.Task#setBaselineStart() . 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: MPD9AbstractReader.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * 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 2
Source File: MSPDIReader.java    From mpxj with 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 3
Source File: SageReader.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Process an individual task.
 *
 * @param line task record
 */
private void processTask(String line)
{
   String[] columns = line.split("\t");
   Task task = m_projectFile.addTask();

   task.setText(1, parseID(columns, 0));
   task.setName(getText(columns, 1));
   task.setDuration(parseDuration(columns, 2));
   // columns[3] task type, 1 - Work, 2 - Inspection, 3 - Bill, 4 - Milestone, 5 - Order Material, 6 - Owner Decision, 7 - Meeting, 8 - Subcontract
   setConstraint(task, ConstraintType.MUST_START_ON, columns, 4);
   setConstraint(task, ConstraintType.START_NO_EARLIER_THAN, columns, 5);
   setConstraint(task, ConstraintType.FINISH_NO_LATER_THAN, columns, 6);
   task.setStart(parseDate(columns, 7));
   task.setFinish(parseDate(columns, 8));
   task.setLateStart(parseDate(columns, 9));
   task.setLateFinish(parseDate(columns, 10));
   task.setTotalSlack(parseDuration(columns, 11));
   task.setBaselineDuration(parseDuration(columns, 12));
   task.setBaselineStart(parseDate(columns, 13));
   task.setBaselineFinish(parseDate(columns, 14));
   // columns[15] original float
   task.setText(2, getText(columns, 16));
   task.setNotes(getText(columns, 17));

   m_taskMap.put(task.getText(1), task);
   m_eventManager.fireTaskReadEvent(task);
}
 
Example 4
Source File: ConceptDrawProjectReader.java    From mpxj with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Read a project from a ConceptDraw PROJECT file.
 *
 * @param project ConceptDraw PROJECT project
 */
private void readProject(Project project)
{
   Task mpxjTask = m_projectFile.addTask();
   //project.getAuthor()
   mpxjTask.setBaselineCost(project.getBaselineCost());
   mpxjTask.setBaselineFinish(project.getBaselineFinishDate());
   mpxjTask.setBaselineStart(project.getBaselineStartDate());
   //project.getBudget();
   //project.getCompany()
   mpxjTask.setFinish(project.getFinishDate());
   //project.getGoal()
   //project.getHyperlinks()
   //project.getMarkerID()
   mpxjTask.setName(project.getName());
   mpxjTask.setNotes(project.getNote());
   mpxjTask.setPriority(project.getPriority());
   //      project.getSite()
   mpxjTask.setStart(project.getStartDate());
   //      project.getStyleProject()
   //      project.getTask()
   //      project.getTimeScale()
   //      project.getViewProperties()

   String projectIdentifier = project.getID().toString();
   mpxjTask.setGUID(UUID.nameUUIDFromBytes(projectIdentifier.getBytes()));

   //
   // Sort the tasks into the correct order
   //
   List<Document.Projects.Project.Task> tasks = new ArrayList<>(project.getTask());
   final AlphanumComparator comparator = new AlphanumComparator();

   Collections.sort(tasks, new Comparator<Document.Projects.Project.Task>()
   {
      @Override public int compare(Document.Projects.Project.Task o1, Document.Projects.Project.Task o2)
      {
         return comparator.compare(o1.getOutlineNumber(), o2.getOutlineNumber());
      }
   });

   Map<String, Task> map = new HashMap<>();
   map.put("", mpxjTask);

   for (Document.Projects.Project.Task task : tasks)
   {
      readTask(projectIdentifier, map, task);
   }
}
 
Example 5
Source File: ConceptDrawProjectReader.java    From mpxj with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Read a task from a ConceptDraw PROJECT file.
 *
 * @param projectIdentifier parent project identifier
 * @param map outline number to task map
 * @param task ConceptDraw PROJECT task
 */
private void readTask(String projectIdentifier, Map<String, Task> map, Document.Projects.Project.Task task)
{
   Task parentTask = map.get(getParentOutlineNumber(task.getOutlineNumber()));
   Task mpxjTask = parentTask.addTask();

   TimeUnit units = task.getBaseDurationTimeUnit();

   mpxjTask.setCost(task.getActualCost());
   mpxjTask.setDuration(getDuration(units, task.getActualDuration()));
   mpxjTask.setFinish(task.getActualFinishDate());
   mpxjTask.setStart(task.getActualStartDate());
   mpxjTask.setBaselineDuration(getDuration(units, task.getBaseDuration()));
   mpxjTask.setBaselineFinish(task.getBaseFinishDate());
   mpxjTask.setBaselineCost(task.getBaselineCost());
   //      task.getBaselineFinishDate()
   //      task.getBaselineFinishTemplateOffset()
   //      task.getBaselineStartDate()
   //      task.getBaselineStartTemplateOffset()
   mpxjTask.setBaselineStart(task.getBaseStartDate());
   //      task.getCallouts()
   mpxjTask.setPercentageComplete(task.getComplete());
   mpxjTask.setDeadline(task.getDeadlineDate());
   //      task.getDeadlineTemplateOffset()
   //      task.getHyperlinks()
   //      task.getMarkerID()
   mpxjTask.setName(task.getName());
   mpxjTask.setNotes(task.getNote());
   mpxjTask.setPriority(task.getPriority());
   //      task.getRecalcBase1()
   //      task.getRecalcBase2()
   mpxjTask.setType(task.getSchedulingType());
   //      task.getStyleProject()
   //      task.getTemplateOffset()
   //      task.getValidatedByProject()

   if (task.isIsMilestone())
   {
      mpxjTask.setMilestone(true);
      mpxjTask.setDuration(Duration.getInstance(0, TimeUnit.HOURS));
      mpxjTask.setBaselineDuration(Duration.getInstance(0, TimeUnit.HOURS));
   }

   String taskIdentifier = projectIdentifier + "." + task.getID();
   m_taskIdMap.put(task.getID(), mpxjTask);
   mpxjTask.setGUID(UUID.nameUUIDFromBytes(taskIdentifier.getBytes()));

   map.put(task.getOutlineNumber(), mpxjTask);

   for (Document.Projects.Project.Task.ResourceAssignments.ResourceAssignment assignment : task.getResourceAssignments().getResourceAssignment())
   {
      readResourceAssignment(mpxjTask, assignment);
   }
}