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

📄 user.java

📁 javaBB,一套很不錯的JSP源碼,特共享給大家
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package org.javabb.vo;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.javabb.bbcode.ProcessBBCode;

/*
 * Copyright 2004 JavaFree.org
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * $Id: User.java,v 1.19.2.1.6.5 2006/10/05 20:16:17 daltoncamargo Exp $
 * @author Dalton Camargo - <a href="mailto:dalton@javabb.org">dalton@javabb.org </a> <br>
 * @author Ronald Tetsuo Miura
 */
public class User extends VOObject implements Serializable {

	private static final long serialVersionUID = 1L;

	/** nullable persistent field */
    private String user;

    /** nullable persistent field */
    private String passwordHash;

    /** nullable persistent field */
    private String name;

    /** nullable persistent field */
    private String email;

    /** nullable persistent field */
    private Long user_posts;

    private Integer admin;

    private Date dataRegistro;

    /** persistent field */
    private Set posts;

    /** persistent field */
    private Set topics;

    /** nullable persistent field */
    private String localizacao;

    /** nullable persistent field */
    private String website;

    /** nullable persistent field */
    private String occupation;

    /** nullable persistent field */
    private String userSig;

    /** nullable persistent field */
    private String user_avatar;

    /** nullable persistent field */
    private String user_icq;

    /** nullable persistent field */
    private String user_interests;

    /** nullable persistent field */
    private String user_sig;

    /** nullable persistent field */
    private String user_aim;

    /** nullable persistent field */
    private String user_yim;

    /** nullable persistent field */
    private String user_msnm;

    /** nullable persistent field */
    private Date _lastVisitTimestamp;

    /** nullable persistent field */
    private Date user_lastvisit;

    /** nullable persistent field */
    private String user_dateformat;

    /** nullable persistent field */
    private String user_allow_viewonline;
    
    /** nullable persistent field */
    private String hash_fpwd;

    /** nullable persistent field */
    private Integer show_mail;

    /** nullable persistent field */
    private Integer show_signature;

    /** nullable persistent field */
    private Integer userStatus;
    
    private Integer receiveNews;

    /** nullable persistent field */
    private String userCode;
    
    private Set forumTopUsers;

    // TODO Dependency Injection
    private ProcessBBCode postFormatter = new ProcessBBCode();

    private Set answerNotifies;
    
    private Set favUserTopics;
    
    /**
     * @param id
     * @param user
     * @param passwordHash
     * @param name
     * @param email
     * @param user_posts
     * @param posts
     * @param topics
     */
    public User(Long id, String user, String passwordHash, String name, String email,
        Long user_posts, Set posts, Set topics) {
        setId(id);
        this.user = user;
        this.passwordHash = passwordHash;
        this.name = name;
        this.email = email;
        this.posts = posts;
        this.posts = posts;
        this.topics = topics;
        this.user_posts = user_posts;
    }

    /**
     * Default constructor.
     */
    public User() {
        // do nothing
    }

    /**
     * @param id
     * @param posts
     * @param topics
     */
    public User(Long id, Set posts, Set topics) {
        setId(id);
        this.posts = posts;
        this.topics = topics;
    }

    /**
     * @param id
     */
    public User(Long id) {
        setId(id);
    }    
    
    /**
     * @return the user ID
     */
    public Long getIdUser() {
        return getId();
    }

    /**
     * @param idUser
     */
    public void setIdUser(Long idUser) {
        this.setId(idUser);
    }

    /**
     * @return the username
     */
    public String getUser() {
        return this.user;
    }

    /**
     * @param user
     */
    public void setUser(String user) {
        this.user = user;
    }

    /**
     * @return passwordHash
     */
    public String getPasswordHash() {
        return this.passwordHash;
    }

    /**
     * @param passwordHash
     */
    public void setPasswordHash(String passwordHash) {
        this.passwordHash = passwordHash;
    }

    /**
     * @return the user name
     */
    public String getName() {
        return this.name;
    }

    /**
     * @param name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return email
     */
    public String getEmail() {
        return this.email;
    }

    /**
     * @param email
     */
    public void setEmail(String email) {
        this.email = email;
    }

    /**
     * @return posts
     */
    public Set getPosts() {
        return this.posts;
    }

    /**
     * @param posts
     */
    public void setPosts(Set posts) {
        this.posts = posts;
    }

    /**
     * @return Returns the topics' value
     */
    public Set getTopics() {
        return this.topics;
    }

    /**
     * @param topics
     */
    public void setTopics(Set topics) {
        this.topics = topics;
    }

    /**
     * @see java.lang.Object#toString()
     */
    public String toString() {
        return new ToStringBuilder(this).append("idUser", getIdUser()).toString();
    }

    /**
     * @see java.lang.Object#equals(java.lang.Object)
     */
    public boolean equals(Object other) {
        if (!(other instanceof User)) {
            return false;
        }

        User castOther = (User) other;

        //return new EqualsBuilder().append(this.getIdUser(), castOther.getIdUser()).isEquals();
        if(this.getIdUser().longValue() == castOther.getIdUser().longValue()){
        	return true;
        } else {
        	return false;
        }
    }

    /**
     * @see java.lang.Object#hashCode()
     */
    public int hashCode() {
        return new HashCodeBuilder().append(getIdUser()).toHashCode();
    }

    /**
     * @return Returns the user_posts.
     */
    public Long getUser_posts() {
        return user_posts;
    }

    /**
     * @param user_posts The user_posts to set.
     */
    public void setUser_posts(Long user_posts) {
        this.user_posts = user_posts;
    }

    /**
     * @return Returns the admin.
     */
    public Integer getAdmin() {
        return admin;
    }

    /**
     * @param admin The admin to set.
     */
    public void setAdmin(Integer admin) {
        this.admin = admin;
    }

    /**
     * @return Returns the admin.
     */
    public boolean isAdministrator() {
        return getAdmin().intValue() == 1;
    }

    /**
     * @return Returns the dataRegistro.

⌨️ 快捷键说明

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