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

📄 topic.java

📁 个人认为是最好的Java论坛源码
💻 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 23, 2003 / 12:40:13 PM
 * The JForum Project
 * http://www.jforum.net
 */
package net.jforum.entities;

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

/**
 * Represents every topic in the forum.
 * 
 * @author Rafael Steil
 * @version $Id: Topic.java,v 1.9 2005/02/03 12:37:41 rafaelsteil Exp $
 */
public class Topic implements Serializable
{
	public static final int TYPE_NORMAL = 0;
	public static final int TYPE_STICKY = 1;
	public static final int TYPE_ANNOUNCE = 2;

	public static final int STATUS_UNLOCKED = 0;
	public static final int STATUS_LOCKED = 1;
	
	private int id;
	private int forumId;
	private boolean read = true;
	private String title;
	private Date time;
	private Date lastPostTimeInMillis;
	private int totalViews;
	private int totalReplies;
	private int status;
	private boolean vote;
	private int type;
	private int firstPostId;
	private String firstPostTime;
	private int lastPostId;	
	private String lastPostTime;
	private boolean moderated;
	private boolean paginate;
	private Double totalPages;
	private User postedBy;
	private User lastPostBy;
	private boolean isHot;
	private boolean hasAttach;
	
	public Topic() {}
		
	/**
	 * Returns the ID of the firts topic
	 * 
	 * @return int value with the ID
	 */
	public int getFirstPostId() {
		return this.firstPostId;
	}

	/**
	 * Returns the ID of the topic
	 * 
	 * @return int value with the ID
	 */
	public int getId() {
		return this.id;
	}

	/**
	 * Returns the ID of the forum this topic belongs to
	 * 
	 * @return int value with the ID
	 */
	public int getForumId() {
		return this.forumId;
	}

	/**
	 * Teturns the ID of the last post in the topic
	 * 
	 * @return int value with the ID
	 */
	public int getLastPostId() {
		return this.lastPostId;
	}

	/**
	 * Returns the status 
	 * 
	 * @return int value with the status
	 */
	public int getStatus() {
		return this.status;
	}

	/**
	 * Returns the time the topic was posted
	 * 
	 * @return int value representing the time
	 */
	public Date getTime() {
		return this.time;
	}
	
	public void setFirstPostTime(String d) {
		this.firstPostTime = d;
	}
	
	public void setLastPostTime(String d) {
		this.lastPostTime = d;
	}

	/**
	 * Returns the title of the topci
	 * 
	 * @return String with the topic title
	 */
	public String getTitle() {
		return (this.title == null ? "" : this.title);
	}

	/**
	 * Returns the total number of replies
	 * 
	 * @return int value with the total
	 */
	public int getTotalReplies() {
		return this.totalReplies;
	}

	/**
	 * Returns the total number of views
	 * 
	 * @return int value with the total number of views
	 */
	public int getTotalViews() {
		return this.totalViews;
	}
	
	public User getPostedBy() {
		return this.postedBy;
	}
	
	public User getLastPostBy() {
		return this.lastPostBy;
	}

	/**
	 * Returns the type
	 * 
	 * @return int value representing the type
	 */
	public int getType() {
		return this.type;
	}

	/**
	 * Is a votation topic?
	 * 
	 * @return boolean value
	 */
	public boolean isVote() {
		return this.vote;
	}

	/**
	 * Sets the id of the firts post in the topic
	 * 
	 * @param firstPostId The post id 
	 */
	public void setFirstPostId(int firstPostId) {
		this.firstPostId = firstPostId;
	}

	/**
	 * Sets the id to the topic
	 * 
	 * @param id The id to set
	 */
	public void setId(int id) {
		this.id = id;
	}

	/**
	 * Sets the id of the forum associeted with this topic
	 * 
	 * @param idForum The id of the forum to set
	 */
	public void setForumId(int idForum) {
		this.forumId = idForum;
	}

	/**
	 * Sets the id of the last post in the topic
	 * 
	 * @param lastPostId The post id
	 */
	public void setLastPostId(int lastPostId) {
		this.lastPostId = lastPostId;
	}

	/**
	 * Sets the status.
	 * 
	 * @param status The status to set
	 */
	public void setStatus(int status) {
		this.status = status;
	}

	/**
	 * Sets the time.
	 * 
	 * @param time The time to set
	 */
	public void setTime(Date time) {
		this.time = time;
	}

	/**
	 * Sets the title.
	 * 
	 * @param title The title to set
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 * Sets the totalReplies.
	 * 
	 * @param totalReplies The totalReplies to set
	 */
	public void setTotalReplies(int totalReplies) {
		this.totalReplies = totalReplies;
	}

	/**
	 * Sets the totalViews.
	 * 
	 * @param totalViews The totalViews to set
	 */
	public void setTotalViews(int totalViews) {
		this.totalViews = totalViews;
	}

	/**
	 * Sets the type.
	 * 
	 * @param type The type to set
	 */
	public void setType(int type) {
		this.type = type;
	}

	/**
	 * Sets the vote.
	 * 
	 * @param vote The vote to set
	 */
	public void setVote(boolean vote) {
		this.vote = vote;
	}
	/**
	 * @return
	 */
	public boolean isModerated() {
		return this.moderated;
	}

	/**
	 * @param b
	 */
	public void setModerated(boolean b) {
		this.moderated = b;
	}
	
	public void setPostedBy(User u) {
		this.postedBy = u;
	}
	
	public void setLastPostBy(User u) {
		this.lastPostBy = u;
	}
	
	public String getFirstPostTime() {
		return this.firstPostTime;
	}
	
	public String getLastPostTime() {
		return this.lastPostTime;
	}

	public void setRead(boolean read) {
		this.read = read;
	}
	
	public boolean getRead() {
		return this.read;
	}
	
	public void setLastPostTimeInMillis(Date t) {
		this.lastPostTimeInMillis = t;
	}
	
	public Date getLastPostTimeInMillis() {
		return this.lastPostTimeInMillis;
	}
	
	public void setPaginate(boolean paginate) {
		this.paginate = paginate;
	}
	
	public boolean getPaginate() {
		return this.paginate;
	}
	
	public void setTotalPages(Double total) {
		this.totalPages = total;
	}
	
	public Double getTotalPages() {
		return this.totalPages;
	}
	
	public void setHot(boolean hot) {
		this.isHot = hot;
	}
	
	public boolean isHot() {
		return this.isHot;
	}
	
	public void setHasAttach(boolean b)
	{
		this.hasAttach = b;
	}
	
	public boolean hasAttach()
	{
		return this.hasAttach;
	}
	
	/** 
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	public boolean equals(Object o)
	{
		if (!(o instanceof Topic)) {
			return false;
		}
		
		return (((Topic)o).getId() == this.id);
	}
	/** 
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode()
	{
		return this.id;
	}
}

⌨️ 快捷键说明

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