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

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

?? dbforumfactory.java

?? 這是學習Java必須讀懂兩套源代碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/**
 * 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);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
av福利精品导航| 奇米在线7777在线精品| 99视频精品在线| 亚洲特黄一级片| 色婷婷狠狠综合| 亚洲国产视频a| 在线播放中文字幕一区| 久久91精品久久久久久秒播| 久久亚洲综合色一区二区三区| 国产麻豆91精品| 亚洲欧洲精品一区二区精品久久久 | fc2成人免费人成在线观看播放| 国产欧美久久久精品影院| av动漫一区二区| 亚洲chinese男男1069| 欧美大片一区二区| 成人激情av网| 午夜精品福利在线| 国产亚洲欧美激情| 在线观看免费视频综合| 久久99久久99精品免视看婷婷| 国产精品美女久久福利网站| 欧美在线观看禁18| 国产一区二区电影| 亚洲一线二线三线视频| 精品剧情在线观看| 欧美亚洲国产一卡| 国产一二精品视频| 一区二区三区91| 久久久精品2019中文字幕之3| 在线免费观看日本欧美| 国产乱人伦精品一区二区在线观看| 亚洲欧洲精品一区二区三区不卡| 欧美日韩国产在线播放网站| 国产精品一级片在线观看| 亚瑟在线精品视频| 国产精品国产成人国产三级| 日韩欧美亚洲另类制服综合在线| 色综合久久久久综合体桃花网| 麻豆国产精品一区二区三区| 一区二区三区av电影| 国产精品视频一二三| 欧美一级专区免费大片| 色婷婷久久一区二区三区麻豆| 国产精品一区二区黑丝| 石原莉奈在线亚洲二区| 亚洲精选免费视频| 日本一区二区视频在线| 日韩三级精品电影久久久 | 97久久超碰精品国产| 极品美女销魂一区二区三区 | www.色综合.com| 男人操女人的视频在线观看欧美| 尤物av一区二区| 国产精品久久久爽爽爽麻豆色哟哟| 欧美一区在线视频| 欧美日韩免费电影| 欧美性做爰猛烈叫床潮| 一本久久精品一区二区| 成人成人成人在线视频| 国产一区在线精品| 激情五月婷婷综合| 另类成人小视频在线| 午夜一区二区三区在线观看| 亚洲精品欧美在线| 综合久久一区二区三区| 国产精品每日更新| 国产精品素人一区二区| 国产蜜臀97一区二区三区| 久久久久国产精品麻豆ai换脸 | 激情欧美一区二区三区在线观看| 亚洲bt欧美bt精品| 亚洲一区电影777| 亚洲网友自拍偷拍| 亚洲综合在线免费观看| 一区二区三区精品| 亚洲国产精品尤物yw在线观看| 夜夜揉揉日日人人青青一国产精品 | 久久久精品综合| 国产亚洲精品aa午夜观看| 国产日韩一级二级三级| 国产精品久线观看视频| 亚洲欧美日韩电影| 国产精品毛片久久久久久久| 综合久久久久久| 亚洲午夜激情av| 婷婷综合五月天| 免费成人在线视频观看| 国产原创一区二区| 91香蕉视频污| 欧美日韩国产小视频在线观看| 欧美猛男男办公室激情| 欧美一二三四在线| 久久精品男人天堂av| 亚洲女同ⅹxx女同tv| 日韩电影免费一区| 久草中文综合在线| 成人av在线资源网站| 在线欧美小视频| 日韩欧美国产高清| 国产精品素人一区二区| 亚洲国产一区二区视频| 激情国产一区二区| 91在线观看污| 日韩欧美国产一区二区在线播放| 国产色91在线| 亚洲综合在线视频| 狠狠色狠狠色合久久伊人| 99久久精品99国产精品| 制服视频三区第一页精品| 久久久久久久久免费| 一区二区三区四区在线免费观看 | 国产综合成人久久大片91| 99久久久国产精品| 日韩午夜激情av| 自拍偷拍国产亚洲| 麻豆精品一区二区综合av| av一区二区三区四区| 在线不卡中文字幕播放| 国产精品国产三级国产aⅴ中文| 天天综合天天综合色| 国产v综合v亚洲欧| 91精品国产高清一区二区三区 | 欧美视频第二页| 久久影视一区二区| 亚洲18影院在线观看| 国产成人高清视频| 91精品国产91久久久久久最新毛片| 国产精品天美传媒| 久久疯狂做爰流白浆xx| 欧美亚洲高清一区二区三区不卡| 久久久五月婷婷| 午夜av一区二区| 91美女视频网站| 国产嫩草影院久久久久| 国内精品国产三级国产a久久| 欧美日韩一级大片网址| 亚洲天堂中文字幕| 国产91丝袜在线播放0| 日韩午夜三级在线| 午夜精品久久久久影视| 在线视频欧美区| 久久精品夜色噜噜亚洲a∨| 日韩高清不卡一区二区三区| 欧美视频完全免费看| 一区二区中文视频| 不卡一卡二卡三乱码免费网站| 精品国产一区a| 午夜精品成人在线视频| 在线观看91视频| 亚洲日本欧美天堂| 91美女蜜桃在线| 18成人在线视频| 成人国产精品视频| 国产精品久久久久毛片软件| 国产激情一区二区三区| 日韩你懂的在线播放| 免费观看成人鲁鲁鲁鲁鲁视频| 欧美另类变人与禽xxxxx| 玉米视频成人免费看| 在线观看精品一区| 亚洲6080在线| 欧美久久久一区| 午夜成人免费电影| 日韩一区二区精品在线观看| 日本不卡的三区四区五区| 欧美日本韩国一区二区三区视频| 亚洲国产综合视频在线观看| 日韩免费观看高清完整版 | 久久网这里都是精品| 日本美女一区二区| 日韩美女一区二区三区四区| 精品一区二区久久久| 亚洲精品一区二区三区在线观看| 韩国理伦片一区二区三区在线播放| 日韩欧美视频一区| 国产精品 欧美精品| 中文字幕亚洲一区二区va在线| 99精品偷自拍| 亚洲成人中文在线| 精品剧情在线观看| 岛国精品在线观看| 亚洲精品精品亚洲| 欧美日本一区二区三区四区| 日本中文字幕一区二区有限公司| 亚洲精品在线观看视频| 成人激情综合网站| 亚洲黄色av一区| 日韩美女一区二区三区| 高清在线观看日韩| 亚洲一区二区三区在线播放| 欧美一级理论性理论a| 国产一区二区三区国产| 亚洲蜜臀av乱码久久精品| 欧美精品久久99久久在免费线| 久久99精品网久久| 1区2区3区国产精品| 6080亚洲精品一区二区| 国产福利一区二区| 亚洲福利视频一区|