Jive Forums API (5.5.20.2-oracle) Web Services Client Javadocs

com.jivesoftware.forum.webservices
Class ForumMessage

java.lang.Object
  extended by com.jivesoftware.forum.webservices.ForumMessage

public class ForumMessage
extends java.lang.Object

A ForumMessage encapsulates message data. Each message belongs to a thread, and relates to other messages in a thread in a tree relationship. This system allows messages to represent threaded conversations.


Constructor Summary
ForumMessage()
           
 
Method Summary
 boolean equals(java.lang.Object o)
           
 int getAttachmentCount()
          Returns the number of attachments this message has.
 java.lang.String getBody()
          Returns the message body.
 int getChildCount()
          Returns the number of children (replies) to this message.
 java.util.Date getCreationDate()
          Returns the date this message was created.
 long getForumID()
          Returns the ID of the forum this message belongs to.
 int getForumIndex()
          Returns the index of this message in the forum.
 long getForumThreadID()
          Returns the ID of the thread this message belongs to.
 long getID()
          Returns the id of this message.
 int getMessageDepth()
          Returns the current depth of this message.
 int getModerationValue()
          Returns the number of moderation points this message has.
 java.util.Date getModificationDate()
          Returns the date this message was last modified.
 long getParentMessageID()
          Returns the ID of the parent message of this message or 0 if this message is the root message of a thread.
 java.lang.String getSubject()
          Returns the message subject.
 java.lang.String getUnfilteredBody()
          Returns the message body, bypassing any active filters.
 java.lang.String getUnfilteredSubject()
          Returns the message subject, bypassing any active filters.
 User getUser()
          Returns the ID User that authored this message.
 int hashCode()
           
 boolean isAnonymous()
          Returns true if this message was posted anonymously.
 void setAnonymous(boolean anonymous)
          Sets whether or not this message was created anonymously.
 void setAttachmentCount(int attachmentCount)
          Sets the number of attachments this message has.
 void setBody(java.lang.String body)
          Sets the body of this message.
 void setChildCount(int childCount)
           
 void setCreationDate(java.util.Date creationDate)
          Sets the creation date of this message.
 void setForumID(long forumID)
          Sets the ID of the forum that this message belongs too.
 void setForumIndex(int forumIndex)
          Sets the forum index of this message.
 void setForumThreadID(long forumThreadID)
          Sets the ID of thread that this message belongs too.
 void setHtml(boolean html)
          Sets whether or not this message contains html.
 void setID(long id)
          Sets the id of this message.
 void setMessageDepth(int messageDepth)
           
 void setModerationValue(int value)
          Sets the number of moderation points this message has.
 void setModificationDate(java.util.Date modificationDate)
          Sets the date this message was last modified.
 void setParentMessageID(long parentMessageID)
          Sets the id of the parent message to this message.
 void setSubject(java.lang.String subject)
          Sets the subject of this message.
 void setUnfilteredBody(java.lang.String unfilteredBody)
          Sets the unfiltered body of the message
 void setUnfilteredSubject(java.lang.String unfilteredSubject)
          Sets the unfiltered version of the subject.
 void setUser(User user)
          Sets the id of the user.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ForumMessage

public ForumMessage()
Method Detail

getID

public long getID()
Returns the id of this message.

Returns:
the unique id of this message.

setID

public void setID(long id)
Sets the id of this message.

Parameters:
id - the id of this message.

getForumIndex

public int getForumIndex()
Returns the index of this message in the forum. The forum index is a sequential, incrementing value assigned to a message when it is added to a forum. Therefore, ordering messages by forum index is generally equivalent to ordering by creation date. There are exceptions to this rule, however; for example, when a message is moved from one forum to another it will get the next available forum index so will be out of creation date order.

Once a forum index is assigned to a message, that value is never re-used. Therefore, there will be gaps in the forum index values as messages are deleted, archived, or moved.

Forum index values are primarily provided to support an NNTP-centric view of forums, since the NNTP protocol requires article numbers (forum indexes) inside a newsgroup (forum).

Returns:
the forumIndex of this message.

setForumIndex

public void setForumIndex(int forumIndex)
Sets the forum index of this message.

Parameters:
forumIndex - the forum index of this message.

getCreationDate

public java.util.Date getCreationDate()
Returns the date this message was created.

Returns:
the date this message was created.

setCreationDate

public void setCreationDate(java.util.Date creationDate)
Sets the creation date of this message. In most cases, the creation date will default to when the message was entered into the system. However, the creation date needs to be set manually when importing messages. In other words, skin authors should ignore this method since it only intended for system maintenance.

Parameters:
creationDate - the date this message was created.
Throws:
UnauthorizedException - if does not have ADMIN permissions.

getModificationDate

public java.util.Date getModificationDate()
Returns the date this message was last modified. When a message is first created, the date returned by this method is identical to the creation date. The modified date is updated every time a message property is updated, such as the message body.

Returns:
the date this message was last modified.

setModificationDate

public void setModificationDate(java.util.Date modificationDate)
Sets the date this message was last modified. In most cases, last modifed will default to when the message data was last changed. However, the last modified date needs to be set manually when importing messages. In other words, skin authors should ignore this method since it only intended for system maintenance.

Parameters:
modificationDate - the date this message was modified.
Throws:
UnauthorizedException - if not allowed to edit the message.

getSubject

public java.lang.String getSubject()
Returns the message subject. If message filters are active, the subject returned will be a filtered one. Because filters often provide security functionality, this method is the preferred way to get the subject of a message.

Returns:
the subject of this message.

getUnfilteredSubject

public java.lang.String getUnfilteredSubject()
Returns the message subject, bypassing any active filters. Because filters often provide security, this method should be used with caution. In particular, you should avoid showing unfiltered data in an environment where embedded HTML might be interpreted.

Unfiltered content is necessary for a few reasons. One is when saving Jive content to another persistence mechanism such as an XML format. Another is when you need to skip filter formatting, such as when a user is responding to another user's message.

Returns:
the subject of this message.

setUnfilteredSubject

public void setUnfilteredSubject(java.lang.String unfilteredSubject)
Sets the unfiltered version of the subject.

Parameters:
unfilteredSubject - the unfiltered version of the subject.

setSubject

public void setSubject(java.lang.String subject)
Sets the subject of this message.

Parameters:
subject - the subject of this message.
Throws:
UnauthorizedException - if not allowed to edit this message.

getBody

public java.lang.String getBody()
Returns the message body. If message filters are active, the body returned will be a filtered one. Because filters often provide security functionality such as stripping out HTML and Javascript, this method is the preferred way to get the body of a message.

Returns:
the body of this message.

getUnfilteredBody

public java.lang.String getUnfilteredBody()
Returns the message body, bypassing any active filters. Because filters often provide security, this method should be used with caution. In particular, you should avoid showing unfiltered data in an environment where embedded HTML might be interpreted.

Unfiltered content is necessary for a few reasons. One is when saving Jive content to another persistence mechanism such as an XML format. Another is when you need to skip filter formatting, such as when a user is responding to another user's message.

Returns:
the unfiltered body of this message.

setBody

public void setBody(java.lang.String body)
             throws UnauthorizedException
Sets the body of this message.

Parameters:
body - the body of this message.
Throws:
UnauthorizedException - if does not allowed to edit this message.

setUnfilteredBody

public void setUnfilteredBody(java.lang.String unfilteredBody)
Sets the unfiltered body of the message

Parameters:
unfilteredBody - the unfiltered body of the message

getUser

public User getUser()
Returns the ID User that authored this message. If the message was created anonymously, this method will return 0.

Returns:
the author of the message.

setUser

public void setUser(User user)
Sets the id of the user.

Parameters:
user - the id of the user.

getParentMessageID

public long getParentMessageID()
Returns the ID of the parent message of this message or 0 if this message is the root message of a thread.


setParentMessageID

public void setParentMessageID(long parentMessageID)
Sets the id of the parent message to this message.

Parameters:
parentMessageID - the id of the parent message to this message.

getAttachmentCount

public int getAttachmentCount()
Returns the number of attachments this message has.

Returns:
the number of attachments this message has.

setAttachmentCount

public void setAttachmentCount(int attachmentCount)
Sets the number of attachments this message has.

Parameters:
attachmentCount - the number of attachments this message has.

getModerationValue

public int getModerationValue()
Returns the number of moderation points this message has. The default moderation value is determined by the forum this message belongs to: Forum.getModerationDefaultMessageValue()

If the moderation value is less than JiveConstants.FORUM_MODERATION_VISIBLE then the message will not be displayed by default.

Returns:
the number of moderation points the message has.

setModerationValue

public void setModerationValue(int value)
                        throws UnauthorizedException
Sets the number of moderation points this message has. If the moderation value is less than than JiveConstants.FORUM_MODERATION_VISIBLE, then a number of things will happen:

When calling this method results in a message to go from below the minimum visible threshold to above, then the actions listed above will all be executed. Any change of the moderation value also results in the modified date of the message being updated.

Only administrators and moderators can call this method.

The authToken token of the user must be passed into this method as a paramater for moderation auditing purposes.

Parameters:
value - the number of moderation points for the message.
Throws:
UnauthorizedException - if does not have ADMIN, MODERATE_MESSAGES or MODERATE_THREADS permissions.
See Also:
com.jivesoftware.forum.gateway.Gateway, WatchManager

isAnonymous

public boolean isAnonymous()
Returns true if this message was posted anonymously. This is a convenience method for: message.getUser() < 1.

Returns:
true if this message was posted anonymously.

setAnonymous

public void setAnonymous(boolean anonymous)
Sets whether or not this message was created anonymously.

Parameters:
anonymous - whether or not this message was created anonymously.

getForumThreadID

public long getForumThreadID()
Returns the ID of the thread this message belongs to.

Returns:
The thread this message belongs to.

setForumThreadID

public void setForumThreadID(long forumThreadID)
Sets the ID of thread that this message belongs too.

Parameters:
forumThreadID - The ID of thread that this message belongs too.

getForumID

public long getForumID()
Returns the ID of the forum this message belongs to.

Returns:
The forum this message belongs to.

setForumID

public void setForumID(long forumID)
Sets the ID of the forum that this message belongs too.

Parameters:
forumID - The ID of the forum that this message belongs too.

setHtml

public void setHtml(boolean html)
Sets whether or not this message contains html.

Parameters:
html - whether or not this message contains html.

getChildCount

public int getChildCount()
Returns the number of children (replies) to this message.

Returns:
the number of children (replies) to this message.

setChildCount

public void setChildCount(int childCount)

getMessageDepth

public int getMessageDepth()
Returns the current depth of this message.

Returns:
the current depth of this message.

setMessageDepth

public void setMessageDepth(int messageDepth)

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.