org.sakaiproject.component.legacy.digest
Class BaseDigestService.BaseDigest

java.lang.Object
  extended byorg.sakaiproject.component.legacy.digest.BaseDigestService.BaseDigest
All Implemented Interfaces:
Comparable, Digest, DigestEdit, Edit, Entity, EventListener, SessionBindingListener
Enclosing class:
BaseDigestService

public class BaseDigestService.BaseDigest
extends Object
implements DigestEdit, SessionBindingListener

Digest implementation


Field Summary
protected  boolean m_active
          Active flag.
protected  String m_event
          The event code for this edit.
protected  String m_id
          The user id.
protected  ResourcePropertiesEdit m_properties
          The properties.
protected  Map m_ranges
          The digest time ranges (Map TimeRange string to List of DigestMessage).
 
Fields inherited from interface org.sakaiproject.service.legacy.entity.Entity
SEPARATOR
 
Constructor Summary
BaseDigestService.BaseDigest(Digest digest)
          Construct from another Digest object.
BaseDigestService.BaseDigest(Element el)
          Construct from information in XML.
BaseDigestService.BaseDigest(String id)
          Construct.
 
Method Summary
protected  void activate()
          Enable editing.
 void add(DigestMessage msg)
          Add another message, in the current time period.
 void clear(Time period)
          Clear all messages from a time period.
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.
protected  String getEvent()
          Access the event code for this edit.
 String getId()
          Access the user id.
 List getMessages(Time period)
          Access the list (DigestMessage) of messages, for the time period.
 List getPeriods()
          Access the list (String, TimePeriod string) of periods.
 ResourceProperties getProperties()
          Access the resources'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(Digest digest)
          Take all values from this object.
protected  void setAll(Digest digest)
          Take all values from this object.
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_id

protected String m_id
The user id.


m_properties

protected ResourcePropertiesEdit m_properties
The properties.


m_ranges

protected Map m_ranges
The digest time ranges (Map TimeRange string to List of DigestMessage).


m_event

protected String m_event
The event code for this edit.


m_active

protected boolean m_active
Active flag.

Constructor Detail

BaseDigestService.BaseDigest

public BaseDigestService.BaseDigest(String id)
Construct.

Parameters:
id - The user id.

BaseDigestService.BaseDigest

public BaseDigestService.BaseDigest(Digest digest)
Construct from another Digest object.


BaseDigestService.BaseDigest

public BaseDigestService.BaseDigest(Element el)
Construct from information in XML.

Parameters:
el - The XML DOM Element definining the user.
Method Detail

setAll

protected void setAll(Digest digest)
Take all values from this object.


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.

getId

public String getId()
Access the user id.

Specified by:
getId in interface Digest
Returns:
The digest 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 resources's properties.

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

getMessages

public List getMessages(Time period)
Access the list (DigestMessage) of messages, for the time period.

Specified by:
getMessages in interface Digest
Parameters:
period - A time in the time period to select.
Returns:
The List (DigestMessage) of messages (possibly empty).

getPeriods

public List getPeriods()
Access the list (String, TimePeriod string) of periods.

Specified by:
getPeriods in interface Digest
Returns:
The List (String, TimePeriod string) of periods.

equals

public boolean equals(Object obj)
Are these objects equal? If they are both User 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.


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.

add

public void add(DigestMessage msg)
Add another message, in the current time period.

Specified by:
add in interface DigestEdit
Parameters:
msg - The DigestMessage to add.

clear

public void clear(Time period)
Clear all messages from a time period.

Specified by:
clear in interface DigestEdit
Parameters:
period - a Time in the time period.

finalize

protected void finalize()
Clean up.


set

protected void set(Digest digest)
Take all values from this object.


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

protected 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