Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.action
Class OldPostAction

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.OldPostAction
All Implemented Interfaces:
AuthTokenAware, EntityAware, UserAware, ForumFactoryAware, 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:
AttachAction, OldEditAction, SpellAction

public class OldPostAction
extends ForumActionSupport
implements com.opensymphony.webwork.interceptor.SessionAware, com.opensymphony.webwork.interceptor.ServletRequestAware

An Action to encapsulate all the logic for posting messages.

See Also:
Serialized Form

Field Summary
static java.lang.String ATTACH
           
static java.lang.String PREVIEW
           
static java.lang.String REJECTED
           
static java.lang.String SPELLCHECK
           
 
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
OldPostAction()
           
 
Method Summary
protected  void cleanSession()
           
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 doRemoveAttach()
           
 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()
           
 int getAttachmentCount()
          Returns an Iterator of temporary attachments associated with this message.
 java.util.Iterator getAttachments()
          Returns an Iterator of temporary attachments associated with this message.
 java.lang.String getBody()
          Returns the message body.
protected  java.lang.String getDoAttach()
          Returns true if the user wants to add attachments to the message, false otherwise.
 java.lang.String getDoGoBack()
          Returns true if the user wants to go back to the main post form (from a secondary page like preview or spelling).
protected  java.lang.String getDoPost()
          Returns true if the user wants to post their message, false otherwise.
protected  java.lang.String getDoPreview()
          Returns true if the user wants to preview their message, false otherwise.
 java.lang.String getDoQuoteOriq()
           
protected  java.lang.String getDoSpellCheck()
          Returns true if the user wants to spell check the message, false otherwise.
 Draft getDraft()
          Get the draft associated with this 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.
 long getForumID()
          Returns the forum ID.
 java.lang.String getFrom()
          Returns the name of the action we're redirecting from.
 ForumMessage getMessage()
          Returns the message we're replying to.
 long getMessageID()
          Returns the message ID or -1 if no message was specified.
 java.lang.String getName()
          Returns the name of the guest posting the message.
 ForumMessage getNewMessage()
          Returns the new posted message.
 boolean getNewMessageIsModerated()
           
protected  java.lang.String getPartialURL()
           
 ForumMessage getPreviewedMessage()
          Returns a ForumMessage object the preview page can use.
 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.
protected  java.lang.String getSessionSuffix()
           
 java.lang.String getSubject()
          Returns the message subject.
 long getTempAttachmentID()
           
 ForumThread getThread()
          Returns the thread we're replying in (or making a reply to).
 long getThreadID()
          Returns the thread ID or -1 if no thread was specified.
 java.lang.String getTid()
           
 java.lang.String getToHex(java.lang.String input, java.lang.String encoding)
           
 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.
protected  boolean isEdit()
          Returns false always.
 boolean isMarkAsQuestion()
          Indicates whether or not the user wants to mark this posting as a question.
 boolean isQuote()
           
 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  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)
           
 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 setDoAttach(java.lang.String doAttach)
          Sets whether or not the user wants to add attachments to the message.
 void setDoGoBack(java.lang.String doGoBack)
          Sets whether or not the user wants to go back to the main post form.
 void setDoPost(java.lang.String doPost)
          Sets whether or not the user wants to post their message.
 void setDoPreview(java.lang.String doPreview)
          Sets whether or not the user wants to preview their message.
 void setDoQuoteOriq(java.lang.String doQuoteOriq)
           
 void setDoSpellCheck(java.lang.String doSpellCheck)
          Sets whether or not the user wants to spell check the message.
 void setDraft(Draft draft)
          Set the draft associated with this object.
 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)
           
 void setForumID(long forumID)
          Sets the ID of the forum to use.
 void setFrom(java.lang.String from)
          Sets the name of the action we're redirecting from.
 void setMarkAsQuestion(boolean markAsQuestion)
          Sets whether or not the user wants to mark this post as a question.
 void setMessage(ForumMessage message)
          Sets the message.
 void setMessageID(long messageID)
          Sets the ID of the message to use.
 void setName(java.lang.String name)
          Sets the name of the guest posting the message.
protected  void setNewMessage(ForumMessage newMessage)
           
 void setQuote(boolean quote)
           
 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 setTempAttachmentID(long tempAttachmentID)
           
protected  void setThread(ForumThread thread)
           
 void setThreadID(long threadID)
          Sets the ID of the thread to use.
 void setTid(java.lang.String tid)
           
 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, getSession, 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

PREVIEW

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

ATTACH

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

SPELLCHECK

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

REJECTED

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

OldPostAction

public OldPostAction()
Method Detail

setServletRequest

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

getForumID

public long getForumID()
Returns the forum ID.

Returns:
the forum ID

setForumID

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

Parameters:
forumID - the ID of the forum we want to use.

getThreadID

public long getThreadID()
Returns the thread ID or -1 if no thread was specified.

Returns:
the thread ID.

setThreadID

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

Parameters:
threadID - the ID of the thread we want to use.

getMessageID

public long getMessageID()
Returns the message ID or -1 if no message was specified.

Returns:
the message ID.

setMessageID

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

Parameters:
messageID - the ID of the message we want to use.

getTempAttachmentID

public long getTempAttachmentID()

setTempAttachmentID

public void setTempAttachmentID(long tempAttachmentID)

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.

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.

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.

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 -

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

Returns:
draft

setDraft

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

Parameters:
draft -

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.

getAssignPoints

public java.lang.String getAssignPoints()

setAssignPoints

public void setAssignPoints(java.lang.String assignPoints)

getTid

public java.lang.String getTid()

setTid

public void setTid(java.lang.String tid)

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.

isQuote

public boolean isQuote()

setQuote

public void setQuote(boolean quote)

isEdit

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

getForum

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

Returns:
the forum we're posting in.

setForum

public void setForum(Forum 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

protected void setThread(ForumThread thread)

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)
Sets the message. Only subclasses need this method.

Parameters:
message - the message to use.

getNewMessage

public ForumMessage getNewMessage()
Returns the new posted message. Note, this method will return null until the messasge 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)

getAttachments

public java.util.Iterator getAttachments()
Returns an Iterator of temporary attachments associated with this message.

Returns:
an Iterator of temporary attachments associated with this message.

getAttachmentCount

public int getAttachmentCount()
Returns an Iterator of temporary attachments associated with this message.

Returns:
an Iterator of temporary attachments associated with this message.

getPreviewedMessage

public ForumMessage getPreviewedMessage()
Returns a ForumMessage object the preview page can use. This is a normal ForumMessage object, only this message has not been saved to the DB - it only exists in memory.

This method assumes you've gone through all the necessary field validation steps.

Returns:
a ForumMessage object the preview page can use.

getReplySubject

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


isCancel

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


setCancel

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


getDoAttach

protected java.lang.String getDoAttach()
Returns true if the user wants to add attachments to the message, false otherwise. This method is protected because it should only be used internally or by a subclass.

Returns:
true if the user wants to add attachments to the message, false otherwise.

setDoAttach

public void setDoAttach(java.lang.String doAttach)
Sets whether or not the user wants to add attachments to the message. Since this method maps directly from a view, the parameter has to be a String. The property will be set each time regardless of the parameter.

Parameters:
doAttach - sets whether or not the user wants to add attachments to the message.

getDoSpellCheck

protected java.lang.String getDoSpellCheck()
Returns true if the user wants to spell check the message, false otherwise. This method is protected because it should only be used internally or by a subclass.

Returns:
true if the user wants to spell check the message, false otherwise.

setDoSpellCheck

public void setDoSpellCheck(java.lang.String doSpellCheck)
Sets whether or not the user wants to spell check the message. Since this method maps directly from a view, the parameter has to be a String. The property will be set each time regardless of the parameter.

Parameters:
doSpellCheck - sets whether or not the user wants to spell check the message.

getDoQuoteOriq

public java.lang.String getDoQuoteOriq()

setDoQuoteOriq

public void setDoQuoteOriq(java.lang.String doQuoteOriq)
Parameters:
doQuoteOriq -

getDoPreview

protected java.lang.String getDoPreview()
Returns true if the user wants to preview their message, false otherwise. This method is protected because it should only be used internally or by a subclass.

Returns:
true if the user wants to preview the message, false otherwise.

setDoPreview

public void setDoPreview(java.lang.String doPreview)
Sets whether or not the user wants to preview their message. Since this method maps directly from a view, the parameter has to be a String. The property will be set each time regardless of the parameter.

Parameters:
doPreview - sets whether or not the user wants to preview their message.

getDoPost

protected java.lang.String getDoPost()
Returns true if the user wants to post their message, false otherwise. This method is protected because it should only used internally or by a subclass.

Returns:
true if the user wants to post their message, false otherwise.

setDoPost

public void setDoPost(java.lang.String doPost)
Sets whether or not the user wants to post their message. Since this method maps directly from a view, the parameter has to be a String. The property will be set each time regardless of the parameter.

Parameters:
doPost - sets whether or not the user wants to post their message.

getDoGoBack

public java.lang.String getDoGoBack()
Returns true if the user wants to go back to the main post form (from a secondary page like preview or spelling).

Returns:
true if the user wants to go back to main post form.

setDoGoBack

public void setDoGoBack(java.lang.String doGoBack)
Sets whether or not the user wants to go back to the main post form.

Parameters:
doGoBack - sets whether or not the user wants to post their message.

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 forumID, threadID and messageID are passed in.

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

doRemoveAttach

public java.lang.String doRemoveAttach()

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.

validate

public void validate()
Validates all user input. This method is protected because it should only be called internally or by a subclass.

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

getNewMessageIsModerated

public boolean getNewMessageIsModerated()

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

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.


retrieveFromSession

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


removeFromSession

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


cleanSession

protected void cleanSession()

getSessionSuffix

protected java.lang.String getSessionSuffix()

getToHex

public java.lang.String getToHex(java.lang.String input,
                                 java.lang.String encoding)
                          throws java.io.UnsupportedEncodingException
Throws:
java.io.UnsupportedEncodingException

getPartialURL

protected java.lang.String getPartialURL()

setSession

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

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.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.