org.sakaiproject.component.legacy.message
Class BaseMessageService.BaseMessageHeaderEdit

java.lang.Object
  extended byorg.sakaiproject.component.legacy.message.BaseMessageService.BaseMessageHeaderEdit
All Implemented Interfaces:
AttachmentContainer, AttachmentContainerEdit, MessageHeader, MessageHeaderEdit
Direct Known Subclasses:
BaseAnnouncementService.BaseAnnouncementMessageHeaderEdit, BaseChatService.BaseChatMessageHeaderEdit, BaseDiscussionService.BaseDiscussionMessageHeaderEdit, BaseMailArchiveService.BaseMailArchiveMessageHeaderEdit
Enclosing class:
BaseMessageService

public class BaseMessageService.BaseMessageHeaderEdit
extends Object
implements MessageHeaderEdit

MessageHeaderEdit implementation


Nested Class Summary
 
Nested classes inherited from class org.sakaiproject.service.legacy.message.MessageHeader
MessageHeader.MessageAccess
 
Field Summary
protected  MessageHeader.MessageAccess m_access
          The message access.
protected  List m_attachments
          The attachments - dereferencer objects.
protected  Time m_date
          The date/time the message was sent to the channel.
protected  boolean m_draft
          The draft status for the message.
protected  User m_from
          The User who sent the message to the channel.
protected  Collection m_groups
          The Collection of groups (authorization group id strings).
protected  String m_id
          The unique (within the channel) message id.
protected  Message m_message
          A transient backpointer to the message.
 
Constructor Summary
BaseMessageService.BaseMessageHeaderEdit(Message msg, Element el)
          Construct, from an already existing XML DOM element.
BaseMessageService.BaseMessageHeaderEdit(Message msg, MessageHeader other)
          Construct as a copy of another header.
BaseMessageService.BaseMessageHeaderEdit(Message msg, String id)
          Construct.
 
Method Summary
 void addAttachment(Reference ref)
          Add an attachment.
 void addGroup(Group group)
          Add a Group to the list of groups for this message.
 void clearAttachments()
          Clear all attachments.
 MessageHeader.MessageAccess getAccess()
          Access the access mode for the message - how we compute who has access to the message.
 List getAttachments()
          Access the attachments of the event.
 Time getDate()
          Access the date/time the message was sent to the channel.
 boolean getDraft()
          Access the draft status of the message.
 User getFrom()
          Access the User who sent the message to the channel.
 Collection getGroups()
          Access the groups defined for this message.
 String getId()
          Access the unique (within the channel) message id.
 void removeAttachment(Reference ref)
          Remove an attachment.
 void removeGroup(Group group)
          Remove this Group from the list of groups for this message.
 void replaceAttachments(List attachments)
          Replace the attachment set.
 void setAccess(MessageHeader.MessageAccess access)
          Set the access mode for the message - how we compute who has access to the message.
 void setDate(Time date)
          Set the date/time the message was sent to the channel.
 void setDraft(boolean draft)
          Set the draft status of the message.
 void setFrom(User user)
          Set the User who sent the message to the channel.
 Element toXml(Document doc, Stack stack)
          Serialize the resource into XML, adding an element to the doc under the top of the stack element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_id

protected String m_id
The unique (within the channel) message id.


m_date

protected Time m_date
The date/time the message was sent to the channel.


m_from

protected User m_from
The User who sent the message to the channel.


m_attachments

protected List m_attachments
The attachments - dereferencer objects.


m_draft

protected boolean m_draft
The draft status for the message.


m_groups

protected Collection m_groups
The Collection of groups (authorization group id strings).


m_access

protected MessageHeader.MessageAccess m_access
The message access.


m_message

protected Message m_message
A transient backpointer to the message.

Constructor Detail

BaseMessageService.BaseMessageHeaderEdit

public BaseMessageService.BaseMessageHeaderEdit(Message msg,
                                                String id)
Construct. Time and From set automatically.

Parameters:
id - The message id.

BaseMessageService.BaseMessageHeaderEdit

public BaseMessageService.BaseMessageHeaderEdit(Message msg,
                                                MessageHeader other)
Construct as a copy of another header.

Parameters:
other - The other message header to copy.

BaseMessageService.BaseMessageHeaderEdit

public BaseMessageService.BaseMessageHeaderEdit(Message msg,
                                                Element el)
Construct, from an already existing XML DOM element.

Parameters:
el - The header in XML in a DOM element.
Method Detail

getId

public String getId()
Access the unique (within the channel) message id.

Specified by:
getId in interface MessageHeader
Returns:
The unique (within the channel) message id.

getDate

public Time getDate()
Access the date/time the message was sent to the channel.

Specified by:
getDate in interface MessageHeader
Returns:
The date/time the message was sent to the channel.

getFrom

public User getFrom()
Access the User who sent the message to the channel.

Specified by:
getFrom in interface MessageHeader
Returns:
The User who sent the message to the channel.

getDraft

public boolean getDraft()
Access the draft status of the message.

Specified by:
getDraft in interface MessageHeader
Returns:
True if the message is a draft, false if not.

setDraft

public void setDraft(boolean draft)
Set the draft status of the message.

Specified by:
setDraft in interface MessageHeaderEdit
Parameters:
draft - True if the message is a draft, false if not.

getGroups

public Collection getGroups()
Description copied from interface: MessageHeader
Access the groups defined for this message.

Specified by:
getGroups in interface MessageHeader
Returns:
A Collection (String) of group refs (authorization group ids) defined for this message; empty if none are defined.

addGroup

public void addGroup(Group group)
              throws PermissionException
Description copied from interface: MessageHeaderEdit
Add a Group to the list of groups for this message.

Specified by:
addGroup in interface MessageHeaderEdit
Parameters:
group - The Group to add to those for this message.
Throws:
PermissionException - if the end user does not have permission to do this.

removeGroup

public void removeGroup(Group group)
                 throws PermissionException
Description copied from interface: MessageHeaderEdit
Remove this Group from the list of groups for this message.

Specified by:
removeGroup in interface MessageHeaderEdit
Parameters:
group - The Group to remove from those for this message.
Throws:
PermissionException - if the end user does not have permission to do this.

getAccess

public MessageHeader.MessageAccess getAccess()
Description copied from interface: MessageHeader
Access the access mode for the message - how we compute who has access to the message.

Specified by:
getAccess in interface MessageHeader
Returns:
The MessageAccess access mode for the message.

setAccess

public void setAccess(MessageHeader.MessageAccess access)
Description copied from interface: MessageHeaderEdit
Set the access mode for the message - how we compute who has access to the message.

Specified by:
setAccess in interface MessageHeaderEdit
Parameters:
access - The MessageAccess access mode for the message.

toXml

public Element toXml(Document doc,
                     Stack stack)
Serialize the resource into XML, adding an element to the doc under the top of the stack element.

Specified by:
toXml in interface MessageHeader
Parameters:
doc - The DOM doc to contain the XML (or null for a string return).
stack - The DOM elements, the top of which is the containing element of the new "resource" element.
Returns:
The newly added element.

setDate

public void setDate(Time date)
Set the date/time the message was sent to the channel.

Specified by:
setDate in interface MessageHeaderEdit
Parameters:
date - The date/time the message was sent to the channel.

setFrom

public void setFrom(User user)
Set the User who sent the message to the channel.

Specified by:
setFrom in interface MessageHeaderEdit
Parameters:
user - The User who sent the message to the channel.

getAttachments

public List getAttachments()
Access the attachments of the event.

Specified by:
getAttachments in interface AttachmentContainer
Returns:
An copy of the set of attachments (a ReferenceVector containing Reference objects) (may be empty).

addAttachment

public void addAttachment(Reference ref)
Add an attachment.

Specified by:
addAttachment in interface AttachmentContainerEdit
Parameters:
ref - The attachment Reference.

removeAttachment

public void removeAttachment(Reference ref)
Remove an attachment.

Specified by:
removeAttachment in interface AttachmentContainerEdit
Parameters:
ref - The attachment Reference to remove (the one removed will equal this, they need not be ==).

replaceAttachments

public void replaceAttachments(List attachments)
Replace the attachment set.

Specified by:
replaceAttachments in interface AttachmentContainerEdit
Parameters:
attachments - A vector of Reference objects that will become the new set of attachments.

clearAttachments

public void clearAttachments()
Clear all attachments.

Specified by:
clearAttachments in interface AttachmentContainerEdit