Jive Forums API (5.5.8) Developer Javadocs

com.jivesoftware.forum.database
Class DbQuestionManager

java.lang.Object
  extended by com.jivesoftware.forum.database.DbQuestionManager
All Implemented Interfaces:
JiveManager, QuestionManager

public class DbQuestionManager
extends java.lang.Object
implements QuestionManager, JiveManager

Implementation of the QuestionManager interface.


Field Summary
protected static QuestionFilter DEFAULT_FILTER
           
 
Constructor Summary
protected DbQuestionManager()
           
 
Method Summary
 Question createQuestion(ForumThread thread)
          Creates a new question.
 void deleteQuestion(Question question)
          Deletes an existing question.
 void destroy()
          Notifies the manager to release any resources that may be holding on too.
 int getHelpfulAnswersPerThread()
          Returns the number of helpful answers allowed per question.
static DbQuestionManager getInstance()
           
 Question getQuestion(ForumThread thread)
          Returns the question associated with a thread.
 Question getQuestion(long threadID)
           
 int getQuestionCount()
          Returns the count of all questions in the system.
 int getQuestionCount(Forum forum)
          Returns the count of all questions in a forum.
 int getQuestionCount(ForumCategory category)
          Returns the count of all questions in a category.
 int getQuestionCount(ForumCategory category, QuestionFilter questionFilter)
          Returns the count of questions in a category that pass the specified question filter.
 int getQuestionCount(Forum forum, QuestionFilter questionFilter)
          Returns the count of questions in a forum that pass the specified question filter.
 int getQuestionCount(QuestionFilter questionFilter)
          Returns the count of all questions in the system that pass the specified question filter.
protected  CachedPreparedStatement getQuestionListSQL(int objectType, long objectID, QuestionFilter questionFilter, boolean countQuery)
          Returns the SQL statement corresponding to a QuestionFilter for questions.
 java.util.Iterator getQuestions()
          Returns an iterator for all questions in the system.
 java.util.Iterator getQuestions(Forum forum)
          Returns an iterator for all questions in a forum.
 java.util.Iterator getQuestions(ForumCategory category)
          Returns an iterator for all questions in a category.
 java.util.Iterator getQuestions(ForumCategory category, QuestionFilter questionFilter)
          Returns an iterator for all questions in a categetory that pass the specified question filter.
 java.util.Iterator getQuestions(Forum forum, QuestionFilter questionFilter)
          Returns an iterator for all questions in a forum that pass the specified question filter.
 java.util.Iterator getQuestions(QuestionFilter questionFilter)
          Returns an iterator for all questions in the system that pass the specified question filter.
 boolean hasQuestion(ForumThread thread)
          Returns true if the thread has a question associated with it.
 void initialize()
          Initialize the manager.
 void setHelpfulAnswersPerThread(int count)
          Sets the number of helpful answers allowed per question.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FILTER

protected static final QuestionFilter DEFAULT_FILTER
Constructor Detail

DbQuestionManager

protected DbQuestionManager()
Method Detail

getInstance

public static DbQuestionManager getInstance()

initialize

public void initialize()
Description copied from interface: JiveManager
Initialize the manager. It is within this method that it is ok to create, access and/or otherwise use external classes (including caches). Until this method is called implementation should not access any external classes that could possibly either access one of the main Factory classes or any caches since doing so can cause deadlocks and possible clustering issues during startup.

This method is used internally by Jive during application startup and should not be called during normal usage of the class.

Specified by:
initialize in interface JiveManager

destroy

public void destroy()
Description copied from interface: JiveManager
Notifies the manager to release any resources that may be holding on too. This could also be used to clear out the managers caches, etc.

This method is used internally by Jive during application startup and should not be called during normal usage of the class.

Specified by:
destroy in interface JiveManager

getHelpfulAnswersPerThread

public int getHelpfulAnswersPerThread()
Description copied from interface: QuestionManager
Returns the number of helpful answers allowed per question. The default is two.

Specified by:
getHelpfulAnswersPerThread in interface QuestionManager
Returns:
the number of helpful answers allowed per thread.

setHelpfulAnswersPerThread

public void setHelpfulAnswersPerThread(int count)
Description copied from interface: QuestionManager
Sets the number of helpful answers allowed per question. The default is two.

Specified by:
setHelpfulAnswersPerThread in interface QuestionManager
Parameters:
count - the number of helpful answers allowed per thread.

getQuestion

public Question getQuestion(ForumThread thread)
                     throws NotFoundException
Description copied from interface: QuestionManager
Returns the question associated with a thread.

Specified by:
getQuestion in interface QuestionManager
Parameters:
thread - the thread.
Returns:
the question associated with a thread.
Throws:
NotFoundException - if the question for the thread could not be found.

getQuestion

public Question getQuestion(long threadID)
                     throws NotFoundException
Throws:
NotFoundException

hasQuestion

public boolean hasQuestion(ForumThread thread)
Description copied from interface: QuestionManager
Returns true if the thread has a question associated with it.

Specified by:
hasQuestion in interface QuestionManager
Parameters:
thread - the thread.
Returns:
true if the thread has a question associated with it.

createQuestion

public Question createQuestion(ForumThread thread)
                        throws UnauthorizedException
Description copied from interface: QuestionManager
Creates a new question. The thread must already be added to a forum.

Specified by:
createQuestion in interface QuestionManager
Parameters:
thread - the thread the question is associated with.
Returns:
the newly created question.
Throws:
UnauthorizedException

deleteQuestion

public void deleteQuestion(Question question)
Description copied from interface: QuestionManager
Deletes an existing question.

Specified by:
deleteQuestion in interface QuestionManager
Parameters:
question - the question.

getQuestionCount

public int getQuestionCount()
Description copied from interface: QuestionManager
Returns the count of all questions in the system.

Specified by:
getQuestionCount in interface QuestionManager
Returns:
the count of all questions in the system.

getQuestionCount

public int getQuestionCount(QuestionFilter questionFilter)
Description copied from interface: QuestionManager
Returns the count of all questions in the system that pass the specified question filter.

Specified by:
getQuestionCount in interface QuestionManager
Parameters:
questionFilter - the question filter.
Returns:
the count of all questions that pass the specified question filter.

getQuestionCount

public int getQuestionCount(ForumCategory category)
Description copied from interface: QuestionManager
Returns the count of all questions in a category.

Specified by:
getQuestionCount in interface QuestionManager
Parameters:
category - the category.
Returns:
the count of all questions in the category.

getQuestionCount

public int getQuestionCount(ForumCategory category,
                            QuestionFilter questionFilter)
Description copied from interface: QuestionManager
Returns the count of questions in a category that pass the specified question filter.

Specified by:
getQuestionCount in interface QuestionManager
Parameters:
category - the category.
questionFilter - the question filter.
Returns:
the count of questions in a category that pass the specified question filter.

getQuestionCount

public int getQuestionCount(Forum forum)
Description copied from interface: QuestionManager
Returns the count of all questions in a forum.

Specified by:
getQuestionCount in interface QuestionManager
Parameters:
forum - the forum.
Returns:
the count of all questions in the forum.

getQuestionCount

public int getQuestionCount(Forum forum,
                            QuestionFilter questionFilter)
Description copied from interface: QuestionManager
Returns the count of questions in a forum that pass the specified question filter.

Specified by:
getQuestionCount in interface QuestionManager
Parameters:
forum - the forum.
questionFilter - the question filter.
Returns:
the count of questions in a forum that pass the specified question filter.

getQuestions

public java.util.Iterator getQuestions()
Description copied from interface: QuestionManager
Returns an iterator for all questions in the system.

Specified by:
getQuestions in interface QuestionManager
Returns:
an iterator for all questions in the system.

getQuestions

public java.util.Iterator getQuestions(QuestionFilter questionFilter)
Description copied from interface: QuestionManager
Returns an iterator for all questions in the system that pass the specified question filter.

Specified by:
getQuestions in interface QuestionManager
Parameters:
questionFilter - the question filter.
Returns:
an iterator for all questions in the system that pass the specified question filter.

getQuestions

public java.util.Iterator getQuestions(ForumCategory category)
Description copied from interface: QuestionManager
Returns an iterator for all questions in a category.

Specified by:
getQuestions in interface QuestionManager
Parameters:
category - the category.
Returns:
an iterator for all questions in a category.

getQuestions

public java.util.Iterator getQuestions(ForumCategory category,
                                       QuestionFilter questionFilter)
Description copied from interface: QuestionManager
Returns an iterator for all questions in a categetory that pass the specified question filter.

Specified by:
getQuestions in interface QuestionManager
Parameters:
category - the category.
questionFilter - the question filter.
Returns:
an iterator for questions in a category that pass the specified question filter.

getQuestions

public java.util.Iterator getQuestions(Forum forum)
Description copied from interface: QuestionManager
Returns an iterator for all questions in a forum.

Specified by:
getQuestions in interface QuestionManager
Parameters:
forum - the forum.
Returns:
an iterator for all questions in a forum.

getQuestions

public java.util.Iterator getQuestions(Forum forum,
                                       QuestionFilter questionFilter)
Description copied from interface: QuestionManager
Returns an iterator for all questions in a forum that pass the specified question filter.

Specified by:
getQuestions in interface QuestionManager
Parameters:
forum - the forum.
questionFilter - the question filter.
Returns:
an iterator for questions in a forum that pass the specified question filter.

getQuestionListSQL

protected CachedPreparedStatement getQuestionListSQL(int objectType,
                                                     long objectID,
                                                     QuestionFilter questionFilter,
                                                     boolean countQuery)
Returns the SQL statement corresponding to a QuestionFilter for questions.

Parameters:
objectType - forum or category
objectID - the ID of the object
questionFilter - a question filter
countQuery - true for a count query
Returns:
prepared statement

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.