001 /**
002 * Copyright 2004-2014 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.kpme.tklm.time.user.pref;
017
018 import org.apache.commons.lang.StringUtils;
019 import org.kuali.kpme.core.util.TKUtils;
020 import org.kuali.kpme.tklm.api.time.user.pref.UserPreferencesContract;
021 import org.kuali.kpme.tklm.common.TkConstants;
022 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
023
024 public class UserPreferences extends PersistableBusinessObjectBase implements UserPreferencesContract {
025 public static final String CACHE_NAME = TkConstants.CacheNamespace.NAMESPACE_PREFIX + "UserPreferences";
026
027 private static final long serialVersionUID = 1L;
028 private String principalId;
029 private String timezone;
030
031 public UserPreferences(){}
032
033 public UserPreferences(String principalId, String timeZone){
034 this.principalId = principalId;
035 this.timezone = timeZone;
036 }
037
038 public void setTimezone(String timezone) {
039 this.timezone = timezone;
040 }
041
042 public String getTimezone() {
043 if (StringUtils.isEmpty(timezone))
044 return TKUtils.getSystemTimeZone();
045
046 return timezone;
047 }
048
049 public String getPrincipalId() {
050 return principalId;
051 }
052
053 public void setPrincipalId(String principalId) {
054 this.principalId = principalId;
055 }
056
057 }