Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.action
Class ForumThreadAction

java.lang.Object
  extended by com.opensymphony.xwork.ActionSupport
      extended by com.jivesoftware.base.action.JiveActionSupport
          extended by com.jivesoftware.forum.action.ForumActionSupport
              extended by com.jivesoftware.forum.action.ForumAction
                  extended by com.jivesoftware.forum.action.ForumThreadAction
All Implemented Interfaces:
AuthTokenAware, EntityAware, JiveObjectLoader, UserAware, ForumFactoryAware, ForumMessageAware, Pageable, com.opensymphony.webwork.interceptor.ServletRequestAware, com.opensymphony.webwork.interceptor.ServletResponseAware, com.opensymphony.xwork.Action, com.opensymphony.xwork.LocaleProvider, com.opensymphony.xwork.TextProvider, com.opensymphony.xwork.Validateable, com.opensymphony.xwork.ValidationAware, com.uwyn.rife.continuations.ContinuableObject, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
BranchAction, DeleteAction, LockThreadAction, MoveThreadAction, PollAction, UnlockThreadAction

public class ForumThreadAction
extends ForumAction
implements Pageable, JiveObjectLoader, ForumMessageAware

This class is a WebWork action which encapsulates all the logic of loading and validating a ForumThread object. You can get a list of messages from this action - the list is generated from the start parameter and the number of messages in the list is based on the user's preference.

Additionally, this action will tell the developer what the next and previous threads are for this thread.

See Also:
Serialized Form

Field Summary
static java.lang.String DEFAULT_THREAD_MODE
          Default thread mode (flat).
static java.lang.String THREAD_FLAT
          Return code which indicates a flat message interface.
static java.lang.String THREAD_THREADED
          Return code which indicates a threaded message interface.
static java.lang.String THREAD_TREE
          Return code which indicates a tree message interface.
 
Fields inherited from class com.jivesoftware.forum.action.ForumActionSupport
CANCEL, DISABLED, FATAL, NOTFOUND, SESSION_REFERRER_KEY, UNAUTHORIZED
 
Fields inherited from class com.jivesoftware.base.action.JiveActionSupport
pageUser, request, response
 
Fields inherited from class com.opensymphony.xwork.ActionSupport
LOG
 
Fields inherited from interface com.opensymphony.xwork.Action
ERROR, INPUT, LOGIN, NONE, SUCCESS
 
Constructor Summary
ForumThreadAction()
           
 
Method Summary
 java.lang.String execute()
          Validates the forum ID and either redirects to the SUCCESS, ERROR page if the id was not found or the login page if the page user is not authorized to view the forum.
 EntityDescriptor getEntityDescriptor(java.util.Map parameters)
          Returns information (ID, type) about a specific type given a Map of parameters.
 ForumMessage getMessage()
          Returns the message specified by the messageID parameter.
 long getMessageID()
          Returns the ID of the message to load.
 java.util.Iterator getMessages()
          Returns an Iterator of messages in this thread.
 ForumThread getNextThread()
          Returns the thread next to (after) this one in the list of threads in the forum.
 int getNextTstart()
          Returns the index hint for the next thread in the list of threads.
 java.util.Iterator getPopularTags()
          Returns an iterable collection of popular tags based on the current community and tag set.
 ForumThread getPreviousThread()
          Returns the thread previous to this one in the list of threads in the forum.
 int getPrevTstart()
          Returns the index hint for th previous thread in the list of threads.
 java.util.Iterator getRecommendedTags()
          Returns an iterable collection of recommended tags based on the current community and tag set.
 ResultFilter getResultFilter()
          Returns the result filter used to create the list of messages in this thread.
 int getStart()
          Returns the starting index of messages in the list of thread.
 ForumThread getThread()
          Returns the thread specified by the threadID parameter.
 long getThreadID()
          Returns the ID of the thread to load.
 java.lang.String getThreadMode()
          Returns the thread mode being used.
 int getTotalItemCount()
          Returns the total number of messages in the thread.
 int getTstart()
          Returns the index hint for this thread.
 boolean hasNextThread()
          Returns true if there is a thread next to (after) this one in the list of threads in the forum.
 boolean hasPreviousThread()
          Returns true if there is a thread previous to this one in the list of threads in the forum.
 boolean isArchived()
          Returns true if this thread is archived, false otherwise.
 boolean isLocked()
          Returns true if this thread is locked, false otherwise.
 boolean isRootMessage(ForumMessage msg)
          Returns true if the given message is the root message of the thread, false otherwise.
 boolean isStqc()
           
 java.lang.String loadObjects()
          Loads Thread and (@link Message} objects.
 void setMessage(ForumMessage message)
          Sets the message to use in this action.
 void setMessageID(long messageID)
          Sets the ID of the message to load.
 void setResultFilter(ResultFilter filter)
          Sets the result filter used to create the list of messages in this thread.
 void setStart(int start)
          Returns the thread index hint for this thread.
 void setStqc(boolean stqc)
           
protected  void setThread(ForumThread thread)
          Sets the thread to use in this action.
 void setThreadID(long threadID)
          Sets the ID of the thread to load.
 void setTstart(int tstart)
          Sets the index hint for this thread.
 
Methods inherited from class com.jivesoftware.forum.action.ForumAction
getAnnouncements, getForum, getForumID, getMessageResultFilter, getThreads, initFields, loadJiveObjects, setForum, setForumID, setMessageResultFilter
 
Methods inherited from class com.jivesoftware.forum.action.ForumActionSupport
getCanAttach, getCanCreateMessage, getCanCreatePoll, getCanCreatePoll, getCanCreateThread, getCanCreateThread, getCanEdit, getCanEditAttach, getCanEditPoll, getCanEditPoll, getCanEditProfile, getCanEditTags, getCanPostAnnounce, getCanPostAnnounce, getCanRead, getCanRead, getForumFactory, getPageUser, getReadStatus, getSkinProperty, getThemeName, isAdmin, isAdmin, isAuthor, isAuthor, isMessageModerationOn, isModerator, isModerator, isResourceInTheme, isSystemAdmin, isThreadModerationOn, setForumFactory, setUser
 
Methods inherited from class com.jivesoftware.base.action.JiveActionSupport
getAuthToken, getGuestProperty, getJiveProperty, getLocales, getPageURL, getSession, getText, getText, getTimeZone, getTimeZones, isFailedLookup, isGuest, setAuthToken, setGuestProperty, setLoginAttributes, setPageUser, setServletRequest, setServletResponse
 
Methods inherited from class com.opensymphony.xwork.ActionSupport
addActionError, addActionMessage, addFieldError, clearErrorsAndMessages, clone, doDefault, doInput, getActionErrors, getActionMessages, getErrorMessages, getErrors, getFieldErrors, getLocale, getText, getText, getText, getText, getText, getText, getText, getTexts, getTexts, hasActionErrors, hasActionMessages, hasErrors, hasFieldErrors, hasKey, pause, setActionErrors, setActionMessages, setFieldErrors, validate
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

THREAD_THREADED

public static final java.lang.String THREAD_THREADED
Return code which indicates a threaded message interface.

See Also:
Constant Field Values

THREAD_FLAT

public static final java.lang.String THREAD_FLAT
Return code which indicates a flat message interface.

See Also:
Constant Field Values

THREAD_TREE

public static final java.lang.String THREAD_TREE
Return code which indicates a tree message interface.

See Also:
Constant Field Values

DEFAULT_THREAD_MODE

public static final java.lang.String DEFAULT_THREAD_MODE
Default thread mode (flat).

See Also:
Constant Field Values
Constructor Detail

ForumThreadAction

public ForumThreadAction()
Method Detail

getThreadID

public long getThreadID()
Returns the ID of the thread to load.

Returns:
the thread ID.

setThreadID

public void setThreadID(long threadID)
Sets the ID of the thread to load.

Parameters:
threadID - the thread ID to load.

getMessageID

public long getMessageID()
Returns the ID of the message to load.

Returns:
the message ID.

setMessageID

public void setMessageID(long messageID)
Sets the ID of the message to load.

Parameters:
messageID - the message ID to load.

getStart

public int getStart()
Returns the starting index of messages in the list of thread. Only relevant for the flat thread mode.

Specified by:
getStart in interface Pageable
Overrides:
getStart in class ForumAction
Returns:
returns the starting index in the list of messages.

setStart

public void setStart(int start)
Returns the thread index hint for this thread.

Overrides:
setStart in class ForumAction
Parameters:
start - the starting index in the list of messages.

getTstart

public int getTstart()
Returns the index hint for this thread.

Returns:
the index hint for this thread.

setTstart

public void setTstart(int tstart)
Sets the index hint for this thread.

Parameters:
tstart - the index hint for this thread.

getNextTstart

public int getNextTstart()
Returns the index hint for the next thread in the list of threads.

Returns:
the index hint for the next thread in the list of threads.

getPrevTstart

public int getPrevTstart()
Returns the index hint for th previous thread in the list of threads.

Returns:
the index hint for th previous thread in the list of threads.

getTotalItemCount

public int getTotalItemCount()
Returns the total number of messages in the thread. This method implements part of the Pageable interface.

Specified by:
getTotalItemCount in interface Pageable
Overrides:
getTotalItemCount in class ForumAction
Returns:
the total number of messages in the thread.

getThread

public ForumThread getThread()
Returns the thread specified by the threadID parameter.

Returns:
the thread specified by the threadID parameter.

setThread

protected void setThread(ForumThread thread)
Sets the thread to use in this action.

Parameters:
thread - the thread to use in this action.

getMessage

public ForumMessage getMessage()
Returns the message specified by the messageID parameter. If no messageID parameter was specified then this method returns the root message of the thread specified.

Returns:
the message specified by the messageID parameter or the root message of the thread.

setMessage

public void setMessage(ForumMessage message)
Sets the message to use in this action.

Specified by:
setMessage in interface ForumMessageAware
Parameters:
message - the message to use in this action.

getMessages

public java.util.Iterator getMessages()
Returns an Iterator of messages in this thread. This depends on the user preference for messages per page so the number of pages in a thread might vary.

Note, this returns an Iterator of messages in "flat" mode - don't call this method if you want the list of messages to display in threaded or tree mode.

Returns:
an Iterator of messages in this thread.

getResultFilter

public ResultFilter getResultFilter()
Returns the result filter used to create the list of messages in this thread. From a ResultFilter you can get the starting index in the list, the number of results per page, moderation values, etc. See the JavaDoc for the ResultFilter class for the full list of properties.

This method is only intended for a "flat" list of messages (non-threaded).

Specified by:
getResultFilter in interface Pageable
Overrides:
getResultFilter in class ForumAction
Returns:
the ResultFilter used to create the list of messages in this thread.

setResultFilter

public void setResultFilter(ResultFilter filter)
Sets the result filter used to create the list of messages in this thread. From a ResultFilter you can get the starting index in the list, the number of results per page, moderation values, etc. See the JavaDoc for the ResultFilter class for the full list of properties.

This method is only intended for a "flat" list of messages (non-threaded).

Parameters:
filter - the ResultFilter used to create the list of messages in this thread.

hasPreviousThread

public boolean hasPreviousThread()
Returns true if there is a thread previous to this one in the list of threads in the forum.

Returns:
true if there is a thread previous to this one, false otherwise.

getPreviousThread

public ForumThread getPreviousThread()
Returns the thread previous to this one in the list of threads in the forum. If this thread is the first thread in the list this method will return null.

Returns:
the thread previous to this one in the list of threads or null if there was no previous thread.

hasNextThread

public boolean hasNextThread()
Returns true if there is a thread next to (after) this one in the list of threads in the forum.

Returns:
true if there is a thread next to (after) this one, false otherwise.

getNextThread

public ForumThread getNextThread()
Returns the thread next to (after) this one in the list of threads in the forum. If this thread is the first thread in the list this method will return null.

Returns:
the thread next to (after) this one in the list of threads or null if there was no previous thread.

isArchived

public boolean isArchived()
Returns true if this thread is archived, false otherwise.

Returns:
true if this thread is archived, false otherwise.

isLocked

public boolean isLocked()
Returns true if this thread is locked, false otherwise.

Returns:
true if this thread is locked, false otherwise.

isRootMessage

public boolean isRootMessage(ForumMessage msg)
Returns true if the given message is the root message of the thread, false otherwise.

Parameters:
msg - the ForumMessage object to test.
Returns:
true if the given message is the root message of the thread, false otherwise.

getThreadMode

public java.lang.String getThreadMode()
Returns the thread mode being used. Will be either THREAD_FLAT, THREAD_THREADED or THREAD_TREE. If the mode can't be determined then DEFAULT_THREAD_MODE.

Overrides:
getThreadMode in class ForumAction
Returns:
the thread mode being used.

isStqc

public boolean isStqc()

setStqc

public void setStqc(boolean stqc)

getEntityDescriptor

public EntityDescriptor getEntityDescriptor(java.util.Map parameters)
Description copied from interface: EntityAware
Returns information (ID, type) about a specific type given a Map of parameters. The parameters are expected to be String keys with Long values. If the parameter is not found, null is returned.

Specified by:
getEntityDescriptor in interface EntityAware
Overrides:
getEntityDescriptor in class ForumAction
Parameters:
parameters - a Map of parameters with String keys and Long values.
Returns:
a descriptor of the object (ID and type) or null if the entity was not found.

execute

public java.lang.String execute()
                         throws java.lang.Exception
Validates the forum ID and either redirects to the SUCCESS, ERROR page if the id was not found or the login page if the page user is not authorized to view the forum.

Specified by:
execute in interface com.opensymphony.xwork.Action
Overrides:
execute in class ForumAction
Returns:
Action.SUCCESS if the forum was loaded successfully, ForumActionSupport.UNAUTHORIZED or Action.ERROR otherwise.
Throws:
java.lang.Exception

getRecommendedTags

public java.util.Iterator getRecommendedTags()
Returns an iterable collection of recommended tags based on the current community and tag set.

Returns:
an iterable collection of recommended tags based on the current community and tag set.

getPopularTags

public java.util.Iterator getPopularTags()
Returns an iterable collection of popular tags based on the current community and tag set.

Returns:
an iterable collection of popular tags based on the current community and tag set.

loadObjects

public java.lang.String loadObjects()
                             throws java.lang.Exception
Loads Thread and (@link Message} objects. Either the thread id or the message id must be set. If thread id is set, but not message id, the message will be set to the root message of the thread. If message id is set, but not thread id, the thread will be set to the one containing the message. If neither is set, ForumThreadNotFoundException is thrown.

Specified by:
loadObjects in interface JiveObjectLoader
Overrides:
loadObjects in class ForumAction
Returns:
result code.
Throws:
java.lang.Exception

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.