|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.domain.DomainObject
com.arsdigita.domain.ObservableDomainObject
com.arsdigita.kernel.ACSObject
com.arsdigita.messaging.Message
com.arsdigita.messaging.ThreadedMessage
Extends Message in a way that allows messages to be organized into discussion threads with a tree structure. A typical discussion might be organized as follows:
msg-0 msg-0.0 msg-0.1 msg-0.1.0 msg-0.1.1 msg-0.2 msg-1 msg-1.0 msg-2
where msg-0.0 and msg-0.1 are replies to msg-0, msg-0.1.0 is a reply to msg-0.1, and so forth. Messages at the first level (msg-0, msg-1, and msg-2) are referred to as "root" message, and higher-level messages contain a pointer to their common root. If a root message is deleted, all of its children are deleted.
A structure like the one shown above is created using the reply() method, which returns a new ThreadedMessage correctly initialized to represent a response to its parent. For example, you might generate a similar structure using:
msg0 = new Message(); // root message msg00 = msg0.reply(); // level 1 replies msg01 = msg0.reply(); msg010 = msg01.reply(); // level 2 replies (to msg01) msg011 = msg01.reply();
Replying to a message always generates a new message one level deeper in the tree. Successive replies to the same message generate the appropriate "next child" for that message.
Field Summary | |
static String |
BASE_DATA_OBJECT_TYPE
Base data object type. |
Fields inherited from class com.arsdigita.messaging.Message |
BODY, INREPLYTO, MESSAGE_ID, MESSAGE_PART, OBJECT_ID, REPLY_TO, SENDER, SENT, SUBJECT, TYPE |
Fields inherited from class com.arsdigita.kernel.ACSObject |
CONTAINER, DEFAULT_DOMAIN_CLASS, DISPLAY_NAME, ID, OBJECT_TYPE, versionId |
Fields inherited from interface com.arsdigita.util.MessageType |
TEXT_HTML, TEXT_PLAIN, TEXT_PREFORMATTED, TEXT_SMART |
Constructor Summary | |
ThreadedMessage()
Creates a new message with the sentDate initialized to the current time, but leaves all other parameters null. |
|
ThreadedMessage(BigDecimal id)
Creates a threaded message by retrieving it from the database using its id; |
|
ThreadedMessage(DataObject dataObject)
Creates a threaded message from its underlying data object. |
|
ThreadedMessage(OID oid)
Creates a threaded message by retrieving it from the database using its OID. |
|
ThreadedMessage(Party f,
String s)
Creates a threaded message from a party with a given subject. |
|
ThreadedMessage(Party from,
String subject,
String body)
Creates a threaded message from a party with a given subject and body. |
|
ThreadedMessage(String type)
Creates a threaded message from its underlying data type. |
Method Summary | |
protected void |
afterSave()
|
protected void |
beforeSave()
Saves the message after verifying that the root and sort key are valid. |
int |
getDepth()
Gets the depth of the message within a tree of messages. |
long |
getNumReplies()
Deprecated. use getThread().getNumReplies(); |
BigDecimal |
getRoot()
Gets the ID of the root message associated with this family of messages. |
ThreadedMessage |
getRootMsg()
|
SortKey |
getSortKey()
Gets the value of the sort key (possibly null). |
MessageThread |
getThread()
gets the MessageThread that this message belongs to |
ThreadedMessage |
newInstance()
|
ThreadedMessage |
replyTo()
Gets a new message that is suitable for a reply to this message. |
ThreadedMessage |
replyTo(Party from,
String body)
Gets a new message suitable for a reply to this message, with the given sender and message body. |
ThreadedMessage |
replyTo(ThreadedMessage reply)
|
void |
setRoot(BigDecimal root)
Deprecated. Use the replyTo() method instead of this method |
void |
setSortKey(SortKey key)
Sets the value of the sort key. |
Methods inherited from class com.arsdigita.messaging.Message |
attach, attach, attach, attach, doWriteCheck, generateHTMLText, getAttachmentCount, getAttachments, getBody, getBodyAsHTML, getBodyType, getContainer, getDisplayName, getFrom, getMessageID, getRefersTo, getReplyInfo, getReplyTo, getRFCMessageID, getSentDate, getSubject, isContainerModified, isMimeType, reply, setBody, setFrom, setRefersTo, setRefersTo, setReplyTo, setRFCMessageID, setSentDate, setSubject, setText |
Methods inherited from class com.arsdigita.kernel.ACSObject |
assertPrivilege, checkPrivilege, doCreateCheck, getBaseDataObjectType, getDefaultDomainClass, getID, getSpecificObjectType, getSpecificOID, gimmeContainer, initialize, setID, setID |
Methods inherited from class com.arsdigita.domain.ObservableDomainObject |
addObserver, getObservers |
Methods inherited from class com.arsdigita.domain.DomainObject |
add, add, addToAssociation, afterDelete, beforeDelete, clear, delete, disconnect, equals, get, getObjectType, getOID, getSession, hashCode, isDeleted, isDisconnected, isModified, isNew, isPropertyModified, isValid, remove, remove, remove, removeFromAssociation, save, set, setAssociation, setAssociation, specializeDataObject, specializeDataObject, toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String BASE_DATA_OBJECT_TYPE
Constructor Detail |
public ThreadedMessage()
public ThreadedMessage(Party f, String s)
f
- the party sending the messages
- the subject of the messagepublic ThreadedMessage(Party from, String subject, String body)
from
- the party sending the messagesubject
- the subject of the messagebody
- the plain-text body of the messagepublic ThreadedMessage(String type)
type
- the DataObject type.public ThreadedMessage(DataObject dataObject)
dataObject
- the DataObject representing this message.public ThreadedMessage(BigDecimal id) throws DataObjectNotFoundException
public ThreadedMessage(OID oid) throws DataObjectNotFoundException
oid
- the OID of the messageMethod Detail |
public ThreadedMessage newInstance()
public ThreadedMessage replyTo(Party from, String body)
from
- the Party sending the replybody
- the text/plain body of the replypublic ThreadedMessage replyTo()
For example, if root = 14 and sortKey = 04a, the new message will have root = 14 and sortKey = 04a000.
If this message already has many responses, the new sort key will be computed based on the maximum value of the current responses. Absolute uniqueness of sort keys is not guaranteed, but conflicts are highly unlikely.
public ThreadedMessage replyTo(ThreadedMessage reply)
public BigDecimal getRoot()
public ThreadedMessage getRootMsg()
public void setRoot(BigDecimal root)
UnsupportedOperationException
public SortKey getSortKey()
public void setSortKey(SortKey key)
key
- is the sort key for this messagepublic int getDepth()
public long getNumReplies()
public MessageThread getThread()
protected void beforeSave()
beforeSave
in class ACSObject
protected void afterSave()
afterSave
in class Message
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |