Source code: com/RuntimeCollective/bboard/bean/Topic.java
1 /* $Header: /home/CVS/rjp/src/com/RuntimeCollective/bboard/bean/Topic.java,v 1.10 2003/09/30 15:12:43 joe Exp $
2 * $Revision: 1.10 $
3 * $Date: 2003/09/30 15:12:43 $
4 *
5 * ====================================================================
6 *
7 * Josephine : http://www.runtime-collective.com/josephine/index.html
8 *
9 * Copyright (C) 2003 Runtime Collective
10 *
11 * This product includes software developed by the
12 * Apache Software Foundation (http://www.apache.org/).
13 *
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 *
28 */
29
30 package com.RuntimeCollective.bboard.bean;
31
32 import com.RuntimeCollective.bboard.MessageList;
33 import com.RuntimeCollective.content.bean.Content;
34 import com.RuntimeCollective.webapps.bean.PermissionBean;
35 import com.RuntimeCollective.webapps.bean.User;
36
37 import java.sql.SQLException;
38 import java.util.Date;
39
40 /**
41 * An interface defining a topic within a bulletin board.
42 * The details of this topic (title, author, flag, etc) are usually taken from the details
43 * of the first message in it -- though this can be determined by a concrete implementation.
44 * <p>
45 * If you want to be spared the hassle of writing JSPs for the creation of your Topic objects,
46 * do have a look at the pages written for the Sussex Enterprise project. You can find them by
47 * checking out the relevent project: "cvs co rsework", then look in rsework/web and in rsework/web/admin.
48 * <p>
49 * The pages are called add/edit/delete(Board)TopicXXX.jsp. They should be pretty self-explanatory.
50 * The rsework/struts-config.xml file is also worth checking, for the action mappings etc.
51 * <p>
52 * And while you're at it, why not vanilla them and copy them to bboard/web/admin ...
53 * <p>
54 * You can also check the Sussex Enterprise staging server (ask Fabrice, JoeH or Sophie).
55 *
56 * @version $Id: Topic.java,v 1.10 2003/09/30 15:12:43 joe Exp $
57 * @see com.RuntimeCollective.bboard.bean.Board
58 * @see com.RuntimeCollective.bboard.bean.Message
59 * @see com.RuntimeCollective.bboard.TopicList
60 */
61 public interface Topic extends Content, PermissionBean {
62
63 /** The name of the database table for this bean type. */
64 public static final String DATABASE_TABLE = "bboard_topic";
65
66 /** Get the bulletin board that this topic is part of. */
67 public Board getBoard();
68 /** Set the bulletin board that this topic is part of. */
69 public void setBoard(Board board);
70
71 /** Get a string identifying a flag to be shown next to the topic. */
72 public String getFlag();
73 /** Set a string identifying a flag to be shown next to the topic. */
74 public void setFlag(String flag);
75
76 /** Get the number of messages that belong to this topic. */
77 public int getNumMessages();
78
79 /** Return an array of Objects that provide metadata about this Topic's
80 * messages. Element 0 will be lastMessageDate. Element 1 will be
81 * numMessages. <p>
82 *
83 * This method could merely return:
84 * <pre>new Object[]{getLastMessageDate(), new Integer(getNumMessages())}</pre>
85 * or could perform a single db query for efficiency.*/
86 public Object[] getMessagesInfo();
87
88 /** Get the date the last message was added to this topic. */
89 public Date getLastMessageDate();
90 /** Set the date the last message was added to this topic. */
91 public void setLastMessageDate(Date lastMessageDate);
92
93 /** Get whether this topic is currently accepting new topics. */
94 public boolean getOpen();
95 /** Set whether this topic is currently accepting new topics. */
96 public void setOpen(boolean open);
97
98 // == Other Methods ===================================================
99
100 /** Set the description under a given format. */
101 public void setDescription(String description, String format);
102
103 /** Get the description under a given format. */
104 public String getDescription(String format);
105
106 /** Get the message list for this topic. */
107 public MessageList getMessageList();
108
109 /** Add a message to this topic. This also adds the message to the relevant MessageList. */
110 public void addMessage( Message message );
111
112 /** Remove a message from this topic. This also removes the message from the relevant MessageList. */
113 public void removeMessage( Message message );
114
115 /** Whether this topic contains any messages that this user has not read. */
116 public boolean hasUnread( User user );
117
118 /** Record that this topic has been read by this user. */
119 public void setReadDate( User user );
120
121 /** Get the date that this topic was last read by this user. */
122 public Date getReadDate( User user );
123
124 /** Set the first message of this topic. This adds the message to the message list for this topic and sets the relevant topic details (author, title, flag, createDate etc). */
125 public void setFirstMessage( Message message );
126 }
127
128
129
130
131