📄 threaddao.java
字号:
package org.redsoft.forum.dao;/** * Forum's DAO interface * * @author Charles Huang * @since JDK 1.4 * @version 1.0 */import org.redsoft.forum.exception.CategoryNotFoundException;import org.redsoft.forum.exception.DAOException;import org.redsoft.forum.exception.ThreadNotFoundException;import java.util.Collection;public interface ThreadDAO{ /** * Add a new thread to the DB */ public org.redsoft.forum.dao.Thread addThread( final org.redsoft.forum.dao.Thread thread ) throws DAOException; /** * Remove a new thread from the DB */ public void removeThread( final org.redsoft.forum.dao.Thread thread ) throws DAOException; /** * Get all the top-level threads under the given category * * @param category - The category * @return Collection - A collection of threads under the given category */ public Collection findByCategory( final int category ) throws CategoryNotFoundException, DAOException; /** * Get the top-level threads under the given category from start index * * @param category - The category * @param startIndex - The start index for retrieveing the records * @param length - The number of records to be tretieved * @return Collection - A collection of threads under the given category */ public Collection findByCategory( final int category, final int startIndex, final int length ) throws CategoryNotFoundException, DAOException; /** * Get a thread given a unique id * * @return PersistentThread - The corresponding thread */ public org.redsoft.forum.dao.Thread findByUID( final long id ) throws ThreadNotFoundException, DAOException; /** * Get all the children threads given a id of a parent threa * * @return Collection - A collection of children threads * */ public Collection findByParnetID( final long parentID ) throws ThreadNotFoundException, DAOException; /** * Get all the children threads given a id of a parent threa * * @param parentID - The id of a parnt thread * @param startIndex - The number of row that we start to get the children threads * @param endIndex - The number of row we end geting the children threads * @return Collection - A collection of children threads * */ public Collection findByParnetID( final long parentID, final int startIndex, final int endIndex ) throws DAOException; /** * Get the top-level threads count under the given category from start index * * @param category - The category * @return int - The top-level threads count under a category */ public int findCountByCategory( final int category ) throws DAOException; /** * update Thread from DB */ public void updateThread( final org.redsoft.forum.dao.Thread thread ) throws ThreadNotFoundException, DAOException; /** * Update the click count */ public void updateClick(long id) throws DAOException; /** * Add a thread to column * @param threadId * @throws ThreadNotFoundException * @throws DAOException */ public void addColumnThread( final long threadId) throws ThreadNotFoundException, DAOException; /** * Remove a thread from column * @param threadId * @throws ThreadNotFoundException * @throws DAOException */ public void removeColumnThread( final long threadId) throws ThreadNotFoundException, DAOException; /** * Get a list of thread by given the user Id from startIndex to endIndex * startIndex included, endIndex exclulded * @return Collection -- a list of PersistentThread Object which user id is the same as given * @exception DAOException * @param userId * @param startIndex should be greater than zero * @param endIndex * @return * @throws DAOException */ public Collection findByUserId(String userId, int startIndex, int endIndex) throws DAOException; /** * Remove a new thread from the DB */ public void removeThread( final long threadID ) throws DAOException; /** * Find all threads posted later than <code>time</code> * (compare timestamp field of threads table in db with time) * * @param time time in milliseconds * use System.currentTimeMillis() to get current time * if time==0, return all threads * @return all threads found * @exception DAOException when querying db * */ public Collection findThreadsPostedLaterThan( long time ) throws DAOException; public Collection findColumnThreadsByAccountId( String userId ) throws DAOException; public int findCountByUserId( String userId ) throws DAOException;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -