org.sakaiproject.component.legacy.calendar
Class BaseCalendarService.BaseCalendarEventEdit

java.lang.Object
  extended byorg.sakaiproject.component.legacy.calendar.BaseCalendarService.BaseCalendarEventEdit
All Implemented Interfaces:
AttachmentContainer, AttachmentContainerEdit, CalendarEvent, CalendarEventEdit, Comparable, Edit, Entity, EventListener, SessionBindingListener
Enclosing class:
BaseCalendarService

public class BaseCalendarService.BaseCalendarEventEdit
extends Object
implements CalendarEventEdit, SessionBindingListener

CalendarEvent implementation


Field Summary
protected  boolean m_active
          Active flag.
protected  List m_attachments
          The attachments - dereferencer objects.
protected  TimeRange m_baseRange
          The base time range: for non-recurring events, this matches m_range, but for recurring events, it is always the range of the initial event in the sequence (transient).
protected  BaseCalendarService.BaseCalendarEdit m_calendar
          The calendar in which this event lives.
protected  String m_event
          The event code for this edit.
protected  RecurrenceRule m_exclusionRule
          The exclusion recurrence rule.
protected  String m_id
          The event id.
protected  ResourcePropertiesEdit m_properties
          The properties.
protected  TimeRange m_range
          The effective time range.
protected  RecurrenceRule m_singleRule
          The recurrence rule (single rule).
 
Fields inherited from interface org.sakaiproject.service.legacy.entity.Entity
SEPARATOR
 
Constructor Summary
BaseCalendarService.BaseCalendarEventEdit(Calendar calendar, CalendarEvent other)
          Construct as a copy of another event.
BaseCalendarService.BaseCalendarEventEdit(Calendar calendar, Element el)
          Construct from an existing definition, in xml.
BaseCalendarService.BaseCalendarEventEdit(CalendarEvent other, RecurrenceInstance ri)
          Construct as a thin copy of another event, with this new time range, and no rules, as part of a recurring event sequence.
BaseCalendarService.BaseCalendarEventEdit(Calendar calendar, String id)
          Construct.
 
Method Summary
protected  void activate()
          Enable editing.
 void addAttachment(Reference ref)
          Add an attachment.
 void clearAttachments()
          Clear all attachments.
protected  void closeEdit()
          Close the edit object - it cannot be used after this.
 int compareTo(Object o)
          Compare one event to another, based on range.
protected  void finalize()
          Clean up.
 List getAttachments()
          Access the attachments of the event.
 String getCalendarReference()
          Gets the containing calendar's reference.
 String getDescription()
          Access the description property as plain text.
 String getDescriptionFormatted()
          Access the description property as formatted text.
 String getDisplayName()
          Access the display name property (cover for PROP_DISPLAY_NAME).
protected  String getEvent()
          Access the event code for this edit.
protected  RecurrenceRule getExclusionRule()
          Gets the exclusion recurrence rule, if any.
 String getField(String name)
          Get the value of an "extra" event field.
 String getId()
          Access the id of the resource.
 String getLocation()
          Access the location (cover for PROP_CALENDAR_LOCATION).
 ResourceProperties getProperties()
          Access the event's properties.
 ResourcePropertiesEdit getPropertiesEdit()
          Access the resource's properties for modification
 TimeRange getRange()
          Access the time range
 RecurrenceRule getRecurrenceRule()
          Gets the recurrence rule, if any.
 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 getType()
          Access the type (cover for PROP_CALENDAR_TYPE).
 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.
 boolean isActiveEdit()
          Check to see if the edit is still active, or has already been closed.
 void notify(Event event)
          Notify the event that it has changed.
 void removeAttachment(Reference ref)
          Remove an attachment.
 void replaceAttachments(List attachments)
          Replace the attachment set.
protected  List resolve(TimeRange range)
          Return a list of all resolved events generated from this event plus it's recurrence rules that fall within the time range, including this event, possibly empty.
protected  void set(CalendarEvent other)
          Take all values from this object.
 void setDescription(String description)
          Set the description property as plain text.
 void setDescriptionFormatted(String description)
          Set the description property as formatted text.
 void setDisplayName(String name)
          Set the display name property (cover for PROP_DISPLAY_NAME).
protected  void setEvent(String event)
          Set the event code for this edit.
protected  void setExclusionRule(RecurrenceRule rule)
          Sets the exclusion recurrence rule.
 void setField(String name, String value)
          Set the value of an "extra" event field.
 void setLocation(String location)
          Set the location (cover for PROP_CALENDAR_LOCATION).
protected  void setPartial(CalendarEvent other)
          Take some values from this object (not id, not rules).
 void setRange(TimeRange range)
          Replace the time range
 void setRecurrenceRule(RecurrenceRule rule)
          Sets the recurrence rule.
 void setType(String type)
          Set the type (cover for PROP_CALENDAR_TYPE).
 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, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_calendar

protected BaseCalendarService.BaseCalendarEdit m_calendar
The calendar in which this event lives.


m_range

protected TimeRange m_range
The effective time range.


m_baseRange

protected TimeRange m_baseRange
The base time range: for non-recurring events, this matches m_range, but for recurring events, it is always the range of the initial event in the sequence (transient).


m_singleRule

protected RecurrenceRule m_singleRule
The recurrence rule (single rule).


m_exclusionRule

protected RecurrenceRule m_exclusionRule
The exclusion recurrence rule.


m_properties

protected ResourcePropertiesEdit m_properties
The properties.


m_id

protected String m_id
The event id.


m_attachments

protected List m_attachments
The attachments - dereferencer objects.


m_event

protected String m_event
The event code for this edit.


m_active

protected boolean m_active
Active flag.

Constructor Detail

BaseCalendarService.BaseCalendarEventEdit

public BaseCalendarService.BaseCalendarEventEdit(Calendar calendar,
                                                 String id)
Construct.

Parameters:
calendar - The calendar in which this event lives.
id - The event id, unique within the calendar.

BaseCalendarService.BaseCalendarEventEdit

public BaseCalendarService.BaseCalendarEventEdit(Calendar calendar,
                                                 CalendarEvent other)
Construct as a copy of another event.

Parameters:
other - The other event to copy.

BaseCalendarService.BaseCalendarEventEdit

public BaseCalendarService.BaseCalendarEventEdit(CalendarEvent other,
                                                 RecurrenceInstance ri)
Construct as a thin copy of another event, with this new time range, and no rules, as part of a recurring event sequence.

Parameters:
other - The other event to copy.
ri - The RecurrenceInstance with the time range (and sequence number) to use.

BaseCalendarService.BaseCalendarEventEdit

public BaseCalendarService.BaseCalendarEventEdit(Calendar calendar,
                                                 Element el)
Construct from an existing definition, in xml.

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

set

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

Parameters:
other - The other object to take values from.

setPartial

protected void setPartial(CalendarEvent other)
Take some values from this object (not id, not rules).

Parameters:
other - The other object to take values from.

finalize

protected void finalize()
Clean up.


getRange

public TimeRange getRange()
Access the time range

Specified by:
getRange in interface CalendarEvent
Returns:
The event time range

setRange

public void setRange(TimeRange range)
Replace the time range

Specified by:
setRange in interface CalendarEventEdit

getDisplayName

public String getDisplayName()
Access the display name property (cover for PROP_DISPLAY_NAME).

Specified by:
getDisplayName in interface CalendarEvent
Returns:
The event's display name property.

setDisplayName

public void setDisplayName(String name)
Set the display name property (cover for PROP_DISPLAY_NAME).

Specified by:
setDisplayName in interface CalendarEventEdit
Parameters:
name - The event's display name property.

getDescription

public String getDescription()
Access the description property as plain text.

Specified by:
getDescription in interface CalendarEvent
Returns:
The event's description property.

getDescriptionFormatted

public String getDescriptionFormatted()
Access the description property as formatted text.

Specified by:
getDescriptionFormatted in interface CalendarEvent
Returns:
The event's description property.

setDescription

public void setDescription(String description)
Set the description property as plain text.

Specified by:
setDescription in interface CalendarEventEdit
Parameters:
description - The event's description property.

setDescriptionFormatted

public void setDescriptionFormatted(String description)
Set the description property as formatted text.

Specified by:
setDescriptionFormatted in interface CalendarEventEdit
Parameters:
description - The event's description property.

getType

public String getType()
Access the type (cover for PROP_CALENDAR_TYPE).

Specified by:
getType in interface CalendarEvent
Returns:
The event's type property.

setType

public void setType(String type)
Set the type (cover for PROP_CALENDAR_TYPE).

Specified by:
setType in interface CalendarEventEdit
Parameters:
type - The event's type property.

getLocation

public String getLocation()
Access the location (cover for PROP_CALENDAR_LOCATION).

Specified by:
getLocation in interface CalendarEvent
Returns:
The event's location property.

getRecurrenceRule

public RecurrenceRule getRecurrenceRule()
Gets the recurrence rule, if any.

Specified by:
getRecurrenceRule in interface CalendarEvent
Returns:
The recurrence rule, or null if none.

getExclusionRule

protected RecurrenceRule getExclusionRule()
Gets the exclusion recurrence rule, if any.

Returns:
The exclusionrecurrence rule, or null if none.

resolve

protected List resolve(TimeRange range)
Return a list of all resolved events generated from this event plus it's recurrence rules that fall within the time range, including this event, possibly empty.

Parameters:
range - The time range bounds for the events returned.
Returns:
a List (CalendarEvent) of all events and recurrences within the time range, including this, possibly empty.

getField

public String getField(String name)
Get the value of an "extra" event field.

Specified by:
getField in interface CalendarEvent
Parameters:
name - The name of the field.
Returns:
the value of the "extra" event field.

setField

public void setField(String name,
                     String value)
Set the value of an "extra" event field.

Specified by:
setField in interface CalendarEventEdit
Parameters:
name - The "extra" field name
value - The value to set, or null to remove the field.

setLocation

public void setLocation(String location)
Set the location (cover for PROP_CALENDAR_LOCATION).

Specified by:
setLocation in interface CalendarEventEdit
Parameters:
location - The event's location property.

setRecurrenceRule

public void setRecurrenceRule(RecurrenceRule rule)
Sets the recurrence rule.

Specified by:
setRecurrenceRule in interface CalendarEventEdit
Parameters:
rule - The recurrence rule, or null to clear out the rule.

setExclusionRule

protected void setExclusionRule(RecurrenceRule rule)
Sets the exclusion recurrence rule.

Parameters:
rule - The recurrence rule, or null to clear out the rule.

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 event's properties.

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

notify

public void notify(Event event)
Notify the event that it has changed.

Parameters:
event - The event that caused the update.

compareTo

public int compareTo(Object o)
Compare one event to another, based on range.

Specified by:
compareTo in interface Comparable
Parameters:
o - The object to be compared.
Returns:
A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified 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.

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.


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

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

getCalendarReference

public String getCalendarReference()
Gets the containing calendar's reference.

Specified by:
getCalendarReference in interface CalendarEvent
Returns:
The containing calendar reference.