⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 user.java

📁 一个论坛程序的简单实现
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*
 * 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.9 2004/10/10 00:19:26 rafaelsteil Exp $
 */
package net.jforum.entities;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;

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 
{
	/**
	 * The user id
	 */
	private int id;
	
	/**
	 * The theme id the user chosen
	 */
	private int themeId;
	
	/**
	 * TODO level???
	 */	
	private int level;
	
	/**
	 * The number of messagens sent by the user
	 */
	private int totalPosts;
	
	private boolean attachSignatureEnabled = true;
	
	/**
	 * The ranking of the user
	 */
	private int rankId = 1;
	
	/**
	 * Is HTML code enabled in user preferences? 
	 */
	private boolean htmlEnabled = true;
	
	/**
	 * Is BB code enabled in user preferences?
	 */
	private boolean bbCodeEnabled = true;
	
	/**
	 * Is smilies in user preferecens?
	 */
	private boolean smiliesEnabled = true;
	
	/**
	 * Is avatars enabled?
	 */
	private boolean avatarEnabled = true;
	
	/**
	 * The user permits private messages to him?
	 */
	private boolean privateMessagesEnabled = true;
	
	/**
	 * The user permits anybody to se he online?
	 */
	private boolean viewOnlineEnabled = true;
	
	/**
	 * Is to send notifications about new private messages?
	 */
	private boolean notifyPrivateMessagesEnabled = true;
	
	/**
	 * Send a message to the user when some post is answered
	 */
	private boolean notifyOnMessagesEnabled = true;
	
	/**
	 * The username of the user
	 */
	private String username;
	
	/**
	 * His password ( duh )
	 */
	private String password;
	
	/**
	 * The last visit time, represented as a long value
	 */
	private Date lastVisit;
	
	/**
	 * Registration date and time
	 */
	private Date registrationDate;
	
	/**
	 * User avatar
	 */
	private String avatar;
	
	private boolean isExternalAvatar;
	
	/**
	 * User email
	 */
	private String email;
	
	/**
	 * ICQ UIN
	 */
	private String icq;
	
	/**
	 * The website URL
	 */
	private String webSite;
	
	/**
	 * Where the user lives
	 */
	private String from;
	
	/**
	 * Signature, attached to his messages
	 */
	private String signature;
	
	/**
	 * AIM identification
	 */
	private String aim;
	
	/**
	 * Yahoo messenger ID
	 */
	private String yim;
	
	/**
	 * Microsoft Messenger
	 */
	private String msnm; 
	
	/**
	 * Occupation
	 */
	private String occupation;
	
	/**
	 * Some text describing user interests
	 */
	private String interests;
	
	/**
	 * Male or female? 
	 */
	private String gender;
	
	/**
	 * Timezone
	 */
	private String timeZone;
	
	/**
	 * User language
	 */
	private String lang;
	
	/**
	 * Format to show date and time
	 */
	private String dateFormat;

	/**
	 * Is to show user's email? 
	 */
	private boolean viewEmailEnabled = true;

	/**
	 * User groups
	 */	
	private ArrayList groupsList;
	
	private int privateMessagesCount;
	
	/**
	 * Once the user activate the account from his email, active = 1 
	 */
	private int active;
	
	/**
	 * Key that the user uses to activate account, by email
	 */
	private String activationKey;	

	/**
	 * For locking & unlocking users
	 */	
	private int deleted;
	
	public boolean isDeleted() {
		return this.deleted == 1;
	}	
	
	public void setDeleted(int deleted){
		this.deleted = deleted;
	}	
	
	/**
	 * Default Constructor
	 */
	public User() 
	{
		this.groupsList = new ArrayList(); 
	}
	
	/**
	 * 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;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -