Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.RuntimeCollective.bboard.bean
Class SimpleBoard  view SimpleBoard download SimpleBoard.java

java.lang.Object
  extended bycom.RuntimeCollective.content.bean.SimpleContent
      extended bycom.RuntimeCollective.content.bean.TextComponent
          extended bycom.RuntimeCollective.bboard.bean.SimpleBoard
All Implemented Interfaces:
Board, com.RuntimeCollective.content.bean.Content, com.RuntimeCollective.webapps.bean.Duplicable, com.RuntimeCollective.webapps.bean.EntityBean, com.RuntimeCollective.webapps.bean.PermissionBean, java.io.Serializable
Direct Known Subclasses:
PermissibleBoard, SimpleBlog, SimpleFaq

public class SimpleBoard
extends com.RuntimeCollective.content.bean.TextComponent
implements Board

The Board class is a Content with a list of Topics.

Version:
$Id: SimpleBoard.java,v 1.34 2003/10/03 14:47:35 criss Exp $

Field Summary
static java.lang.String DATABASE_TABLE
          The name of the database table for this bean type.
static java.lang.String INTERFACE_BEAN
          The name of the interface that this bean implements, and which may be used to key this bean on the session.
static java.lang.String LIVE_ORDER
           
protected  boolean Open
          Whether this board is currently accepting new topics.
private static java.lang.String QUERY_LAST_MESSAGE_DATE
           
private static java.lang.String QUERY_LAST_TOPIC_DATE
           
private static java.lang.String QUERY_NUM_TOPICS
           
private static java.lang.String QUERY_TOPICS_BY_MESSAGE_DATE_1
           
private static java.lang.String QUERY_TOPICS_BY_MESSAGE_DATE_2
           
static java.lang.String SELECT_ID
           
static java.lang.String T_COMMA
           
static java.lang.String WHERE_BOARD
           
 
Fields inherited from class com.RuntimeCollective.content.bean.TextComponent
Format, MAX_DESCRIPTION_LENGTH, Text, Title
 
Fields inherited from class com.RuntimeCollective.content.bean.SimpleContent
Author_id, CreationDate, id, LastModifiedDate, LastModifierUser_id
 
Fields inherited from interface com.RuntimeCollective.webapps.bean.EntityBean
NULL_ID
 
Constructor Summary
SimpleBoard()
          Construct a new blank Board, giving it a new unique ID.
SimpleBoard(int id)
          Get a Board from the RuntimeDataSource, given an id.
 
Method Summary
 void addTopic(Topic topic)
          Add a topic to this board.
 void approveAll()
          Approve all the topics and messages in that Board (only relevent if you are using moderation).
 void archive()
          Archive this board from the database.
 boolean canEdit(com.RuntimeCollective.webapps.bean.User user)
          Whether this user can edit this board.
 boolean canView(com.RuntimeCollective.webapps.bean.User user)
          Whether this user can view this board.
 void delete()
          Delete this Board from the database.
protected  void deleteTopics()
          Delete all topics associated with the board.
 java.lang.String getDescription()
          Get the description: get the text in fact.
 java.lang.String getDescription(java.lang.String format)
          Get the description under a given format.
 Faq getFaq()
          Get the FAQ for this board.
 java.util.Iterator getIndexedTopics()
          Get all the Topics for this Board, with their positions.
 java.util.Date getLastUpdated()
          Get the last-updated date for the BBoard.
 int getNumTopics()
          Get the number of topics the BBoard has.
 boolean getOpen()
          Get whether this board is currently accepting new topics.
 com.RuntimeCollective.bboard.TopicList getTopicList()
          Get the list of topics for this board.
 com.RuntimeCollective.bboard.TopicList getTopicListByMessageDate()
          Get the list of topics for this board, ordered by message date (most recent first).
 java.util.Iterator getTopics()
          Get all the Topics for this Board, ordered by most recent message first
 boolean hasUnread(com.RuntimeCollective.webapps.bean.User user)
          Whether this board contains any topics that contain any messages that have not been read by this user.
 void removeTopic(Topic topic)
          Remove a topic from this board.
 void save()
          Save this Board to the database.
 void setDescription(java.lang.String description)
          Set the description: set the text in fact.
 void setDescription(java.lang.String description, java.lang.String format)
          Set the description under a given format.
 void setOpen(boolean open)
          Set whether this board is currently accepting new topics.
 
Methods inherited from class com.RuntimeCollective.content.bean.TextComponent
getFormat, getText, getTitle, setFormat, setText, setTextAsHtml, setTitle, viewFormat
 
Methods inherited from class com.RuntimeCollective.content.bean.SimpleContent
customiseDuplicate, getAuthor, getCreationDate, getId, getLastModifiedDate, getLastModifierUser, makeDuplicate, makeDuplicate, setAuthor, setCreationDate, setId, setLastModifiedDate, setLastModifierUser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.RuntimeCollective.content.bean.Content
getAuthor, getCreationDate, getLastModifiedDate, getLastModifierUser, getTitle, setAuthor, setCreationDate, setLastModifiedDate, setLastModifierUser, setTitle, viewFormat
 
Methods inherited from interface com.RuntimeCollective.webapps.bean.EntityBean
getId, setId
 
Methods inherited from interface com.RuntimeCollective.webapps.bean.Duplicable
customiseDuplicate, makeDuplicate, makeDuplicate
 

Field Detail

DATABASE_TABLE

public static final java.lang.String DATABASE_TABLE
The name of the database table for this bean type.

See Also:
Constant Field Values

INTERFACE_BEAN

public static final java.lang.String INTERFACE_BEAN
The name of the interface that this bean implements, and which may be used to key this bean on the session.

See Also:
Constant Field Values

Open

protected boolean Open
Whether this board is currently accepting new topics. Defaults to true.


SELECT_ID

public static java.lang.String SELECT_ID

T_COMMA

public static java.lang.String T_COMMA

WHERE_BOARD

public static java.lang.String WHERE_BOARD

LIVE_ORDER

public static java.lang.String LIVE_ORDER

QUERY_LAST_MESSAGE_DATE

private static final java.lang.String QUERY_LAST_MESSAGE_DATE
See Also:
Constant Field Values

QUERY_LAST_TOPIC_DATE

private static final java.lang.String QUERY_LAST_TOPIC_DATE
See Also:
Constant Field Values

QUERY_NUM_TOPICS

private static final java.lang.String QUERY_NUM_TOPICS
See Also:
Constant Field Values

QUERY_TOPICS_BY_MESSAGE_DATE_1

private static final java.lang.String QUERY_TOPICS_BY_MESSAGE_DATE_1
See Also:
Constant Field Values

QUERY_TOPICS_BY_MESSAGE_DATE_2

private static final java.lang.String QUERY_TOPICS_BY_MESSAGE_DATE_2
See Also:
Constant Field Values
Constructor Detail

SimpleBoard

public SimpleBoard()
            throws java.sql.SQLException
Construct a new blank Board, giving it a new unique ID.


SimpleBoard

public SimpleBoard(int id)
            throws java.sql.SQLException
Get a Board from the RuntimeDataSource, given an id.

Method Detail

save

public void save()
          throws java.sql.SQLException
Save this Board to the database.

Specified by:
save in interface com.RuntimeCollective.webapps.bean.EntityBean

deleteTopics

protected void deleteTopics()
                     throws java.sql.SQLException
Delete all topics associated with the board. Used by the delete() method.

Subclasses of SimpleBoard may also cause this method before removing data from their own tables, to prevent the EBS from failing to instantiate the bean when deleting topics.


delete

public void delete()
            throws java.sql.SQLException
Delete this Board from the database.

Specified by:
delete in interface com.RuntimeCollective.webapps.bean.EntityBean

archive

public void archive()
             throws java.sql.SQLException
Archive this board from the database. This sets the archive date of the board.


canEdit

public boolean canEdit(com.RuntimeCollective.webapps.bean.User user)
Whether this user can edit this board. Defaults to 'true' -- more sophisticated permissions systems should be handled by subclasses

Specified by:
canEdit in interface com.RuntimeCollective.webapps.bean.PermissionBean

canView

public boolean canView(com.RuntimeCollective.webapps.bean.User user)
Whether this user can view this board. Defaults to 'true' -- more sophisticated permissions systems should be handled by subclasses

Specified by:
canView in interface com.RuntimeCollective.webapps.bean.PermissionBean

getOpen

public boolean getOpen()
Get whether this board is currently accepting new topics. Defaults to true.

Specified by:
getOpen in interface Board

setOpen

public void setOpen(boolean open)
Set whether this board is currently accepting new topics. If we are closing this board then this will also close all the topics associated with this board.

Specified by:
setOpen in interface Board

getTopicList

public com.RuntimeCollective.bboard.TopicList getTopicList()
Get the list of topics for this board. This orders topics according to create date.

Specified by:
getTopicList in interface Board

getTopicListByMessageDate

public com.RuntimeCollective.bboard.TopicList getTopicListByMessageDate()
Get the list of topics for this board, ordered by message date (most recent first).

Specified by:
getTopicListByMessageDate in interface Board

addTopic

public void addTopic(Topic topic)
Add a topic to this board.

Specified by:
addTopic in interface Board

removeTopic

public void removeTopic(Topic topic)
Remove a topic from this board. This removes the topic from the relevant TopicList.

Specified by:
removeTopic in interface Board

getIndexedTopics

public java.util.Iterator getIndexedTopics()
Get all the Topics for this Board, with their positions.

WARNING: This does NOT implement lazy-loading; all Topics will be instantiated.

Specified by:
getIndexedTopics in interface Board

getTopics

public java.util.Iterator getTopics()
Get all the Topics for this Board, ordered by most recent message first

Specified by:
getTopics in interface Board

setDescription

public void setDescription(java.lang.String description)
Set the description: set the text in fact.

Specified by:
setDescription in interface com.RuntimeCollective.content.bean.Content

setDescription

public void setDescription(java.lang.String description,
                           java.lang.String format)
Set the description under a given format.

Specified by:
setDescription in interface Board

getDescription

public java.lang.String getDescription()
Get the description: get the text in fact.

Specified by:
getDescription in interface com.RuntimeCollective.content.bean.Content

getDescription

public java.lang.String getDescription(java.lang.String format)
Get the description under a given format.

Specified by:
getDescription in interface Board

hasUnread

public boolean hasUnread(com.RuntimeCollective.webapps.bean.User user)
Whether this board contains any topics that contain any messages that have not been read by this user.

Specified by:
hasUnread in interface Board

getFaq

public Faq getFaq()
Get the FAQ for this board. If none is defined, then a new one is created.

Specified by:
getFaq in interface Board

getLastUpdated

public java.util.Date getLastUpdated()
Get the last-updated date for the BBoard.

Returns the date of the most recently-posted message, or if there are no messages posted, returns the date of most recently-added topic. Or returns null if there are no topics.

(takes no account of archived/open status)


getNumTopics

public int getNumTopics()
Get the number of topics the BBoard has.

(takes no account of archived/open status)


approveAll

public void approveAll()
Approve all the topics and messages in that Board (only relevent if you are using moderation).

Specified by:
approveAll in interface Board