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

📄 threaddaomock.java

📁 Chinaxp 论坛源代码
💻 JAVA
字号:
/* * XP Forum * * Copyright (c) 2002-2003 RedSoft Group.  All rights reserved. * */package org.redsoft.forum.dao.mock;import java.util.Collection;import java.util.List;import java.util.Vector;import org.redsoft.forum.dao.ThreadDAO;import org.redsoft.forum.exception.CategoryNotFoundException;import org.redsoft.forum.exception.DAOException;import org.redsoft.forum.exception.ThreadNotFoundException;/** * Mock ThreadDAO * @@author <a href="mailto:chjxm@msn.com">cinc</a> * * @@version $Id: ThreadDAOmock.java,v 1.4 2004/04/10 19:56:59 cinc Exp $ */public class ThreadDAOmock implements ThreadDAO {    protected static List list = null;    public ThreadDAOmock() {        if ( list == null ) {            list = new Vector();            addThread( new org.redsoft.forum.dao.Thread(                    1000,                    "testTitle",                    "testContent",                    "User1",                    System.currentTimeMillis(),                    -1,                    1,                    System.currentTimeMillis(),                    1,                    0,                    1234,                    true            ) );        }    }    public org.redsoft.forum.dao.Thread addThread(org.redsoft.forum.dao.Thread thread) {        list.add( thread );        return thread;    }    public void removeThread(org.redsoft.forum.dao.Thread thread) {        list.remove( thread );    }    public Collection findByCategory(int category)            throws CategoryNotFoundException {        return list;    }    public Collection findByCategory(int category,                                     int startIndex,                                     int length) throws CategoryNotFoundException {        return list;    }    public org.redsoft.forum.dao.Thread findByUID(long id) throws ThreadNotFoundException {        for (int index = 0; index < list.size(); index++) {            org.redsoft.forum.dao.Thread thread = (org.redsoft.forum.dao.Thread) list.get(index);            if ( thread.getId() == id ) {                return thread;            }        }        throw new ThreadNotFoundException( "with id : " + id );    }    public Collection findByParnetID(long parentID) throws ThreadNotFoundException {        findByUID( parentID );        return list;    }    public Collection findByParnetID(long parentID, int startIndex, int endIndex) {        return list;    }    public int findCountByCategory(int category) {        return list.size();    }    public void updateThread(org.redsoft.forum.dao.Thread thread) throws ThreadNotFoundException {    }    public void updateClick(long id) {    }    public void addColumnThread(long threadId) throws ThreadNotFoundException {        org.redsoft.forum.dao.Thread thread = findByUID( threadId );        thread.setColumnThread( true );    }    public void removeColumnThread(long threadId) throws ThreadNotFoundException, DAOException {        org.redsoft.forum.dao.Thread thread = findByUID( threadId );        thread.setColumnThread( false );    }    public Collection findByUserId(String userId, int startIndex, int endIndex) {        return list;    }    public void removeThread(long threadID) {    }    public Collection findThreadsPostedLaterThan(long time) {        return list;    }    public Collection findColumnThreadsByAccountId(String userId) {        return list;    }    public int findCountByUserId(String userId) throws DAOException {        return list.size();    }}

⌨️ 快捷键说明

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