Package net.sf.mpxj

Examples of net.sf.mpxj.Duration


      assignment.setDelay(record.getDuration(11));

      //
      // Calculate the remaining work
      //
      Duration work = assignment.getWork();
      Duration actualWork = assignment.getActualWork();
      if (work != null && actualWork != null)
      {
         if (work.getUnits() != actualWork.getUnits())
         {
            actualWork = actualWork.convertUnits(work.getUnits(), m_projectFile.getProjectHeader());
         }

         assignment.setRemainingWork(Duration.getInstance(work.getDuration() - actualWork.getDuration(), work.getUnits()));
      }

      if (resource != null)
      {
         assignment.setResourceUniqueID(resource.getUniqueID());
View Full Code Here


    * @param unitsValue integer units value
    * @return Duration instance
    */
   public static Duration getDuration(ProjectHeader header, Integer durationValue, Integer unitsValue)
   {
      Duration result;
      if (durationValue == null)
      {
         result = null;
      }
      else
      {
         result = Duration.getInstance(durationValue.intValue(), TimeUnit.MINUTES);
         TimeUnit units = getDurationUnits(unitsValue);
         if (result.getUnits() != units)
         {
            result = result.convertUnits(units, header);
         }
      }
      return (result);
   }
View Full Code Here

    * @param recurrence RecurringTask instance
    * @return integer value
    */
   public static Integer getDurationUnits(RecurringTask recurrence)
   {
      Duration duration = recurrence.getDuration();
      Integer result = null;

      if (duration != null)
      {
         result = UNITS_MAP.get(duration.getUnits());
      }

      return (result);
   }
View Full Code Here

            }
            break;
         case DURATION :
            while (offset + 6 <= data.length)
            {
               Duration duration = MPPUtility.getAdjustedDuration(file, MPPUtility.getInt(data, offset), MPPUtility.getDurationTimeUnits(MPPUtility.getShort(data, offset + 4)));
               list.add(duration);
               offset += 6;
            }
            break;
         case STRING :
View Full Code Here

                     }
                     else
                     {
                        durationUnits = MPPUtility.getDurationTimeUnits(MPPUtility.getShort(durationData, 4));
                     }
                     Duration duration = Duration.getInstance(durationValueInHours, TimeUnit.HOURS);
                     value = duration.convertUnits(durationUnits, m_file.getProjectHeader());
                     break;
                  }

                  case BOOLEAN :
                  {
View Full Code Here

                     }
                     else
                     {
                        durationUnits = MPPUtility.getDurationTimeUnits(MPPUtility.getShort(durationData, 4));
                     }
                     Duration duration = Duration.getInstance(durationValueInHours, TimeUnit.HOURS);
                     value = duration.convertUnits(durationUnits, m_file.getProjectHeader());
                     break;

                  }

                  case BOOLEAN :
View Full Code Here

                        if (task1 != null && task2 != null)
                        {
                           RelationType type = RelationType.getInstance(MPPUtility.getShort(data, 12));
                           TimeUnit durationUnits = MPPUtility.getDurationTimeUnits(MPPUtility.getShort(data, 14));
                           Duration lag = MPPUtility.getAdjustedDuration(m_file, MPPUtility.getInt(data, 16), durationUnits);
                           Relation relation = task2.addPredecessor(task1, type, lag);
                           m_file.fireRelationReadEvent(relation);
                        }
                     }
                  }
View Full Code Here

         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);
            m_project.fireRelationReadEvent(relation);
         }
      }
   }
View Full Code Here

      // Calculate missing attributes
      //
      ProjectCalendar calendar = m_projectFile.getCalendar();
      if (calendar != null)
      {
         Duration duration = calendar.getWork(mpxjTask.getStart(), mpxjTask.getFinish(), TimeUnit.HOURS);
         double durationDays = duration.getDuration() / 8;
         if (durationDays > 0)
         {
            duration = Duration.getInstance(durationDays, TimeUnit.DAYS);
         }
         mpxjTask.setDuration(duration);

         if (percentComplete.intValue() != 0)
         {
            mpxjTask.setActualStart(mpxjTask.getStart());

            if (percentComplete.intValue() == 100)
            {
               mpxjTask.setActualFinish(mpxjTask.getFinish());
               mpxjTask.setActualDuration(duration);
               mpxjTask.setActualWork(mpxjTask.getWork());
               mpxjTask.setRemainingWork(Duration.getInstance(0, TimeUnit.HOURS));
            }
            else
            {
               Duration work = mpxjTask.getWork();
               Duration actualWork = Duration.getInstance((work.getDuration() * percentComplete.doubleValue()) / 100.0d, work.getUnits());

               mpxjTask.setActualDuration(Duration.getInstance((duration.getDuration() * percentComplete.doubleValue()) / 100.0d, duration.getUnits()));
               mpxjTask.setActualWork(actualWork);
               mpxjTask.setRemainingWork(Duration.getInstance(work.getDuration() - actualWork.getDuration(), work.getUnits()));
            }
         }
      }
      mpxjTask.setEffortDriven(true);

View Full Code Here

            {
               Integer predecessorID = getInteger(predecessor.getPredecessorId());
               Task predecessorTask = m_projectFile.getTaskByUniqueID(predecessorID);
               if (predecessorTask != null)
               {
                  Duration lag = getDuration(predecessor.getLag());
                  if (lag == null)
                  {
                     lag = Duration.getInstance(0, TimeUnit.HOURS);
                  }
                  Relation relation = mpxjTask.addPredecessor(predecessorTask, RELATIONSHIP_TYPES.get(predecessor.getType()), lag);
View Full Code Here

TOP

Related Classes of net.sf.mpxj.Duration

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.