shared
Class CalendarCategory

java.lang.Object
  extended byshared.CalendarCategory

public class CalendarCategory
extends java.lang.Object

This class specifies a category of the calendar events. Its wrapping a vector of references of all events of this category.

Author:
buetow

Constructor Summary
CalendarCategory(java.io.File categoryFile)
          Creates a new calendar category object and sets the categorie's name to the filename of the category.
CalendarCategory(java.lang.String sCategoryName)
          Creates a new calendar category object and sets the categorie's File to the name of the category.
 
Method Summary
 void addEvent(CalendarEvent event)
          This method adds an event to the category.
 void flush()
          This method flushes the calendar category to the database at the filesystem.
 java.util.Vector getEvents()
          This method returns the categorie's events.
 java.io.File getFile()
          This method returns the calendar events file object.
 java.util.Vector getMatchingEvents(ClientRequest clientRequest)
          This method looks for all calendar events of this category which matches a given client's request.
 java.lang.String getName()
          This method returns the categorie's name.
 boolean hasChanged()
          This method lets you check if the calendar category has been modified/changed by a calendar client request.
 boolean matchesName(java.util.regex.Pattern pattern)
          This method checks the current category's name against a regular expression pattern.
 void removeEvent(CalendarEvent event)
          This method removes a given event from its event vector.
 void setEvents(java.util.Vector vecEvents)
          This method sets the categorie's initial events.
 void setHasChanged(boolean bHasChanged)
          This method specifies if the calendar category has been modified/changed or not.
 void unsetFile()
          This method Sets the categories file handle to null.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CalendarCategory

public CalendarCategory(java.io.File categoryFile)
Creates a new calendar category object and sets the categorie's name to the filename of the category.

Parameters:
categoryFile - The file object which contains the unparsed events for this specific category. It will be unset after parsing.

CalendarCategory

public CalendarCategory(java.lang.String sCategoryName)
Creates a new calendar category object and sets the categorie's File to the name of the category.

Parameters:
sCategoryName - Specifies the categorie's name.
Method Detail

setEvents

public void setEvents(java.util.Vector vecEvents)
This method sets the categorie's initial events.

Parameters:
vecEvents - Specifies the categorie's events.

addEvent

public void addEvent(CalendarEvent event)
This method adds an event to the category.

Parameters:
event - Specifies the calendar event to add to this category.

getFile

public java.io.File getFile()
This method returns the calendar events file object.

Returns:
Returns the categorie's file object.

unsetFile

public void unsetFile()
This method Sets the categories file handle to null. This is done if all the data has been read from the file database.


getName

public java.lang.String getName()
This method returns the categorie's name.

Returns:
Returns the categorie's name.

getEvents

public java.util.Vector getEvents()
This method returns the categorie's events.

Returns:
Returns a Vector of all CalendarEvent objects.

getMatchingEvents

public java.util.Vector getMatchingEvents(ClientRequest clientRequest)
This method looks for all calendar events of this category which matches a given client's request.

Parameters:
clientRequest - Specifies the client request sent by the calendar client.
Returns:
Returns a Vector of all matching CalendarEvent objects.

matchesName

public boolean matchesName(java.util.regex.Pattern pattern)
This method checks the current category's name against a regular expression pattern.

Parameters:
pattern - Specifies the pattern to be used.
Returns:
Returns true if the event matches, else false will be returned.

removeEvent

public void removeEvent(CalendarEvent event)
This method removes a given event from its event vector.

Parameters:
event - Specifies the calendar event object to be removed from this category

hasChanged

public boolean hasChanged()
This method lets you check if the calendar category has been modified/changed by a calendar client request. This is needed by the CalendarDatabase.flush method, to write all the changes back to the database files.

Returns:
Returns true if the category has changed, else it will return false.

setHasChanged

public void setHasChanged(boolean bHasChanged)
This method specifies if the calendar category has been modified/changed or not.

Parameters:
bHasChanged - Specifies if the category has been modified/changed or not.

flush

public void flush()
This method flushes the calendar category to the database at the filesystem.