1 package com.atlassian.sal.api.timezone;
2
3 import java.util.TimeZone;
4
5 import javax.annotation.Nonnull;
6
7 import com.atlassian.sal.api.user.UserKey;
8
9 /**
10 *
11 * @since v2.6.0
12 */
13 public interface TimeZoneManager
14 {
15
16 /**
17 * Returns the time zone of the logged in user.
18 * NB: This is guaranteed to return a non-null value.
19 * If no user is logged in (anonymous user) or the system doesn't support time zone configuration or no specific time zone is configured,
20 * it should still return a time zone. (e.g. the default time zone for the system).
21 *
22 * @return the user's time zone. Should never return null.
23 */
24 @Nonnull
25 TimeZone getUserTimeZone();
26
27 /**
28 * Returns the time zone of the given user.
29 *
30 * NB: This is guaranteed to return a non-null value.
31 * If given user doesn't exists or invalid or the system doesn't support time zone configuration or no specific time zone is configured,
32 * for the given user then method still returns a time zone. (e.g. the default time zone for the system).
33 *
34 * @param user to return time zone for
35 * @return the user's time zone or default time if user not found, is invalid or has no specific time zone configured
36 * @throws NullPointerException if given user is <code>null</code>
37 * @since v2.13.0
38 */
39 @Nonnull
40 TimeZone getUserTimeZone(@Nonnull UserKey user);
41
42 /**
43 * Returns the default time zone for the application.
44 * NB: This is guaranteed to return a non-null value.
45 *
46 * If the system doesn't support time zone configuration, it should still return a time zone (e.g. the JVM time zone).
47 *
48 * @return the default time zone of the system. Should never return null.
49 */
50 @Nonnull
51 TimeZone getDefaultTimeZone();
52 }