net.sf.mpxj.Duration Java Examples

The following examples show how to use net.sf.mpxj.Duration. 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: PrimaveraPMFileWriter.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Retrieve a duration in the form required by Primavera.
 *
 * @param duration Duration instance
 * @return formatted duration
 */
private Double getDuration(Duration duration)
{
   Double result;
   if (duration == null)
   {
      result = null;
   }
   else
   {
      if (duration.getUnits() != TimeUnit.HOURS)
      {
         duration = duration.convertUnits(TimeUnit.HOURS, m_projectFile.getProjectProperties());
      }

      result = Double.valueOf(duration.getDuration());
   }
   return result;
}
 
Example #2
Source File: MerlinReader.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Extract a duration amount from the assignment, converting a percentage
 * into an actual duration.
 *
 * @param task parent task
 * @param work duration from assignment
 * @return Duration instance
 */
private Duration assignmentDuration(Task task, Duration work)
{
   Duration result = work;

   if (result != null)
   {
      if (result.getUnits() == TimeUnit.PERCENT)
      {
         Duration taskWork = task.getWork();
         if (taskWork != null)
         {
            result = Duration.getInstance(taskWork.getDuration() * result.getDuration(), taskWork.getUnits());
         }
      }
   }
   return result;
}
 
Example #3
Source File: MultiDayExceptionsTest.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Test an individual project.
 *
 * @param file project file
 */
private void testMultiDayExceptions(File file) throws Exception
{
   ProjectReader reader = ProjectReaderUtility.getProjectReader(file.getName());
   if (reader instanceof MPDDatabaseReader)
   {
      assumeJvm();
   }

   DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
   ProjectFile project = reader.read(file);
   ProjectCalendar calendar = project.getCalendarByName("Standard");

   Date startDate = DateHelper.getDayStartDate(df.parse("23/12/2019"));
   Date endDate = DateHelper.getDayEndDate(df.parse("08/01/2020"));

   Duration duration = calendar.getWork(startDate, endDate, TimeUnit.DAYS);

   assertEquals("9.0d", duration.toString());
}
 
Example #4
Source File: P3DatabaseReader.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Read task relationships.
 */
private void readRelationships()
{
   for (MapRow row : m_tables.get("REL"))
   {
      Task predecessor = m_activityMap.get(row.getString("PREDECESSOR_ACTIVITY_ID"));
      Task successor = m_activityMap.get(row.getString("SUCCESSOR_ACTIVITY_ID"));
      if (predecessor != null && successor != null)
      {
         Duration lag = row.getDuration("LAG_VALUE");
         RelationType type = row.getRelationType("LAG_TYPE");

         successor.addPredecessor(predecessor, type, lag);
      }
   }
}
 
Example #5
Source File: JsonWriter.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Write a duration field to the JSON file.
 *
 * @param fieldName field name
 * @param value field value
 */
private void writeDurationField(String fieldName, Object value) throws IOException
{
   if (value != null)
   {
      if (value instanceof String)
      {
         m_writer.writeNameValuePair(fieldName + "_text", (String) value);
      }
      else
      {
         Duration val = (Duration) value;
         if (val.getDuration() != 0)
         {
            Duration minutes = val.convertUnits(TimeUnit.MINUTES, m_projectFile.getProjectProperties());
            long seconds = (long) (minutes.getDuration() * 60.0);
            m_writer.writeNameValuePair(fieldName, seconds);
         }
      }
   }
}
 
Example #6
Source File: MpxjQuery.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Dump timephased work for an assignment.
 *
 * @param assignment resource assignment
 */
private static void listTimephasedWork(ResourceAssignment assignment)
{
   Task task = assignment.getTask();
   int days = (int) ((task.getFinish().getTime() - task.getStart().getTime()) / (1000 * 60 * 60 * 24)) + 1;
   if (days > 1)
   {
      SimpleDateFormat df = new SimpleDateFormat("dd/MM/yy");

      TimescaleUtility timescale = new TimescaleUtility();
      ArrayList<DateRange> dates = timescale.createTimescale(task.getStart(), TimescaleUnits.DAYS, days);
      TimephasedUtility timephased = new TimephasedUtility();

      ArrayList<Duration> durations = timephased.segmentWork(assignment.getCalendar(), assignment.getTimephasedWork(), TimescaleUnits.DAYS, dates);
      for (DateRange range : dates)
      {
         System.out.print(df.format(range.getStart()) + "\t");
      }
      System.out.println();
      for (Duration duration : durations)
      {
         System.out.print(duration.toString() + "        ".substring(0, 7) + "\t");
      }
      System.out.println();
   }
}
 
Example #7
Source File: DateHelper.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * This utility method calculates the difference in working
 * time between two dates, given the context of a task.
 *
 * @param task parent task
 * @param date1 first date
 * @param date2 second date
 * @param format required format for the resulting duration
 * @return difference in working time between the two dates
 */
public static Duration getVariance(Task task, Date date1, Date date2, TimeUnit format)
{
   Duration variance = null;

   if (date1 != null && date2 != null)
   {
      ProjectCalendar calendar = task.getEffectiveCalendar();
      if (calendar != null)
      {
         variance = calendar.getWork(date1, date2, format);
      }
   }

   if (variance == null)
   {
      variance = Duration.getInstance(0, format);
   }

   return (variance);
}
 
Example #8
Source File: MSPDIReader.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Test to determine if this is a split task.
 *
 * @param calendar current calendar
 * @param list timephased resource assignment list
 * @return boolean flag
 */
private boolean isSplit(ProjectCalendar calendar, List<TimephasedWork> list)
{
   boolean result = false;
   for (TimephasedWork assignment : list)
   {
      if (calendar != null && assignment.getTotalAmount().getDuration() == 0)
      {
         Duration calendarWork = calendar.getWork(assignment.getStart(), assignment.getFinish(), TimeUnit.MINUTES);
         if (calendarWork.getDuration() != 0)
         {
            result = true;
            break;
         }
      }
   }
   return result;
}
 
Example #9
Source File: SageReader.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Process an individual predecessor.
 *
 * @param line predecessor record
 */
private void processPredecessor(String line)
{
   String[] columns = line.split("\t");

   Task task = m_taskMap.get(parseID(columns, 0));
   if (task == null)
   {
      return;
   }

   Task predecessor = m_taskMap.get(parseID(columns, 1));
   if (predecessor == null)
   {
      return;
   }

   RelationType type = parseRelationType(columns, 2);
   Duration lag = parseDuration(columns, 3);
   // columns[4] - job
   // columns[5] - predecessor name
   // columns[6] - unknown
   // columns[7] - unknown

   task.addPredecessor(predecessor, type, lag);
}
 
Example #10
Source File: ObjectPropertiesController.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Replace default values will null, allowing them to be ignored.
 *
 * @param value value to test
 * @return filtered value
 */
private Object filterValue(Object value)
{
   if (value instanceof Boolean && !((Boolean) value).booleanValue())
   {
      value = null;
   }
   if (value instanceof String && ((String) value).isEmpty())
   {
      value = null;
   }
   if (value instanceof Double && ((Double) value).doubleValue() == 0.0)
   {
      value = null;
   }
   if (value instanceof Integer && ((Integer) value).intValue() == 0)
   {
      value = null;
   }
   if (value instanceof Duration && ((Duration) value).getDuration() == 0.0)
   {
      value = null;
   }

   return value;
}
 
Example #11
Source File: RecurrenceUtility.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Convert the integer representation of a duration value and duration units
 * into an MPXJ Duration instance.
 *
 * @param properties project properties, used for duration units conversion
 * @param durationValue integer duration value
 * @param unitsValue integer units value
 * @return Duration instance
 */
public static Duration getDuration(ProjectProperties properties, 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, properties);
      }
   }
   return (result);
}
 
Example #12
Source File: MPPAbstractTimephasedWorkNormaliser.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Retrieves the pro-rata work carried out on a given day.
 *
 * @param calendar current calendar
 * @param assignment current assignment.
 * @return assignment work duration
 */
private Duration getAssignmentWork(ProjectCalendar calendar, TimephasedWork assignment)
{
   Date assignmentStart = assignment.getStart();

   Date splitStart = assignmentStart;
   Date splitFinishTime = calendar.getFinishTime(splitStart);
   Date splitFinish = DateHelper.setTime(splitStart, splitFinishTime);

   Duration calendarSplitWork = calendar.getWork(splitStart, splitFinish, TimeUnit.MINUTES);
   Duration assignmentWorkPerDay = assignment.getAmountPerDay();
   Duration splitWork;

   double splitMinutes = assignmentWorkPerDay.getDuration();
   splitMinutes *= calendarSplitWork.getDuration();
   splitMinutes /= (8 * 60); // this appears to be a fixed value
   splitWork = Duration.getInstance(splitMinutes, TimeUnit.MINUTES);
   return splitWork;
}
 
Example #13
Source File: Record.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Accessor method used to retrieve an Duration object representing the
 * contents of an individual field. If the field does not exist in the
 * record, null is returned.
 *
 * @param field the index number of the field to be retrieved
 * @return the value of the required field
 * @throws MPXJException normally thrown when parsing fails
 */
public Duration getDuration(int field) throws MPXJException
{
   Duration result;

   if ((field < m_fields.length) && (m_fields[field].length() != 0))
   {
      result = DurationUtility.getInstance(m_fields[field], m_formats.getDurationDecimalFormat(), m_locale);
   }
   else
   {
      result = null;
   }

   return (result);
}
 
Example #14
Source File: DatatypeConverter.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Convert a duration in seconds to a Duration instance.
 *
 * @param durationInSeconds duration in seconds
 * @return Duration instance
 */
private static final Duration getDurationFromSeconds(int durationInSeconds)
{
   if (durationInSeconds == NULL_SECONDS)
   {
      return null;
   }
   double durationInHours = durationInSeconds;
   durationInHours /= (60 * 60);
   return Duration.getInstance(durationInHours, TimeUnit.HOURS);
}
 
Example #15
Source File: GanttProjectReader.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Read the relationships for an individual GanttProject task.
 *
 * @param gpTask GanttProject task
 */
private void readRelationships(net.sf.mpxj.ganttproject.schema.Task gpTask)
{
   for (Depend depend : gpTask.getDepend())
   {
      Task task1 = m_projectFile.getTaskByUniqueID(Integer.valueOf(NumberHelper.getInt(gpTask.getId()) + 1));
      Task task2 = m_projectFile.getTaskByUniqueID(Integer.valueOf(NumberHelper.getInt(depend.getId()) + 1));
      if (task1 != null && task2 != null)
      {
         Duration lag = Duration.getInstance(NumberHelper.getInt(depend.getDifference()), TimeUnit.DAYS);
         Relation relation = task2.addPredecessor(task1, getRelationType(depend.getType()), lag);
         m_eventManager.fireRelationReadEvent(relation);
      }
   }
}
 
Example #16
Source File: PlannerReader.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * This method extracts predecessor data from a Planner file.
 *
 * @param plannerTask Task data
 */
private void readPredecessors(net.sf.mpxj.planner.schema.Task plannerTask)
{
   Task mpxjTask = m_projectFile.getTaskByUniqueID(getInteger(plannerTask.getId()));

   Predecessors predecessors = plannerTask.getPredecessors();
   if (predecessors != null)
   {
      List<Predecessor> predecessorList = predecessors.getPredecessor();
      for (Predecessor predecessor : predecessorList)
      {
         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);
            m_eventManager.fireRelationReadEvent(relation);
         }
      }
   }

   //
   // Process child tasks
   //
   List<net.sf.mpxj.planner.schema.Task> childTasks = plannerTask.getTask();
   for (net.sf.mpxj.planner.schema.Task childTask : childTasks)
   {
      readPredecessors(childTask);
   }
}
 
Example #17
Source File: MerlinReader.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Read relation data.
 */
private void processDependencies() throws SQLException
{
   List<Row> rows = getRows("select * from zdependency where zproject=?", m_projectID);
   for (Row row : rows)
   {
      Task nextTask = m_project.getTaskByUniqueID(row.getInteger("ZNEXTACTIVITY_"));
      Task prevTask = m_project.getTaskByUniqueID(row.getInteger("ZPREVIOUSACTIVITY_"));
      Duration lag = row.getDuration("ZLAG_");
      RelationType type = row.getRelationType("ZTYPE");
      Relation relation = nextTask.addPredecessor(prevTask, type, lag);
      relation.setUniqueID(row.getInteger("Z_PK"));
   }
}
 
Example #18
Source File: DurationField.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override public Object read(String line, int offset)
{
   Object result;
   Integer value = ((Integer) super.read(line, offset));
   if (value == null)
   {
      result = null;
   }
   else
   {
      result = Duration.getInstance(value.intValue(), TimeUnit.DAYS);
   }
   return result;
}
 
Example #19
Source File: TableCONTAB.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override protected void readRow(int uniqueID, byte[] data)
{
   if (data[0] != (byte) 0xFF)
   {
      Map<String, Object> map = new HashMap<>();
      map.put("UNIQUE_ID", Integer.valueOf(uniqueID));
      map.put("TASK_ID_1", Integer.valueOf(PEPUtility.getShort(data, 1)));
      map.put("TASK_ID_2", Integer.valueOf(PEPUtility.getShort(data, 3)));
      map.put("TYPE", getRelationType(PEPUtility.getShort(data, 9)));
      map.put("LAG", Duration.getInstance(PEPUtility.getShort(data, 11), TimeUnit.DAYS));
      addRow(uniqueID, map);
   }
}
 
Example #20
Source File: RecurrenceUtility.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Converts a TimeUnit instance to an integer value suitable for
 * writing to an MPX file.
 *
 * @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);
}
 
Example #21
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);
   }
}
 
Example #22
Source File: SqliteResultSetRow.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override public Duration getDuration(String name)
{
   String value = getString(name);
   if (value == null || value.isEmpty())
   {
      throw new IllegalArgumentException("Unexpected duration value");
   }

   String[] items = value.split(",");
   if (items.length != 3)
   {
      throw new IllegalArgumentException("Unexpected duration value: " + value);
   }

   String item = DatatypeConverter.parseString(items[2]);
   Number durationValue;

   try
   {
      durationValue = DatatypeConverter.parseDouble(item);
   }

   catch (ParseException ex)
   {
      throw new IllegalArgumentException("Unexpected duration value", ex);
   }

   return Duration.getInstance(NumberHelper.getDouble(durationValue), TimeUnit.HOURS);
}
 
Example #23
Source File: MapRow.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override public Duration getDuration(String name)
{
   Duration result;
   String value = getString(name);
   if (value == null)
   {
      result = null;
   }
   else
   {
      result = parseDuration(value);
   }
   return result;
}
 
Example #24
Source File: ConceptDrawProjectReader.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Read a task relationship.
 *
 * @param link ConceptDraw PROJECT task link
 */
private void readRelationship(Link link)
{
   Task sourceTask = m_taskIdMap.get(link.getSourceTaskID());
   Task destinationTask = m_taskIdMap.get(link.getDestinationTaskID());
   if (sourceTask != null && destinationTask != null)
   {
      Duration lag = getDuration(link.getLagUnit(), link.getLag());
      RelationType type = link.getType();
      Relation relation = destinationTask.addPredecessor(sourceTask, type, lag);
      relation.setUniqueID(link.getID());
   }
}
 
Example #25
Source File: ConceptDrawProjectReader.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Read resource assignments.
 *
 * @param task Parent task
 * @param assignment ConceptDraw PROJECT resource assignment
 */
private void readResourceAssignment(Task task, Document.Projects.Project.Task.ResourceAssignments.ResourceAssignment assignment)
{
   Resource resource = m_projectFile.getResourceByUniqueID(assignment.getResourceID());
   if (resource != null)
   {
      ResourceAssignment mpxjAssignment = task.addResourceAssignment(resource);
      mpxjAssignment.setUniqueID(assignment.getID());
      mpxjAssignment.setWork(Duration.getInstance(assignment.getManHour().doubleValue() * m_workHoursPerDay, TimeUnit.HOURS));
      mpxjAssignment.setUnits(assignment.getUse());
   }
}
 
Example #26
Source File: MSPDIWriter.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Converts a duration to duration time units.
 *
 * @param value duration value
 * @return duration time units
 */
private BigInteger printExtendedAttributeDurationFormat(Object value)
{
   BigInteger result = null;
   if (value instanceof Duration)
   {
      result = DatatypeConverter.printDurationTimeUnits(((Duration) value).getUnits(), false);
   }
   return (result);
}
 
Example #27
Source File: MSPDIWriter.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * This method writes a single predecessor link to the MSPDI file.
 *
 * @param taskID The task UID
 * @param type The predecessor type
 * @param lag The lag duration
 * @return A new link to be added to the MSPDI file
 */
private Project.Tasks.Task.PredecessorLink writePredecessor(Integer taskID, RelationType type, Duration lag)
{
   Project.Tasks.Task.PredecessorLink link = m_factory.createProjectTasksTaskPredecessorLink();

   link.setPredecessorUID(NumberHelper.getBigInteger(taskID));
   link.setType(BigInteger.valueOf(type.getValue()));
   link.setCrossProject(Boolean.FALSE); // SF-300: required to keep P6 happy when importing MSPDI files

   if (lag != null && lag.getDuration() != 0)
   {
      double linkLag = lag.getDuration();
      if (lag.getUnits() != TimeUnit.PERCENT && lag.getUnits() != TimeUnit.ELAPSED_PERCENT)
      {
         linkLag = 10.0 * Duration.convertUnits(linkLag, lag.getUnits(), TimeUnit.MINUTES, m_projectFile.getProjectProperties()).getDuration();
      }
      link.setLinkLag(BigInteger.valueOf((long) linkLag));
      link.setLagFormat(DatatypeConverter.printDurationTimeUnits(lag.getUnits(), false));
   }
   else
   {
      // SF-329: default required to keep Powerproject happy when importing MSPDI files
      link.setLinkLag(BIGINTEGER_ZERO);
      link.setLagFormat(DatatypeConverter.printDurationTimeUnits(m_projectFile.getProjectProperties().getDefaultDurationUnits(), false));
   }

   return (link);
}
 
Example #28
Source File: MPD9AbstractReader.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Process a relationship between two tasks.
 *
 * @param row relationship data
 */
protected void processLink(Row row)
{
   Task predecessorTask = m_project.getTaskByUniqueID(row.getInteger("LINK_PRED_UID"));
   Task successorTask = m_project.getTaskByUniqueID(row.getInteger("LINK_SUCC_UID"));
   if (predecessorTask != null && successorTask != null)
   {
      RelationType type = RelationType.getInstance(row.getInt("LINK_TYPE"));
      TimeUnit durationUnits = MPDUtility.getDurationTimeUnits(row.getInt("LINK_LAG_FMT"));
      Duration duration = MPDUtility.getDuration(row.getDouble("LINK_LAG").doubleValue(), durationUnits);
      Relation relation = successorTask.addPredecessor(predecessorTask, type, duration);
      relation.setUniqueID(row.getInteger("LINK_UID"));
      m_eventManager.fireRelationReadEvent(relation);
   }
}
 
Example #29
Source File: MPXWriter.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * This method is called to format a relation.
 *
 * @param relation relation instance
 * @return formatted relation instance
 */
private String formatRelation(Relation relation)
{
   String result = null;

   if (relation != null)
   {
      StringBuilder sb = new StringBuilder(relation.getTargetTask().getID().toString());

      Duration duration = relation.getLag();
      RelationType type = relation.getType();
      double durationValue = duration.getDuration();

      if ((durationValue != 0) || (type != RelationType.FINISH_START))
      {
         String[] typeNames = LocaleData.getStringArray(m_locale, LocaleData.RELATION_TYPES);
         sb.append(typeNames[type.getValue()]);
      }

      if (durationValue != 0)
      {
         if (durationValue > 0)
         {
            sb.append('+');
         }

         sb.append(formatDuration(duration));
      }

      result = sb.toString();
   }

   m_eventManager.fireRelationWrittenEvent(relation);
   return (result);
}
 
Example #30
Source File: DatatypeConverter.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Retrieve a duration in the form required by Phoenix.
 *
 * @param duration Duration instance
 * @return formatted duration
 */
public static final String printDuration(Duration duration)
{
   String result = null;
   if (duration != null)
   {
      result = duration.getDuration() + " " + printTimeUnits(duration.getUnits());
   }
   return result;
}