|
Jive Forums API (5.5.20.2-oracle) Developer Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ForumMessage
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. For example:
[thread] |- [message] |- [message] |- [message] |- [message] |- [message] |- [message]
Each message has a subject and body. Messages are authored by a user in the system or can be anonymous. An ID is given to each message so that it can be tracked uniquely. Because is possible that one might want to store more information with each message besides a subject and body, each message can have an arbitrary number of properties. For example, a property "IPAddress" could be stored with each message that records the IP address of the person posting the message for security reasons.
The creation date, and the date the message was last modified are maintained for each message. These values are normally maintained automatically by the system and do not need to be set explicitly except in special circumstances.
Message editing has a number of rules:
For added functionality, any number of filters can be applied to a message. Filters dynamically format the subject and body of a message. Methods are also provided to bypass filters.
ForumFactory.getMessage(long)
,
ForumThread.getMessage(long)
Field Summary |
---|
Fields inherited from interface com.jivesoftware.forum.JiveContentObject |
---|
PLAIN_STRATEGY |
Method Summary | |
---|---|
Attachment |
createAttachment(java.lang.String name,
java.lang.String contentType,
java.io.InputStream data)
Creates a new attachment for this message. |
void |
deleteAttachment(Attachment attachment)
Deletes an attachment that belongs to this message. |
void |
deleteProperty(java.lang.String name)
Deletes an extended property. |
int |
getAttachmentCount()
Returns the number of attachments this message has. |
java.util.Iterator |
getAttachments()
Returns an Iterator for all the attachments of this message. |
java.lang.String |
getBody()
Returns the message body. |
java.util.Date |
getCreationDate()
Returns the date this message was created. |
Forum |
getForum()
Returns the forum this message belongs to. |
int |
getForumIndex()
Returns the index of this message in the forum. |
ForumThread |
getForumThread()
Returns the thread this message belongs to. |
long |
getID()
Returns the id of this message, or -1 if this message hasn't been added to the database yet. |
int |
getModerationValue()
Returns the number of moderation points this message has. |
java.util.Date |
getModificationDate()
Returns the date this message was last modified. |
ForumMessage |
getParentMessage()
Returns the parent message of this message or null if this message is the root message of a thread. |
java.lang.String |
getPlainBody()
Returns the message body with no html markup applied. |
java.lang.String |
getPlainSubject()
Returns the message subject with no html markup applied. |
java.util.Collection |
getProperties(java.lang.String parentName)
Return all immediate children property values of a parent property as an unmodifiable Collection of String values. |
java.lang.String |
getProperty(java.lang.String name)
Returns an extended property of this message. |
java.util.Iterator |
getPropertyNames()
Returns an Iterator of String values for all the names of the message properties. |
java.lang.String |
getSubject()
Returns the message subject. |
TagDelegator |
getTagDelegator()
Retrieve a tag delegator to manage message tags. |
java.lang.String |
getUnfilteredBody()
Returns the message body, bypassing any active filters. |
java.lang.String |
getUnfilteredProperty(java.lang.String name)
Returns an extended property of this message, bypassing any filters. |
java.lang.String |
getUnfilteredSubject()
Returns the message subject, bypassing any active filters. |
User |
getUser()
Returns the User that authored this message. |
boolean |
isAnonymous()
Returns true if this message was posted anonymously. |
boolean |
isAuthorized(long permissionType)
Returns true if the handle on this object has the permission specified. |
boolean |
isHtml()
Returns true if this body of this message contains HTML. |
void |
setBody(java.lang.String body)
Sets the body of this message. |
void |
setCreationDate(java.util.Date creationDate)
Sets the creation date of this message. |
void |
setModerationValue(int value,
AuthToken authToken)
Sets the number of moderation points this message has. |
void |
setModificationDate(java.util.Date modificationDate)
Sets the date this message was last modified. |
void |
setProperty(java.lang.String name,
java.lang.String value)
Sets an extended property of this message. |
void |
setSubject(java.lang.String subject)
Sets the subject of this message. |
Methods inherited from interface com.jivesoftware.base.JiveObject |
---|
getObjectType |
Method Detail |
---|
long getID()
getID
in interface JiveObject
int getForumIndex()
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).
java.util.Date getCreationDate()
getCreationDate
in interface JiveContentObject
void setCreationDate(java.util.Date creationDate) throws UnauthorizedException
creationDate
- the date this message was created.
UnauthorizedException
- if does not have ADMIN permissions.java.util.Date getModificationDate()
getModificationDate
in interface JiveContentObject
void setModificationDate(java.util.Date modificationDate) throws UnauthorizedException
modificationDate
- the date this message was modified.
UnauthorizedException
- if not allowed to edit the message.java.lang.String getSubject()
getSubject
in interface JiveContentObject
java.lang.String getPlainSubject()
getPlainSubject
in interface JiveContentObject
java.lang.String getUnfilteredSubject()
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.
getUnfilteredSubject
in interface JiveContentObject
void setSubject(java.lang.String subject) throws UnauthorizedException, MessageRejectedException
subject
- the subject of this message.
UnauthorizedException
- if not allowed to edit this message.
MessageRejectedException
- if an interceptor rejected the message.java.lang.String getBody()
getBody
in interface JiveContentObject
java.lang.String getPlainBody()
getPlainBody
in interface JiveContentObject
java.lang.String getUnfilteredBody()
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.
getUnfilteredBody
in interface JiveContentObject
void setBody(java.lang.String body) throws UnauthorizedException, MessageRejectedException
body
- the body of this message.
UnauthorizedException
- if does not allowed to edit this message.
MessageRejectedException
- if an interceptor rejected the message.User getUser()
getUser
in interface JiveContentObject
ForumMessage getParentMessage()
TreeWalker
for similiar functionality.
Attachment createAttachment(java.lang.String name, java.lang.String contentType, java.io.InputStream data) throws AttachmentException, UnauthorizedException
name
- the name of the new attachment, usually the file name.contentType
- the content type of the attachment.data
- an InputStream that contains the binary data of the
attachment. The stream will never be closed so you must
close it manually after calling this method.
AttachmentException
- if an error occured while creating the
attachment. Errors can occur because the attachment is too large or
because the message already has too many attachments.
UnauthorizedException
- if not allowed to create attachments.Attachment
,
AttachmentManager
int getAttachmentCount()
void deleteAttachment(Attachment attachment) throws AttachmentException, UnauthorizedException
attachment
- the attachment to delete.
java.lang.IllegalArgumentException
- if the attachment doesn't belong to
the message.
UnauthorizedException
- if not authorized to delete the attachment.
AttachmentException
- if there was an error deleting the attachment.java.util.Iterator getAttachments()
Attachment
int getModerationValue()
Forum.getModerationDefaultMessageValue()
If the moderation value is less than JiveConstants.FORUM_MODERATION_VISIBLE
then the message will not be displayed by default.
void setModerationValue(int value, AuthToken authToken) throws UnauthorizedException
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.
value
- the number of moderation points for the message.authToken
- the AuthToken token of the user that is making the
moderation decision.
UnauthorizedException
- if does not have ADMIN, MODERATE_MESSAGES
or MODERATE_THREADS permissions.Gateway
,
WatchManager
java.lang.String getProperty(java.lang.String name)
For security reasons, you should enable an HTML filter in case properties contain malicious HTML code.
name
- the name of the property to get.
java.util.Collection getProperties(java.lang.String parentName)
parentName
- the name of the parent property to return the children for.
java.lang.String getUnfilteredProperty(java.lang.String name)
Because properties are not filtered before being returned, this method should be used with caution. In particular, you should avoid showing unfiltered data in an environment where embedded HTML might be interpreted.
name
- the name of the property to get.
void setProperty(java.lang.String name, java.lang.String value) throws UnauthorizedException
name
- the name of the property to set.value
- the new value for the property.
UnauthorizedException
- if not allowed to edit the message.void deleteProperty(java.lang.String name) throws UnauthorizedException
name
does not exist, this method will do nothing.
name
- the name of the property to delete.
UnauthorizedException
- if not allowed to edit the message.java.util.Iterator getPropertyNames()
boolean isAnonymous()
ForumThread getForumThread()
Forum getForum()
boolean isAuthorized(long permissionType)
A list of possible permissions can be found in the ForumPermissions class. Certain methods of this class are restricted to certain permissions as specified in the method comments.
permissionType
- permissionType a permission type.
ForumPermissions
boolean isHtml()
DbForumMessage.PROP_CONTENT_TYPE
extended property being set to
DbForumMessage.TEXT_HTML
.
TagDelegator getTagDelegator()
|
Jive Forums Project Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |