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

java.lang.Object
  extended byorg.sakaiproject.component.legacy.message.BaseMessageService.BaseMessageEdit
All Implemented Interfaces:
Comparable, Edit, Entity, EventListener, Message, MessageEdit, SessionBindingListener
Direct Known Subclasses:
BaseAnnouncementService.BaseAnnouncementMessageEdit, BaseChatService.BaseChatMessageEdit, BaseDiscussionService.BaseDiscussionMessageEdit, BaseMailArchiveService.BaseMailArchiveMessageEdit
Enclosing class:
BaseMessageService

public class BaseMessageService.BaseMessageEdit
extends Object
implements MessageEdit, SessionBindingListener

MessageEdit implementation


Field Summary
protected  boolean m_active
          Active flag.
protected  String m_body
          The message body.
protected  MessageChannel m_channel
          A transient backpointer to the channel
protected  String m_event
          The event code for this edit.
protected  MessageHeaderEdit m_header
          The message header.
protected  ResourcePropertiesEdit m_properties
          The properties.
 
Fields inherited from interface org.sakaiproject.service.legacy.entity.Entity
SEPARATOR
 
Constructor Summary
BaseMessageService.BaseMessageEdit(MessageChannel channel, Element el)
          Construct from an existing definition, in xml.
BaseMessageService.BaseMessageEdit(MessageChannel channel, Message other)
          Construct as a copy of another message.
BaseMessageService.BaseMessageEdit(MessageChannel channel, String id)
          Construct.
 
Method Summary
 void activate()
          Enable editing.
protected  void closeEdit()
          Close the edit object - it cannot be used after this.
 int compareTo(Object obj)
          Compare this object with the specified object for order.
 boolean equals(Object obj)
          Are these objects equal?
protected  void finalize()
          Clean up.
 String getBody()
          Access the body text, as a string.
protected  String getEvent()
          Access the event code for this edit.
 MessageHeader getHeader()
          Access the message header.
 MessageHeaderEdit getHeaderEdit()
          Access the message header.
 String getId()
          Access the id of the resource.
 ResourceProperties getProperties()
          Access the channel's properties.
 ResourcePropertiesEdit getPropertiesEdit()
          Access the resource's properties for modification
 String getReference()
          Access the internal reference which can be used to access the resource from within the system.
 String getReference(String rootProperty)
          Access the alternate internal reference which can be used to access the entity from within the system.
 String getUrl()
          Access the URL which can be used to access the resource.
 String getUrl(String rootProperty)
          Access the alternate URL which can be used to access the entity.
 int hashCode()
          Make a hash code that reflects the equals() logic as well.
 boolean isActiveEdit()
          Check to see if the edit is still active, or has already been closed.
protected  void set(Message other)
          Take all values from this object.
protected  void setAll(Message other)
          Take all values from this object.
 void setBody(String body)
          Replace the body, as a string.
protected  void setEvent(String event)
          Set the event code for this edit.
 Element toXml(Document doc, Stack stack)
          Serialize the resource into XML, adding an element to the doc under the top of the stack element.
 void valueBound(SessionBindingEvent event)
          SessionBindingListener implementation
 void valueUnbound(SessionBindingEvent event)
          Notifies the object that it is being unbound from a session.
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_event

protected String m_event
The event code for this edit.


m_active

protected boolean m_active
Active flag.


m_header

protected MessageHeaderEdit m_header
The message header.


m_body

protected String m_body
The message body.


m_properties

protected ResourcePropertiesEdit m_properties
The properties.


m_channel

protected MessageChannel m_channel
A transient backpointer to the channel

Constructor Detail

BaseMessageService.BaseMessageEdit

public BaseMessageService.BaseMessageEdit(MessageChannel channel,
                                          String id)
Construct.

Parameters:
id - The message id.

BaseMessageService.BaseMessageEdit

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

Parameters:
other - The other message to copy.

BaseMessageService.BaseMessageEdit

public BaseMessageService.BaseMessageEdit(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

setAll

protected void setAll(Message other)
Take all values from this object.


finalize

protected void finalize()
Clean up.


getHeader

public MessageHeader getHeader()
Access the message header.

Specified by:
getHeader in interface Message
Returns:
The message header.

getId

public String getId()
Access the id of the resource.

Specified by:
getId in interface Entity
Returns:
The id.

getUrl

public String getUrl()
Access the URL which can be used to access the resource.

Specified by:
getUrl in interface Entity
Returns:
The URL which can be used to access the resource.

getReference

public String getReference()
Access the internal reference which can be used to access the resource from within the system.

Specified by:
getReference in interface Entity
Returns:
The the internal reference which can be used to access the resource from within the system.

getReference

public String getReference(String rootProperty)
Description copied from interface: Entity
Access the alternate internal reference which can be used to access the entity from within the system.

Specified by:
getReference in interface Entity
Parameters:
rootProperty - The name of the entity property whose value controls which alternate reference is requested. If null, the native 'raw' reference is requested.
Returns:
The the alternate internal reference which can be used to access the entity from within the system.

getUrl

public String getUrl(String rootProperty)
Description copied from interface: Entity
Access the alternate URL which can be used to access the entity.

Specified by:
getUrl in interface Entity
Parameters:
rootProperty - The name of the entity property whose value controls which alternate reference URL is requested. If null, the native 'raw' URL is requested.
Returns:
The alternate URL which can be used to access the entity.

getProperties

public ResourceProperties getProperties()
Access the channel's properties.

Specified by:
getProperties in interface Entity
Returns:
The channel's properties.

getBody

public String getBody()
Access the body text, as a string.

Specified by:
getBody in interface Message
Returns:
The body text, as a string.

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 Entity
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.

compareTo

public int compareTo(Object obj)
Compare this object with the specified object for order.

Specified by:
compareTo in interface Comparable
Returns:
A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

equals

public boolean equals(Object obj)
Are these objects equal? If they are both Message objects, and they have matching id's, they are.

Returns:
true if they are equal, false if not.

hashCode

public int hashCode()
Make a hash code that reflects the equals() logic as well. We want two objects, even if different instances, if they have the same id to hash the same.


setBody

public void setBody(String body)
Replace the body, as a string.

Specified by:
setBody in interface MessageEdit
Parameters:
body - The body, as a string.

set

protected void set(Message other)
Take all values from this object.


getHeaderEdit

public MessageHeaderEdit getHeaderEdit()
Access the message header.

Specified by:
getHeaderEdit in interface MessageEdit
Returns:
The message header.

getEvent

protected String getEvent()
Access the event code for this edit.

Returns:
The event code for this edit.

setEvent

protected void setEvent(String event)
Set the event code for this edit.

Parameters:
event - The event code for this edit.

getPropertiesEdit

public ResourcePropertiesEdit getPropertiesEdit()
Access the resource's properties for modification

Specified by:
getPropertiesEdit in interface Edit
Returns:
The resource's properties.

activate

public void activate()
Enable editing.


isActiveEdit

public boolean isActiveEdit()
Check to see if the edit is still active, or has already been closed.

Specified by:
isActiveEdit in interface Edit
Returns:
true if the edit is active, false if it's been closed.

closeEdit

protected void closeEdit()
Close the edit object - it cannot be used after this.


valueBound

public void valueBound(SessionBindingEvent event)
SessionBindingListener implementation

Specified by:
valueBound in interface SessionBindingListener
Parameters:
event - the event that identifies the session

valueUnbound

public void valueUnbound(SessionBindingEvent event)
Description copied from interface: SessionBindingListener
Notifies the object that it is being unbound from a session.

Specified by:
valueUnbound in interface SessionBindingListener
Parameters:
event - the event that identifies the session