View Javadoc

1   /**
2    * Copyright 2004-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.kpme.core.service.timezone;
17  
18  import org.joda.time.DateTimeZone;
19  import org.kuali.kpme.core.util.HrConstants;
20  import org.springframework.cache.annotation.Cacheable;
21  
22  public interface TimezoneService {
23  
24      /**
25       * Returns the DateTimeZone object for the current user OR the system
26       * default timezone if there is no current user / a time zone is missing.
27       *
28       * @return
29       */
30      public DateTimeZone getUserTimezoneWithFallback();
31  
32  	/**
33  	 * Fetch user time zone of the current on-context user.
34  	 * @return
35  	 */
36  	public String getUserTimezone();
37  
38      /**
39       * (this call may be cached)
40       * Fetch the users timezone, Data on:
41       *
42       * Principal Calendar > Job/Location > System Default
43       *
44       * @param principalId The principal you are looking for.
45       *
46       * @return String timezone, see: http://joda-time.sourceforge.net/timezones.html
47       */
48      @Cacheable(value= HrConstants.CacheNamespace.KPME_GLOBAL_CACHE_NAME, key="'{UserTimezone}' + 'principalId=' + #p0")
49      public String getUserTimezone(String principalId);
50  
51  	/**
52  	 * Determine if Timezone is same as server timezone
53  	 * @return
54  	 */
55  	public boolean isSameTimezone();
56  	
57  	/**
58  	 * Fetch the time zone of the approver. This method is used in the approval page
59  	 * @param principalId The principal id for the approver
60  	 * @return String timezone, see: http://joda-time.sourceforge.net/timezones.html
61  	 */
62  	public String getApproverTimezone(String principalId);
63  	
64  	/**
65  	 * Fetch the time zone of the current target user.
66  	 * If there's no target user, time zone of the current user or system time zone will be returned
67  	 * @return 
68  	 */
69  	public DateTimeZone getTargetUserTimezoneWithFallback();
70  	
71  	/**
72  	 * Fetch the id of the time zone of the current target user.
73  	 * If there's no target user, time zone of the current user or system time zone will be returned
74  	 * @return String timezone, see: http://joda-time.sourceforge.net/timezones.html
75  	 */
76  	public String getTargetUserTimezone();
77  
78  }