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

The following examples show how to use net.sf.mpxj.Task#getLateFinish() . 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: AstaReader.java    From mpxj with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Populate summary task dates.
 * 
 * @param parentTask summary task
 */
private void updateDates(Task parentTask)
{
   if (parentTask.hasChildTasks())
   {
      int finished = 0;
      Date actualStartDate = parentTask.getActualStart();
      Date actualFinishDate = parentTask.getActualFinish();
      Date earlyStartDate = parentTask.getEarlyStart();
      Date earlyFinishDate = parentTask.getEarlyFinish();
      Date lateStartDate = parentTask.getLateStart();
      Date lateFinishDate = parentTask.getLateFinish();

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

         actualStartDate = DateHelper.min(actualStartDate, task.getActualStart());
         actualFinishDate = DateHelper.max(actualFinishDate, task.getActualFinish());
         earlyStartDate = DateHelper.min(earlyStartDate, task.getEarlyStart());
         earlyFinishDate = DateHelper.max(earlyFinishDate, task.getEarlyFinish());
         lateStartDate = DateHelper.min(lateStartDate, task.getLateStart());
         lateFinishDate = DateHelper.max(lateFinishDate, task.getLateFinish());

         if (task.getActualFinish() != null)
         {
            ++finished;
         }
      }

      parentTask.setActualStart(actualStartDate);
      parentTask.setEarlyStart(earlyStartDate);
      parentTask.setEarlyFinish(earlyFinishDate);
      parentTask.setLateStart(lateStartDate);
      parentTask.setLateFinish(lateFinishDate);

      //
      // Only if all child tasks have actual finish dates do we
      // set the actual finish date on the parent task.
      //
      if (finished == parentTask.getChildTasks().size())
      {
         parentTask.setActualFinish(actualFinishDate);
      }
   }
}
 
Example 2
Source File: PhoenixReader.java    From mpxj with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * See the notes above.
 *
 * @param parentTask parent task.
 */
private void updateDates(Task parentTask)
{
   if (parentTask.hasChildTasks())
   {
      int finished = 0;
      Date plannedStartDate = parentTask.getStart();
      Date plannedFinishDate = parentTask.getFinish();
      Date actualStartDate = parentTask.getActualStart();
      Date actualFinishDate = parentTask.getActualFinish();
      Date earlyStartDate = parentTask.getEarlyStart();
      Date earlyFinishDate = parentTask.getEarlyFinish();
      Date lateStartDate = parentTask.getLateStart();
      Date lateFinishDate = parentTask.getLateFinish();

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

         plannedStartDate = DateHelper.min(plannedStartDate, task.getStart());
         plannedFinishDate = DateHelper.max(plannedFinishDate, task.getFinish());
         actualStartDate = DateHelper.min(actualStartDate, task.getActualStart());
         actualFinishDate = DateHelper.max(actualFinishDate, task.getActualFinish());
         earlyStartDate = DateHelper.min(earlyStartDate, task.getEarlyStart());
         earlyFinishDate = DateHelper.max(earlyFinishDate, task.getEarlyFinish());
         lateStartDate = DateHelper.min(lateStartDate, task.getLateStart());
         lateFinishDate = DateHelper.max(lateFinishDate, task.getLateFinish());

         if (task.getActualFinish() != null)
         {
            ++finished;
         }
      }

      parentTask.setStart(plannedStartDate);
      parentTask.setFinish(plannedFinishDate);
      parentTask.setActualStart(actualStartDate);
      parentTask.setEarlyStart(earlyStartDate);
      parentTask.setEarlyFinish(earlyFinishDate);
      parentTask.setLateStart(lateStartDate);
      parentTask.setLateFinish(lateFinishDate);

      //
      // Only if all child tasks have actual finish dates do we
      // set the actual finish date on the parent task.
      //
      if (finished == parentTask.getChildTasks().size())
      {
         parentTask.setActualFinish(actualFinishDate);
      }

      Duration duration = null;
      if (plannedStartDate != null && plannedFinishDate != null)
      {
         duration = m_projectFile.getDefaultCalendar().getWork(plannedStartDate, plannedFinishDate, TimeUnit.DAYS);
         parentTask.setDuration(duration);
      }
   }
}
 
Example 3
Source File: SDEFWriter.java    From mpxj with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Write a task.
 *
 * @param record task instance
 * @throws IOException
 */
private void writeTask(Task record) throws IOException
{
   m_buffer.setLength(0);
   if (!record.getSummary())
   {
      m_buffer.append("ACTV ");
      m_buffer.append(SDEFmethods.rset(record.getUniqueID().toString(), 10) + " ");
      m_buffer.append(SDEFmethods.lset(record.getName(), 30) + " ");

      // Following just makes certain we have days for duration, as per USACE spec.
      Duration dd = record.getDuration();
      double duration = dd.getDuration();
      if (dd.getUnits() != TimeUnit.DAYS)
      {
         dd = Duration.convertUnits(duration, dd.getUnits(), TimeUnit.DAYS, m_minutesPerDay, m_minutesPerWeek, m_daysPerMonth);
      }
      Double days = Double.valueOf(dd.getDuration() + 0.5); // Add 0.5 so half day rounds up upon truncation
      Integer est = Integer.valueOf(days.intValue());
      m_buffer.append(SDEFmethods.rset(est.toString(), 3) + " "); // task duration in days required by USACE

      String conType = "ES "; // assume early start
      Date conDate = record.getEarlyStart();
      int test = record.getConstraintType().getValue(); // test for other types
      if (test == 1 || test == 3 || test == 6 || test == 7 || test == 9)
      {
         conType = "LF "; // see ConstraintType enum for definitions
         conDate = record.getLateFinish();
      }
      m_buffer.append(m_formatter.format(conDate).toUpperCase() + " "); // Constraint Date
      m_buffer.append(conType); // Constraint Type
      if (record.getCalendar() == null)
      {
         m_buffer.append("1 ");
      }
      else
      {
         m_buffer.append(SDEFmethods.lset(record.getCalendar().getUniqueID().toString(), 1) + " ");
      }
      // skipping hammock code in here
      // use of text fields for extra USACE data is suggested at my web site: www.geocomputer.com
      // not documented on how to do this here, so I need to comment out at present
      //	      m_buffer.append(SDEFmethods.Lset(record.getText1(), 3) + " ");
      //	      m_buffer.append(SDEFmethods.Lset(record.getText2(), 4) + " ");
      //	      m_buffer.append(SDEFmethods.Lset(record.getText3(), 4) + " ");
      //	      m_buffer.append(SDEFmethods.Lset(record.getText4(), 6) + " ");
      //	      m_buffer.append(SDEFmethods.Lset(record.getText5(), 6) + " ");
      //	      m_buffer.append(SDEFmethods.Lset(record.getText6(), 2) + " ");
      //	      m_buffer.append(SDEFmethods.Lset(record.getText7(), 1) + " ");
      //	      m_buffer.append(SDEFmethods.Lset(record.getText8(), 30) + " ");
      m_writer.println(m_buffer.toString());
      m_eventManager.fireTaskWrittenEvent(record);
   }
}
 
Example 4
Source File: SureTrakDatabaseReader.java    From mpxj with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * See the notes above.
 *
 * @param parentTask parent task.
 */
private void updateDates(Task parentTask)
{
   if (parentTask.hasChildTasks())
   {
      int finished = 0;
      Date startDate = parentTask.getStart();
      Date finishDate = parentTask.getFinish();
      Date actualStartDate = parentTask.getActualStart();
      Date actualFinishDate = parentTask.getActualFinish();
      Date earlyStartDate = parentTask.getEarlyStart();
      Date earlyFinishDate = parentTask.getEarlyFinish();
      Date lateStartDate = parentTask.getLateStart();
      Date lateFinishDate = parentTask.getLateFinish();

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

         startDate = DateHelper.min(startDate, task.getStart());
         finishDate = DateHelper.max(finishDate, task.getFinish());
         actualStartDate = DateHelper.min(actualStartDate, task.getActualStart());
         actualFinishDate = DateHelper.max(actualFinishDate, task.getActualFinish());
         earlyStartDate = DateHelper.min(earlyStartDate, task.getEarlyStart());
         earlyFinishDate = DateHelper.max(earlyFinishDate, task.getEarlyFinish());
         lateStartDate = DateHelper.min(lateStartDate, task.getLateStart());
         lateFinishDate = DateHelper.max(lateFinishDate, task.getLateFinish());

         if (task.getActualFinish() != null)
         {
            ++finished;
         }
      }

      parentTask.setStart(startDate);
      parentTask.setFinish(finishDate);
      parentTask.setActualStart(actualStartDate);
      parentTask.setEarlyStart(earlyStartDate);
      parentTask.setEarlyFinish(earlyFinishDate);
      parentTask.setLateStart(lateStartDate);
      parentTask.setLateFinish(lateFinishDate);

      //
      // Only if all child tasks have actual finish dates do we
      // set the actual finish date on the parent task.
      //
      if (finished == parentTask.getChildTasks().size())
      {
         parentTask.setActualFinish(actualFinishDate);
      }
   }
}
 
Example 5
Source File: P3DatabaseReader.java    From mpxj with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * See the notes above.
 *
 * @param parentTask parent task.
 */
private void updateDates(Task parentTask)
{
   if (parentTask.hasChildTasks())
   {
      int finished = 0;
      Date startDate = parentTask.getStart();
      Date finishDate = parentTask.getFinish();
      Date actualStartDate = parentTask.getActualStart();
      Date actualFinishDate = parentTask.getActualFinish();
      Date earlyStartDate = parentTask.getEarlyStart();
      Date earlyFinishDate = parentTask.getEarlyFinish();
      Date lateStartDate = parentTask.getLateStart();
      Date lateFinishDate = parentTask.getLateFinish();

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

         startDate = DateHelper.min(startDate, task.getStart());
         finishDate = DateHelper.max(finishDate, task.getFinish());
         actualStartDate = DateHelper.min(actualStartDate, task.getActualStart());
         actualFinishDate = DateHelper.max(actualFinishDate, task.getActualFinish());
         earlyStartDate = DateHelper.min(earlyStartDate, task.getEarlyStart());
         earlyFinishDate = DateHelper.max(earlyFinishDate, task.getEarlyFinish());
         lateStartDate = DateHelper.min(lateStartDate, task.getLateStart());
         lateFinishDate = DateHelper.max(lateFinishDate, task.getLateFinish());

         if (task.getActualFinish() != null)
         {
            ++finished;
         }
      }

      parentTask.setStart(startDate);
      parentTask.setFinish(finishDate);
      parentTask.setActualStart(actualStartDate);
      parentTask.setEarlyStart(earlyStartDate);
      parentTask.setEarlyFinish(earlyFinishDate);
      parentTask.setLateStart(lateStartDate);
      parentTask.setLateFinish(lateFinishDate);

      //
      // Only if all child tasks have actual finish dates do we
      // set the actual finish date on the parent task.
      //
      if (finished == parentTask.getChildTasks().size())
      {
         parentTask.setActualFinish(actualFinishDate);
      }
   }
}