code: public static Integer getDurationUnits(RecurringTask recurrence)
     {
        Duration duration = recurrence.getDuration();
        Integer result = null;
  
        if (duration != null)
        {
           result = UNITS_MAP.get(duration.getUnits());
        }
  
        return (result);
     }
docs: Converts a TimeUnit instance to an integer value suitable for
  writing to an MPX file.
  
  @param recurrence RecurringTask instance
  @return integer value