Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.action
Class ForumAction

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
All Implemented Interfaces:
AuthTokenAware, EntityAware, JiveObjectLoader, UserAware, ForumFactoryAware, 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:
ForumThreadAction

public class ForumAction
extends ForumActionSupport
implements Pageable, JiveObjectLoader

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

See Also:
Serialized Form

Field Summary
 
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
ForumAction()
           
 
Method Summary
 java.lang.String execute()
          Loads the specified forum.
 java.util.Iterator getAnnouncements()
          Returns an iterator of all announcements in the system.
 EntityDescriptor getEntityDescriptor(java.util.Map parameters)
          Returns information (ID, type) about a specific type given a Map of parameters.
 Forum getForum()
          Returns the forum we've loaded.
 long getForumID()
          Returns the forum ID.
 ResultFilter getMessageResultFilter()
          Returns a result filter for viewing lists of messages.
 ResultFilter getResultFilter()
          Returns the result filter used to create the list of threads in this forum.
 int getStart()
          Returns the starting index for the list of threads in this forum.
 java.lang.String getThreadMode()
           
 java.util.Iterator getThreads()
          Returns a list of threads on the current page in this forum.
 int getTotalItemCount()
          Returns the total number of threads in the forum.
protected  void initFields()
           
protected  boolean loadJiveObjects()
           
 java.lang.String loadObjects()
          Loads objects in an action.
protected  void setForum(Forum forum)
          Sets the forum to work with.
 void setForumID(long forumID)
          Sets the forum ID.
 void setMessageResultFilter(ResultFilter filter)
          Sets the result filter for viewing lists of messages.
 void setStart(int start)
          Sets the starting index for the list of threads in this forum.
 
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
 

Constructor Detail

ForumAction

public ForumAction()
Method Detail

getForumID

public long getForumID()
Returns the forum ID.

Returns:
the forum ID.

setForumID

public void setForumID(long forumID)
Sets the forum ID.

Parameters:
forumID - the forum ID to set.

getStart

public int getStart()
Returns the starting index for the list of threads in this forum. The index is 0 based and by default is 0. This method will never return a value less than zero as well.

This method implements part of the Pageable interface - this allows this action to be used for the creation of a Pagniator object.

Specified by:
getStart in interface Pageable
Returns:
the starting index for the list of threads in this forum.

setStart

public void setStart(int start)
Sets the starting index for the list of threads in this forum.

Parameters:
start - the starting index of the list of threads in this forum.

getForum

public Forum getForum()
Returns the forum we've loaded.

Returns:
the requested forum object.

setForum

protected void setForum(Forum forum)
Sets the forum to work with. This is protected because it only needs to be called by subclasses.

Parameters:
forum - the forum to work with.

getTotalItemCount

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

Specified by:
getTotalItemCount in interface Pageable
Returns:
the total number of threads in the forum.

getResultFilter

public ResultFilter getResultFilter()
Returns the result filter used to create the list of threads in this forum. 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.

Note, this method implements part of the Pageable interface.

Specified by:
getResultFilter in interface Pageable
Returns:
the ResultFilter used to create the list of threads in this forum.

getMessageResultFilter

public ResultFilter getMessageResultFilter()
Returns a result filter for viewing lists of messages. This is typically used for thread paginators.

Returns:
a result filter for viewing lists of messages.

setMessageResultFilter

public void setMessageResultFilter(ResultFilter filter)
Sets the result filter for viewing lists of messages. This is typically used for thread paginators.

Parameters:
filter - a result filter for viewing lists of messages.

getThreadMode

public java.lang.String getThreadMode()

getThreads

public java.util.Iterator getThreads()
Returns a list of threads on the current page in this forum. Note, this will not likely be a full list of threads in the forum because the number of threads will be limited by the result filter which is based on the start parameter and the user's preference for the number of threads per page.

Returns:
a list of threads on the current page in this forum.

getAnnouncements

public java.util.Iterator getAnnouncements()
Returns an iterator of all announcements in the system.

Returns:
an iterator of all announcements in the system.

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 ForumActionSupport
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
Loads the specified forum. Return codes:

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

loadObjects

public java.lang.String loadObjects()
                             throws java.lang.Exception
Description copied from interface: JiveObjectLoader
Loads objects in an action. This method should return Action.SUCCESS if object loading occurred normally. If another type of code is returned then a WebWork interceptor can pick up on that and return a different view page.

Specified by:
loadObjects in interface JiveObjectLoader
Returns:
Action.SUCCESS if object loading occurred normally, anything else to indicate that object loading failed.
Throws:
java.lang.Exception - if an unexpected error occurs when loading the objects.

initFields

protected void initFields()

loadJiveObjects

protected boolean loadJiveObjects()
                           throws UnauthorizedException
Throws:
UnauthorizedException

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.