📄 threaddaomock.java
字号:
/*
* XP Forum
*
* Copyright (c) 2002-2003 RedSoft Group. All rights reserved.
*
*/
package org.redsoft.forum.dao.mock;
import org.redsoft.forum.dao.ThreadDAO;
import org.redsoft.forum.dao.PersistentThread;
import org.redsoft.forum.exception.CategoryNotFoundException;
import org.redsoft.forum.exception.ThreadNotFoundException;
import java.sql.SQLException;
import java.util.Collection;
import java.util.List;
import java.util.Vector;
/**
* Mock ThreadDAO
* @@author <a href="mailto:chjxm@msn.com">cinc</a>
*
* @@version $Id: ThreadDAOmock.java,v 1.1 2003/07/17 07:43:20 cinc Exp $
*/
public class ThreadDAOmock implements ThreadDAO {
protected List list = new Vector();
public ThreadDAOmock() {
}
public PersistentThread addThread(PersistentThread thread) throws SQLException {
list.add( thread );
return thread;
}
public void removeThread(PersistentThread thread) throws SQLException {
list.remove( thread );
}
public Collection findByCategory(int category)
throws SQLException,
CategoryNotFoundException {
return list;
}
public Collection findByCategory(int category,
int startIndex,
int length) throws SQLException,
CategoryNotFoundException {
return list;
}
public PersistentThread findByUID(long id) throws SQLException, ThreadNotFoundException {
for (int index = 0; index < list.size(); index++) {
PersistentThread thread = (PersistentThread) list.get(index);
if ( thread.getID() == id ) {
return thread;
}
}
throw new ThreadNotFoundException();
}
public Collection findByParnetID(long parentID) throws ThreadNotFoundException, SQLException {
return list;
}
public Collection findByParnetID(long parentID, int startIndex, int endIndex) throws SQLException {
return list;
}
public int findCountByCategory(int category) throws SQLException {
return list.size();
}
public void updateThread(PersistentThread thread) throws SQLException, ThreadNotFoundException {
}
public void updateClick(long id) throws SQLException {
}
public Collection findByUserId(String userId) throws SQLException {
return null;
}
public void removeThread(long threadID) throws SQLException {
}
public Collection findThreadsPostedLaterThan(long time) throws SQLException {
return list;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -