Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.database
Class DbForumMessage

java.lang.Object
  extended by com.jivesoftware.forum.database.DbForumMessage
All Implemented Interfaces:
JiveObject, Watchable, ForumMessage, JiveContentObject, Taggable, Cacheable, com.tangosol.io.ExternalizableLite, java.io.Serializable

public class DbForumMessage
extends java.lang.Object
implements ForumMessage, Cacheable, com.tangosol.io.ExternalizableLite

Database implementation of the ForumMessage interface. It stores messages in the jiveMessage database table, and message properties in the jiveMessageProp table.

Messages are not inserted into the database until they are added to a thread. Therefore, it is best to set all properties of the message before adding it to a thread in order to avoid extra database operations.

The maximum body size (in bytes) is defined using the Jive property message.maxBodySize and has a default value of 524288. Any body larger than the max size will be truncated before it's saved to the database.

See Also:
Serialized Form

Field Summary
protected  java.lang.String filteredBody
           
protected  java.lang.String filteredPlainBody
           
protected  java.lang.String filteredPlainSubject
           
protected  java.util.Map filteredProperties
           
protected  java.lang.String filteredSubject
           
protected  long forumID
           
protected  int moderationValue
           
static java.lang.String PROP_CONTENT_TYPE
           
static java.lang.String PROP_EMAIL
           
static java.lang.String PROP_IP
           
static java.lang.String PROP_NAME
           
static java.lang.String PROP_SOURCE
           
static java.lang.String PROP_USER
           
static java.lang.String TEXT_HTML
           
protected  long threadID
           
static java.lang.String UPDATE_FORUM_INDEX
           
 
Fields inherited from interface com.jivesoftware.forum.JiveContentObject
PLAIN_STRATEGY
 
Constructor Summary
  DbForumMessage()
          Constructor for internal use only.
protected DbForumMessage(long messageID)
          Loads the specified message by its message id.
protected DbForumMessage(long forumID, int forumIndex)
          Loads the specified message by forumID and forum index.
protected DbForumMessage(User user, Forum forum)
          Creates a new DbForumMessage object.
 
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.
 boolean equals(java.lang.Object object)
           
 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.util.Iterator getAttachments(java.sql.Connection con)
           
 java.lang.String getBody()
          Returns the message body.
 int getCachedSize()
          Returns the approximate size of the Object in bytes.
 java.util.Date getCreationDate()
          Returns the date this message was created.
static long getFilterExpiration()
          Returns the time (in milliseconds) that filtered output can be cached before being expired.
 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()
          Retrieve the unique identifier for the jive object.
 int getModerationValue()
          Returns the number of moderation points this message has.
 java.util.Date getModificationDate()
          Returns the date this message was last modified.
 int getObjectType()
          Return the object type of the jive object.
 ForumMessage getParentMessage()
          Returns the parent message of this message or null if this message is the root message of a thread.
 long getParentMessageID()
          Returns the parent message of the message, or -1 if there is no parent message (when the message is the root message of the 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.
protected  int getRewardPoints()
          Returns the number of reward points for the thread.
 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.
 int hashCode()
           
protected  void insertIntoDb(DbForumThread thread, long parentMessageID, java.sql.Connection con)
          Inserts a new message into the database.
 boolean isAnonymous()
          Returns true if this message was posted anonymously.
 boolean isAuthorized(long type)
          Returns true if the handle on this object has the permission specified.
 boolean isHtml()
          Returns true if this body of this message contains HTML.
protected static void loadBulkFromDb(long forumID, int startForumIndex, int endForumIndex)
          Bulk loads messages within a range of of forumIndex values.
protected  void moveMessage(DbForumThread newThread, long parentMessageID, java.sql.Connection con)
          Moves an existing message and all of its children from an existing thread to a new thread.
protected  void prepareInsertIntoDb(DbForumThread thread)
          Prepares the message to be inserted into the database.
 void readExternal(java.io.DataInput in)
           
 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.
static void setFilterExpiration(long filterExpiration)
          Sets the time (in milleseconds) that filtered output can be cached before being expired.
 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.
protected  void setModValue(int value, AuthToken authToken)
           
 void setProperty(java.lang.String name, java.lang.String value)
          Sets an extended property of this message.
protected  void setRewardPoints(int rewardPoints, java.sql.Connection con)
          Sets the number of reward points for the thread.
 void setSubject(java.lang.String subject)
          Sets the subject of this message.
 void setUser(User user)
           
 java.lang.String toString()
          Returns a String representation of the message object using the subject.
protected  void updateModifiedDate(long date, java.sql.Connection con)
          Updates the modified date.
 void writeExternal(java.io.DataOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

UPDATE_FORUM_INDEX

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

PROP_CONTENT_TYPE

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

PROP_NAME

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

PROP_EMAIL

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

PROP_IP

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

PROP_USER

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

PROP_SOURCE

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

TEXT_HTML

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

threadID

protected long threadID

forumID

protected long forumID

moderationValue

protected int moderationValue

filteredSubject

protected java.lang.String filteredSubject

filteredPlainSubject

protected java.lang.String filteredPlainSubject

filteredBody

protected java.lang.String filteredBody

filteredPlainBody

protected java.lang.String filteredPlainBody

filteredProperties

protected java.util.Map filteredProperties
Constructor Detail

DbForumMessage

protected DbForumMessage(User user,
                         Forum forum)
Creates a new DbForumMessage object. If the User object is null, we'll assume that the message has an anonymous author. The message is not saved to the database until the insertIntoDb() method is called. Adding a message to a thread triggers this.

Parameters:
user - the user creating the message, or null if it's anonymous
forum - the forum the message is being created in.

DbForumMessage

protected DbForumMessage(long messageID)
                  throws ForumMessageNotFoundException
Loads the specified message by its message id.

Parameters:
messageID - the message ID.
Throws:
ForumMessageNotFoundException

DbForumMessage

protected DbForumMessage(long forumID,
                         int forumIndex)
                  throws ForumMessageNotFoundException
Loads the specified message by forumID and forum index.

Parameters:
forumID - the forumID.
forumIndex - the forum index.
Throws:
ForumMessageNotFoundException

DbForumMessage

public DbForumMessage()
Constructor for internal use only. It is used to bulk create messages from a database query that loads many messages at once and for object serialization.

Method Detail

getFilterExpiration

public static long getFilterExpiration()
Returns the time (in milliseconds) that filtered output can be cached before being expired. By default, the value is -1, which means the filtered output is never expired except when the message is expired from cache. Setting a non-negative expiration time is useful in cases where one or more filters is time senstive; for example, a filter that converts a ticker symbol into a live stock quote.

Returns:
the time (in milliseconds) that filtered output can be cached, or -1 if it can be cached indefinitely.

setFilterExpiration

public static void setFilterExpiration(long filterExpiration)
Sets the time (in milleseconds) that filtered output can be cached before being expired. By default, the value is -1, which means the filtered output is never expired except when the message is expired from cache. Setting a non-negative expiration time is useful in cases where one or more filters is time senstive; for example, a filter that converts a ticker symbol into a live stock quote.

Parameters:
filterExpiration - the time (in milliseconds) that filtered output can be cached, or -1 if it can be cached indefinitely.

getID

public long getID()
Description copied from interface: JiveObject
Retrieve the unique identifier for the jive object.

Specified by:
getID in interface JiveObject
Specified by:
getID in interface ForumMessage
Returns:
the unique identifier for the jive object.

getForumIndex

public int getForumIndex()
Description copied from interface: ForumMessage
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).

Specified by:
getForumIndex in interface ForumMessage
Returns:
the forumIndex of this message.

getCreationDate

public java.util.Date getCreationDate()
Description copied from interface: ForumMessage
Returns the date this message was created.

Specified by:
getCreationDate in interface ForumMessage
Specified by:
getCreationDate in interface JiveContentObject
Returns:
the date this message was created.

setCreationDate

public void setCreationDate(java.util.Date creationDate)
Description copied from interface: ForumMessage
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.

Specified by:
setCreationDate in interface ForumMessage
Parameters:
creationDate - the date this message was created.

getModificationDate

public java.util.Date getModificationDate()
Description copied from interface: ForumMessage
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.

Specified by:
getModificationDate in interface ForumMessage
Specified by:
getModificationDate in interface JiveContentObject
Returns:
the date this message was last modified.

setModificationDate

public void setModificationDate(java.util.Date modificationDate)
Description copied from interface: ForumMessage
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.

Specified by:
setModificationDate in interface ForumMessage
Parameters:
modificationDate - the date this message was modified.

getSubject

public java.lang.String getSubject()
Description copied from interface: ForumMessage
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.

Specified by:
getSubject in interface ForumMessage
Specified by:
getSubject in interface JiveContentObject
Returns:
the subject of this message.

getPlainSubject

public java.lang.String getPlainSubject()
Description copied from interface: ForumMessage
Returns the message subject with no html markup applied. If message filters are active, the subject returned will be a filtered one with no html markup applied.

Specified by:
getPlainSubject in interface ForumMessage
Specified by:
getPlainSubject in interface JiveContentObject
Returns:
the subject of the message with no html markup applied

getUnfilteredSubject

public java.lang.String getUnfilteredSubject()
Description copied from interface: ForumMessage
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.

Specified by:
getUnfilteredSubject in interface ForumMessage
Specified by:
getUnfilteredSubject in interface JiveContentObject
Returns:
the subject of this message.

setSubject

public void setSubject(java.lang.String subject)
                throws MessageRejectedException
Description copied from interface: ForumMessage
Sets the subject of this message.

Specified by:
setSubject in interface ForumMessage
Parameters:
subject - the subject of this message.
Throws:
MessageRejectedException - if an interceptor rejected the message.

getBody

public java.lang.String getBody()
Description copied from interface: ForumMessage
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.

Specified by:
getBody in interface ForumMessage
Specified by:
getBody in interface JiveContentObject
Returns:
the body of this message.

getPlainBody

public java.lang.String getPlainBody()
Description copied from interface: ForumMessage
Returns the message body with no html markup applied. If message filters are active, the body returned will be a filtered one with no html markup applied.

Specified by:
getPlainBody in interface ForumMessage
Specified by:
getPlainBody in interface JiveContentObject
Returns:
the body of the message with no html markup applied

getUnfilteredBody

public java.lang.String getUnfilteredBody()
Description copied from interface: ForumMessage
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.

Specified by:
getUnfilteredBody in interface ForumMessage
Specified by:
getUnfilteredBody in interface JiveContentObject
Returns:
the unfiltered body of this message.

setBody

public void setBody(java.lang.String body)
             throws MessageRejectedException
Description copied from interface: ForumMessage
Sets the body of this message.

Specified by:
setBody in interface ForumMessage
Parameters:
body - the body of this message.
Throws:
MessageRejectedException - if an interceptor rejected the message.

getUser

public User getUser()
Description copied from interface: ForumMessage
Returns the User that authored this message. If the message was created anonymously, this method will return null.

Specified by:
getUser in interface ForumMessage
Specified by:
getUser in interface JiveContentObject
Returns:
the author of the message.

setUser

public void setUser(User user)

getParentMessage

public ForumMessage getParentMessage()
Description copied from interface: ForumMessage
Returns the parent message of this message or null if this message is the root message of a thread. See TreeWalker for similiar functionality.

Specified by:
getParentMessage in interface ForumMessage
Returns:
the parent message of this message or null if this message is a root message

createAttachment

public Attachment createAttachment(java.lang.String name,
                                   java.lang.String contentType,
                                   java.io.InputStream data)
                            throws java.lang.IllegalStateException,
                                   AttachmentException
Description copied from interface: ForumMessage
Creates a new attachment for this message. Each attachment has a name, content type and binary data. Rules about who can create attachments and what kind attachments are allowed are controlled via an AttachmentManager.

Specified by:
createAttachment in interface ForumMessage
Parameters:
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.
Returns:
an Attachment object representing the new attachment created.
Throws:
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.
java.lang.IllegalStateException
See Also:
Attachment, AttachmentManager

getAttachmentCount

public int getAttachmentCount()
Description copied from interface: ForumMessage
Returns the number of attachments this message has.

Specified by:
getAttachmentCount in interface ForumMessage
Returns:
the number of attachments this message has.

deleteAttachment

public void deleteAttachment(Attachment attachment)
                      throws AttachmentException
Description copied from interface: ForumMessage
Deletes an attachment that belongs to this message. Only administrators or the creator of this message are allowed to call this method.

Specified by:
deleteAttachment in interface ForumMessage
Parameters:
attachment - the attachment to delete.
Throws:
AttachmentException - if there was an error deleting the attachment.

getAttachments

public java.util.Iterator getAttachments()
Description copied from interface: ForumMessage
Returns an Iterator for all the attachments of this message.

Specified by:
getAttachments in interface ForumMessage
Returns:
an Iterator for the message's attachments.
See Also:
Attachment

getAttachments

public java.util.Iterator getAttachments(java.sql.Connection con)

getModerationValue

public int getModerationValue()
Description copied from interface: ForumMessage
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.

Specified by:
getModerationValue in interface ForumMessage
Returns:
the number of moderation points the message has.

setModerationValue

public void setModerationValue(int value,
                               AuthToken authToken)
Description copied from interface: ForumMessage
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.

Specified by:
setModerationValue in interface ForumMessage
Parameters:
value - the number of moderation points for the message.
authToken - the AuthToken token of the user that is making the moderation decision.
See Also:
Gateway, WatchManager

getProperty

public java.lang.String getProperty(java.lang.String name)
Description copied from interface: ForumMessage
Returns an extended property of this message. Each message can have an arbitrary number of extended properties. This lets particular skins or filters provide enhanced functionality that is not part of the base interface.

For security reasons, you should enable an HTML filter in case properties contain malicious HTML code.

Specified by:
getProperty in interface ForumMessage
Parameters:
name - the name of the property to get.
Returns:
the value of the property.

getUnfilteredProperty

public java.lang.String getUnfilteredProperty(java.lang.String name)
Description copied from interface: ForumMessage
Returns an extended property of this message, bypassing any filters. Each message can have an arbitrary number of extended properties. This lets particular skins or filters provide enhanced functionality that is not part of the base interface.

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.

Specified by:
getUnfilteredProperty in interface ForumMessage
Parameters:
name - the name of the property to get.
Returns:
the value of the property.

getProperties

public java.util.Collection getProperties(java.lang.String parentName)
Description copied from interface: ForumMessage
Return all immediate children property values of a parent property as an unmodifiable Collection of String values. A parent/child relationship is denoted by the "." character. For example, given the properties X.Y.A, X.Y.B, X.Y.C and X.Y.C.D, then the immediate child properties of X.Y are X.Y.A, X.Y.B, and X.Y.C (the value of X.Y.C.D would not be returned using this method).

Specified by:
getProperties in interface ForumMessage
Parameters:
parentName - the name of the parent property to return the children for.
Returns:
all Collection of all child property values for the given parent.

setProperty

public void setProperty(java.lang.String name,
                        java.lang.String value)
Description copied from interface: ForumMessage
Sets an extended property of this message. Each message can have an arbitrary number of extended properties. This lets particular skins or filters provide enhanced functionality that is not part of the base interface.

Specified by:
setProperty in interface ForumMessage
Parameters:
name - the name of the property to set.
value - the new value for the property.

deleteProperty

public void deleteProperty(java.lang.String name)
Description copied from interface: ForumMessage
Deletes an extended property. If the property specified by name does not exist, this method will do nothing.

Specified by:
deleteProperty in interface ForumMessage
Parameters:
name - the name of the property to delete.

getPropertyNames

public java.util.Iterator getPropertyNames()
Description copied from interface: ForumMessage
Returns an Iterator of String values for all the names of the message properties.

Specified by:
getPropertyNames in interface ForumMessage
Returns:
an Iterator for the names of all message properties.

isAnonymous

public boolean isAnonymous()
Description copied from interface: ForumMessage
Returns true if this message was posted anonymously. This is a convenience method for: message.getUser() != null.

Specified by:
isAnonymous in interface ForumMessage
Returns:
true if this message was posted anonymously.

getParentMessageID

public long getParentMessageID()
Returns the parent message of the message, or -1 if there is no parent message (when the message is the root message of the thread).

Note: the need for this method is fairly specialized. Normally, a TreeWalker can be used to determine the parent of a message. However, certain code paths such as NNTP needs very fast access to parent information through this method without the potential of additional database selects.

Returns:
the parent message or -1 if there is not a parent message.
See Also:
TreeWalker.getParent(ForumMessage)

getForumThread

public ForumThread getForumThread()
Description copied from interface: ForumMessage
Returns the thread this message belongs to.

Specified by:
getForumThread in interface ForumMessage
Returns:
the thread this message belongs to.

getForum

public Forum getForum()
Description copied from interface: ForumMessage
Returns the forum this message belongs to.

Specified by:
getForum in interface ForumMessage
Returns:
the forum this message belongs to.

isAuthorized

public boolean isAuthorized(long type)
Description copied from interface: ForumMessage
Returns true if the handle on this object has the permission specified. For example, if a forum administrator has a handle on this object, then calling isAuthorized(ForumPermissions.FORUM_ADMIN) would return true.

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.

Specified by:
isAuthorized in interface ForumMessage
Parameters:
type - permissionType a permission type.
Returns:
true if the handle on the object has the specified permission.
See Also:
ForumPermissions

isHtml

public boolean isHtml()
Description copied from interface: ForumMessage
Returns true if this body of this message contains HTML. This is determined by the PROP_CONTENT_TYPE extended property being set to TEXT_HTML.

Specified by:
isHtml in interface ForumMessage
Returns:
true if the content type is text/html

getTagDelegator

public TagDelegator getTagDelegator()
Description copied from interface: ForumMessage
Retrieve a tag delegator to manage message tags. Attempting to retrieve a tag delegator prior to the message being created will result in an IllegalStateArgument being thrown.

Specified by:
getTagDelegator in interface ForumMessage
Returns:
a tag delegator to manage thread tags.

getCachedSize

public int getCachedSize()
Description copied from interface: Cacheable
Returns the approximate size of the Object in bytes. The size should be considered to be a best estimate of how much memory the Object occupies and may be based on empirical trials or dynamic calculations.

Specified by:
getCachedSize in interface Cacheable
Returns:
the size of the Object in bytes.

readExternal

public void readExternal(java.io.DataInput in)
                  throws java.io.IOException
Specified by:
readExternal in interface com.tangosol.io.ExternalizableLite
Throws:
java.io.IOException

writeExternal

public void writeExternal(java.io.DataOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface com.tangosol.io.ExternalizableLite
Throws:
java.io.IOException

toString

public java.lang.String toString()
Returns a String representation of the message object using the subject.

Overrides:
toString in class java.lang.Object
Returns:
a String representation of the ForumMessage object.

hashCode

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

equals

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

getRewardPoints

protected int getRewardPoints()
Returns the number of reward points for the thread.


setRewardPoints

protected void setRewardPoints(int rewardPoints,
                               java.sql.Connection con)
                        throws java.sql.SQLException
Sets the number of reward points for the thread.

Throws:
java.sql.SQLException

setModValue

protected void setModValue(int value,
                           AuthToken authToken)

moveMessage

protected void moveMessage(DbForumThread newThread,
                           long parentMessageID,
                           java.sql.Connection con)
                    throws java.sql.SQLException
Moves an existing message and all of its children from an existing thread to a new thread. Usually, this will be done when a new thread is created from an existing message and its children.

Parameters:
newThread - the new thread the message and its children will belong to.
parentMessageID - the new parent message ID of this message.
con - a database connection to use for SQL operations.
Throws:
java.sql.SQLException - if an error occurs.

updateModifiedDate

protected void updateModifiedDate(long date,
                                  java.sql.Connection con)
                           throws java.sql.SQLException
Updates the modified date. It accepts a Connection so that it can participate in trasactions.

Throws:
java.sql.SQLException

loadBulkFromDb

protected static void loadBulkFromDb(long forumID,
                                     int startForumIndex,
                                     int endForumIndex)
Bulk loads messages within a range of of forumIndex values. More precicesly, all messages where the message's forumIndex value is >= startForumIndex and < endForumIndex will be loaded. If there are holes in the forumIndex range due to messages being deleted, moved, or archived, that information will be cached in the system forumIndexCache.

Parameters:
forumID - the ID of the forum to load messages from.
startForumIndex - the starting forumIndex value in the range of messages to load.
endForumIndex - the ending forumIndex value in the range of messages to load.

prepareInsertIntoDb

protected void prepareInsertIntoDb(DbForumThread thread)
                            throws java.sql.SQLException,
                                   UnauthorizedException
Prepares the message to be inserted into the database. This method is required because the insertIntoDb(com.jivesoftware.forum.database.DbForumThread, long, java.sql.Connection) method would require more than one open database connection otherwise, which can lead to deadlocks.

Parameters:
thread - the thread the message is being inserted into.
Throws:
java.sql.SQLException - if an error occurs.
UnauthorizedException - if not allowed to call this method.

insertIntoDb

protected void insertIntoDb(DbForumThread thread,
                            long parentMessageID,
                            java.sql.Connection con)
                     throws java.sql.SQLException,
                            UnauthorizedException
Inserts a new message into the database. A connection object must be passed in. The connection must be open when passed in, and will remain open when passed back. This method allows us to make insertions be transactional.

Parameters:
con - an open Connection used to insert the message to the db.
thread - the ForumThread the message is being added to.
Throws:
java.sql.SQLException
UnauthorizedException

getObjectType

public int getObjectType()
Description copied from interface: JiveObject
Return the object type of the jive object.

Specified by:
getObjectType in interface JiveObject
Returns:
the object type of the jive object.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.