Jive Forums API (5.5.8) Developer Javadocs

com.jivesoftware.forum.database
Class DbQuestion

java.lang.Object
  extended by com.jivesoftware.forum.database.DbQuestion
All Implemented Interfaces:
Question, Cacheable, java.io.Serializable

public class DbQuestion
extends java.lang.Object
implements Question, Cacheable

Implementation of the Question interface.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.jivesoftware.forum.Question
Question.State
 
Constructor Summary
DbQuestion(ForumThread thread)
          Constructs a new Question.
DbQuestion(long threadID)
          Loads an existing question.
 
Method Summary
 void addHelpfulAnswer(ForumMessage message)
          Marks the specified message as a helpful answer to this question.
 void deleteProperty(java.lang.String name)
          Deletes an extended property.
 boolean equals(java.lang.Object obj)
           
 int getCachedSize()
          Returns the approximate size of the Object in bytes.
 ForumMessage getCorrectAnswer()
          Returns the correct answer, or null if no correct answer has been set.
 java.util.Date getCreationDate()
          Returns the date this question was created.
 ForumThread getForumThread()
          Returns the thread that the question is associated with.
 java.util.Collection getHelpfulAnswers()
          Returns a read-only Collection of ForumMessage objects that have been marked as helpful.
 java.util.Collection getProperties(java.lang.String parentName)
          Return all immediate children property values of a parent property as an unmodifiable Collection of String values.
 java.lang.String getProperty(java.lang.String name)
          Returns an extended property of this object.
 java.util.Iterator getPropertyNames()
          Returns an Iterator of String values for all the names of the properties.
 java.util.Date getResolutionDate()
          Returns the date that question was resolved, or null if the question has not been resolved.
 Question.State getState()
          Returns the resolution state of this question.
 User getUser()
          Returns the user that created the question.
 int hashCode()
           
 boolean isCorrectAnswer(ForumMessage message)
          Returns true if the specified message is the correct answer.
 boolean isHelpfulAnswer(ForumMessage message)
          Returns true if the specified message has been marked as a helpful answer to this question.
 void setCorrectAnswer(ForumMessage message)
          Sets the specified message as the correct answer.
 void setProperty(java.lang.String name, java.lang.String value)
          Sets an extended property of object.
 void setState(Question.State state)
          Sets the resolution state of this question.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DbQuestion

public DbQuestion(ForumThread thread)
Constructs a new Question.


DbQuestion

public DbQuestion(long threadID)
           throws NotFoundException
Loads an existing question.

Parameters:
threadID - the threadID.
Throws:
NotFoundException - if loading the question fails.
Method Detail

getUser

public User getUser()
Description copied from interface: Question
Returns the user that created the question.

Specified by:
getUser in interface Question
Returns:
the user the created the question.

getForumThread

public ForumThread getForumThread()
Description copied from interface: Question
Returns the thread that the question is associated with.

Specified by:
getForumThread in interface Question
Returns:
the thread that the question is associated with.

getState

public Question.State getState()
Description copied from interface: Question
Returns the resolution state of this question.

Specified by:
getState in interface Question
Returns:
the resolution state.

setState

public void setState(Question.State state)
              throws UnauthorizedException
Description copied from interface: Question
Sets the resolution state of this question. Rules for who is allowed to set the state of the question are as follows: When to set the state is left open in order to accomodate a variety of workflows and business rules. However, the typical rules are as follows:

Specified by:
setState in interface Question
Parameters:
state - the resolution state.
Throws:
UnauthorizedException - if not allowed to change the resolution state to the specified value.

getCreationDate

public java.util.Date getCreationDate()
Description copied from interface: Question
Returns the date this question was created.

Specified by:
getCreationDate in interface Question
Returns:
the date the question was created.

getResolutionDate

public java.util.Date getResolutionDate()
Description copied from interface: Question
Returns the date that question was resolved, or null if the question has not been resolved. A question is considered resolved if the state is Question.State.assumed_resolved or Question.State.resolved. The rules for the resolution date are as follows:

Specified by:
getResolutionDate in interface Question
Returns:
the date the question was resolved, or null if the question has not been resolved.

addHelpfulAnswer

public void addHelpfulAnswer(ForumMessage message)
                      throws UnauthorizedException
Description copied from interface: Question
Marks the specified message as a helpful answer to this question.

Specified by:
addHelpfulAnswer in interface Question
Parameters:
message - the message.
Throws:
UnauthorizedException - if not allowed to mark the message as a helpful answer.

isHelpfulAnswer

public boolean isHelpfulAnswer(ForumMessage message)
Description copied from interface: Question
Returns true if the specified message has been marked as a helpful answer to this question.

Specified by:
isHelpfulAnswer in interface Question
Parameters:
message - the message.
Returns:
true if the specified message is a helpful answer to this question.

getHelpfulAnswers

public java.util.Collection getHelpfulAnswers()
Description copied from interface: Question
Returns a read-only Collection of ForumMessage objects that have been marked as helpful. If there are no helpful answers, this method will return an empty collection.

Specified by:
getHelpfulAnswers in interface Question
Returns:
a Collection of helpful answers (ForumMessage objects).

setCorrectAnswer

public void setCorrectAnswer(ForumMessage message)
                      throws UnauthorizedException
Description copied from interface: Question
Sets the specified message as the correct answer.

Specified by:
setCorrectAnswer in interface Question
Parameters:
message - the message.
Throws:
UnauthorizedException - if not allowed to set the specified message as the correct answer to this question.

isCorrectAnswer

public boolean isCorrectAnswer(ForumMessage message)
Description copied from interface: Question
Returns true if the specified message is the correct answer.

Specified by:
isCorrectAnswer in interface Question
Parameters:
message - the message.
Returns:
true if the specified message is the correct.

getCorrectAnswer

public ForumMessage getCorrectAnswer()
Description copied from interface: Question
Returns the correct answer, or null if no correct answer has been set.

Specified by:
getCorrectAnswer in interface Question
Returns:
the correct answer.

getProperty

public java.lang.String getProperty(java.lang.String name)
Description copied from interface: Question
Returns an extended property of this object. Each question can have an arbitrary number of extended properties. This lets particular skins or filters provide enhanced functionality that is not part of the base interface.

Specified by:
getProperty in interface Question
Parameters:
name - the name of the property to get.
Returns:
the value of the property.

getProperties

public java.util.Collection getProperties(java.lang.String parentName)
Description copied from interface: Question
Return all immediate children property values of a parent property as an unmodifiable Collection of String values. A parent/child relationship is denoted by the "." character. For example, given the properties X.Y.A, X.Y.B, X.Y.C and X.Y.C.D, then the immediate child properties of X.Y are X.Y.A, X.Y.B, and X.Y.C (the value of X.Y.C.D would not be returned using this method).

Specified by:
getProperties in interface Question
Parameters:
parentName - the name of the parent property to return the children for.
Returns:
all Collection of all child property values for the given parent.

setProperty

public void setProperty(java.lang.String name,
                        java.lang.String value)
Description copied from interface: Question
Sets an extended property of object. This object can have an arbitrary number of extended properties. This lets particular skins or filters provide enhanced functionality that is not part of the base interface.

Specified by:
setProperty in interface Question
Parameters:
name - the name of the property to set.
value - the new value for the property.

deleteProperty

public void deleteProperty(java.lang.String name)
Description copied from interface: Question
Deletes an extended property. If the property specified by name does not exist, this method will do nothing.

Specified by:
deleteProperty in interface Question
Parameters:
name - the name of the property to delete.

getPropertyNames

public java.util.Iterator getPropertyNames()
Description copied from interface: Question
Returns an Iterator of String values for all the names of the properties.

Specified by:
getPropertyNames in interface Question
Returns:
an Iterator for the names of all properties.

getCachedSize

public int getCachedSize()
Description copied from interface: Cacheable
Returns the approximate size of the Object in bytes. The size should be considered to be a best estimate of how much memory the Object occupies and may be based on empirical trials or dynamic calculations.

Specified by:
getCachedSize in interface Cacheable
Returns:
the size of the Object in bytes.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.