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

The following examples show how to use net.sf.mpxj.Task#setBaselineWork() . 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: PrimaveraReader.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * See the notes above.
 *
 * @param parentTask parent task.
 */
private void updateWork(Task parentTask)
{
   if (parentTask.hasChildTasks())
   {
      ProjectProperties properties = m_project.getProjectProperties();

      Duration actualWork = null;
      Duration baselineWork = null;
      Duration remainingWork = null;
      Duration work = null;

      for (Task task : parentTask.getChildTasks())
      {
         updateWork(task);

         actualWork = Duration.add(actualWork, task.getActualWork(), properties);
         baselineWork = Duration.add(baselineWork, task.getBaselineWork(), properties);
         remainingWork = Duration.add(remainingWork, task.getRemainingWork(), properties);
         work = Duration.add(work, task.getWork(), properties);
      }

      parentTask.setActualWork(actualWork);
      parentTask.setBaselineWork(baselineWork);
      parentTask.setRemainingWork(remainingWork);
      parentTask.setWork(work);
   }
}