View Javadoc

1   /**
2    * Copyright 2004-2013 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.tklm.time.user.pref;
17  
18  import org.apache.commons.lang.StringUtils;
19  import org.kuali.kpme.core.util.TKUtils;
20  import org.kuali.kpme.tklm.api.time.user.pref.UserPreferencesContract;
21  import org.kuali.kpme.tklm.common.TkConstants;
22  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
23  
24  public class UserPreferences extends PersistableBusinessObjectBase implements UserPreferencesContract {
25      public static final String CACHE_NAME = TkConstants.CacheNamespace.NAMESPACE_PREFIX + "UserPreferences";
26  
27  	private static final long serialVersionUID = 1L;
28  	private String principalId;
29  	private String timezone;
30  
31  	public UserPreferences(){}
32  
33  	public UserPreferences(String principalId, String timeZone){
34  		this.principalId = principalId;
35  		this.timezone = timeZone;
36  	}
37  
38  	public void setTimezone(String timezone) {
39  		this.timezone = timezone;
40  	}
41  
42  	public String getTimezone() {
43          if (StringUtils.isEmpty(timezone))
44              return TKUtils.getSystemTimeZone();
45  
46  		return timezone;
47  	}
48  
49  	public String getPrincipalId() {
50  		return principalId;
51  	}
52  
53  	public void setPrincipalId(String principalId) {
54  		this.principalId = principalId;
55  	}
56  
57  }