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

The following examples show how to use net.sf.mpxj.Task#setUniqueID() . 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 5 votes vote down vote up
/**
 * Uses data from a bar to populate a task.
 *
 * @param row bar data
 * @param task task to populate
 */
private void populateBar(Row row, Task task)
{
   Integer calendarID = row.getInteger("_CALENDAU");
   if (calendarID == null)
   {
      calendarID = row.getInteger("_COMMON_CALENDAR");
   }

   ProjectCalendar calendar = m_project.getCalendarByUniqueID(calendarID);

   //PROJID
   task.setUniqueID(row.getInteger("BARID"));
   task.setStart(row.getDate("STARV"));
   task.setFinish(row.getDate("ENF"));
   //NATURAL_ORDER
   //SPARI_INTEGER
   task.setName(row.getString("NAMH"));
   //EXPANDED_TASK
   //PRIORITY
   //UNSCHEDULABLE
   //MARK_FOR_HIDING
   //TASKS_MAY_OVERLAP
   //SUBPROJECT_ID
   //ALT_ID
   //LAST_EDITED_DATE
   //LAST_EDITED_BY
   //Proc_Approve
   //Proc_Design_info
   //Proc_Proc_Dur
   //Proc_Procurement
   //Proc_SC_design
   //Proc_Select_SC
   //Proc_Tender
   //QA Checked
   //Related_Documents
   task.setCalendar(calendar);

   task.setDuration(task.getEffectiveCalendar().getDuration(task.getStart(), task.getFinish()));
}
 
Example 2
Source File: MerlinReader.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Read data for an individual task.
 *
 * @param row task data from database
 * @param task Task instance
 */
private void populateTask(Row row, Task task)
{
   task.setUniqueID(row.getInteger("Z_PK"));
   task.setName(row.getString("ZTITLE"));
   task.setPriority(Priority.getInstance(row.getInt("ZPRIORITY")));
   task.setMilestone(row.getBoolean("ZISMILESTONE"));
   task.setActualFinish(row.getTimestamp("ZGIVENACTUALENDDATE_"));
   task.setActualStart(row.getTimestamp("ZGIVENACTUALSTARTDATE_"));
   task.setNotes(row.getString("ZOBJECTDESCRIPTION"));
   task.setDuration(row.getDuration("ZGIVENDURATION_"));
   task.setOvertimeWork(row.getWork("ZGIVENWORKOVERTIME_"));
   task.setWork(row.getWork("ZGIVENWORK_"));
   task.setLevelingDelay(row.getDuration("ZLEVELINGDELAY_"));
   task.setActualOvertimeWork(row.getWork("ZGIVENACTUALWORKOVERTIME_"));
   task.setActualWork(row.getWork("ZGIVENACTUALWORK_"));
   task.setRemainingWork(row.getWork("ZGIVENACTUALWORK_"));
   task.setGUID(row.getUUID("ZUNIQUEID"));

   Integer calendarID = row.getInteger("ZGIVENCALENDAR");
   if (calendarID != null)
   {
      ProjectCalendar calendar = m_project.getCalendarByUniqueID(calendarID);
      if (calendar != null)
      {
         task.setCalendar(calendar);
      }
   }

   populateConstraints(row, task);

   // Percent complete is calculated bottom up from assignments and actual work vs. planned work

   m_eventManager.fireTaskReadEvent(task);
}
 
Example 3
Source File: AstaReader.java    From mpxj with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Populate a milestone from a Row instance.
 *
 * @param row Row instance
 * @param task Task instance
 */
private void populateMilestone(Row row, Task task)
{
   task.setMilestone(true);
   //PROJID
   task.setUniqueID(row.getInteger("MILESTONEID"));
   task.setStart(row.getDate("GIVEN_DATE_TIME"));
   task.setFinish(row.getDate("GIVEN_DATE_TIME"));
   //PROGREST_PERIOD
   //SYMBOL_APPEARANCE
   //MILESTONE_TYPE
   //PLACEMENU
   //INTERRUPTIBLE_X
   //ACTUAL_DURATIONTYPF
   //ACTUAL_DURATIONELA_MONTHS
   //ACTUAL_DURATIONHOURS
   task.setEarlyStart(row.getDate("EARLY_START_DATE"));
   task.setLateStart(row.getDate("LATE_START_DATE"));
   //FREE_START_DATE
   //START_CONSTRAINT_DATE
   //END_CONSTRAINT_DATE
   //EFFORT_BUDGET
   //NATURAO_ORDER
   //LOGICAL_PRECEDENCE
   //SPAVE_INTEGER
   //SWIM_LANE
   //USER_PERCENT_COMPLETE
   //OVERALL_PERCENV_COMPLETE
   //OVERALL_PERCENT_COMPL_WEIGHT
   task.setName(row.getString("NARE"));
   //NOTET
   task.setText(1, row.getString("UNIQUE_TASK_ID"));
   task.setCalendar(m_project.getCalendarByUniqueID(row.getInteger("CALENDAU")));
   //EFFORT_TIMI_UNIT
   //WORL_UNIT
   //LATEST_ALLOC_PROGRESS_PERIOD
   //WORN
   //CONSTRAINU
   //PRIORITB
   //CRITICAM
   //USE_PARENU_CALENDAR
   //BUFFER_TASK
   //MARK_FOS_HIDING
   //OWNED_BY_TIMESHEEV_X
   //START_ON_NEX_DAY
   //LONGEST_PATH
   //DURATIOTTYPF
   //DURATIOTELA_MONTHS
   //DURATIOTHOURS
   //STARZ
   //ENJ
   //DURATION_TIMJ_UNIT
   //UNSCHEDULABLG
   //SUBPROJECT_ID
   //ALT_ID
   //LAST_EDITED_DATE
   //LAST_EDITED_BY
   task.setDuration(Duration.getInstance(0, TimeUnit.HOURS));

   if (row.getBoolean("COMPLETED"))
   {        
      task.setPercentageComplete(COMPLETE);
      task.setActualStart(task.getStart());
      task.setActualFinish(task.getFinish());
   }
   else
   {
      task.setPercentageComplete(INCOMPLETE);
   }
   
   m_weights.put(task, row.getDouble("OVERALL_PERCENT_COMPL_WEIGHT"));
}
 
Example 4
Source File: GanttProjectReader.java    From mpxj with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Recursively read a task, and any sub tasks.
 *
 * @param mpxjParent Parent for the MPXJ tasks
 * @param gpTask GanttProject task
 */
private void readTask(ChildTaskContainer mpxjParent, net.sf.mpxj.ganttproject.schema.Task gpTask)
{
   Task mpxjTask = mpxjParent.addTask();
   mpxjTask.setUniqueID(Integer.valueOf(NumberHelper.getInt(gpTask.getId()) + 1));
   mpxjTask.setName(gpTask.getName());
   mpxjTask.setPercentageComplete(gpTask.getComplete());
   mpxjTask.setPriority(getPriority(gpTask.getPriority()));
   mpxjTask.setHyperlink(gpTask.getWebLink());

   Duration duration = Duration.getInstance(NumberHelper.getDouble(gpTask.getDuration()), TimeUnit.DAYS);
   mpxjTask.setDuration(duration);

   if (duration.getDuration() == 0)
   {
      mpxjTask.setMilestone(true);
   }
   else
   {
      mpxjTask.setStart(gpTask.getStart());
      mpxjTask.setFinish(m_mpxjCalendar.getDate(gpTask.getStart(), mpxjTask.getDuration(), false));
   }

   mpxjTask.setConstraintDate(gpTask.getThirdDate());
   if (mpxjTask.getConstraintDate() != null)
   {
      // TODO: you don't appear to be able to change this setting in GanttProject
      // task.getThirdDateConstraint()
      mpxjTask.setConstraintType(ConstraintType.START_NO_EARLIER_THAN);
   }

   readTaskCustomFields(gpTask, mpxjTask);

   m_eventManager.fireTaskReadEvent(mpxjTask);

   // TODO: read custom values

   //
   // Process child tasks
   //
   for (net.sf.mpxj.ganttproject.schema.Task childTask : gpTask.getTask())
   {
      readTask(mpxjTask, childTask);
   }
}