org.sakaiproject.component.legacy.discussion
Class BaseDiscussionService.BaseDiscussionMessageEdit

java.lang.Object
  extended byorg.sakaiproject.component.legacy.message.BaseMessageService.BaseMessageEdit
      extended byorg.sakaiproject.component.legacy.discussion.BaseDiscussionService.BaseDiscussionMessageEdit
All Implemented Interfaces:
Comparable, DiscussionMessage, DiscussionMessageEdit, Edit, Entity, EventListener, Message, MessageEdit, SessionBindingListener
Enclosing class:
BaseDiscussionService

public class BaseDiscussionService.BaseDiscussionMessageEdit
extends BaseMessageService.BaseMessageEdit
implements DiscussionMessageEdit

DiscussionMessage implementation


Field Summary
 
Fields inherited from class org.sakaiproject.component.legacy.message.BaseMessageService.BaseMessageEdit
m_active, m_body, m_channel, m_event, m_header, m_properties
 
Fields inherited from interface org.sakaiproject.service.legacy.entity.Entity
SEPARATOR
 
Constructor Summary
BaseDiscussionService.BaseDiscussionMessageEdit(MessageChannel channel, Element el)
          Construct from an existing definition, in xml.
BaseDiscussionService.BaseDiscussionMessageEdit(MessageChannel channel, Message other)
          Construct as a copy of another message.
BaseDiscussionService.BaseDiscussionMessageEdit(MessageChannel channel, String id)
          Construct.
 
Method Summary
 DiscussionMessageHeader getDiscussionHeader()
          Access the discussion message header.
 DiscussionMessageHeaderEdit getDiscussionHeaderEdit()
          Access the discussion message header.
 DiscussionMessage getLatestReply()
          Access the most recent reply to this message, if any.
 int getNumberOfReplies()
          Count the number of replies to this message (i.e. the size of the getReplies iterator).
 Iterator getReplies()
          Return an array of messages that are a reply to this message.
 int getReplyToDepth()
          Return the depth of replyTo value for this message.
protected  int getReplyToDepth(HashSet messages)
          Return the depth of replyTo value for this message.
 boolean hasReplies()
          Are there any replys to this message?
 
Methods inherited from class org.sakaiproject.component.legacy.message.BaseMessageService.BaseMessageEdit
activate, closeEdit, compareTo, equals, finalize, getBody, getEvent, getHeader, getHeaderEdit, getId, getProperties, getPropertiesEdit, getReference, getReference, getUrl, getUrl, hashCode, isActiveEdit, set, setAll, setBody, setEvent, toXml, valueBound, valueUnbound
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.sakaiproject.service.legacy.message.Message
getBody, getHeader
 
Methods inherited from interface org.sakaiproject.service.legacy.entity.Entity
getId, getProperties, getReference, getReference, getUrl, getUrl, toXml
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface org.sakaiproject.service.legacy.message.MessageEdit
getHeaderEdit, setBody
 
Methods inherited from interface org.sakaiproject.service.legacy.entity.Edit
getPropertiesEdit, isActiveEdit
 

Constructor Detail

BaseDiscussionService.BaseDiscussionMessageEdit

public BaseDiscussionService.BaseDiscussionMessageEdit(MessageChannel channel,
                                                       String id)
Construct.

Parameters:
channel - The channel in which this message lives.
id - The message id.

BaseDiscussionService.BaseDiscussionMessageEdit

public BaseDiscussionService.BaseDiscussionMessageEdit(MessageChannel channel,
                                                       Message other)
Construct as a copy of another message.

Parameters:
other - The other message to copy.

BaseDiscussionService.BaseDiscussionMessageEdit

public BaseDiscussionService.BaseDiscussionMessageEdit(MessageChannel channel,
                                                       Element el)
Construct from an existing definition, in xml.

Parameters:
channel - The channel in which this message lives.
el - The message in XML in a DOM element.
Method Detail

getDiscussionHeader

public DiscussionMessageHeader getDiscussionHeader()
Access the discussion message header.

Specified by:
getDiscussionHeader in interface DiscussionMessage
Returns:
The discussion message header.

getDiscussionHeaderEdit

public DiscussionMessageHeaderEdit getDiscussionHeaderEdit()
Access the discussion message header.

Specified by:
getDiscussionHeaderEdit in interface DiscussionMessageEdit
Returns:
The discussion message header.

getReplies

public Iterator getReplies()
Return an array of messages that are a reply to this message.

Specified by:
getReplies in interface DiscussionMessage
Returns:
an array of DiscussionMessage objects that are replies to this message (may be null).

hasReplies

public boolean hasReplies()
Are there any replys to this message?

Specified by:
hasReplies in interface DiscussionMessage
Returns:
true if there are replies to this message, false if now.

getReplyToDepth

public int getReplyToDepth()
Return the depth of replyTo value for this message. Messages that are not a reply to any other message have depth = 0. If the message is a reply to a message, this message's depth is the replyTo's depth + 1.

Specified by:
getReplyToDepth in interface DiscussionMessage
Returns:
The depth of replyTo value for this message.

getReplyToDepth

protected int getReplyToDepth(HashSet messages)
Return the depth of replyTo value for this message. Messages that are not a reply to any other message have depth = 0.

Parameters:
messages - A set of messages seen so far in the response chain. If the message is a reply to a message, this message's depth is the replyTo's depth + 1.
Returns:
The depth of replyTo value for this message.

getLatestReply

public DiscussionMessage getLatestReply()
Access the most recent reply to this message, if any.

Specified by:
getLatestReply in interface DiscussionMessage
Returns:
the most recent DiscussionMessage reply to this message, or null if there are no replies.

getNumberOfReplies

public int getNumberOfReplies()
Count the number of replies to this message (i.e. the size of the getReplies iterator).

Specified by:
getNumberOfReplies in interface DiscussionMessage
Returns:
the number of replies to this message.