edu.cmu.andrew.icalendar
Class AbstractEvent

java.lang.Object
  |
  +--edu.cmu.andrew.icalendar.AbstractEvent
All Implemented Interfaces:
Event

public abstract class AbstractEvent
extends Object
implements Event

A skeleton Event class. All abstract methods must be implemented EXCEPT EITHER getSecondaryMap should be implemented OR outputICalendar and getSecondaryValue should be overriden. If getSecondaryMap is not implemented, it should raise a RuntimeException. Under normal circumstances, a class representing a new event should override:

A class representing a modification of an old event should implement the above but ensure that getSeq returns a number strictly greater than the SEQUENCE property of the old instance and should override getUid to return the same UID as the previous instance.

Author:
leg

Inner Class Summary
private  class AbstractEvent.PropertyMap
          A Map<String, List<Property> >
 
Field Summary
private  Date created
           
private  String uid
          create a UID for this object in case getUid isn't overriden
 
Constructor Summary
AbstractEvent()
           
 
Method Summary
 Date getCreated()
          Returns the creation date/time of this event.
abstract  String getDescription()
          The detailed description of this event.
abstract  Date getEnddate()
          Returns the ending date of this event.
 String getEventClass()
          One of "PUBLIC", "PRIVATE", or "CONFIDENTIAL".
 CharacterIterator getIndexable()
          What data should be indexed from this event?
abstract  String getLocation()
          The location of this event.
 String getNthValue(String property)
           
abstract  String getOwningAgenda()
          All events stored in the event store have an "owning agenda".
 int getPriority()
          the priority of the event, if any, from 1 to 9, with 1 the highest priority.
protected  Map getPropertyMap()
          Returns a Map of attributes.
protected abstract  Map getSecondaryMap()
          Returns a Map of secondary attributes, assuming secondary attributes are single-valued strings, of iCalendar property name to property value, without and parameters.
abstract  int getSeq()
          The sequence number of an event is incremented every time the event is modified in a substantial fashion.
abstract  Date getStartdate()
          The date that this event starts on.
 EventStatus getStatus()
          The status of the event.
abstract  String getSummary()
          The summary ("title") of this event.
 boolean getTransp()
          Whether or not this event is transparent to other events.
 String getUid()
          The unique ID of an event is a globally unique identification that is invariant across the life of this event, regardless of invitations/removals/cancellations.
abstract  boolean hasEndtime()
          The equivalent to hasStarttime.
abstract  boolean hasStarttime()
          Returns true if the startdate has a time component.
 Writer outputICalendar(Writer w)
          Write the iCalendar representation to w.
 String toString()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 
Methods inherited from interface edu.cmu.andrew.icalendar.Event
getSecondaryValue
 

Field Detail

uid

private final String uid
create a UID for this object in case getUid isn't overriden

created

private final Date created
Constructor Detail

AbstractEvent

public AbstractEvent()
Method Detail

getUid

public String getUid()
Description copied from interface: Event
The unique ID of an event is a globally unique identification that is invariant across the life of this event, regardless of invitations/removals/cancellations.
Specified by:
getUid in interface Event
Returns:
a UID synthesized for this event at object creation

getSeq

public abstract int getSeq()
Description copied from interface: Event
The sequence number of an event is incremented every time the event is modified in a substantial fashion. See RFC 2445. (In event calendar terms, any change is likely to increase the SEQ.) It starts at 0 and is strictly ascending.
Specified by:
getSeq in interface Event
Following copied from interface: edu.cmu.andrew.icalendar.Event
Returns:
the current sequence number

getStartdate

public abstract Date getStartdate()
Description copied from interface: Event
The date that this event starts on. The time is only significant if hasStarttime returns tRUe.
Specified by:
getStartdate in interface Event
Following copied from interface: edu.cmu.andrew.icalendar.Event
Returns:
the starting time of this event, non-null

hasStarttime

public abstract boolean hasStarttime()
Description copied from interface: Event
Returns true if the startdate has a time component. If it is a day event, this returns false; otherwise it returns true. If this returns false, then getStartdate() is accurate only to the nearest day.
Specified by:
hasStarttime in interface Event
Following copied from interface: edu.cmu.andrew.icalendar.Event
Returns:
true if there is a specific starting time for this event, false otherwise

getEnddate

public abstract Date getEnddate()
Description copied from interface: Event
Returns the ending date of this event. The time is only significant if hasEndtime returns true.
Specified by:
getEnddate in interface Event
Following copied from interface: edu.cmu.andrew.icalendar.Event
Returns:
the ending time of this event

hasEndtime

public abstract boolean hasEndtime()
Description copied from interface: Event
The equivalent to hasStarttime.
Specified by:
hasEndtime in interface Event
Following copied from interface: edu.cmu.andrew.icalendar.Event
Returns:
true if there is a specific ending time for this event, false otherwise

getCreated

public Date getCreated()
Description copied from interface: Event
Returns the creation date/time of this event.
Specified by:
getCreated in interface Event
Returns:
a Date representing the time that this AbstractEvent was instantiated

getEventClass

public String getEventClass()
Description copied from interface: Event
One of "PUBLIC", "PRIVATE", or "CONFIDENTIAL". It defaults to "PUBLIC".
Specified by:
getEventClass in interface Event
Returns:
the default class, "PUBLIC"

getDescription

public abstract String getDescription()
Description copied from interface: Event
The detailed description of this event.
Specified by:
getDescription in interface Event
Following copied from interface: edu.cmu.andrew.icalendar.Event
Returns:
the description, non-null

getPriority

public int getPriority()
Description copied from interface: Event
the priority of the event, if any, from 1 to 9, with 1 the highest priority. a 0 priority is "undefined".
Specified by:
getPriority in interface Event
Returns:
0, representing no known priority

getStatus

public EventStatus getStatus()
Description copied from interface: Event
The status of the event. The default value is EventStatus.CONFIRMED.
Specified by:
getStatus in interface Event
Returns:
CONFIRMED, the default status

getSummary

public abstract String getSummary()
Description copied from interface: Event
The summary ("title") of this event.
Specified by:
getSummary in interface Event
Following copied from interface: edu.cmu.andrew.icalendar.Event
Returns:
the summary

getTransp

public boolean getTransp()
Description copied from interface: Event
Whether or not this event is transparent to other events.
Specified by:
getTransp in interface Event
Following copied from interface: edu.cmu.andrew.icalendar.Event
Returns:
the transparency; false by default

getLocation

public abstract String getLocation()
Description copied from interface: Event
The location of this event.
Specified by:
getLocation in interface Event
Following copied from interface: edu.cmu.andrew.icalendar.Event
Returns:
the location, non-null

getNthValue

public String getNthValue(String property)

getOwningAgenda

public abstract String getOwningAgenda()
Description copied from interface: Event
All events stored in the event store have an "owning agenda". This returns the hierarchical identifier of that owning agenda, if any. Events not in the calendar store should return the empty string for this.
Specified by:
getOwningAgenda in interface Event
Following copied from interface: edu.cmu.andrew.icalendar.Event
Returns:
the owning agenda, if any

getIndexable

public CharacterIterator getIndexable()
Description copied from interface: Event
What data should be indexed from this event?
Specified by:
getIndexable in interface Event
Following copied from interface: edu.cmu.andrew.icalendar.Event
Returns:
characters from the fields that should be indexed

getSecondaryMap

protected abstract Map getSecondaryMap()
Returns a Map of secondary attributes, assuming secondary attributes are single-valued strings, of iCalendar property name to property value, without and parameters. This method needs to be implemented if the subclass of AbstractEvent does not provide its own outputICalendar method.
Returns:
a Map<String, String>

getPropertyMap

protected Map getPropertyMap()
Returns a Map of attributes.
Returns:
a Map<String, List<Property>>

outputICalendar

public Writer outputICalendar(Writer w)
                       throws IOException
Description copied from interface: Event
Write the iCalendar representation to w. It invokes the output method of each subcomponent and each property of this object. Outputs only a VEVENT component.
Specified by:
outputICalendar in interface Event
Following copied from interface: edu.cmu.andrew.icalendar.Event
Parameters:
w - the writer to send output to
Returns:
the writer w
Throws:
IOException - when w does so

toString

public String toString()
Overrides:
toString in class Object