com.atlassian.jira.timezone
Class TimeZoneServiceImpl

java.lang.Object
  extended by com.atlassian.jira.timezone.TimeZoneServiceImpl
All Implemented Interfaces:
TimeZoneResolver, TimeZoneService

public class TimeZoneServiceImpl
extends Object
implements TimeZoneService, TimeZoneResolver

Since:
v4.4

Field Summary
 
Fields inherited from interface com.atlassian.jira.timezone.TimeZoneService
JIRA, SYSTEM
 
Constructor Summary
TimeZoneServiceImpl(ApplicationProperties applicationProperties, PermissionManager permissionManager, UserPreferencesManager userPreferencesManager)
           
TimeZoneServiceImpl(ApplicationProperties applicationProperties, PermissionManager permissionManager, UserPreferencesManager userPreferencesManager, com.atlassian.jira.timezone.TimeZoneIdsProvider timeZoneIdsProvider)
           
 
Method Summary
 void 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.
protected  Set<String> getCanonicalIds()
           
 TimeZone getDefaultTimeZone(JiraServiceContext serviceContext)
          Returns the JIRA default time zone.
 TimeZoneInfo getDefaultTimeZoneInfo(JiraServiceContext serviceContext)
          Returns the default time zone which is globally configured.
 String getDefaultTimeZoneRegionKey()
          Return the region key of the current default time zone.
protected  TimeZone getJVMTimeZone()
           
 TimeZoneInfo getJVMTimeZoneInfo(JiraServiceContext serviceContext)
          Returns the time zone of the JVM
 List<TimeZoneInfo> getTimeZoneInfos(JiraServiceContext serviceContext)
          Retrieves all time zones.
 List<RegionInfo> getTimeZoneRegions(JiraServiceContext serviceContext)
          Returns all time zone regions.
 TimeZone getUserTimeZone(JiraServiceContext serviceContext)
          Returns a user's effective time zone.
 TimeZoneInfo 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 useSystemTimeZone()
          Returns true if the JVM time zone is used, otherwise false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeZoneServiceImpl

public TimeZoneServiceImpl(ApplicationProperties applicationProperties,
                           PermissionManager permissionManager,
                           UserPreferencesManager userPreferencesManager)

TimeZoneServiceImpl

public TimeZoneServiceImpl(ApplicationProperties applicationProperties,
                           PermissionManager permissionManager,
                           UserPreferencesManager userPreferencesManager,
                           com.atlassian.jira.timezone.TimeZoneIdsProvider timeZoneIdsProvider)
Method Detail

getDefaultTimeZoneInfo

public TimeZoneInfo getDefaultTimeZoneInfo(JiraServiceContext serviceContext)
Description copied from interface: TimeZoneService
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.

Specified by:
getDefaultTimeZoneInfo in interface TimeZoneService
Parameters:
serviceContext - JIRA Service Context containing the user that is retrieving the time zone information.
Returns:
Returns the default time zone

useSystemTimeZone

public boolean useSystemTimeZone()
Description copied from interface: TimeZoneService
Returns true if the JVM time zone is used, otherwise false.

Specified by:
useSystemTimeZone in interface TimeZoneService
Returns:
true if the JVM time zone is used.

getTimeZoneRegions

public List<RegionInfo> getTimeZoneRegions(JiraServiceContext serviceContext)
Description copied from interface: TimeZoneService
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.

Specified by:
getTimeZoneRegions in interface TimeZoneService
Parameters:
serviceContext - JIRA Service Context containing the user that is retrieving the time zone information.
Returns:
Returns all time zone regions.

getTimeZoneInfos

public List<TimeZoneInfo> getTimeZoneInfos(JiraServiceContext serviceContext)
Description copied from interface: TimeZoneService
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

Specified by:
getTimeZoneInfos in interface TimeZoneService
Parameters:
serviceContext - JIRA Service Context containing the user that is retrieving the time zone information.
Returns:
all supported time zones

getCanonicalIds

protected Set<String> getCanonicalIds()

getJVMTimeZoneInfo

public TimeZoneInfo getJVMTimeZoneInfo(JiraServiceContext serviceContext)
Description copied from interface: TimeZoneService
Returns the time zone of the JVM

Specified by:
getJVMTimeZoneInfo in interface TimeZoneService
Parameters:
serviceContext - JIRA Service Context containing the user that is retrieving the time zone information.
Returns:
the time zone of the JVM

getJVMTimeZone

protected TimeZone getJVMTimeZone()

setDefaultTimeZone

public void setDefaultTimeZone(String timeZoneId,
                               JiraServiceContext serviceContext)
Description copied from interface: TimeZoneService
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.

Specified by:
setDefaultTimeZone in interface TimeZoneService
Parameters:
timeZoneId - the id of the time zone.
serviceContext - JIRA Service Context containing the user that changing the default time zone.

clearDefaultTimeZone

public void clearDefaultTimeZone(JiraServiceContext serviceContext)
Description copied from interface: TimeZoneService
Reset the default time zone to the JVM time zone.

Specified by:
clearDefaultTimeZone in interface TimeZoneService
Parameters:
serviceContext - JIRA Service Context containing the user that changing the default time zone.

getDefaultTimeZoneRegionKey

public String getDefaultTimeZoneRegionKey()
Description copied from interface: TimeZoneService
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.

Specified by:
getDefaultTimeZoneRegionKey in interface TimeZoneService
Returns:
region key.

clearUserDefaultTimeZone

public void clearUserDefaultTimeZone(JiraServiceContext serviceContext)
Description copied from interface: TimeZoneService
Resets the time zone for this user to the JIRA default time zone.

Specified by:
clearUserDefaultTimeZone in interface TimeZoneService
Parameters:
serviceContext - JIRA Service Context containing the user.

getUserTimeZoneInfo

public TimeZoneInfo getUserTimeZoneInfo(JiraServiceContext serviceContext)
Description copied from interface: TimeZoneService
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.

Specified by:
getUserTimeZoneInfo in interface TimeZoneService
Parameters:
serviceContext - JIRA Service Context containing the user.
Returns:
the TimeZone for this user.

usesJiraTimeZone

public boolean usesJiraTimeZone(JiraServiceContext serviceContext)
Description copied from interface: TimeZoneService
Returns true if this user is using the JIRA default time zone or false if the user has is using a custom time zone.

Specified by:
usesJiraTimeZone in interface TimeZoneService
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

public void setUserDefaultTimeZone(String timeZoneId,
                                   JiraServiceContext serviceContext)
Description copied from interface: TimeZoneService
Sets the default time zone for this user.

Specified by:
setUserDefaultTimeZone in interface TimeZoneService
Parameters:
timeZoneId - the time zone id
serviceContext - JIRA Service Context containing the user.

getDefaultTimeZone

public TimeZone getDefaultTimeZone(JiraServiceContext serviceContext)
Description copied from interface: TimeZoneResolver
Returns the JIRA default time zone.

Specified by:
getDefaultTimeZone in interface TimeZoneResolver
Parameters:
serviceContext - a JiraServiceContext
Returns:
a TimeZone
See Also:
TimeZoneService.getDefaultTimeZoneInfo(com.atlassian.jira.bc.JiraServiceContext)

getUserTimeZone

public TimeZone getUserTimeZone(JiraServiceContext serviceContext)
Description copied from interface: TimeZoneResolver
Returns a user's effective time zone.

Specified by:
getUserTimeZone in interface TimeZoneResolver
Parameters:
serviceContext - a JiraServiceContext
Returns:
a TimeZone
See Also:
TimeZoneService.getUserTimeZoneInfo(com.atlassian.jira.bc.JiraServiceContext)


Copyright © 2002-2012 Atlassian. All Rights Reserved.