|
|||||||||
| Home >> All >> com >> RuntimeCollective >> bboard >> [ bean overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.RuntimeCollective.bboard.bean
Class SimpleTopic

java.lang.Objectcom.RuntimeCollective.content.bean.SimpleContent
com.RuntimeCollective.content.bean.TextComponent
com.RuntimeCollective.bboard.bean.SimpleTopic
- All Implemented Interfaces:
- java.lang.Cloneable, com.RuntimeCollective.content.bean.Content, com.RuntimeCollective.webapps.bean.Duplicable, com.RuntimeCollective.webapps.bean.EntityBean, com.RuntimeCollective.webapps.bean.PermissionBean, com.RuntimeCollective.search.bean.Searchable, java.io.Serializable, Topic
- public class SimpleTopic
- extends com.RuntimeCollective.content.bean.TextComponent
- implements Topic, com.RuntimeCollective.search.bean.Searchable, java.lang.Cloneable
- extends com.RuntimeCollective.content.bean.TextComponent
The Topic class is TextComponent attached to a Board, and to which are assigned many Messages.
- Version:
- $Id: SimpleTopic.java,v 1.31 2003/10/06 17:10:04 joe Exp $
| 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 | |
SimpleTopic()
Construct a new blank Topic, giving it a new unique ID. |
|
SimpleTopic(int id)
Get a Topic from the RuntimeDataSource, given an id. |
|
| Method Summary | |
void |
addMessage(Message message)
Add a message to this topic. |
void |
archive()
Archive this topic from the database. |
boolean |
canEdit(com.RuntimeCollective.webapps.bean.User user)
Can this user edit this bean. |
boolean |
canView(com.RuntimeCollective.webapps.bean.User user)
Can this user view this bean. |
java.lang.Object |
clone()
This method may be called to create a new copy of the Object. |
java.lang.Object |
clone(Board board)
|
void |
delete()
Delete this Topic from the database. |
java.lang.String |
getAllMessageText()
Return all the messages text, concatenated together. |
Board |
getBoard()
Get 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. |
java.util.Collection |
getFields()
Get a Collection of Strings, for every Field that can be searched for on this object. |
java.lang.String |
getFlag()
Get a string identifying a flag to be shown next to the topic. |
java.util.Iterator |
getIndexedMessages()
Get all the Messages for this Topic, with their positions |
java.util.Date |
getLastMessageDate()
Get the date of the last message added to this topic, or null if there are no messages. |
java.util.Date |
getLastMessageDateCached()
Get the date of the last message added to this topic, or null if there are no messages. |
java.util.Date |
getLastUpdate()
Returns last update time, either the time of the last message, or the creation time of this topic |
java.lang.String |
getLink()
Get a link that will display this object (ok, so this is a bit of a hack - there must be a better way, possibly with forwards) |
com.RuntimeCollective.bboard.MessageList |
getMessageList()
Get the message list for this topic. |
java.util.Iterator |
getMessages()
Get all the Messages for this Topic |
java.lang.Object[] |
getMessagesInfo()
Return an array of Objects that provide metadata about this Topic's messages. |
int |
getNumMessages()
Get the number of messages added to this topic. |
boolean |
getOpen()
Get whether this topic is currently accepting new messages. |
java.util.Date |
getReadDate(com.RuntimeCollective.webapps.bean.User user)
Get the date that this topic was last read by this user, or null if it has never been read. |
java.lang.String |
getSearchSummary()
Get a short, one paragraph summary for this searchable object. |
java.lang.String |
getSearchText()
Get all text for this object that will be searched on. |
java.lang.String |
getSearchTitle()
Get a one-line title for this searchable object. |
boolean |
hasUnread(com.RuntimeCollective.webapps.bean.User user)
Whether this topic contains any messages that this user has not read. |
com.RuntimeCollective.search.bean.Searchable[] |
populateIndex()
Return a Searchable[] of all Topics that need to be added to the search index. |
void |
removeMessage(Message message)
Remove a message from this topic. |
void |
save()
Save this Topic to the database. |
void |
setBoard(Board board)
Set the Board |
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 |
setFirstMessage(Message message)
Set the first message of this topic. |
void |
setFlag(java.lang.String flag)
Set a string identifying a flag to be shown next to the topic. |
void |
setLastMessageDate(java.util.Date lastMessageDate)
Set the date of the last message added to this topic; in fact sets the lastModifiedDate. |
void |
setOpen(boolean open)
Set whether this topic is currently accepting new messages. |
void |
setReadDate(com.RuntimeCollective.webapps.bean.User user)
Record that this topic has been read by this user. |
| 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 |
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 |
DELETE_FROM
public static final java.lang.String DELETE_FROM
- See Also:
- Constant Field Values
WHERE_ID
public static final java.lang.String WHERE_ID
- See Also:
- Constant Field Values
UPDATE
public static final java.lang.String UPDATE
- See Also:
- Constant Field Values
SET_ARCHIVE_DATE
public static final java.lang.String SET_ARCHIVE_DATE
- See Also:
- Constant Field Values
QUOTE
public static final java.lang.String QUOTE
- See Also:
- Constant Field Values
SELECT_M_ID_FROM
public static final java.lang.String SELECT_M_ID_FROM
- See Also:
- Constant Field Values
M_COMMA
public static final java.lang.String M_COMMA
- See Also:
- Constant Field Values
C_WHERE_M_TOPIC
public static final java.lang.String C_WHERE_M_TOPIC
- See Also:
- Constant Field Values
AND_IDS_ORDER_CDATE
public static final java.lang.String AND_IDS_ORDER_CDATE
- See Also:
- Constant Field Values
SELECT_FIELDS_FROM
public static final java.lang.String SELECT_FIELDS_FROM
- See Also:
- Constant Field Values
T_WHERE_T_ID
public static final java.lang.String T_WHERE_T_ID
- See Also:
- Constant Field Values
DELETE_USER_READS_WHERE_USER_ID
public static final java.lang.String DELETE_USER_READS_WHERE_USER_ID
- See Also:
- Constant Field Values
AND_TOPIC
public static final java.lang.String AND_TOPIC
- See Also:
- Constant Field Values
INSERT_INTO_USER_READS_VALUES
public static final java.lang.String INSERT_INTO_USER_READS_VALUES
- See Also:
- Constant Field Values
END_PAR
public static final java.lang.String END_PAR
- See Also:
- Constant Field Values
COMMA
public static final java.lang.String COMMA
- See Also:
- Constant Field Values
SELECT_READ_DATE_WHERE_USER
public static final java.lang.String SELECT_READ_DATE_WHERE_USER
- See Also:
- Constant Field Values
QUERY_LAST_MESSAGE_DATE
public static final java.lang.String QUERY_LAST_MESSAGE_DATE
- See Also:
- Constant Field Values
QUERY_NUM_MESSAGES
public static final java.lang.String QUERY_NUM_MESSAGES
- See Also:
- Constant Field Values
QUERY_MESSAGES_INFO
public static final java.lang.String QUERY_MESSAGES_INFO
- See Also:
- Constant Field Values
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
BoardId
protected int BoardId
- The Board
Flag
protected java.lang.String Flag
- A string identifying a flag to be shown next to the topic.
Open
protected boolean Open
- Whether this topic is currently accepting new messages.
lastMessageDateCached
public java.util.Date lastMessageDateCached
- A cache of the last result of getLastMessageDate().
readDates
private java.util.HashMap readDates
- A cache recording when this topic was read by this user.
searchCategory
public static java.lang.String searchCategory
- The category, or section name, to "file" this object under in the search index.
VIEW_TOPIC_PATH_PARAM
protected static final java.lang.String VIEW_TOPIC_PATH_PARAM
- See Also:
- Constant Field Values
DEFAULT_VIEW_TOPIC_PATH
protected static final java.lang.String DEFAULT_VIEW_TOPIC_PATH
- See Also:
- Constant Field Values
VIEW_TOPIC_PATH
protected static java.lang.String VIEW_TOPIC_PATH
| Constructor Detail |
SimpleTopic
public SimpleTopic()
throws java.sql.SQLException
- Construct a new blank Topic, giving it a new unique ID.
SimpleTopic
public SimpleTopic(int id)
throws java.sql.SQLException
- Get a Topic from the RuntimeDataSource, given an id.
| Method Detail |
save
public void save()
throws java.sql.SQLException
- Save this Topic to the database.
- Specified by:
savein interfacecom.RuntimeCollective.webapps.bean.EntityBean
delete
public void delete()
throws java.sql.SQLException
- Delete this Topic from the database.
- Specified by:
deletein interfacecom.RuntimeCollective.webapps.bean.EntityBean
archive
public void archive()
throws java.sql.SQLException
- Archive this topic from the database.
This sets the archive date of the topic.
setBoard
public void setBoard(Board board)
getBoard
public Board getBoard()
getFlag
public java.lang.String getFlag()
- Get a string identifying a flag to be shown next to the topic.
setFlag
public void setFlag(java.lang.String flag)
- Set a string identifying a flag to be shown next to the topic.
getOpen
public boolean getOpen()
setOpen
public void setOpen(boolean open)
getNumMessages
public int getNumMessages()
- Get the number of messages added to this topic.
- Specified by:
getNumMessagesin interfaceTopic
getLastMessageDate
public java.util.Date getLastMessageDate()
- Get the date of the last message added to this topic,
or null if there are no messages.
This queries the db every time.
- Specified by:
getLastMessageDatein interfaceTopic
setLastMessageDate
public void setLastMessageDate(java.util.Date lastMessageDate)
- Set the date of the last message added to this topic;
in fact sets the lastModifiedDate.
- Specified by:
setLastMessageDatein interfaceTopic
getLastMessageDateCached
public java.util.Date getLastMessageDateCached()
- Get the date of the last message added to this topic,
or null if there are no messages.
This returns the last value returned by getLastMessageDate().
getMessagesInfo
public java.lang.Object[] getMessagesInfo()
- Return an array of Objects that provide metadata about this Topic's
messages. Element 0 will be lastMessageDate. Element 1 will be
numMessages.
This method could merely return:
new Object[]{getLastMessageDate(), new Integer(getNumMessages())}or could perform a single db query for efficiency.- Specified by:
getMessagesInfoin interfaceTopic
getMessageList
public com.RuntimeCollective.bboard.MessageList getMessageList()
- Get the message list for this topic.
- Specified by:
getMessageListin interfaceTopic
addMessage
public void addMessage(Message message)
- Add a message to this topic.
- Specified by:
addMessagein interfaceTopic
removeMessage
public void removeMessage(Message message)
- Remove a message from this topic. This also removes the message from the relevant MessageList.
- Specified by:
removeMessagein interfaceTopic
getIndexedMessages
public java.util.Iterator getIndexedMessages()
- Get all the Messages for this Topic, with their positions
getMessages
public java.util.Iterator getMessages()
- Get all the Messages for this Topic
canEdit
public boolean canEdit(com.RuntimeCollective.webapps.bean.User user)
- Can this user edit this bean.
Defaults to inheriting the value of canView for the board that this topic is part of, but subclasses can implement a more sophisticated permissions model.
- Specified by:
canEditin interfacecom.RuntimeCollective.webapps.bean.PermissionBean
canView
public boolean canView(com.RuntimeCollective.webapps.bean.User user)
- Can this user view this bean.
Defaults to inheriting the value of canEdit for the board that this topic is part of, but subclasses can implement a more sophisticated permissions model.
Note This also sets the
readDatefor this user.- Specified by:
canViewin interfacecom.RuntimeCollective.webapps.bean.PermissionBean
setDescription
public void setDescription(java.lang.String description)
- Set the description: set the text in fact.
- Specified by:
setDescriptionin interfacecom.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:
setDescriptionin interfaceTopic
getDescription
public java.lang.String getDescription()
- Get the description: get the text in fact.
- Specified by:
getDescriptionin interfacecom.RuntimeCollective.content.bean.Content
getDescription
public java.lang.String getDescription(java.lang.String format)
- Get the description under a given format.
- Specified by:
getDescriptionin interfaceTopic
hasUnread
public boolean hasUnread(com.RuntimeCollective.webapps.bean.User user)
- Whether this topic contains any messages that this user has not read.
setReadDate
public void setReadDate(com.RuntimeCollective.webapps.bean.User user)
- Record that this topic has been read by this user.
- Specified by:
setReadDatein interfaceTopic
getReadDate
public java.util.Date getReadDate(com.RuntimeCollective.webapps.bean.User user)
- Get the date that this topic was last read by this user, or null if it has never been read.
- Specified by:
getReadDatein interfaceTopic
setFirstMessage
public void setFirstMessage(Message message)
- 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). The description is set to the first 80 chars of the content of the first message.
- Specified by:
setFirstMessagein interfaceTopic
getSearchTitle
public java.lang.String getSearchTitle()
- Get a one-line title for this searchable object.
- Specified by:
getSearchTitlein interfacecom.RuntimeCollective.search.bean.Searchable
getSearchSummary
public java.lang.String getSearchSummary()
- Get a short, one paragraph summary for this searchable object.
- Specified by:
getSearchSummaryin interfacecom.RuntimeCollective.search.bean.Searchable
getSearchText
public java.lang.String getSearchText()
- Get all text for this object that will be searched on.
- Specified by:
getSearchTextin interfacecom.RuntimeCollective.search.bean.Searchable
getFields
public java.util.Collection getFields()
- Get a Collection of Strings, for every Field that can be searched for on this object.
For ContentSiteLocation, these are:
- Title
- Text
- AllMessageText
- Specified by:
getFieldsin interfacecom.RuntimeCollective.search.bean.Searchable
getLink
public java.lang.String getLink()
- Get a link that will display this object
(ok, so this is a bit of a hack - there must be a better way, possibly with forwards)
- Specified by:
getLinkin interfacecom.RuntimeCollective.search.bean.Searchable
populateIndex
public com.RuntimeCollective.search.bean.Searchable[] populateIndex() throws com.RuntimeCollective.search.SearchException
- Return a Searchable[] of all Topics that need to be added to the search index.
Populate the search index with all instances of this class that should be searchable.
Assumes an empty index?
This will run through all Topics, adding each one that
returns
truefor getOpen().- Specified by:
populateIndexin interfacecom.RuntimeCollective.search.bean.Searchable
getAllMessageText
public java.lang.String getAllMessageText()
- Return all the messages text, concatenated together.
Only really useful for advanced search.
getLastUpdate
public java.util.Date getLastUpdate()
- Returns last update time, either the time of the last message, or the creation time of this topic
clone
public java.lang.Object clone()
- Description copied from class:
java.lang.Object - This method may be called to create a new copy of the
Object. The typical behavior is as follows:
o == o.clone()is falseo.getClass() == o.clone().getClass()is trueo.equals(o)is true
However, these are not strict requirements, and may be violated if necessary. Of the three requirements, the last is the most commonly violated, particularly if the subclass does not override Object.equals(Object)>
Object.equals(Object)55 .If the Object you call clone() on does not implement java.lang.Cloneable (which is a placeholder interface), then a CloneNotSupportedException is thrown. Notice that Object does not implement Cloneable; this method exists as a convenience for subclasses that do.
Object's implementation of clone allocates space for the new Object using the correct class, without calling any constructors, and then fills in all of the new field values with the old field values. Thus, it is a shallow copy. However, subclasses are permitted to make a deep copy.
All array types implement Cloneable, and override this method as follows (it should never fail):
public Object clone() { try { super.clone(); } catch (CloneNotSupportedException e) { throw new InternalError(e.getMessage()); } }
clone
public java.lang.Object clone(Board board)
|
|||||||||
| Home >> All >> com >> RuntimeCollective >> bboard >> [ bean overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC