📄 user.java
字号:
/*
* Copyright (c) 2003, Rafael Steil
* All rights reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided
* that the following conditions are met:
*
* 1) Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
* 2) Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or
* other materials provided with the distribution.
* 3) Neither the name of "Rafael Steil" nor
* the names of its contributors may be used to endorse
* or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
*
* This file creating date: Feb 17, 2003 / 10:25:04 PM
* The JForum Project
* http://www.jforum.net
*
* $Id: User.java,v 1.12 2005/02/01 21:44:41 rafaelsteil Exp $
*/
package net.jforum.entities;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import net.jforum.SessionFacade;
import net.jforum.util.preferences.ConfigKeys;
import net.jforum.util.preferences.SystemGlobals;
/**
* Represents a single user in the system.
* An user is every person which uses the forum. Well,
* every registered user. Anonymous users does not have
* a specific ID, for example. This class contains all information
* about some user configuration options and preferences.
*
* @author Rafael Steil
*/
public class User implements Serializable
{
private int id;
private int themeId;
private int level;
private int totalPosts;
private boolean attachSignatureEnabled = true;
private int rankId = 1;
private boolean htmlEnabled = true;
private boolean bbCodeEnabled = true;
private boolean smiliesEnabled = true;
private boolean avatarEnabled = true;
private boolean privateMessagesEnabled = true;
private boolean viewOnlineEnabled = true;
private boolean notifyPrivateMessagesEnabled = true;
private boolean notifyOnMessagesEnabled = true;
private String username;
private String password;
private Date lastVisit;
private Date registrationDate;
private String avatar;
private boolean isExternalAvatar;
private String email;
private String icq;
private String webSite;
private String from;
private String signature;
private String aim;
private String yim;
private String msnm;
private String occupation;
private String interests;
private String gender;
private String timeZone;
private String lang;
private String dateFormat;
private boolean viewEmailEnabled = true;
private List groupsList;
private int privateMessagesCount;
private KarmaStatus karma;
private int active;
private String activationKey;
private int deleted;
/**
* Default Constructor
*/
public User()
{
this.groupsList = new ArrayList();
}
public boolean isDeleted() {
return this.deleted == 1;
}
public void setDeleted(int deleted){
this.deleted = deleted;
}
/**
* Gets the AIM identification
*
* @return String with the AIM ID
*/
public String getAim() {
return this.aim;
}
/**
* Gets the avatar of the user
*
* @return String with the avatar
*/
public String getAvatar() {
return this.avatar;
}
/**
* Checks if avatar is enabled
*
* @return boolean value
*/
public boolean isAvatarEnabled() {
return this.avatarEnabled;
}
/**
* Checks if BB code is enabled
*
* @return boolean value
*/
public boolean isBbCodeEnabled() {
return this.bbCodeEnabled;
}
/**
* Gets the format to represent dates and time
*
* @return String with the format
*/
public String getDateFormat() {
return this.dateFormat;
}
/**
* Gets the user email
*
* @return String with the email
*/
public String getEmail() {
return this.email;
}
/**
* Gets the user location ( where he lives )
*
* @return String with the location
*/
public String getFrom() {
return this.from;
}
/**
* Gets the user gender
*
* @return String value. Possible values are <code>M</code> or <code>F</code>
*/
public String getGender() {
return this.gender;
}
/**
* Checks if HTML code is enabled by default in user messages
*
* @return boolean value
*/
public boolean isHtmlEnabled() {
return this.htmlEnabled;
}
/**
* Gets the ICQ UIM
*
* @return String with the UIN
*/
public String getIcq() {
return this.icq;
}
/**
* Gets the user id
*
* @return int value with the id
*/
public int getId() {
return this.id;
}
/**
* Gets the user interests
*
* @return String literal
*/
public String getInterests() {
return this.interests;
}
/**
* Gets the user language
*
* @return String value with the language chosen
*/
public String getLang() {
return this.lang;
}
/**
* Gets the last visit time the user was in the forum
*
* @return long value representing the time
*/
public Date getLastVisit() {
return this.lastVisit;
}
/**
* Gets the user leve
*
* @return int value with the level
*/
public int getLevel() {
return this.level;
}
/**
* Checks if notification of new private messages is enabled
*
* @return boolean value
*/
public boolean isNotifyPrivateMessagesEnabled() {
return this.notifyPrivateMessagesEnabled;
}
/**
* Gets the OCC
*
* @return String
*/
public String getOccupation() {
return this.occupation;
}
/**
* Gets the user password
*
* @return String with the password ( in plain/text )
*/
public String getPassword() {
return this.password;
}
/**
* Checks if user permits other people to sent private messages to him
*
* @return boolean value
*/
public boolean isPrivateMessagesEnabled() {
return this.privateMessagesEnabled;
}
/**
* Gets the ranking ID of the user
*
* @return int
*/
public int getRankId() {
return this.rankId;
}
/**
* Gets the registration date of the user
*
* @return String value with the registration date
*/
public String getRegistrationDate()
{
SimpleDateFormat df = new SimpleDateFormat(SystemGlobals.getValue(ConfigKeys.DATE_TIME_FORMAT));
return df.format(this.registrationDate);
}
/**
* Gets the user signature
*
* @return String literal with the signature
*/
public String getSignature() {
return this.signature;
}
/**
* Checks if smilies are enabled
*
* @return boolean value
*/
public boolean isSmiliesEnabled() {
return this.smiliesEnabled;
}
/**
* Gets the id of the theme chosen by the user
*
* @return int value with the theme ID
*/
public int getThemeId() {
return this.themeId;
}
/**
* Gets the timezone
*
* @return String value with the timezone
*/
public String getTimeZone() {
return this.timeZone;
}
/**
* Gets the total number of messages posted by the user
*
* @return int value with the total of messages
*/
public int getTotalPosts() {
return this.totalPosts;
}
/**
* Gets the username
*
* @return String with the username
*/
public String getUsername() {
return this.username;
}
/**
* Checks if the user permits other people to see he online
*
* @return boolean value
*/
public boolean isViewOnlineEnabled() {
return this.viewOnlineEnabled;
}
/**
* Gets the user website address
*
* @return String with the URL
*/
public String getWebSite() {
return this.webSite;
}
/**
* Gets the Yahoo messenger ID
*
* @return String with the ID
*/
public String getYim() {
return this.yim;
}
/**
* Is the user's email authenticated?
*
* @return integer 1 if true
*/
public boolean isActive(){
return this.active == 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -