Compoze Software, Inc.

com.compoze.discussion
Class Forum

java.lang.Object
  |
  +--com.compoze.discussion.Forum
All Implemented Interfaces:
java.io.Serializable

public class Forum
extends java.lang.Object
implements java.io.Serializable

This class represents a forum.

To add and search for forums, see the Forums collection class. Once the forum is obtained, its accessor methods may be called to set and get properties. The update() method must be called to store any changes to the server.

The following table contains the mappings from Forum properties to their corresponding Java methods:

Forum Property Java Methods
ForumProperty.ARCHIVE isArchived()
setArchive(boolean)
ForumProperty.ARCHIVE_DATE getArchiveDate()
ForumProperty.AUTHOR getAuthor()
ForumProperty.CONTENT_TYPE getContentType()
ForumProperty.DATE_CREATED getDateCreated()
ForumProperty.DATE_LAST_MODIFIED getDateLastModified()
ForumProperty.DESCRIPTION getDescription()
ForumProperty.EXPIRATION_DATE getExpiration()
hasExpiration()
clearExpiration()
ForumProperty.KEYWORDS getKeywords()
ForumProperty.MAXIMUM_TOPIC_COUNT getMaximumTopicCount()
hasMaximumTopicCount()
clearMaximumTopicCount()
ForumProperty.MESSAGE_COUNT getMessageCount()
ForumProperty.NAME getName()
ForumProperty.TOPIC_COUNT getTopicCount()
ForumProperty.TYPE getType()
ForumProperty.CUSTOM_NUM1 getCustomNum1()
ForumProperty.CUSTOM_NUM2 getCustomNum2()
ForumProperty.CUSTOM_NUM3 getCustomNum3()
ForumProperty.CUSTOM_NUM4 getCustomNum4()
ForumProperty.CUSTOM_STR1 getCustomStr1()
ForumProperty.CUSTOM_STR2 getCustomStr2()
ForumProperty.CUSTOM_STR3 getCustomStr3()
ForumProperty.CUSTOM_STR4 getCustomStr4()

See Also:
Serialized Form

Field Summary
protected  int m_iMessageCount
           
protected  int m_iTopicCount
           
 
Constructor Summary
Forum()
          Constructor.
 
Method Summary
 void clearExpiration()
          Clears the expiration date for this forum.
 void clearMaximumTopicCount()
          Clears the maximum number of topics for this fourm.
 java.lang.Object clone()
          Creates and returns a copy of this object.
 void delete()
          Deletes the forum.
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this one.
 AccessManager getAccessManager()
          Gets the access manager for this forum.
 java.util.Date getArchiveDate()
          Gets the archive date for this forum.
 java.lang.String getAuthor()
          Gets the name of the author.
 java.lang.String getContentType()
          Gets the content type of the forum description.
 long getCustomNum1()
          Gets the custom number1 field of the forum.
 long getCustomNum2()
          Gets the custom number2 field of the forum.
 long getCustomNum3()
          Gets the custom number3 field of the forum.
 long getCustomNum4()
          Gets the custom number4 field of the forum.
 java.lang.String getCustomStr1()
          Gets the custom string1 field of the forum.
 java.lang.String getCustomStr2()
          Gets the custom string2 field of the forum.
 java.lang.String getCustomStr3()
          Gets the custom string3 field of the forum.
 java.lang.String getCustomStr4()
          Gets the custom string4 field of the forum.
 java.util.Date getDateCreated()
          Gets the date the forum was created.
 java.util.Date getDateLastModified()
          Gets the date the forum was last modified.
 java.lang.String getDescription()
          Gets the description of the forum.
 java.util.Date getExpiration()
          Gets the expiration date of this forum, if on exists.
 long getID()
          Gets the unique identifier (id) of the forum.
 java.lang.String getKeywords()
          Gets the keywords associated with this forum.
 int getMaximumTopicCount()
          Gets the maximum topic count, if set.
 int getMessageCount()
          Gets the number of messages associated with the topics under this forum.
 Messages getMessages()
          Gets the messages associated with this forum.
 java.lang.String getName()
          Gets the name of the forum.
 int getTopicCount()
          Gets the number of topics associated with the forum.
 Topics getTopics()
          Gets the topics associated with this forum.
 ForumType getType()
          Gets the type of forum.
 boolean hasExpiration()
          Checks if this forum has an expiration.
 boolean hasMaximumTopicCount()
          Checks if the forum has a maximum topic count set.
 boolean isArchived()
          Checks if this forum is archived.
 boolean isExpired()
          Checks if this forum is expired.
 boolean isMaximumTopicCount()
          Checks if the forum has reached the maximum topic count.
 boolean isModified()
          Checks if this forum has been modified since the user's last login.
 void setArchive(boolean bArchive)
          Sets the archive flag for this forum.
 void setContentType(java.lang.String sContentType)
          Sets the content type of the forum description.
 void setCustomNum1(long lCustomNum1)
          Sets the custom number1 field of the forum.
 void setCustomNum2(long lCustomNum2)
          Sets the custom number2 field of the forum.
 void setCustomNum3(long lCustomNum3)
          Sets the custom number3 field of the forum.
 void setCustomNum4(long lCustomNum4)
          Sets the custom number4 field of the forum.
 void setCustomStr1(java.lang.String sCustomStr1)
          Sets the custom string1 field of the forum.
 void setCustomStr2(java.lang.String sCustomStr2)
          Sets the custom string2 field of the forum.
 void setCustomStr3(java.lang.String sCustomStr3)
          Sets the custom string3 field of the forum.
 void setCustomStr4(java.lang.String sCustomStr4)
          Sets the custom string4 field of the forum.
 void setDescription(java.lang.String sDescription)
          Sets the description of the forum.
 void setExpiration(java.util.Date expirationDate)
          Sets the expiration date for this forum.
 void setKeywords(java.lang.String sKeywords)
          Sets the keywords associated with this forum.
 void setKeywords(java.lang.String[] keywords)
          Sets the keywords associated with this forum.
 void setMaximumTopicCount(int iMaximum)
          Sets the maximum number of topics this forum can have.
 void setName(java.lang.String sName)
          Sets the name of the forum.
 void setType(ForumType type)
          Sets the type of forum.
 java.lang.String toString()
          Returns a string representation of the object.
 boolean update()
          Updates the forum (saves the forum entry).
 boolean update(boolean bForce)
          Updates the forum (saves the forum entry).
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_iTopicCount

protected int m_iTopicCount

m_iMessageCount

protected int m_iMessageCount
Constructor Detail

Forum

public Forum()
Constructor. NOTE: This default constructor technically leaves the forum in an invalid state. Use Forums.add(String) to create a forum.
Method Detail

clone

public java.lang.Object clone()
Creates and returns a copy of this object.
Overrides:
clone in class java.lang.Object
Returns:
a clone of this instance

getID

public long getID()
Gets the unique identifier (id) of the forum. This is non-zero number that uniquely identifies the forum.
Returns:
the id of the forum

getName

public java.lang.String getName()
Gets the name of the forum.
Returns:
the name of the forum or null if no name is set

setName

public void setName(java.lang.String sName)
Sets the name of the forum.
Parameters:
sName - the name of the forum or null if no name is set

isArchived

public boolean isArchived()
Checks if this forum is archived.
Returns:
true if this forum is archived; false otherwise

setArchive

public void setArchive(boolean bArchive)
Sets the archive flag for this forum.
Parameters:
bArchive - true to set this forum as archived; false otherwise

getArchiveDate

public java.util.Date getArchiveDate()
Gets the archive date for this forum.
Returns:
the archive date or null if the archive flag is not set to true
See Also:
isArchived()

setType

public void setType(ForumType type)
             throws java.security.AccessControlException
Sets the type of forum. The user must be an owner of the forum to set the type. If setting the type to MODERATED, the user is given the DiscussionPermission.MODERATOR. If setting the type to UNMODERATED, all existing moderator permissions are removed.
Parameters:
type - the type of forum (may not be null)
Throws:
java.security.AccessControlException - occurs if the user attempting to set the forum type is not an owner

getType

public ForumType getType()
Gets the type of forum.
Returns:
the type of forum

getDateCreated

public java.util.Date getDateCreated()
Gets the date the forum was created.
Returns:
the date created

getDateLastModified

public java.util.Date getDateLastModified()
Gets the date the forum was last modified. A forum is considered modified if a new topic is added, updated or deleted, or new messages are added, updated or deleted.
Returns:
the date last modified

isModified

public boolean isModified()
Checks if this forum has been modified since the user's last login.
Returns:
true if forum has been modified; false otherwise

getContentType

public java.lang.String getContentType()
Gets the content type of the forum description. The content type can be used to determine how to display the forum description. For example, text/plain can be displayed as plain text.
Returns:
the MIME content type of the description
See Also:
getDescription()

setContentType

public void setContentType(java.lang.String sContentType)
Sets the content type of the forum description.
Parameters:
sContentType - the MIME content type of the description (may not be null or empty)
See Also:
getDescription()

getDescription

public java.lang.String getDescription()
Gets the description of the forum. The description should explain what types of topics are contained.
Returns:
the description of the forum or null for no description

setDescription

public void setDescription(java.lang.String sDescription)
Sets the description of the forum. The description should explain what types of topics are contained.
Parameters:
sDescription - the description of the forum or null for no description

getTopicCount

public int getTopicCount()
Gets the number of topics associated with the forum. This number includes the topics directly under the forum.
Returns:
the number of topics (0 for none)

isMaximumTopicCount

public boolean isMaximumTopicCount()
Checks if the forum has reached the maximum topic count. This is only applicable if the maximum topic count is set and is non-zero.
Returns:
true if the forum has reached the maximum topic count; false otherwise
See Also:
getMaximumTopicCount()

hasMaximumTopicCount

public boolean hasMaximumTopicCount()
Checks if the forum has a maximum topic count set.
Returns:
true if maximum topic count is set; false otherwise

getMaximumTopicCount

public int getMaximumTopicCount()
Gets the maximum topic count, if set.
Returns:
the maximum topic count
See Also:
hasMaximumTopicCount()

setMaximumTopicCount

public void setMaximumTopicCount(int iMaximum)
Sets the maximum number of topics this forum can have. Once this limit is reached, no more topics are allowed.
Parameters:
iMaximum - the maximum number of topics ( < 0 for no maximum)

clearMaximumTopicCount

public void clearMaximumTopicCount()
Clears the maximum number of topics for this fourm.

getMessageCount

public int getMessageCount()
Gets the number of messages associated with the topics under this forum. The number of messages includes all messages directly under the associated topics and the sub-messages of those messages.
Returns:
the number of messages (0 for none)

getKeywords

public java.lang.String getKeywords()
Gets the keywords associated with this forum.
Returns:
the keywords associated with this forum or null for none
See Also:
setKeywords(String)

getMessages

public Messages getMessages()
Gets the messages associated with this forum.
Returns:
the list of messages

getTopics

public Topics getTopics()
Gets the topics associated with this forum.
Returns:
the list of topics

getAuthor

public java.lang.String getAuthor()
Gets the name of the author. The author is the name of the user who originally created this forum.
Returns:
the author name

hasExpiration

public boolean hasExpiration()
Checks if this forum has an expiration. After the expiration date, no more topics can be added to this forum.
Returns:
true if this forum has an expiration: false otherwise

getExpiration

public java.util.Date getExpiration()
Gets the expiration date of this forum, if on exists.
Returns:
the expiration date or null for none

setExpiration

public void setExpiration(java.util.Date expirationDate)
Sets the expiration date for this forum. After the expiration date, no more topics can be added to this forum.
Parameters:
expirationDate - the date the forum expires or null for no expiration date

clearExpiration

public void clearExpiration()
Clears the expiration date for this forum.

isExpired

public boolean isExpired()
Checks if this forum is expired. This would be the case if the forum had an expiration date which was passed.
Returns:
true if the forum is expired; false if forum has not expired or not expiration is set
See Also:
hasExpiration()

setKeywords

public void setKeywords(java.lang.String[] keywords)
Sets the keywords associated with this forum. Keywords represent meta-data to describe the forum which are not part of the forum subject or name. When searching for forums by keywords, this field is checked.

The specified array of keywords are converted into a space delimited String of keywords. Existing keywords (if any) are over-written by the specified keywords.

Parameters:
keywords - an array of keywords to associate with this forum (may not be null)
See Also:
setKeywords(String)

setKeywords

public void setKeywords(java.lang.String sKeywords)
Sets the keywords associated with this forum. Keywords represent meta-data to describe the forum which are not part of the forum subject or name. When searching for forums by keywords, this field is checked.

Existing keywords (if any) are over-written by the specified keywords.

Parameters:
sKeywords - the keywords to associate with this forum or null for none

getCustomNum1

public long getCustomNum1()
Gets the custom number1 field of the forum.
Returns:
the custom number1 field of the forum or null if the custom number1 field is not set

setCustomNum1

public void setCustomNum1(long lCustomNum1)
Sets the custom number1 field of the forum.
Parameters:
lCustomNum1 - the custom number1 field of the forum

getCustomNum2

public long getCustomNum2()
Gets the custom number2 field of the forum.
Returns:
the custom number2 field of the forum or null if the custom number2 field is not set

setCustomNum2

public void setCustomNum2(long lCustomNum2)
Sets the custom number2 field of the forum.
Parameters:
lCustomNum2 - the custom number2 field of the forum

getCustomNum3

public long getCustomNum3()
Gets the custom number3 field of the forum.
Returns:
the custom number3 field of the forum or null if the custom number3 field is not set

setCustomNum3

public void setCustomNum3(long lCustomNum3)
Sets the custom number3 field of the forum.
Parameters:
lCustomNum3 - the custom number3 field of the forum

getCustomNum4

public long getCustomNum4()
Gets the custom number4 field of the forum.
Returns:
the custom number4 field of the forum or null if the custom number4 field is not set

setCustomNum4

public void setCustomNum4(long lCustomNum4)
Sets the custom number4 field of the forum.
Parameters:
lCustomNum4 - the custom number4 field of the forum

getCustomStr1

public java.lang.String getCustomStr1()
Gets the custom string1 field of the forum.
Returns:
the custom string1 field of the forum or null if the custom string1 field is not set

setCustomStr1

public void setCustomStr1(java.lang.String sCustomStr1)
Sets the custom string1 field of the forum.
Parameters:
sCustomStr1 - the custom string1 field of the forum

getCustomStr2

public java.lang.String getCustomStr2()
Gets the custom string2 field of the forum.
Returns:
the custom string2 field of the forum or null if the custom string2 field is not set

setCustomStr2

public void setCustomStr2(java.lang.String sCustomStr2)
Sets the custom string2 field of the forum.
Parameters:
sCustomStr2 - the custom string2 field of the forum

getCustomStr3

public java.lang.String getCustomStr3()
Gets the custom string3 field of the forum.
Returns:
the custom string3 field of the forum or null if the custom string3 field is not set

setCustomStr3

public void setCustomStr3(java.lang.String sCustomStr3)
Sets the custom string3 field of the forum.
Parameters:
sCustomStr3 - the custom string3 field of the forum

getCustomStr4

public java.lang.String getCustomStr4()
Gets the custom string4 field of the forum.
Returns:
the custom string4 field of the forum or null if the custom string4 field is not set

setCustomStr4

public void setCustomStr4(java.lang.String sCustomStr4)
Sets the custom string4 field of the forum.
Parameters:
sCustomStr4 - the custom string4 field of the forum

getAccessManager

public AccessManager getAccessManager()
                               throws AccessManagerException
Gets the access manager for this forum. The access manager is used to modify the permissions.
Returns:
the access manager for this forum
Throws:
AccessManagerException - an error occurs retrieving the access manager
See Also:
DiscussionPermission

update

public boolean update()
               throws java.security.AccessControlException
Updates the forum (saves the forum entry). This method must be called to commit changes to the forum.
Returns:
true if the update is successful; false otherwise
Throws:
java.security.AccessControlException - occurs if the user does not have permission to edit the forum

update

public boolean update(boolean bForce)
               throws java.security.AccessControlException
Updates the forum (saves the forum entry). This method must be called to commit changes to the forum.
Parameters:
bForce - true to force the update; false otherwise (currently ignored)
Returns:
true if the update is successful; false otherwise
Throws:
java.security.AccessControlException - occurs if the user does not have permission to edit the forum

delete

public void delete()
            throws java.security.AccessControlException
Deletes the forum.
Throws:
java.security.AccessControlException - occurs if the user does not have permission to delete the forum

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one. The message id is used to determine equality.
Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare for eqaulity
Returns:
true if the objects are equals; falseotherwise

toString

public java.lang.String toString()
Returns a string representation of the object.
Overrides:
toString in class java.lang.Object
Returns:
the string representation of the object

Compoze Software, Inc.

Copyright ©1999-2003 Compoze Software, Inc. All rights reserved.