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

📄 forumnewsmanager.java

📁 一个用jsp写的完整的论坛源代码
💻 JAVA
字号:
package com.bcxy.bbs.forum;

/**
 * Title:
 * Description:
 * Copyright:
 * Company: www.liyunet.com
 * 
 * @author lishujiang	
 * @version 1.0
 */

import java.util.Vector;

import com.bcxy.bbs.util.BBSConst;
import com.bcxy.cache.CacheManager;
import com.bcxy.conf.ENV;
import com.bcxy.db.JdbcWrapper;

public class ForumNewsManager {

	public static ForumNews getForumNews(int forumID)
			throws ForumNewsNotFoundException {
		ForumNews temp = null;
		try {
			temp = (ForumNews)CacheManager.getCache(ENV.FORUM_NEWS).get("news"+(forumID));
			if(temp==null){
				temp = new ForumNews(forumID);
				CacheManager.getCache(ENV.FORUM_NEWS).put("news"+(forumID),temp);
			}
			return temp;
		} catch (Exception e) {
			throw new ForumNewsNotFoundException();
		}

	}

	/**
	 * 
	 * @param newsID
	 * @return
	 * @throws Exception
	 */
	public static ForumNews getSignalForumNews(int newsID) throws Exception {
		ForumNews forumNews = null;
		try {
			forumNews = (ForumNews)CacheManager.getCache(ENV.GATEWAY).get("news"+newsID);
			if(forumNews==null){
				forumNews = new ForumNews(newsID);
				CacheManager.getCache(ENV.GATEWAY).put("news"+(newsID),forumNews);
			}
		} catch (Exception e) {
			throw new ForumNewsNotFoundException();
		}
		return forumNews;
	}

	/**
	 * 
	 * @return
	 * @throws Exception
	 */
	public static Vector getForumNewsVector() throws Exception {
		JdbcWrapper jw = new JdbcWrapper("select id from " + BBSConst.TABLE_BBSNEWS + "  order by id desc");		
		Vector forumNewsVector = new Vector();
		while (jw.next()) {
			int id = jw.getInt(1);
			ForumNews forumNews = getSignalForumNews(id);
			forumNewsVector.add(forumNews);
		}
		return forumNewsVector;
	}

	/**
	 * 
	 * @param forumID
	 * @return
	 * @throws Exception
	 */
	public static Vector getForumNewsVector(int forumID) throws Exception {
		JdbcWrapper jw = new JdbcWrapper("select id from " + BBSConst.TABLE_BBSNEWS + " where boardID="
				+ forumID + " order by id desc");		
		Vector forumNewsVector = new Vector();
		while (jw.next()) {
			int id = jw.getInt(1);
			ForumNews forumNews = getSignalForumNews(id);
			forumNewsVector.add(forumNews);
		}
		return forumNewsVector;
	}
}

⌨️ 快捷键说明

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