Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.action
Class ForumActionSupport

java.lang.Object
  extended by com.opensymphony.xwork.ActionSupport
      extended by com.jivesoftware.base.action.JiveActionSupport
          extended by com.jivesoftware.forum.action.ForumActionSupport
All Implemented Interfaces:
AuthTokenAware, EntityAware, UserAware, ForumFactoryAware, 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:
AbuseAction, Accountbox, AddressBookAction, AddressBookAddAction, AddressBookRemoveAction, AddressBookViewAction, AnnounceAction, AttachmentSettingsAction, AvatarDisplayAction, AvatarModerationAction, AvatarSetActiveAction, AvatarSettingsAction, AvatarUploadAction, AvatarUserDeleteAction, Breadcrumbs, BulkModerateAction, ChangePasswordAction, Click, CommunityEverywhereSettings, DeletePrivateMessageAction, DraftsAction, DraftsDeleteAction, EditRenderFilter, EditTagsAction, EditWatchesAction, EmailResetPasswordToken, FilterSettings, ForumAction, ForumCategoryAction, GuestSettingsAction, HelpAction, MarkPrivateMessageAction, MovePrivateMessageAction, MyRewardsAction, OldPostAction, OnlineAction, ParameterNameDispatchAction, PluginSettingsAction, PollPostAction, PollsViewAction, PollViewAction, PollVoteAction, PostAction, PostAnnounceAction, PrivateMessageFolderAction, PrivateMessageFolderAddAction, PrivateMessageFolderDeleteAction, PrivateMessageFolderEditAction, PrivateMessagePostAction, PrivateMessagesAction, PrivateMessageViewAction, ProfileAction, ProfileRedirectAction, RatingAddAction, ReadAction, RecentHistoryAction, ResetPassword, RewardsAction, RosterAction, SearchAction, SearchProfile, StatusLevelLeadersAction, TagAction, TagCloudAction, UserSearch, UserSettingsAction, ValidateAction, WatchesAction

public class ForumActionSupport
extends JiveActionSupport
implements ForumFactoryAware, EntityAware

A base action class that handles a set of common Jive Forums code. This class extends the WebWork ActionSupport class which provides a lot of handy WebWork utilities. This class is also request and response aware so all actions will have a handle on the HttpServletRequest and HttpServletResponse objects.

Action writers may wish to define this class in the actions xml file - there is an execute() method implemented in this class which will always return Action.SUCCESS.

See Also:
Serialized Form

Field Summary
static java.lang.String CANCEL
           
static java.lang.String DISABLED
           
static java.lang.String FATAL
           
static java.lang.String NOTFOUND
           
protected static java.lang.String SESSION_REFERRER_KEY
           
static java.lang.String 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
ForumActionSupport()
           
 
Method Summary
 java.lang.String execute()
          Default implementation of doExecute() method.
 boolean getCanAttach(Forum forum)
          Returns true if the page user can create message attachments in the given forum, false otherwise..
 boolean getCanCreateMessage(ForumThread thread)
          Returns true if the page user is authorized to create messages in the given thread, false otherwise.
 boolean getCanCreatePoll(Forum forum)
          Returns true if the page user is authorized to create polls in the given forum, false otherwise.
 boolean getCanCreatePoll(ForumCategory category)
          Returns true if the page user is authorized to create polls in the given category, false otherwise.
 boolean getCanCreateThread(Forum forum)
          Returns true if the page user is authorized to create threads in the given forum, false otherwise.
 boolean getCanCreateThread(ForumCategory category)
          Returns true if the page user is authorized to create threads in the given category, false otherwise.
 boolean getCanEdit(ForumMessage message)
          Returns true if the page user has permission to edit the specified message, false otherwise.
 boolean getCanEditAttach(ForumMessage message)
          Returns true if the page usre can create message attachments in the given forum, false otherwise.
 boolean getCanEditPoll(ForumCategory category, Poll poll)
           
 boolean getCanEditPoll(Forum forum, Poll poll)
           
 boolean getCanEditProfile()
          Returns true if the user can edit their profile, false otherwise
 boolean getCanEditTags(ForumMessage message)
           
 boolean getCanPostAnnounce(Forum forum)
          Returns true if the page user is authorized to post announcements in the given forum, false otherwise.
 boolean getCanPostAnnounce(ForumCategory category)
          Returns true if the page user is authorized to post announcements in the given category, false otherwise.
 boolean getCanRead(Forum forum)
          Returns true if the page user is authorized to view content given forum, false otherwise.
 boolean getCanRead(ForumCategory category)
          Returns true if the page user is authorized to view content given category, false otherwise.
 EntityDescriptor getEntityDescriptor(java.util.Map parameters)
          Returns information (ID, type) about a specific type given a Map of parameters.
 ForumFactory getForumFactory()
          Returns a reference to the ForumFactory object.
 User getPageUser()
          Returns the current page user's User object, or null if the user is a guest.
 boolean getReadStatus(java.lang.Object obj, int type)
          Returns true if the user has the specified read status on the object, false otherwise.
 java.lang.String getSkinProperty(Forum forum, java.lang.String name)
          Returns a skin property.
 java.lang.String getThemeName()
          Returns the theme name associated with the current request.
 boolean isAdmin(Forum forum)
          Returns true if the page user is an administrator of the specified forum, false otherwise.
 boolean isAdmin(ForumCategory category)
          Returns true if the page user is an administrator of the specified category, false otherwise.
 boolean isAuthor(ForumMessage message)
          Returns true if the page user is the author of the specified message, false otherwise.
 boolean isAuthor(ForumThread thread)
          Returns true if the page user is the author of the specified thread, false otherwise.
 boolean isMessageModerationOn(Forum forum)
          Returs true if message-level moderation is enabled for this forum, false otherwise.
 boolean isModerator(Forum forum)
          Returns true if the page user is a moderator of the specified forum.
 boolean isModerator(ForumCategory category)
          Returns true if the page user is a moderator of the specified category.
 boolean isResourceInTheme(java.lang.String resourceName)
          Checks if a file is available for the current theme.
 boolean isSystemAdmin()
          Returns true if the page user is the system admin, false otherwise.
 boolean isThreadModerationOn(Forum forum)
          Returns true if thread-level moderation is enabled for this forum, false otherwise.
 void setForumFactory(ForumFactory forumFactory)
          Sets the forum factory -- useful for developers who subclass this class.
 void setUser(User user)
           
 
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

NOTFOUND

public static final java.lang.String NOTFOUND
See Also:
Constant Field Values

UNAUTHORIZED

public static final java.lang.String UNAUTHORIZED
See Also:
Constant Field Values

DISABLED

public static final java.lang.String DISABLED
See Also:
Constant Field Values

CANCEL

public static final java.lang.String CANCEL
See Also:
Constant Field Values

FATAL

public static final java.lang.String FATAL
See Also:
Constant Field Values

SESSION_REFERRER_KEY

protected static final java.lang.String SESSION_REFERRER_KEY
See Also:
Constant Field Values
Constructor Detail

ForumActionSupport

public ForumActionSupport()
Method Detail

getForumFactory

public ForumFactory getForumFactory()
Returns a reference to the ForumFactory object. All Jive objects are rooted in the forum factory class.

Returns:
a reference to the ForumFactory object.
See Also:
ForumFactory

setForumFactory

public void setForumFactory(ForumFactory forumFactory)
Sets the forum factory -- useful for developers who subclass this class. Set the forum factory if you need to change a user or do a login and need a forum factory object with the correct permissions.

Specified by:
setForumFactory in interface ForumFactoryAware
Parameters:
forumFactory - an instance of ForumFactory

getPageUser

public User getPageUser()
Returns the current page user's User object, or null if the user is a guest.

The best way to test for guest status is to call JiveActionSupport.isGuest().

Specified by:
getPageUser in class JiveActionSupport
Returns:
the current page user's User object or null if the user is a geust.
See Also:
User

setUser

public void setUser(User user)
Specified by:
setUser in interface UserAware
Overrides:
setUser in class JiveActionSupport

isSystemAdmin

public boolean isSystemAdmin()
Returns true if the page user is the system admin, false otherwise.

Returns:
true if the page user is the system admin, false otherwise.

isAdmin

public boolean isAdmin(ForumCategory category)
Returns true if the page user is an administrator of the specified category, false otherwise.

Parameters:
category - the category to check.
Returns:
true if the page user is an admin, false otherwise.

isAdmin

public boolean isAdmin(Forum forum)
Returns true if the page user is an administrator of the specified forum, false otherwise.

Parameters:
forum - the forum to check.
Returns:
true if the page user is an admin, false otherwise.

isModerator

public boolean isModerator(ForumCategory category)
Returns true if the page user is a moderator of the specified category. Note, the user might be an admin of a subcategory - in that case this method will still return whether or not they're an admin of the specified category and not take into account subcategories.

Parameters:
category - the category to check.
Returns:
true if the user is a moderator, false otherwise.

isModerator

public boolean isModerator(Forum forum)
Returns true if the page user is a moderator of the specified forum.

Parameters:
forum - the category to check.
Returns:
true if the user is a moderator, false otherwise.

isAuthor

public boolean isAuthor(ForumThread thread)
Returns true if the page user is the author of the specified thread, false otherwise. This method will always return false for anonymously posted threads or guest users.

Parameters:
thread - the thread to check.
Returns:
true if the page user is the author of the specified thread, false otherwise.

isAuthor

public boolean isAuthor(ForumMessage message)
Returns true if the page user is the author of the specified message, false otherwise. This method will always return false for anonymous messages or guest users.

Parameters:
message - the message to check.
Returns:
true if the page user is the author of the specified message, false otherwise.

getCanEdit

public boolean getCanEdit(ForumMessage message)
Returns true if the page user has permission to edit the specified message, false otherwise. This method will always return false if the page user is a guest. System admins, moderators and the original author are allowed to edit. This method checks to see if the page user is any of those.

Additionally, this method will obey the editing policy which is set via the admin console. A message can always be edited, never be edited, edited as long as there are no replies or edited in a given time frame.

This method checks to make sure the given message is not null. It may be necessary to modify code that calls this method to add a null check around it.

Parameters:
message - the message to test.
Returns:
true if the page user has permission to edit the specified message, false otherwise.

getCanEditTags

public boolean getCanEditTags(ForumMessage message)

getCanAttach

public boolean getCanAttach(Forum forum)
Returns true if the page user can create message attachments in the given forum, false otherwise.. A user can create an attachment if they have an explicit create message permission or if they're a system admin, global moderator, global category admin or a global forum admin. Also considers if the maxAttachmentsPerMessage is greater than 0.

Parameters:
forum - the forum to check for permissions.
Returns:
true if the page user can create message attachments in the given forum, false otherwise.

getCanEditAttach

public boolean getCanEditAttach(ForumMessage message)
Returns true if the page usre can create message attachments in the given forum, false otherwise.

Parameters:
message - the message to check.
Returns:
true if the page user can create message attachments in the given forum, false otherwise.

getCanPostAnnounce

public boolean getCanPostAnnounce(ForumCategory category)
Returns true if the page user is authorized to post announcements in the given category, false otherwise. The page user must be an admin, moderator, or have the ForumPermissions.ANNOUNCEMENT_ADMIN.

Parameters:
category - the category to check.
Returns:
true if the page user is authorized to post announcements in the given category, false otherwise.

getCanPostAnnounce

public boolean getCanPostAnnounce(Forum forum)
Returns true if the page user is authorized to post announcements in the given forum, false otherwise. The page user must be an admin, moderator, or have the ForumPermissions.ANNOUNCEMENT_ADMIN.

Parameters:
forum - the forum to check.
Returns:
true if the page user is authorized to post announcements in the given forum, false otherwise.

getCanCreatePoll

public boolean getCanCreatePoll(ForumCategory category)
Returns true if the page user is authorized to create polls in the given category, false otherwise. The page user must be an admin, moderator, or have the ForumPermissions.CREATE_POLL.

Parameters:
category - the forum to check.
Returns:
true if the page user is authorized to create polls in the given category, false otherwise.

getCanCreateMessage

public boolean getCanCreateMessage(ForumThread thread)
Returns true if the page user is authorized to create messages in the given thread, false otherwise. The page user must be an admin, moderator, or have the ForumPermissions.CREATE_MESSAGE.

Parameters:
thread - the thread to check.
Returns:
true if the page user is authorized to create messages in the given thread, false otherwise.

getCanCreateThread

public boolean getCanCreateThread(Forum forum)
Returns true if the page user is authorized to create threads in the given forum, false otherwise. The page user must be an admin, moderator, or have the ForumPermissions.CREATE_THREAD.

Parameters:
forum - the forum to check.
Returns:
true if the page user is authorized to create threads in the given forum, false otherwise.

getCanCreateThread

public boolean getCanCreateThread(ForumCategory category)
Returns true if the page user is authorized to create threads in the given category, false otherwise. The page user must be an admin, moderator, or have the ForumPermissions.CREATE_THREAD.

Parameters:
category - the forum to check.
Returns:
true if the page user is authorized to create threads in the given category, false otherwise.

getCanCreatePoll

public boolean getCanCreatePoll(Forum forum)
Returns true if the page user is authorized to create polls in the given forum, false otherwise. The page user must be an admin, moderator, or have the ForumPermissions.CREATE_POLL.

Parameters:
forum - the forum to check.
Returns:
true if the page user is authorized to create polls in the given forum, false otherwise.

getCanEditPoll

public boolean getCanEditPoll(Forum forum,
                              Poll poll)

getCanEditPoll

public boolean getCanEditPoll(ForumCategory category,
                              Poll poll)

getCanRead

public boolean getCanRead(ForumCategory category)
Returns true if the page user is authorized to view content given category, false otherwise. The page user must be an admin, moderator, or have the ForumPermissions.READ_FORUM.

Parameters:
category - the forum to check.
Returns:
true if the page user is authorized to view content in the given category, false otherwise.

getCanRead

public boolean getCanRead(Forum forum)
Returns true if the page user is authorized to view content given forum, false otherwise. The page user must be an admin, moderator, or have the ForumPermissions.READ_FORUM.

Parameters:
forum - the forum to check.
Returns:
true if the page user is authorized to view content in the given forum, false otherwise.

getSkinProperty

public java.lang.String getSkinProperty(Forum forum,
                                        java.lang.String name)
Returns a skin property. The value of the given property is searched for in the forum, the forum's category and the global properties list.

Parameters:
forum - the forum to search in. See the SkinUtils method description for more details.
name - the name of the property we're looking for.
Returns:
the value of the property or null if it was not found.
See Also:
SkinUtils.getSkinProperty(Forum,String)

getReadStatus

public boolean getReadStatus(java.lang.Object obj,
                             int type)
Returns true if the user has the specified read status on the object, false otherwise.

Note, if the user is a guest then false will be returned always. This is because read tracking is not supported for guests.

Parameters:
obj - the object to test - must be a ForumThread or ForumMessage
type - the read status to check.
Returns:
true if the user has the read status on the given object, false otherwise.

isThreadModerationOn

public boolean isThreadModerationOn(Forum forum)
Returns true if thread-level moderation is enabled for this forum, false otherwise.

Parameters:
forum - the Forum to test.
Returns:
true if thread-level moderation is enabled for this forum, false otherwise.

isMessageModerationOn

public boolean isMessageModerationOn(Forum forum)
Returs true if message-level moderation is enabled for this forum, false otherwise.

Parameters:
forum - the Forum to test.
Returns:
true if message-level moderation is enabled for this forum, false otherwise.

getCanEditProfile

public boolean getCanEditProfile()
Returns true if the user can edit their profile, false otherwise

Returns:
true if the user can edit their profile, false otherwise

execute

public java.lang.String execute()
                         throws java.lang.Exception
Default implementation of doExecute() method. This class is intended to be a base class for other actions but can be used as an action itself if the skin author simply wants to get access to the context & methods provided by this class.

Specified by:
execute in interface com.opensymphony.xwork.Action
Overrides:
execute in class JiveActionSupport
Returns:
Action.SUCCESS
Throws:
java.lang.Exception

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
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.

isResourceInTheme

public boolean isResourceInTheme(java.lang.String resourceName)
Checks if a file is available for the current theme.

Parameters:
resourceName - the resource to check for the current theme.
Returns:
true if the resource exists and is readable

getThemeName

public java.lang.String getThemeName()
Returns the theme name associated with the current request.

Returns:
the theme name associated with the current request.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.