code: public static Integer getDurationValue(ProjectProperties properties, Duration duration)
     {
        Integer result;
        if (duration == null)
        {
           result = null;
        }
        else
        {
           if (duration.getUnits() != TimeUnit.MINUTES)
           {
              duration = duration.convertUnits(TimeUnit.MINUTES, properties);
           }
           result = Integer.valueOf((int) duration.getDuration());
        }
        return (result);
     }
docs: Convert an MPXJ Duration instance into an integer duration in minutes
  ready to be written to an MPX file.
  
  @param properties project properties, used for duration units conversion
  @param duration Duration instance
  @return integer duration in minutes