Holger's
Java API

com.antelmann.calendar
Class CalendarEntry

java.lang.Object
  extended by com.antelmann.db.AbstractDBEntry
      extended by com.antelmann.calendar.CalendarEntry
All Implemented Interfaces:
DBEntry, LifeCycleObject, Serializable

public class CalendarEntry
extends AbstractDBEntry
implements LifeCycleObject

represents a generic entry in a calendar

Author:
Holger Antelmann
See Also:
Serialized Form

Field Summary
static DataFlavor calendarEntryFlavor
           
protected  HashSet<String> categories
           
protected  Properties properties
           
protected  Recurrence recurrence
           
static Comparator<CalendarEntry> standardComparator
          compares first on time and then on title
 
Fields inherited from interface com.antelmann.db.DBEntry
ENTRY_FLAVOR, ENTRY_LIST_FLAVOR
 
Constructor Summary
CalendarEntry(Object id, CalendarEntry entry)
          creates a duplicate from entry where only the id is different from the original
CalendarEntry(Object id, Date begin, Date end, String title)
          begin and title must not be null
CalendarEntry(Object id, Date begin, Date end, String title, String location, String description)
          begin and title must not be null
CalendarEntry(Object id, Date begin, long duration, String title)
          begin and title must not be null
CalendarEntry(Object id, Date begin, long durationMillis, String title, String location, String description)
          begin and title must not be null
 
Method Summary
 boolean addCategory(String category)
           
 long creationTime()
           
 boolean deepCompare(CalendarEntry entry)
          checks whether all: title, begin date and location are equal.
 Date getBeginTime()
           
 String[] getCategories()
           
 String getDescription()
           
 long getDuration()
          time in milliseconds
 Date getEndTime()
           
 String getLocation()
           
 Object getProperty(Object key)
           
 Object getProperty(Object key, Object defaultValue)
           
 Set<Object> getPropertyKeys()
           
 Recurrence getRecurrence()
           
 Date[] getRecurrences(Date after, Date before)
          may return null if no recurrence is set.
 String getTitle()
           
 boolean hasCategory(String category)
           
 boolean isCanceled()
           
 boolean isConfirmed()
           
 long lastUpdated()
           
 boolean overlapsWith(CalendarEntry entry)
           
 boolean removeCategory(String category)
           
 Object removeProperty(Object key)
           
 boolean sameDay(Date date)
          returns true if the given date is on the same day as the begin time of this entry
 void setBeginTime(Date begin)
          setting the begin also alters the end, as the duration remains
 void setCanceled(boolean flag)
           
 void setConfirmed(boolean flag)
           
 void setDescription(String desc)
           
 void setDuration(long millis)
           
 void setLocation(String location)
           
 Object setProperty(Object property, Object value)
           
 void setRecurrence(Recurrence r)
           
 void setTitle(String title)
           
 String toString()
           
 
Methods inherited from class com.antelmann.db.AbstractDBEntry
equals, getID, hashCode, hashEntry, sameEntry
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

calendarEntryFlavor

public static final DataFlavor calendarEntryFlavor

standardComparator

public static final Comparator<CalendarEntry> standardComparator
compares first on time and then on title


categories

protected HashSet<String> categories

properties

protected Properties properties

recurrence

protected Recurrence recurrence
Constructor Detail

CalendarEntry

public CalendarEntry(Object id,
                     Date begin,
                     Date end,
                     String title)
begin and title must not be null


CalendarEntry

public CalendarEntry(Object id,
                     Date begin,
                     long duration,
                     String title)
begin and title must not be null


CalendarEntry

public CalendarEntry(Object id,
                     Date begin,
                     Date end,
                     String title,
                     String location,
                     String description)
begin and title must not be null


CalendarEntry

public CalendarEntry(Object id,
                     Date begin,
                     long durationMillis,
                     String title,
                     String location,
                     String description)
begin and title must not be null


CalendarEntry

public CalendarEntry(Object id,
                     CalendarEntry entry)
creates a duplicate from entry where only the id is different from the original

Method Detail

creationTime

public long creationTime()

lastUpdated

public long lastUpdated()

getBeginTime

public Date getBeginTime()
Specified by:
getBeginTime in interface LifeCycleObject

setBeginTime

public void setBeginTime(Date begin)
setting the begin also alters the end, as the duration remains


getEndTime

public Date getEndTime()
Specified by:
getEndTime in interface LifeCycleObject

getDuration

public long getDuration()
time in milliseconds


setDuration

public void setDuration(long millis)

getTitle

public String getTitle()

setTitle

public void setTitle(String title)

getLocation

public String getLocation()

setLocation

public void setLocation(String location)

getDescription

public String getDescription()

isConfirmed

public boolean isConfirmed()

isCanceled

public boolean isCanceled()

setDescription

public void setDescription(String desc)

setConfirmed

public void setConfirmed(boolean flag)

setCanceled

public void setCanceled(boolean flag)

addCategory

public boolean addCategory(String category)

removeCategory

public boolean removeCategory(String category)

hasCategory

public boolean hasCategory(String category)

getCategories

public String[] getCategories()

setProperty

public Object setProperty(Object property,
                          Object value)

getProperty

public Object getProperty(Object key)

removeProperty

public Object removeProperty(Object key)

getProperty

public Object getProperty(Object key,
                          Object defaultValue)

getPropertyKeys

public Set<Object> getPropertyKeys()

getRecurrence

public Recurrence getRecurrence()

setRecurrence

public void setRecurrence(Recurrence r)

getRecurrences

public Date[] getRecurrences(Date after,
                             Date before)
                      throws IllegalArgumentException
may return null if no recurrence is set.

Parameters:
after - must come before the second parameter
before - must come after the first parameter
Throws:
IllegalArgumentException

deepCompare

public boolean deepCompare(CalendarEntry entry)
checks whether all: title, begin date and location are equal.


toString

public String toString()
Overrides:
toString in class AbstractDBEntry

overlapsWith

public boolean overlapsWith(CalendarEntry entry)

sameDay

public boolean sameDay(Date date)
returns true if the given date is on the same day as the begin time of this entry



(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads