Package com.atlassian.jira.timezone
Interface TimeZoneService
- All Known Implementing Classes:
TimeZoneServiceCachingDecorator
,TimeZoneServiceImpl
@PublicApi
public interface TimeZoneService
The TimeZoneService manages the JIRA wide default timezone.
This default time zone is either the JVM default time zone or can be configured by the administrator.
The TimeZoneService is also used to retrieve a list of time zone and regions for the administration UI.
- Since:
- v4.4
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
clearDefaultTimeZone
(JiraServiceContext serviceContext) Reset the default time zone to the JVM time zone.void
clearUserDefaultTimeZone
(JiraServiceContext serviceContext) Resets the time zone for this user to the JIRA default time zone.getDefaultTimeZoneInfo
(JiraServiceContext serviceContext) Returns the default time zone which is globally configured.Return the region key of the current default time zone.getJVMTimeZoneInfo
(JiraServiceContext serviceContext) Returns the time zone of the JVMgetTimeZoneInfos
(JiraServiceContext serviceContext) Retrieves all time zones.getTimeZoneRegions
(JiraServiceContext serviceContext) Returns all time zone regions.getUserTimeZoneInfo
(JiraServiceContext serviceContext) Return the time zone for this user.void
setDefaultTimeZone
(String timeZoneId, JiraServiceContext serviceContext) Allows to set the default time zone.void
setUserDefaultTimeZone
(String timeZoneId, JiraServiceContext serviceContext) Sets the default time zone for this user.boolean
usesJiraTimeZone
(JiraServiceContext serviceContext) Returns true if this user is using the JIRA default time zone or false if the user has is using a custom time zone.boolean
Returns true if the JVM time zone is used, otherwise false.
-
Field Details
-
SYSTEM
- See Also:
-
JIRA
- See Also:
-
-
Method Details
-
getJVMTimeZoneInfo
Returns the time zone of the JVM- Parameters:
serviceContext
- JIRA Service Context containing the user that is retrieving the time zone information.- Returns:
- the time zone of the JVM
-
getDefaultTimeZoneInfo
Returns the default time zone which is globally configured. This can either be the JVM time zone or a time zone configured by the administrator.- Parameters:
serviceContext
- JIRA Service Context containing the user that is retrieving the time zone information.- Returns:
- Returns the default time zone
-
getTimeZoneRegions
Returns all time zone regions. Timezones are grouped by region, so it is more convenient for the user to find the correct time zone. Regions have a key and an i18n display name.- Parameters:
serviceContext
- JIRA Service Context containing the user that is retrieving the time zone information.- Returns:
- Returns all time zone regions.
-
getTimeZoneInfos
Retrieves all time zones. Returns only a subset of the time zones which are provided by the JVM. This cannonical list of time zones can be found here: See http://joda-time.sourceforge.net/time zones.html- Parameters:
serviceContext
- JIRA Service Context containing the user that is retrieving the time zone information.- Returns:
- all supported time zones
-
useSystemTimeZone
boolean useSystemTimeZone()Returns true if the JVM time zone is used, otherwise false.- Returns:
- true if the JVM time zone is used.
-
setDefaultTimeZone
Allows to set the default time zone. The user requires the JIRA administrator permission to perform this operation. Only time zones with IDs returned by getTimeZoneInfos() are supported.- Parameters:
timeZoneId
- the id of the time zone.serviceContext
- JIRA Service Context containing the user that changing the default time zone.
-
clearDefaultTimeZone
Reset the default time zone to the JVM time zone.- Parameters:
serviceContext
- JIRA Service Context containing the user that changing the default time zone.
-
getDefaultTimeZoneRegionKey
String getDefaultTimeZoneRegionKey()Return the region key of the current default time zone. If the region key is SYSTEM, it indicates it is using the JVM time zone.- Returns:
- region key.
-
clearUserDefaultTimeZone
Resets the time zone for this user to the JIRA default time zone.- Parameters:
serviceContext
- JIRA Service Context containing the user.
-
getUserTimeZoneInfo
Return the time zone for this user. This can either be a time zone which the user has defined in its preferences or the JIRA default time zone. NB: If the user is null JIRA's default time zone is returned.- Parameters:
serviceContext
- JIRA Service Context containing the user.- Returns:
- the TimeZone for this user.
-
usesJiraTimeZone
Returns true if this user is using the JIRA default time zone or false if the user has is using a custom time zone.- Parameters:
serviceContext
-- Returns:
- true if this user is using the JIRA default time zone or false if the user has is using a custom time zone.
-
setUserDefaultTimeZone
Sets the default time zone for this user.- Parameters:
timeZoneId
- the time zone idserviceContext
- JIRA Service Context containing the user.
-