亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? dbforumfactory.java

?? 這是學(xué)習(xí)Java必須讀懂兩套源代碼
?? JAVA
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/**
 * Copyright (C) 2001 Yasna.com. All rights reserved.
 *
 * ===================================================================
 * The Apache Software License, Version 1.1
 *
 * 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. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by
 *        Yasna.com (http://www.yasna.com)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Yazd" and "Yasna.com" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please
 *    contact yazd@yasna.com.
 *
 * 5. Products derived from this software may not be called "Yazd",
 *    nor may "Yazd" appear in their name, without prior written
 *    permission of Yasna.com.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 YASNA.COM OR
 * ITS 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 software consists of voluntary contributions made by many
 * individuals on behalf of Yasna.com. For more information
 * on Yasna.com, please see <http://www.yasna.com>.
 */

/**
 * Copyright (C) 2000 CoolServlets.com. All rights reserved.
 *
 * ===================================================================
 * The Apache Software License, Version 1.1
 *
 * 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. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by
 *        CoolServlets.com (http://www.coolservlets.com)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Jive" and "CoolServlets.com" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please
 *    contact webmaster@coolservlets.com.
 *
 * 5. Products derived from this software may not be called "Jive",
 *    nor may "Jive" appear in their name, without prior written
 *    permission of CoolServlets.com.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 COOLSERVLETS.COM OR
 * ITS 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 software consists of voluntary contributions made by many
 * individuals on behalf of CoolServlets.com. For more information
 * on CoolServlets.com, please see <http://www.coolservlets.com>.
 */

package com.Yasna.forum.database;

import com.Yasna.util.*;
import com.Yasna.forum.*;
import java.sql.*;
import java.util.*;
import java.io.*;

/**
 * Database implementation of the ForumFactory interface.
 */
public class DbForumFactory extends ForumFactory {

    /** DATABASE QUERIES **/
    private static final String FORUM_COUNT = "SELECT count(*) FROM yazdForum";
    private static final String DELETE_FORUM = "DELETE FROM yazdForum WHERE forumID=?";
    private static final String DELETE_FORUM_USER_PERMS =
        "DELETE FROM yazdUserPerm WHERE forumID=?";
    private static final String DELETE_FORUM_GROUP_PERMS =
        "DELETE FROM yazdGroupPerm WHERE forumID=?";
    private static final String DELETE_FORUM_PROPERTIES =
        "DELETE FROM yazdForumProp WHERE forumID=?";
    private static final String GET_USER_PERMS =
         "SELECT DISTINCT permission FROM yazdUserPerm WHERE forumID=? " +
         "AND userID=?";
    private static final String USERS_WITH_PERM =
        "SELECT DISTINCT userID FROM yazdUserPerm WHERE forumID=? AND permission=?";
    private static final String GET_GROUP_PERMS =
        "SELECT DISTINCT permission from yazdGroupPerm WHERE forumID=? " +
        "AND groupID=?";
    private static final String GROUPS_WITH_PERM =
        "SELECT DISTINCT groupID FROM yazdGroupPerm WHERE forumID=? AND permission=?";
    private static final String ALL_MESSAGES =
        "SELECT messageID FROM yazdMessage";
    private static final String DELETE_MESSAGE =
        "DELETE FROM yazdMessage WHERE messageID=?";

    protected DbCacheManager cacheManager;

    /**
     * The profile manager provides access to users and groups.
     */
    private ProfileManager profileManager;

    /**
     * The search indexer periodically runs to index forum content
     */
    private DbSearchIndexer searchIndexer;

    /**
     * Creates a new DbForumFactory.
     */
    public DbForumFactory() {
        cacheManager = new DbCacheManager();

        profileManager = new DbProfileManager(this);
        searchIndexer = new DbSearchIndexer(this);
    }

    //FROM THE FORUMFACTORY INTERFACE//

    public Forum createForum(String name, String description)
            throws UnauthorizedException, ForumAlreadyExistsException
    {
        Forum newForum = null;
        try {
            Forum existingForum = getForum(name);

            //The forum already exists since now exception, so:
            throw new ForumAlreadyExistsException();
        }
        catch (ForumNotFoundException fnfe) {
            //The forum doesn't already exist so we can create a new one
            newForum = new DbForum(name, description, this);
        }
        return newForum;
    }

    public void deleteForum(Forum forum) throws UnauthorizedException {
        //First, remove forum from memory.
        cacheManager.remove(DbCacheManager.FORUM_CACHE, new Integer(forum.getID()));
        cacheManager.remove(DbCacheManager.USER_PERMS_CACHE, new Integer(forum.getID()));
        cacheManager.remove(DbCacheManager.FORUM_ID_CACHE, forum.getName());

        //Delete all messages and threads in the forum.
        Iterator threads = forum.threads();
        while (threads.hasNext()) {
            ForumThread thread = (ForumThread)threads.next();
            forum.deleteThread(thread);
        }

        //Now, delete all filters associated with the forum. We delete in
        //reverse order since filter indexes will change if we don't delete
        //the last filter entry.
        int filterCount = forum.getForumMessageFilters().length;
        for (int i=filterCount-1; i>=0; i--) {
            forum.removeForumMessageFilter(i);
        }

        //Finally, delete the forum itself and all permissions and properties
        //associated with it.
        Connection con = null;
        PreparedStatement pstmt = null;
        try {
            con = DbConnectionManager.getConnection();
            pstmt = con.prepareStatement(DELETE_FORUM);
            pstmt.setInt(1,forum.getID());
            pstmt.execute();
            pstmt.close();
            //User perms
            pstmt = con.prepareStatement(DELETE_FORUM_USER_PERMS);
            pstmt.setInt(1,forum.getID());
            pstmt.execute();
            pstmt.close();
            //Group perms
            pstmt = con.prepareStatement(DELETE_FORUM_GROUP_PERMS);
            pstmt.setInt(1,forum.getID());
            pstmt.execute();
            pstmt.close();
            //Properties
            pstmt = con.prepareStatement(DELETE_FORUM_PROPERTIES);
            pstmt.setInt(1,forum.getID());
            pstmt.execute();
        }
        catch( Exception sqle ) {
            System.err.println("Error in DbForumFactory:deleteForum()-" + sqle);
        }
        finally {
            try {  pstmt.close(); }
            catch (Exception e) { e.printStackTrace(); }
            try {  con.close();   }
            catch (Exception e) { e.printStackTrace(); }
        }
    }
    public Iterator forumsModeration(){ //this has to be revisited again
	return null;
    }
    public Forum getForum(int forumID)
            throws ForumNotFoundException, UnauthorizedException
    {
        //If cache is not enabled, do a new lookup of object
        if (!cacheManager.isCacheEnabled()) {
            return new DbForum(forumID, this);
        }
        //Cache is enabled.
        Integer forumIDInteger = new Integer(forumID);
        DbForum forum = (DbForum)cacheManager.get(DbCacheManager.FORUM_CACHE, forumIDInteger);
        if(forum == null) {
            forum = new DbForum(forumID, this);
            cacheManager.add(DbCacheManager.FORUM_CACHE, forumIDInteger, forum);
        }
        return forum;
    }

    public Forum getForum(String name)
            throws ForumNotFoundException, UnauthorizedException
    {
        //If cache is not enabled, do a new lookup of object
        if (!cacheManager.isCacheEnabled()) {
            Forum forum = new DbForum(name, this);
            return forum;
        }
        //Cache is enabled.
        CacheableInteger forumIDInteger = (CacheableInteger)cacheManager.get(
                DbCacheManager.FORUM_ID_CACHE,
                name
        );
        //if id wan't found in cache, load it up and put it there.
        if (forumIDInteger == null) {
            Forum forum = new DbForum(name, this);
            forumIDInteger = new CacheableInteger(new Integer(forum.getID()));
            cacheManager.add(DbCacheManager.FORUM_ID_CACHE, name, forumIDInteger);
        }
        return getForum(forumIDInteger.getInteger().intValue());
    }

    public int getForumCount() {
        int forumCount = 0;
        Connection con = null;
        PreparedStatement pstmt = null;
        try {
            con = DbConnectionManager.getConnection();
            pstmt = con.prepareStatement(FORUM_COUNT);
            ResultSet rs = pstmt.executeQuery();
            rs.next();
            forumCount = rs.getInt(1);
        }
        catch( SQLException sqle ) {
            System.err.println("DbForumFactory:getForumCount() failed: " + sqle);
        }
        finally {
            try {  pstmt.close(); }
            catch (Exception e) { e.printStackTrace(); }
            try {  con.close();   }
            catch (Exception e) { e.printStackTrace(); }
        }
        return forumCount;
    }

    public Iterator forums() {
        return new DbForumFactoryIterator(this);
    }

    public ProfileManager getProfileManager() {
        return profileManager;
    }

    public SearchIndexer getSearchIndexer() {
        return searchIndexer;
    }

    public int[] usersWithPermission(int permissionType)
            throws UnauthorizedException
    {
        int [] users = new int[0];
        Connection con = null;
        PreparedStatement pstmt = null;
        try {
            con = DbConnectionManager.getConnection();
            pstmt = con.prepareStatement(USERS_WITH_PERM);
            pstmt.setInt(1,-1);
            pstmt.setInt(2,permissionType);
            ResultSet rs = pstmt.executeQuery();
            ArrayList userList = new ArrayList();
            while (rs.next()) {
                userList.add(new Integer(rs.getInt("userID")));
            }
            users = new int[userList.size()];
            for (int i=0; i<users.length; i++) {
                users[i] = ((Integer)userList.get(i)).intValue();
            }
        }
        catch( SQLException sqle ) {
            sqle.printStackTrace();
        }
        finally {
            try {  pstmt.close(); }
            catch (Exception e) { e.printStackTrace(); }
            try {  con.close();   }
            catch (Exception e) { e.printStackTrace(); }
        }
        return users;
    }

    public int[] groupsWithPermission(int permissionType)
            throws UnauthorizedException
    {
        int [] groups = new int[0];
        Connection con = null;
        PreparedStatement pstmt = null;
        try {
            con = DbConnectionManager.getConnection();
            pstmt = con.prepareStatement(GROUPS_WITH_PERM);

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
2014亚洲片线观看视频免费| 日韩欧美黄色影院| 精品国产免费人成电影在线观看四季| 国产精品美女久久久久久久久久久 | 91精品国产91热久久久做人人 | 日韩一区二区在线免费观看| 亚洲欧洲精品一区二区三区| 国内精品伊人久久久久av影院 | 91小视频在线| 精品黑人一区二区三区久久 | 国产精品蜜臀在线观看| 日本中文一区二区三区| 91免费看`日韩一区二区| 久久亚洲二区三区| 日本成人在线网站| 91久久精品一区二区二区| 国产人久久人人人人爽| 全国精品久久少妇| 欧美日韩三级一区二区| 亚洲男人天堂av| 粉嫩高潮美女一区二区三区| 日韩一区二区三区四区| 午夜成人免费视频| 在线中文字幕一区| 成人免费在线观看入口| 国产精品影视在线| 欧美成人三级在线| 青青草91视频| 欧美一区二区三区日韩视频| 亚洲一区二区三区四区五区中文 | 成人免费电影视频| 久久色视频免费观看| 久久国产精品72免费观看| 在线电影欧美成精品| 亚洲国产精品影院| 欧美午夜精品免费| 亚洲一区二区在线免费观看视频 | 国产老女人精品毛片久久| 欧美一级高清片| 免费成人美女在线观看| 337p亚洲精品色噜噜噜| 天天综合网天天综合色| 欧美日韩久久久一区| 亚洲国产毛片aaaaa无费看 | 在线国产亚洲欧美| 亚洲精品视频在线看| 色先锋久久av资源部| 亚洲精品一二三| 色视频一区二区| 一区二区理论电影在线观看| 欧美伊人久久大香线蕉综合69| 亚洲欧美激情视频在线观看一区二区三区 | 麻豆视频一区二区| 精品欧美一区二区久久| 精品一区二区三区香蕉蜜桃| 欧美电影免费观看高清完整版在线观看 | 中文字幕av免费专区久久| 国产精品亚洲午夜一区二区三区| 久久综合九色综合欧美98| 国产精品一二二区| 中文字幕一区二区三区不卡 | 成人午夜激情影院| 国产精品成人免费| 91精品办公室少妇高潮对白| 亚洲成人av电影| 日韩欧美中文一区二区| 欧美日韩视频在线第一区| 同产精品九九九| 日韩一区二区麻豆国产| 国产一区二区三区免费播放| 日本一区二区高清| 在线区一区二视频| 麻豆久久一区二区| 国产偷国产偷精品高清尤物| av电影在线观看一区| 一区二区三区 在线观看视频| 欧美日韩精品一区二区三区| 日本三级亚洲精品| 国产日韩欧美a| 在线欧美日韩精品| 免费观看成人鲁鲁鲁鲁鲁视频| 精品88久久久久88久久久| 成人黄色电影在线| 亚洲成av人**亚洲成av**| 91精品国产综合久久精品性色| 狠狠色狠狠色综合| 国产精品乱码人人做人人爱| 欧美亚洲综合在线| 国产真实精品久久二三区| 日韩码欧中文字| 欧美一卡在线观看| 成+人+亚洲+综合天堂| 亚洲成av人片在线| 日本一区二区三区在线不卡 | 国产精品12区| 一区二区三区免费观看| 日韩午夜精品电影| 99精品欧美一区二区三区综合在线| 丝袜诱惑亚洲看片| 国产精品人人做人人爽人人添| 欧洲激情一区二区| 国产一区二区中文字幕| 亚洲精品免费看| xf在线a精品一区二区视频网站| 色综合久久久久久久| 美女诱惑一区二区| 亚洲另类在线制服丝袜| 欧美电影免费观看高清完整版在线| 91蜜桃传媒精品久久久一区二区| 日本不卡123| 亚洲码国产岛国毛片在线| 亚洲精品在线观看网站| 欧美写真视频网站| 成人美女在线观看| 久久精品国产秦先生| 亚洲成人综合网站| 国产精品国产三级国产有无不卡 | 久久久久久久久久电影| 欧美亚洲动漫精品| 成人高清视频在线观看| 日本美女一区二区三区| 亚洲精品欧美综合四区| 久久九九久久九九| 国产成a人亚洲| 久久国产三级精品| 亚洲大型综合色站| 亚洲女人的天堂| 国产精品免费av| 久久久久久久久伊人| 欧美精品黑人性xxxx| 色综合天天狠狠| 成人综合婷婷国产精品久久免费| 免费看日韩a级影片| 亚洲va欧美va人人爽| 亚洲九九爱视频| 国产精品国产三级国产| 久久久精品影视| 精品三级av在线| 日韩欧美123| 欧美高清视频在线高清观看mv色露露十八| 成人app软件下载大全免费| 国产成人精品影视| 国产一区二区三区高清播放| 麻豆极品一区二区三区| 强制捆绑调教一区二区| 日韩精品高清不卡| 天天综合日日夜夜精品| 亚洲国产一区二区在线播放| 亚洲精品日韩一| 日韩毛片一二三区| 中文字幕在线一区二区三区| 国产精品天干天干在观线| 久久精品视频网| 国产亚洲午夜高清国产拍精品| 精品播放一区二区| www国产成人| 久久先锋影音av| 久久久久久久网| 久久九九99视频| 久久久99精品久久| 久久久久久久综合| 中文字幕精品综合| 中文字幕一区二区5566日韩| 中文字幕一区免费在线观看| 1区2区3区国产精品| 国产成人在线色| 国产精品一区专区| 国产精品一二三在| 成人av在线一区二区三区| 99久久久久久| 91电影在线观看| 欧美三区在线观看| 在线电影一区二区三区| 日韩久久久久久| 久久亚洲精品小早川怜子| 欧美高清在线视频| 亚洲精品视频自拍| 亚洲已满18点击进入久久| 午夜私人影院久久久久| 日韩精品一二区| 美女网站色91| 国产成人在线视频网址| bt欧美亚洲午夜电影天堂| 色偷偷一区二区三区| 欧美日韩国产123区| 亚洲精品在线一区二区| 国产精品美女www爽爽爽| 亚洲欧美日韩中文字幕一区二区三区 | 欧美刺激午夜性久久久久久久| 2023国产精品| 国产精品久线观看视频| 亚洲成人免费av| 免费亚洲电影在线| 粉嫩av一区二区三区在线播放| 色94色欧美sute亚洲13| 91麻豆精品国产| 国产区在线观看成人精品| 亚洲欧美电影一区二区| 日韩1区2区日韩1区2区| 高清不卡一区二区|