Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.action
Class PostAction

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.PostAction
All Implemented Interfaces:
AuthTokenAware, EntityAware, UserAware, ForumAware, ForumCategoryAware, ForumFactoryAware, ForumMessageAware, ForumThreadAware, com.opensymphony.webwork.interceptor.ServletRequestAware, com.opensymphony.webwork.interceptor.ServletResponseAware, com.opensymphony.webwork.interceptor.SessionAware, 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:
EditAction

public class PostAction
extends ForumActionSupport
implements ForumAware, ForumCategoryAware, ForumThreadAware, ForumMessageAware, com.opensymphony.webwork.interceptor.SessionAware, com.opensymphony.webwork.interceptor.ServletRequestAware

An Action to encapsulate all the logic for posting messages using the new style single post page (as opposed to additional pages for spell checking, adding attachments, previewing, etc).

See Also:
Serialized Form

Field Summary
static java.lang.String ATTACH
           
static java.lang.String REJECTED
           
static java.lang.String REQUEST_TOO_LARGE
           
static java.lang.String SESSION_MESSAGE_KEY
           
static java.lang.String SUCCESS_MODERATED
           
static java.lang.String SUCCESS_NEW_MESSAGE
           
static java.lang.String SUCCESS_NEW_MESSAGE_STQC
           
static java.lang.String SUCCESS_NEW_TOPIC
           
 
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, 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
PostAction()
           
 
Method Summary
protected  void addAttachments(ForumMessage message)
          Adds attachments to a message
protected  void cleanSession()
          Cleans the session of all relevant data
protected  void createMessage()
          Convenience method for creating a new message.
 java.lang.String doDefault()
          Loads specified Jive objects (the forum, parent message, etc) and checks that the user has posting permission in this forum.
 java.lang.String doPost()
          This command allows users to post directly from another page.
 java.lang.String doReply()
          This command is for designating that this message should be treated as reply.
 java.lang.String execute()
          Loads specified Jive objects (the forum, parent message, etc) and checks that the user has posting permission in this forum.
 java.lang.String getAssignPoints()
          Returns the number of points assigned for answering the question.
 java.io.File[] getAttachFile()
          Returns an array of File objects corresponding to uploaded files
 java.lang.String[] getAttachFileContentType()
          Returns an srray of content types corresponding to the array of uploaded files
 java.lang.String[] getAttachFileFileName()
          Returns an array of file names corresponding to the array of uploaded files
 int getAttachmentCount()
          Returns a count of attachments associated with the new message.
protected  java.util.List getAttachmentList()
          Returns a list of attachments from the temporary message
 java.util.Iterator getAttachments()
          Returns an iterator of attachments associated with the new message.
 java.lang.String getBody()
          Returns the message body.
 Draft getDraft()
          Get the draft associated with the message.
 java.lang.String getEmail()
          Returns the email address of the guest posting the message.
 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're posting in.
 java.lang.String getFrom()
          Returns the name of the action we're redirecting from.
 ForumMessage getMessage()
          Returns the message we're replying to.
 java.lang.String getName()
          Returns the name of the guest posting the message.
 ForumMessage getNewMessage()
          Returns the new posted message.
 boolean getNewMessageIsModerated()
          Returns true if the newly posted message is moderated.
 java.lang.String getParentQuotedText(boolean returnAsHtml)
          A convenience method to quote the parent's message body.
 java.lang.String getPartialURL()
          Convenience method for building a partial URL with forumID, threadID, messageID and reply specified.
 java.util.Iterator getPopularTags()
          Returns an iterable collection of popular tags based on the current community and tag set.
 long[] getRemoveAttachID()
          Returns the id's of attachments that are to be removed from the message.
 java.lang.String getReplySubject()
          A convenience method to return the reply message subject.
 java.lang.String getResolution()
          Returns the resolution being set for the question.
 javax.servlet.http.HttpServletRequest getServletRequest()
           
 java.util.Map getSession()
          Convenience method to gain access to the session object
 boolean getShowPopularTags()
          Method to determine if popular tags should be shown.
 java.lang.String getSubject()
          Returns the message subject.
protected  ContentTag getTag(java.lang.String tagname)
           
 java.lang.String getTags()
          Gets the current tags for this thread
 ForumThread getThread()
          Returns the thread we're replying in (or making a reply to).
protected  boolean hasDraft()
          Returns true if the user has one or more drafts that match this forum / thread / message combination.
protected  boolean hasPostPermission()
          Returns true if the user has permission to post in this forum, false otherwise.
 java.lang.String isCancel()
          Indicates the user wants to cancel.
 boolean isDraftEnabled()
          Indicates whether or not drafts are enabled.
 boolean isDraftExists()
          Indicates whether or not the user has a draft.
 boolean isEdit()
          Returns false always.
 boolean isEditStampRequired()
          Returns false always.
 boolean isJiveForumUploadSizeLimitExceeded()
          Returns true if the request size limit was exceeded.
 boolean isMarkAsQuestion()
          Indicates whether or not the user wants to mark this posting as a question.
 boolean isPostedFromGUIEditor()
          Returns true if the content being posted was posted from the GUI editor.
 boolean isReply()
          Returns true if this message is a reply to another message.
 boolean isShortTermQueryCacheEnabled()
          Returns true if short term query cache is enabled, false otherwise.
protected  boolean loadJiveObjects()
          Loads Jive objects used in this actions (ie, forum, thread, message objects).
protected  void loadToSession(ForumMessage message)
          Puts relevant message data in the session.
protected  boolean newMessageModerated(ForumMessage msg)
          Determines whether the new message is moderated and sets the isNewMessageModerated variable.
protected  void removeAttachments(ForumMessage message)
          Remove attachments from a message
protected  void removeFromSession()
          Retrieves relevant message data from the session.
protected  ForumMessage retrieveFromSession()
          Retrieves relevant message data from the session.
 void setAssignPoints(java.lang.String assignPoints)
          Sets the number of points to assign for answering the question.
 void setAttachFile(java.io.File[] attachFile)
          Sets an array of File objects corresponding to uploaded files
 void setAttachFileContentType(java.lang.String[] attachFileContentType)
          Sets an srray of content types corresponding to the array of uploaded files
 void setAttachFileFileName(java.lang.String[] attachFileFileName)
          Sets an array of file names corresponding to the array of uploaded files
 void setBody(java.lang.String body)
          Sets the message body.
 void setCancel(java.lang.String cancel)
          Sets whether or not the user wants to cancel.
 void setDraft(Draft draft)
          Set the draft associated with the message.
 void setDraftEnabled(boolean draftEnabled)
          Sets whether or not drafts are enabled
 void setDraftExists(boolean draftExists)
          Sets whether or not the user has a draft for this forum/thread/message combo.
 void setEmail(java.lang.String email)
          Sets the email address of the guest posting the message.
 void setForum(Forum forum)
          Provides the action an instance of Forum
 void setForumCategory(ForumCategory category)
           
 void setFrom(java.lang.String from)
          Sets the name of the action we're redirecting from.
 void setJiveForumUploadSizeLimitExceeded(boolean jiveForumUploadSizeLimitExceeded)
          Set to true if the request size limit was exceeded.
 void setMarkAsQuestion(boolean markAsQuestion)
          Sets whether or not the user wants to mark this post as a question.
 void setMessage(ForumMessage message)
          Provides the action an instance of ForumMessage
 void setName(java.lang.String name)
          Sets the name of the guest posting the message.
protected  void setNewMessage(ForumMessage newMessage)
          Sets the new posted message.
 void setPostedFromGUIEditor(boolean postedFromGUIEditor)
          Set to true if the content being posted was posted from the GUI editor, false otherwise.
 void setRemoveAttachID(long[] removeAttachID)
          Sets the id's of attachments that are to be removed from the message.
 void setReply(boolean reply)
          Sets reply to true if this is a reply to a message or thread, false otherwise.
 void setResolution(java.lang.String resolution)
          Sets the resolution for this question.
 void setServletRequest(javax.servlet.http.HttpServletRequest request)
           
 void setSession(java.util.Map session)
           
 void setSubject(java.lang.String subject)
          Sets the message subject.
 void setTags(java.lang.String tags)
          Sets the current tags for this thread
 void setThread(ForumThread thread)
          Provides the action an instance of ForumThread
 void setUseDraft(boolean useDraft)
          Sets whether or not the user wants to use an existing draft.
 boolean useDraft()
          Returns true if the user wants to use an existing draft, used by the 'Your Drafts' area of the site to autopopulate a forum post rather than showing the user a message that says 'would you like to use the existing draft?'
 void validate()
          Validates all user input.
 
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, getText, getText, getTimeZone, getTimeZones, isFailedLookup, isGuest, setAuthToken, setGuestProperty, setLoginAttributes, setPageUser, setServletResponse
 
Methods inherited from class com.opensymphony.xwork.ActionSupport
addActionError, addActionMessage, addFieldError, clearErrorsAndMessages, clone, 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
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTACH

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

REJECTED

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

REQUEST_TOO_LARGE

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

SUCCESS_MODERATED

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

SUCCESS_NEW_TOPIC

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

SUCCESS_NEW_MESSAGE_STQC

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

SUCCESS_NEW_MESSAGE

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

SESSION_MESSAGE_KEY

public static final java.lang.String SESSION_MESSAGE_KEY
See Also:
Constant Field Values
Constructor Detail

PostAction

public PostAction()
Method Detail

getSession

public java.util.Map getSession()
Description copied from class: JiveActionSupport
Convenience method to gain access to the session object

Overrides:
getSession in class JiveActionSupport

setSession

public void setSession(java.util.Map session)
Specified by:
setSession in interface com.opensymphony.webwork.interceptor.SessionAware

getServletRequest

public javax.servlet.http.HttpServletRequest getServletRequest()

setServletRequest

public void setServletRequest(javax.servlet.http.HttpServletRequest request)
Specified by:
setServletRequest in interface com.opensymphony.webwork.interceptor.ServletRequestAware
Overrides:
setServletRequest in class JiveActionSupport

getForum

public Forum getForum()
Returns the forum we're posting in.

Returns:
the forum we're posting in.

setForum

public void setForum(Forum forum)
Description copied from interface: ForumAware
Provides the action an instance of Forum

Specified by:
setForum in interface ForumAware
Parameters:
forum - an instance of Forum

getThread

public ForumThread getThread()
Returns the thread we're replying in (or making a reply to). If this is a new post this method will return null.

Returns:
the thread we're replying in (or making a reply to).

setThread

public void setThread(ForumThread thread)
Description copied from interface: ForumThreadAware
Provides the action an instance of ForumThread

Specified by:
setThread in interface ForumThreadAware
Parameters:
thread - an instance of ForumThread

getMessage

public ForumMessage getMessage()
Returns the message we're replying to. If this is a new post, this method will return null.

Returns:
the message we're replying to or null if this is a new post.

setMessage

public void setMessage(ForumMessage message)
Description copied from interface: ForumMessageAware
Provides the action an instance of ForumMessage

Specified by:
setMessage in interface ForumMessageAware
Parameters:
message - an instance of ForumMessage

getName

public java.lang.String getName()
Returns the name of the guest posting the message. Note, the guest may choose to not enter a name.

Returns:
the name of the guest posting the message.

setName

public void setName(java.lang.String name)
Sets the name of the guest posting the message. A max of 75 characters is allowed.

Parameters:
name - the name of the guest posting the message.

getEmail

public java.lang.String getEmail()
Returns the email address of the guest posting the message. Note, the guest may choose to not enter an email address.

Returns:
the email address of the guest posting the message.

setEmail

public void setEmail(java.lang.String email)
Sets the email address of the guest posting the message.

Parameters:
email - the email address of the guest posting the message.

getSubject

public java.lang.String getSubject()
Returns the message subject.

Returns:
the message subject.

setSubject

public void setSubject(java.lang.String subject)
Sets the message subject. A max of 255 characters is allowed (though, views should restrict it to 100-150).

Parameters:
subject - sets the message subject.

getBody

public java.lang.String getBody()
Returns the message body.

Returns:
the message body.

setBody

public void setBody(java.lang.String body)
Sets the message body.

Parameters:
body - the body of a message.

isPostedFromGUIEditor

public boolean isPostedFromGUIEditor()
Returns true if the content being posted was posted from the GUI editor. This action needs to know that so that it can unformat the input so that it;s saved into the db always in plain text

Returns:
true if the content being posted was posted from the GUI editor

setPostedFromGUIEditor

public void setPostedFromGUIEditor(boolean postedFromGUIEditor)
Set to true if the content being posted was posted from the GUI editor, false otherwise.

Parameters:
postedFromGUIEditor - true if the content being posted was posted from the GUI editor, false otherwise.

getAttachFile

public java.io.File[] getAttachFile()
Returns an array of File objects corresponding to uploaded files

Returns:
an array of File objects corresponding to uploaded files

setAttachFile

public void setAttachFile(java.io.File[] attachFile)
Sets an array of File objects corresponding to uploaded files

Parameters:
attachFile - an array of File objects corresponding to uploaded files

getAttachFileContentType

public java.lang.String[] getAttachFileContentType()
Returns an srray of content types corresponding to the array of uploaded files

Returns:
an srray of content types corresponding to the array of uploaded files
See Also:
getAttachFile()

setAttachFileContentType

public void setAttachFileContentType(java.lang.String[] attachFileContentType)
Sets an srray of content types corresponding to the array of uploaded files

Parameters:
attachFileContentType - an srray of content types corresponding to the array of uploaded files

getAttachFileFileName

public java.lang.String[] getAttachFileFileName()
Returns an array of file names corresponding to the array of uploaded files

Returns:
an array of file names corresponding to the array of uploaded files
See Also:
getAttachFile()

setAttachFileFileName

public void setAttachFileFileName(java.lang.String[] attachFileFileName)
Sets an array of file names corresponding to the array of uploaded files

Parameters:
attachFileFileName - an array of file names corresponding to the array of uploaded files

getRemoveAttachID

public long[] getRemoveAttachID()
Returns the id's of attachments that are to be removed from the message. This method is only pertinent when an error occurs and attachments have already been uploaded.

Returns:
the id's of attachments that are to be removed from the message.

setRemoveAttachID

public void setRemoveAttachID(long[] removeAttachID)
Sets the id's of attachments that are to be removed from the message. This method is only pertinent when an error occurs and attachments have already been uploaded.

Parameters:
removeAttachID - the id's of attachments that are to be removed from the message.

getFrom

public java.lang.String getFrom()
Returns the name of the action we're redirecting from.

Returns:
the name of the action we're redirecting from.

setFrom

public void setFrom(java.lang.String from)
Sets the name of the action we're redirecting from.

Parameters:
from - the name of the action we're redirecting from.

isCancel

public java.lang.String isCancel()
Indicates the user wants to cancel.

Returns:
the cancel string

setCancel

public void setCancel(java.lang.String cancel)
Sets whether or not the user wants to cancel.

Parameters:
cancel - the cancel string

isMarkAsQuestion

public boolean isMarkAsQuestion()
Indicates whether or not the user wants to mark this posting as a question.

Returns:
"true" if the user marked the post as a question, null if not.

setMarkAsQuestion

public void setMarkAsQuestion(boolean markAsQuestion)
Sets whether or not the user wants to mark this post as a question.

Parameters:
markAsQuestion - "true" if the user wants to mark this post as a question.

getTags

public java.lang.String getTags()
Gets the current tags for this thread

Returns:
the current tags for this thread

setTags

public void setTags(java.lang.String tags)
Sets the current tags for this thread

Parameters:
tags - the current tags for this thread

useDraft

public boolean useDraft()
Returns true if the user wants to use an existing draft, used by the 'Your Drafts' area of the site to autopopulate a forum post rather than showing the user a message that says 'would you like to use the existing draft?'

Returns:
"true" if the URL contains a useDraft variable

setUseDraft

public void setUseDraft(boolean useDraft)
Sets whether or not the user wants to use an existing draft.

Parameters:
useDraft - true to use and existing draft, false otherwise.

isDraftExists

public boolean isDraftExists()
Indicates whether or not the user has a draft.

Returns:
"true" if the user has a draft, false if not.

setDraftExists

public void setDraftExists(boolean draftExists)
Sets whether or not the user has a draft for this forum/thread/message combo.

Parameters:
draftExists - "true" if the user has a draft

isDraftEnabled

public boolean isDraftEnabled()
Indicates whether or not drafts are enabled.

Returns:
"true" if drafts are enabled, false if not

setDraftEnabled

public void setDraftEnabled(boolean draftEnabled)
Sets whether or not drafts are enabled

Parameters:
draftEnabled - "true" if drafts are enabled

getDraft

public Draft getDraft()
Get the draft associated with the message.

Returns:
the draft associated with the message

setDraft

public void setDraft(Draft draft)
Set the draft associated with the message.

Parameters:
draft - the draft associated with the message

getResolution

public java.lang.String getResolution()
Returns the resolution being set for the question.

Returns:
the resolution being set for the question.

setResolution

public void setResolution(java.lang.String resolution)
Sets the resolution for this question.

Parameters:
resolution - the resolution to set.

getShowPopularTags

public boolean getShowPopularTags()
Method to determine if popular tags should be shown. Only requirement is that we have some popular tags to show

Returns:
if Popular tags should be show

getAssignPoints

public java.lang.String getAssignPoints()
Returns the number of points assigned for answering the question.

Returns:
the number of points assigned for answering the question.

setAssignPoints

public void setAssignPoints(java.lang.String assignPoints)
Sets the number of points to assign for answering the question.

Parameters:
assignPoints - the number of points to assign for answering the question.

isJiveForumUploadSizeLimitExceeded

public boolean isJiveForumUploadSizeLimitExceeded()
Returns true if the request size limit was exceeded. The default size limit is calculated as follows:

The maximum size limit is the greater of :

Returns:
true if the request size limit was exceeded

setJiveForumUploadSizeLimitExceeded

public void setJiveForumUploadSizeLimitExceeded(boolean jiveForumUploadSizeLimitExceeded)
Set to true if the request size limit was exceeded. This is set by the multipart request parser and should not be set by users of this action.

Parameters:
jiveForumUploadSizeLimitExceeded - true if the request size limit was exceeded.

isReply

public boolean isReply()
Returns true if this message is a reply to another message. Note, it is not necessary to pass in a 'reply=true' parameter to this action as long as the action is linked as "post!reply.jspa?..." or, has a valid forum ID, thread ID and message ID parameters (in the latter case, it's assumed to be a reply).

Returns:
true if this message is a reply to another message, false if it's a new thread.

setReply

public void setReply(boolean reply)
Sets reply to true if this is a reply to a message or thread, false otherwise.

Parameters:
reply - true if this is a reply to a message or thread, false otherwise.

isEdit

public boolean isEdit()
Returns false always. Subclasses should override this method to indicate an action that supports message editing using the post form.

Returns:
false always. Subclasses should override this.

isEditStampRequired

public boolean isEditStampRequired()
Returns false always. Subclasses should override this method to indicate an edit must have the "Message was edited by:..." message appended to the message body.

Returns:
false always. Subclasses should override this.

getNewMessage

public ForumMessage getNewMessage()
Returns the new posted message. Note, this method will return null until the message has been created. This method exists so the success page can create a link (using the new message ID) to the message page.

Returns:
the new posted message or null if the message hasn't been posted yet.

setNewMessage

protected void setNewMessage(ForumMessage newMessage)
Sets the new posted message. Subclasses should set the new message if they override the createMessage() method.

Parameters:
newMessage - the new posted message or null if the message hasn't been posted yet.

getNewMessageIsModerated

public boolean getNewMessageIsModerated()
Returns true if the newly posted message is moderated.

Returns:
true if the newly posted message is moderated.

getAttachments

public java.util.Iterator getAttachments()
Returns an iterator of attachments associated with the new message. Normally this will return an empty list as attachments are not added to the message prior to posting, however if an error or validation failure occurs the uploaded attachments can be retrieved using this method. The success page may also find this method useful to display any uploaded attachments.

Returns:
an Iterator of temporary attachments associated with the new message.

getAttachmentCount

public int getAttachmentCount()
Returns a count of attachments associated with the new message. Normally this will return 0 as attachments are not added to the message prior to posting, however if an error or validation failure occurs the count of uploaded attachments can be retrieved using this method. The success page may also find this method useful to display any uploaded attachments.

Returns:
the number of attachments associated with the new message.

getReplySubject

public java.lang.String getReplySubject()
A convenience method to return the reply message subject.

Returns:
the reply message subject.

getParentQuotedText

public java.lang.String getParentQuotedText(boolean returnAsHtml)
A convenience method to quote the parent's message body.

Parameters:
returnAsHtml - true to return the quoted message as html, false to return as text
Returns:
the parent's message body quoted appropriately to the specified return mode

isShortTermQueryCacheEnabled

public boolean isShortTermQueryCacheEnabled()
Returns true if short term query cache is enabled, false otherwise.

Returns:
true if short term query cache is enabled, false otherwise.

getPartialURL

public java.lang.String getPartialURL()
Convenience method for building a partial URL with forumID, threadID, messageID and reply specified.

Returns:
a partial URL with forumID, threadID, messageID and reply specified.

doPost

public java.lang.String doPost()
This command allows users to post directly from another page.

Returns:
the view to redirect to.
See Also:
execute()

doReply

public java.lang.String doReply()
This command is for designating that this message should be treated as reply. A reply is also assumed when a valid forum, thread and message are passed in.

Returns:
the view to redirect to.
See Also:
doDefault()

validate

public void validate()
Validates all user input.

Specified by:
validate in interface com.opensymphony.xwork.Validateable
Overrides:
validate in class com.opensymphony.xwork.ActionSupport

doDefault

public java.lang.String doDefault()
Loads specified Jive objects (the forum, parent message, etc) and checks that the user has posting permission in this forum. If there are errors loading the objects, Action.ERROR is returned and if the user doesn't have permission to post, Action.LOGIN is returned.

This method will also add info messages - views can display them by getting Iterators from the ActionSupport.getActionMessages() method.

Overrides:
doDefault in class com.opensymphony.xwork.ActionSupport
Returns:
the view to redirect to.

execute

public java.lang.String execute()
Loads specified Jive objects (the forum, parent message, etc) and checks that the user has posting permission in this forum. If there are errors loading the objects, Action.ERROR is returned and if the user doesn't have permission to post, Action.LOGIN is returned.

This method also validates all message fields and, depending on what the user wants to do (post, etc), executes the appropriate course of action.

If the user wants to post the message and all fields validate, this method will post the message and return Action.SUCCESS;

Specified by:
execute in interface com.opensymphony.xwork.Action
Overrides:
execute in class ForumActionSupport
Returns:
the view to redirect to.

newMessageModerated

protected boolean newMessageModerated(ForumMessage msg)
Determines whether the new message is moderated and sets the isNewMessageModerated variable.

Parameters:
msg - the message to determine moderation upon
Returns:
true if the message is moderated, false otherwise

addAttachments

protected void addAttachments(ForumMessage message)
Adds attachments to a message

Parameters:
message - the message to add attachments to

removeAttachments

protected void removeAttachments(ForumMessage message)
Remove attachments from a message

Parameters:
message - the message to remove attachments from

createMessage

protected void createMessage()
                      throws UnauthorizedException,
                             MessageRejectedException
Convenience method for creating a new message. This creates the message with the correct user, sets the subject, body, and optionally sets name, email and the IP properties.

Throws:
UnauthorizedException - if the user does not have permission to create the message.
MessageRejectedException - if the user is prevented from posting this message.

loadJiveObjects

protected boolean loadJiveObjects()
                           throws UnauthorizedException
Loads Jive objects used in this actions (ie, forum, thread, message objects).

Returns:
true if there were no errors loading the objects, false otherwise.
Throws:
UnauthorizedException - if not authorized to load a jive object

hasPostPermission

protected boolean hasPostPermission()
Returns true if the user has permission to post in this forum, false otherwise.

Returns:
true if the user has permission to post in this forum, false otherwise.

hasDraft

protected boolean hasDraft()
Returns true if the user has one or more drafts that match this forum / thread / message combination.

Returns:
true if the user has one or more drafts that match this forum / thread / message combination.

loadToSession

protected void loadToSession(ForumMessage message)
Puts relevant message data in the session. This method should only be called after all message data has been validated.

Parameters:
message - the message to load to the session

retrieveFromSession

protected ForumMessage retrieveFromSession()
Retrieves relevant message data from the session.

Returns:
the message that was previously loaded to the session, or null if no message was loaded to the session or th session timed out

removeFromSession

protected void removeFromSession()
Retrieves relevant message data from the session.


cleanSession

protected void cleanSession()
Cleans the session of all relevant data


getAttachmentList

protected java.util.List getAttachmentList()
Returns a list of attachments from the temporary message

Returns:
a list of attachments from the temporary message

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.

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.

getTag

protected ContentTag getTag(java.lang.String tagname)

setForumCategory

public void setForumCategory(ForumCategory category)
Specified by:
setForumCategory in interface ForumCategoryAware

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.