private String getDurationString ( Duration value ) { String result = null ; if ( value != null ) { double seconds = 0 ; switch ( value . getUnits ( ) ) { case MINUTES : case ELAPSED_MINUTES : { seconds = value . getDuration ( ) * 60 ; break ; } case HOURS : case ELAPSED_HOURS : { seconds = value . getDuration ( ) * ( 60 * 60 ) ; break ; } case DAYS : { double minutesPerDay = m_projectFile . getProjectProperties ( ) . getMinutesPerDay ( ) . doubleValue ( ) ; seconds = value . getDuration ( ) * ( minutesPerDay * 60 ) ; break ; } case ELAPSED_DAYS : { seconds = value . getDuration ( ) * ( 24 * 60 * 60 ) ; break ; } case WEEKS : { double minutesPerWeek = m_projectFile . getProjectProperties ( ) . getMinutesPerWeek ( ) . doubleValue ( ) ; seconds = value . getDuration ( ) * ( minutesPerWeek * 60 ) ; break ; } case ELAPSED_WEEKS : { seconds = value . getDuration ( ) * ( 7 * 24 * 60 * 60 ) ; break ; } case MONTHS : { double minutesPerDay = m_projectFile . getProjectProperties ( ) . getMinutesPerDay ( ) . doubleValue ( ) ; double daysPerMonth = m_projectFile . getProjectProperties ( ) . getDaysPerMonth ( ) . doubleValue ( ) ; seconds = value . getDuration ( ) * ( daysPerMonth * minutesPerDay * 60 ) ; break ; } case ELAPSED_MONTHS : { seconds = value . getDuration ( ) * ( 30 * 24 * 60 * 60 ) ; break ; } case YEARS : { double minutesPerDay = m_projectFile . getProjectProperties ( ) . getMinutesPerDay ( ) . doubleValue ( ) ; double daysPerMonth = m_projectFile . getProjectProperties ( ) . getDaysPerMonth ( ) . doubleValue ( ) ; seconds = value . getDuration ( ) * ( 12 * daysPerMonth * minutesPerDay * 60 ) ; break ; } case ELAPSED_YEARS : { seconds = value . getDuration ( ) * ( 365 * 24 * 60 * 60 ) ; break ; } default : { break ; } } result = Long . toString ( ( long ) seconds ) ; } return ( result ) ; }
Converts an MPXJ Duration instance into the string representation of a Planner duration .