java.lang.Object | |
↳ | com.atlassian.jira.util.JiraDurationUtils |
Util class reponsible for printing durations in various formats.
Note that this class uses the Duration formatting as configured for time-tracking and is therefore quite specific. For more generic duration formatting see com.atlassian.core.util.DateUtils
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
JiraDurationUtils.DaysDurationFormatter | This formatter formats time duration to days only. | ||||||||||
JiraDurationUtils.DurationFormatter | This interface defines methods for formatting time duration | ||||||||||
JiraDurationUtils.HoursDurationFormatter | This formatter formats time duration to hours only. | ||||||||||
JiraDurationUtils.PrettyDurationFormatter | This formatter formats time duration to "pretty" format, such as 3 weeks, 2 days, 1 hour, 15 minutes. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | FORMAT_DAYS | days formatter application property value | |||||||||
String | FORMAT_HOURS | hours formatter application property value | |||||||||
String | FORMAT_PRETTY | pretty formatter aplication property value |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
formatterRef | duration formatter currently in use |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This constructor is deprecated.
Use alternate constructor
JiraDurationUtils(ApplicationProperties, JiraAuthenticationContext, TimeTrackingConfiguration, EventPublisher, I18nHelper.BeanFactory, CacheManager)
| |||||||||||
Sets the duration formatter based on the settings in the application properties and authentication context
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Formats time duration with given locale
| |||||||||||
Formats time duration with default (system) locale
| |||||||||||
Returns i18n resource key for the current formatter
| |||||||||||
Formats time duration in the most compact way possible.
| |||||||||||
Formats time duration in the most compact way possible.
| |||||||||||
Turn a duration string into the number of seconds that it represents, taking into account JIRA's configuration
(i.e.
| |||||||||||
This method is deprecated.
since v4.4. Use
parseDuration(String, Locale) instead.
| |||||||||||
This method wil be called after the plugin system is fully initialised and all components added to the
dependency injection framework.
| |||||||||||
Sets the duration formatter with a new instance of a particular formatter chosen based on the settings in the
application properties and authentication context
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
com.atlassian.jira.extension.Startable
|
days formatter application property value
hours formatter application property value
pretty formatter aplication property value
duration formatter currently in use
This constructor is deprecated.
Use alternate constructor
JiraDurationUtils(ApplicationProperties, JiraAuthenticationContext, TimeTrackingConfiguration, EventPublisher, I18nHelper.BeanFactory, CacheManager)
Sets the duration formatter based on the settings in the application properties and authentication context
applicationProperties | application properties |
---|---|
authenticationContext | the context of the logged in user, used to get an I18nHelper appropriate for the user |
timeTrackingConfiguration | the current time tracking configuration |
eventPublisher | event publisher so the duration utils can be notified when an import occurs. |
i18nFactory | the creator of i18nBean classes. |
Sets the duration formatter based on the settings in the application properties and authentication context
applicationProperties | application properties |
---|---|
authenticationContext | the context of the logged in user, used to get an I18nHelper appropriate for the user |
timeTrackingConfiguration | the current time tracking configuration |
eventPublisher | event publisher so the duration utils can be notified when an import occurs. |
i18nFactory | the creator of i18nBean classes. |
cacheManager | the cache manager |
Formats time duration with given locale
duration | time duration to format |
---|---|
locale | user's locale |
Formats time duration with default (system) locale
duration | time duration to format |
---|
Returns i18n resource key for the current formatter
Formats time duration in the most compact way possible.
duration | time in seconds |
---|---|
locale | locale to use. This is used only for translation, not for decimal formatting. |
Formats time duration in the most compact way possible.
duration | time duration to format |
---|
Turn a duration string into the number of seconds that it represents, taking into account JIRA's configuration (i.e. how many hours are in a day, how many days are in a week, etc)
duration | string in JIRA's duration format (i.e. "20h") |
---|---|
locale | Locale to use when interpreting the duration string |
InvalidDurationException | when the duration cannot be parsed |
---|
This method is deprecated.
since v4.4. Use parseDuration(String, Locale)
instead.
Turn a duration string into the number of seconds that it represents, taking into account JIRA's configuration (i.e. how many hours are in a day, how many days are in a week, etc) This uses the default locale of Locale.UK and is retained for backwards compatibility
duration | string in JIRA's duration format (i.e. "20h") |
---|
InvalidDurationException | when the duration cannot be parsed |
---|
This method wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.
Exception |
---|
Sets the duration formatter with a new instance of a particular formatter chosen based on the settings in the application properties and authentication context
applicationProperties | application properties |
---|---|
authenticationContext | authentication context |