Compoze Software, Inc.

com.compoze.discussion
Class DiscussionSession

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

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

This class provides a session for managing discussion information, and is the entry point into the Discussion API. It collects together properties used by the Discussion API and is not subclassed.

An instance of the DiscussionSession can be obtained by calling getSession() with an authenticated user. Once a session is obtained, there are several entry points into the rest of the API. If you wish to begin manipulating forums, you should use the getForums() method to get the forums collection. Alternatively, if you already have the ID of the forum, topic, or message that you wish to retrieve you may use the getForum(long), getTopic(long) or getMessage(long).

See Also:
Serialized Form

Method Summary
 void close()
          Closes this session
protected  void finalize()
          Finalize.
 Forum getForum(long lForumID)
          Gets a forum with the given forum id.
 Forums getForums()
          Gets the forums collection to all of the forums the authenticated user has DiscussionPermission.READ permission.
 int getMaxmiumMessageAttachmentSize()
          Gets the maximum message file attachment size (in bytes).
 int getMaxmiumTopicAttachmentSize()
          Gets the maximum topic file attachment size (in bytes).
 Message getMessage(long lMessageID)
          Gets a message with the given message id.
 Messages getMessages()
          Gets the messages collection to all of the messages the authenticated user has DiscussionPermission.READ permission.
static DiscussionSession getSession(User user)
          Gets the discussion session using the specified user.
 Topic getTopic(long lTopicID)
          Gets a topic with the given topic id.
 Topics getTopics()
          Gets the topics collection to all of the topics the authenticated user has DiscussionPermission.READ permission.
 User getUser()
          Gets the authenticated user for this session.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getSession

public static DiscussionSession getSession(User user)
Gets the discussion session using the specified user.
Parameters:
user - the authenticated user
Returns:
the new discussion session

getForums

public Forums getForums()
Gets the forums collection to all of the forums the authenticated user has DiscussionPermission.READ permission.
Returns:
the forums collection

getTopics

public Topics getTopics()
Gets the topics collection to all of the topics the authenticated user has DiscussionPermission.READ permission.

This topics collection is not associated with any forum therefore, new topics can not be added using Topics.add(String). If an attempt is made to add a topic to this collection, an exception is thrown. To add a topic, the topics collection must be obtained from a forum.

Returns:
the topics collection
See Also:
Forum.getTopics()

getMessages

public Messages getMessages()
Gets the messages collection to all of the messages the authenticated user has DiscussionPermission.READ permission.

This messages collection is not associated with any topic or parent message therefore, new messages can not be added using Messages.add(String). If an attempt is made to add a message to this collection, an exception is thrown. To add a message, the messages collection must be obtained from a topic or message.

Returns:
the messages collection
See Also:
Topic.getMessages(), Message.getMessages()

getMessage

public Message getMessage(long lMessageID)
                   throws java.security.AccessControlException
Gets a message with the given message id.
Parameters:
lMessageID - the message id
Returns:
the message or null if not found
Throws:
java.security.AccessControlException - if the authenticated user is not allowed to read the message

getTopic

public Topic getTopic(long lTopicID)
               throws java.security.AccessControlException
Gets a topic with the given topic id.
Parameters:
id - the topic id
Returns:
the topic or null if not found
Throws:
java.security.AccessControlException - if the authenticated user is not allowed to read the topic

getForum

public Forum getForum(long lForumID)
               throws java.security.AccessControlException
Gets a forum with the given forum id.
Parameters:
lForumID - the forum id
Returns:
the forum or null if not found
Throws:
java.security.AccessControlException - if the authenticated user is not allowed to read the forum

getUser

public User getUser()
Gets the authenticated user for this session.
Returns:
the authenticated user

getMaxmiumTopicAttachmentSize

public int getMaxmiumTopicAttachmentSize()
Gets the maximum topic file attachment size (in bytes). This value is configurable in discussion.properties using the topics.maxfilesize property.
Returns:
the maximum topic file attachment size (in bytes)

getMaxmiumMessageAttachmentSize

public int getMaxmiumMessageAttachmentSize()
Gets the maximum message file attachment size (in bytes). This value is configurable in discussion.properties using the messages.maxfilesize property.
Returns:
the maximum message file attachment size (in bytes)

close

public void close()
Closes this session

finalize

protected void finalize()
                 throws java.lang.Throwable
Finalize. This method calls close.
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable - if an error occurred during finalization

toString

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

Compoze Software, Inc.

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