Compoze Software, Inc.

com.compoze.todo
Class ToDo

java.lang.Object
  |
  +--com.compoze.todo.ToDo
All Implemented Interfaces:
java.io.Serializable

public class ToDo
extends java.lang.Object
implements java.io.Serializable

This class represents a to do.

To add and search for to dos, see the ToDos collection class. Once the list is obtained, its accessor methods may be called to set and get properties. The update() method must be called to store any changes to the server.

A ToDo conforms to the vCalendar specification (RFC #2445). To generate a vCalendar compliant representation of a todo, use toVcalendarString().

The following table contains the mappings from To Do properties to their corresponding Java methods:

To Do Property Java Methods
ToDoProperty.BILLING_INFORMATION getBillingInformation()
ToDoProperty.CATEGORY getCategories()
ToDoProperty.COMPLETE_DATE getCompleteDate()
ToDoProperty.DATE_CREATED getDateCreated()
ToDoProperty.DATE_LAST_MODIFIED getDateLastModified()
ToDoProperty.DATE_RECURRENCE isRecurring()
ToDoProperty.DESCRIPTION getDescription()
ToDoProperty.DUE_DATE getDueDate()
ToDoProperty.FLAG getFlag()
ToDoProperty.LOCATION getLocation()
ToDoProperty.MILEAGE getMileage()
ToDoProperty.ORGANIZER getOrganizer()
ToDoProperty.PERCENT getPercent()
ToDoProperty.PRIORITY getPriority()
ToDoProperty.START_DATE getStartDate()
ToDoProperty.STATUS getStatus()
ToDoProperty.SUMMARY getSummary()
ToDoProperty.CUSTOM_NUM1 getCustomNum1()
ToDoProperty.CUSTOM_NUM2 getCustomNum2()
ToDoProperty.CUSTOM_NUM3 getCustomNum3()
ToDoProperty.CUSTOM_NUM4 getCustomNum4()
ToDoProperty.CUSTOM_STR1 getCustomStr1()
ToDoProperty.CUSTOM_STR2 getCustomStr2()
ToDoProperty.CUSTOM_STR3 getCustomStr3()
ToDoProperty.CUSTOM_STR4 getCustomStr4()

See Also:
Serialized Form

Field Summary
static java.lang.String DEFAULT_VCALENDAR_VERSION
          The default vCalendar version.
 
Constructor Summary
ToDo()
          Constructor.
 
Method Summary
 void addCategory(Category category)
          Adds the specified category to the list of categories.
 void clearDateRecurrence()
          Clears the date recurrence for the to do.
 void clearFlag()
          Clears the flag on this to do.
 void delete()
          Deletes the to do.
 void flag(Flag flag)
          Flags this to do with the specified flag.
 AccessManager getAccessManager()
          Gets the access manager for this to do.
 java.lang.String getBillingInformation()
          Gets the billing information of the to do.
 Categories getCategories()
          Gets the list of categories.
 java.util.Date getCompleteDate()
          Gets the complete date.
 java.lang.String getCompleteDateString(java.text.DateFormat dateFormat)
          Gets the complete date formatted string.
 long getCustomNum1()
          Gets the custom number1 field of the to do.
 long getCustomNum2()
          Gets the custom number2 field of the to do.
 long getCustomNum3()
          Gets the custom number3 field of the to do.
 long getCustomNum4()
          Gets the custom number4 field of the to do.
 java.lang.String getCustomStr1()
          Gets the custom string1 field of the to do.
 java.lang.String getCustomStr2()
          Gets the custom string2 field of the to do.
 java.lang.String getCustomStr3()
          Gets the custom string3 field of the to do.
 java.lang.String getCustomStr4()
          Gets the custom string4 field of the to do.
 java.util.Date getDateCreated()
          Gets the date the to do was created.
 java.util.Date getDateLastModified()
          Gets the date the to do was last modified.
 DateRecurrence getDateRecurrence()
          Gets the date recurrence for the to do.
 java.lang.String getDescription()
          Gets the description of the to do.
 java.util.Date getDueDate()
          Gets the due date.
 java.lang.String getDueDateString(java.text.DateFormat dateFormat)
          Gets the due date formatted string.
 Flag getFlag()
          Gets the flag of the to do.
 long getID()
          Gets the unique identifier (id) of the to do.
 java.lang.String getLocation()
          Gets the location of the to do.
 java.lang.String getMileage()
          Gets the mileage of the to do.
 java.lang.String getOrganizer()
          Gets the name of the organizer.
 ToDo getParent()
          Gets the parent to do of this to do.
 long getParentToDoID()
          Gets the parent to do id of this to do.
 int getPercent()
          Gets the percent complete.
 Priority getPriority()
          Gets the priority of the to do.
 java.util.Date getStartDate()
          Gets the start date.
 java.lang.String getStartDateString(java.text.DateFormat dateFormat)
          Gets the start date formatted string.
 Status getStatus()
          Gets the status of the to do.
 java.lang.String getSummary()
          Gets the summary of the to do.
 java.lang.String getSummary(int iLength)
          Gets the summary of the to do.
 java.lang.String getSummary(int iLength, java.util.Locale locale)
          Gets the summary of the to do.
 java.lang.String getSummary(java.util.Locale locale)
          Gets the summary of the to do.
 ToDos getToDos()
          Gets the sub-tos of this to do.
 boolean isComplete()
          Checks if the to do is complete.
 boolean isHighPriority()
          Checks if the to do is high priority.
 boolean isRecurring()
          Checks if this to do is a recurring to do (its date recurrence is not null).
 void markComplete()
          Marks the to do as completed and sets the complete date.
 void removeCategories()
          Removes all categories from the list of categories.
 void removeCategory(Category category)
          Removes the specified category from the list of categories.
 void setBillingInformation(java.lang.String sBillingInformation)
          Sets the billing information of the to do.
 void setCompleteDate(java.util.Date completeDate)
          Sets the complete date.
 void setCustomNum1(long lCustomNum1)
          Sets the custom number1 field of the to do.
 void setCustomNum2(long lCustomNum2)
          Sets the custom number2 field of the to do.
 void setCustomNum3(long lCustomNum3)
          Sets the custom number3 field of the to do.
 void setCustomNum4(long lCustomNum4)
          Sets the custom number4 field of the to do.
 void setCustomStr1(java.lang.String sCustomStr1)
          Sets the custom string1 field of the to do.
 void setCustomStr2(java.lang.String sCustomStr2)
          Sets the custom string2 field of the to do.
 void setCustomStr3(java.lang.String sCustomStr3)
          Sets the custom string3 field of the to do.
 void setCustomStr4(java.lang.String sCustomStr4)
          Sets the custom string4 field of the to do.
 void setDateRecurrence(DateRecurrence recurrence)
          Sets the date recurrence that defines a recurring to do.
 void setDescription(java.lang.String sDescription)
          Sets the description of the to do.
 void setDueDate(java.util.Date dueDate)
          Sets the due date.
 void setLocation(java.lang.String sLocation)
          Sets the location of the to do.
 void setMileage(java.lang.String sMileage)
          Sets the mileage of the to do.
 void setPercent(int iPercent)
          Sets the percent complete.
 void setPriority(Priority priority)
          Sets the priority of the to do.
 void setStartDate(java.util.Date startDate)
          Sets the start date.
 void setStatus(Status status)
          Sets the status of the to do.
 void setSummary(java.lang.String sSummary)
          Sets the summary of the to do.
 java.lang.String toString()
          Returns a string representation of the object.
 java.lang.String toVcalendarString()
          Creates a string that contains the vCalendar compliant (RFC #2445) representation of the to do.
 java.lang.String toVcalendarString(java.lang.String sVersion)
          Creates a string that contains the vCalendar compliant (RFC #2445) representation of the to do.
 boolean update()
          Updates the to do (saves the to do entry).
 boolean update(boolean bForce)
          Updates the to do (saves the to do entry).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_VCALENDAR_VERSION

public static final java.lang.String DEFAULT_VCALENDAR_VERSION
The default vCalendar version.
See Also:
toVcalendarString()
Constructor Detail

ToDo

public ToDo()
Constructor. NOTE: This default constructor technically leaves the to do in an invalid state. Use ToDos.add() to create a to do.
Method Detail

getID

public long getID()
Gets the unique identifier (id) of the to do. This is non-zero number that uniquely identifies the to do.
Returns:
the id of the to do

setDateRecurrence

public void setDateRecurrence(DateRecurrence recurrence)
Sets the date recurrence that defines a recurring to do. The date recurrence is based on the date and time of the first instance.

To clear the date recurrence, use clearDateRecurrence(). If recurrence is set on a to do, once the to do is marked completed markComplete(), the next to do in the recurrence is created.

Parameters:
recurrence - the date recurrence (may not be null)

getDateRecurrence

public DateRecurrence getDateRecurrence()
Gets the date recurrence for the to do. If you want to check to see if a to do is recurring, use the isRecurring() method.
Returns:
the date recurrence for the to do or null if it is not set

clearDateRecurrence

public void clearDateRecurrence()
Clears the date recurrence for the to do.

isRecurring

public boolean isRecurring()
Checks if this to do is a recurring to do (its date recurrence is not null).
Returns:
true if this to do is a recurring to do; false otherwise

getOrganizer

public java.lang.String getOrganizer()
Gets the name of the organizer. The organizer is the name of the user who originally created this to do.
Returns:
the organizer name

getSummary

public java.lang.String getSummary()
Gets the summary of the to do. If the summary is an empty string, the setting todo.summary from todo_resources.properties is returned. This will prevent an empty string from being returned. If you wish to return the empty string, set todo.summary to blank. The default locale is used.
Returns:
the summary of the to do
See Also:
getSummary(java.util.Locale)

getSummary

public java.lang.String getSummary(java.util.Locale locale)
Gets the summary of the to do.

If the summary is an empty string, the setting todo.summary from todo_resources.properties is returned. This will prevent an empty string from being returned. If you wish to return the empty string, set todo.summary to blank.

Parameters:
locale - the locale to use
Returns:
the summary of the to do

getSummary

public java.lang.String getSummary(int iLength,
                                   java.util.Locale locale)
Gets the summary of the to do. The summary is truncated after the specified number of characters and "..." is appended to it.
Parameters:
iLength - the maximum length of the result (string plus "...")
locale - the locale to use
Returns:
the truncated summary of the to do

getSummary

public java.lang.String getSummary(int iLength)
Gets the summary of the to do. The summary is truncated after the specified number of characters and "..." is appended to it.
Parameters:
iLength - the maximum length of the result (string plus "...")
Returns:
the truncated summary of the to do

setSummary

public void setSummary(java.lang.String sSummary)
Sets the summary of the to do.
Parameters:
sSummary - the summary of to do

getLocation

public java.lang.String getLocation()
Gets the location of the to do.
Returns:
the location of the to do

setLocation

public void setLocation(java.lang.String sLocation)
Sets the location of the to do.
Parameters:
sLocation - the location of to do

getBillingInformation

public java.lang.String getBillingInformation()
Gets the billing information of the to do.
Returns:
the billing information of the to do

setBillingInformation

public void setBillingInformation(java.lang.String sBillingInformation)
Sets the billing information of the to do.
Parameters:
sBillingInformation - the billing information of to do

getMileage

public java.lang.String getMileage()
Gets the mileage of the to do.
Returns:
the mileage of the to do

setMileage

public void setMileage(java.lang.String sMileage)
Sets the mileage of the to do.
Parameters:
sMileage - the mileage of to do

getDescription

public java.lang.String getDescription()
Gets the description of the to do.
Returns:
the description of the to do

setDescription

public void setDescription(java.lang.String sDescription)
Sets the description of the to do.
Parameters:
sDescription - the description of to do

markComplete

public void markComplete()
Marks the to do as completed and sets the complete date. If the to do is recurring, the next to do in the recurrence is created.
See Also:
Status.COMPLETED, setStatus(Status), getCompleteDate(), isRecurring()

setStatus

public void setStatus(Status status)
Sets the status of the to do.
Parameters:
status - the status to set the to do (may not be null)

getStatus

public Status getStatus()
Gets the status of the to do.
Returns:
the status of the to do

isComplete

public boolean isComplete()
Checks if the to do is complete.
Returns:
true if the to do is complete; false otherwise
See Also:
Status.COMPLETED

setPriority

public void setPriority(Priority priority)
Sets the priority of the to do.
Parameters:
priority - the priority to set the to do (may not be null)

getPriority

public Priority getPriority()
Gets the priority of the to do.
Returns:
the priority of the to do

isHighPriority

public boolean isHighPriority()
Checks if the to do is high priority.
Returns:
true if the to do is high priority; false otherwise
See Also:
Priority.HIGH

getFlag

public Flag getFlag()
Gets the flag of the to do.
Returns:
the flag of the to do or null for none

flag

public void flag(Flag flag)
Flags this to do with the specified flag.
Parameters:
flag - the flag

clearFlag

public void clearFlag()
Clears the flag on this to do.

getPercent

public int getPercent()
Gets the percent complete.
Returns:
the percentage of the to do that is complete (between 0 and 100)

setPercent

public void setPercent(int iPercent)
Sets the percent complete.
Parameters:
iPercent - the percentage of the to do that is complete (must be between 0 and 100, inclusive)
Throws:
java.lang.IllegalArgumentException - if the specified percentage is not between 0 and 100, inclusive
See Also:
setPercent(int)

getDueDate

public java.util.Date getDueDate()
Gets the due date.
Returns:
the due date or null if not set

setDueDate

public void setDueDate(java.util.Date dueDate)
Sets the due date.
Parameters:
dueDate - the due date or null to not set

getDueDateString

public java.lang.String getDueDateString(java.text.DateFormat dateFormat)
Gets the due date formatted string.

If the due date is not set (null), the setting todo.due_date from todo_resources.properties is returned. This will prevent an empty string from being returned. If you wish to return the empty string, set todo.due_date to blank.

Returns:
the due date formatted string

getStartDate

public java.util.Date getStartDate()
Gets the start date.
Returns:
the start date or null if not set

getStartDateString

public java.lang.String getStartDateString(java.text.DateFormat dateFormat)
Gets the start date formatted string.

If the start date is not set (null), the setting todo.start_date from todo_resources.properties is returned. This will prevent an empty string from being returned. If you wish to return the empty string, set todo.start_date to blank.

Returns:
the start date formatted string

setStartDate

public void setStartDate(java.util.Date startDate)
Sets the start date.
Parameters:
startDate - the start date or null to not set

setCompleteDate

public void setCompleteDate(java.util.Date completeDate)
Sets the complete date.
Parameters:
completeDate - the complete date or null to not set

getCompleteDate

public java.util.Date getCompleteDate()
Gets the complete date.
Returns:
the complete date or null if not set

getCompleteDateString

public java.lang.String getCompleteDateString(java.text.DateFormat dateFormat)
Gets the complete date formatted string.

If the complete date is not set (null), the setting todo.complete_date from todo_resources.properties is returned. This will prevent an empty string from being returned. If you wish to return the empty string, set todo.complete_date to blank.

Returns:
the complete date formatted string

getCategories

public Categories getCategories()
Gets the list of categories. Any modification to this collection of category objects will not be reflected in the to do. To modify the list of categories, use addCategory(Category) and removeCategory(Category).
Returns:
the categories collection or null if no categories are set
See Also:
Category, addCategory(Category), removeCategory(Category)

addCategory

public void addCategory(Category category)
Adds the specified category to the list of categories.
Parameters:
category - the category to add (may not be null)
See Also:
getCategories(), removeCategory(Category)

removeCategories

public void removeCategories()
Removes all categories from the list of categories.
See Also:
getCategories(), addCategory(Category), removeCategory(Category)

removeCategory

public void removeCategory(Category category)
Removes the specified category from the list of categories.
Parameters:
category - the category to remove (may not be null)
See Also:
getCategories(), addCategory(Category)

getDateCreated

public java.util.Date getDateCreated()
Gets the date the to do was created.
Returns:
the date created

getDateLastModified

public java.util.Date getDateLastModified()
Gets the date the to do was last modified.
Returns:
the date last modified

getCustomNum1

public long getCustomNum1()
Gets the custom number1 field of the to do.
Returns:
the custom number1 field of the to do or null if the custom number1 field is not set

setCustomNum1

public void setCustomNum1(long lCustomNum1)
Sets the custom number1 field of the to do.
Parameters:
lCustomNum1 - the custom number1 field of the to do

getCustomNum2

public long getCustomNum2()
Gets the custom number2 field of the to do.
Returns:
the custom number2 field of the to do or null if the custom number2 field is not set

setCustomNum2

public void setCustomNum2(long lCustomNum2)
Sets the custom number2 field of the to do.
Parameters:
lCustomNum2 - the custom number2 field of the to do

getCustomNum3

public long getCustomNum3()
Gets the custom number3 field of the to do.
Returns:
the custom number3 field of the to do or null if the custom number3 field is not set

setCustomNum3

public void setCustomNum3(long lCustomNum3)
Sets the custom number3 field of the to do.
Parameters:
lCustomNum3 - the custom number3 field of the to do

getCustomNum4

public long getCustomNum4()
Gets the custom number4 field of the to do.
Returns:
the custom number4 field of the to do or null if the custom number4 field is not set

setCustomNum4

public void setCustomNum4(long lCustomNum4)
Sets the custom number4 field of the to do.
Parameters:
lCustomNum4 - the custom number4 field of the to do

getCustomStr1

public java.lang.String getCustomStr1()
Gets the custom string1 field of the to do.
Returns:
the custom string1 field of the to do or null if the custom string1 field is not set

setCustomStr1

public void setCustomStr1(java.lang.String sCustomStr1)
Sets the custom string1 field of the to do.
Parameters:
sCustomStr1 - the custom string1 field of the to do

getCustomStr2

public java.lang.String getCustomStr2()
Gets the custom string2 field of the to do.
Returns:
the custom string2 field of the to do or null if the custom string2 field is not set

setCustomStr2

public void setCustomStr2(java.lang.String sCustomStr2)
Sets the custom string2 field of the to do.
Parameters:
sCustomStr2 - the custom string2 field of the to do

getCustomStr3

public java.lang.String getCustomStr3()
Gets the custom string3 field of the to do.
Returns:
the custom string3 field of the to do or null if the custom string3 field is not set

setCustomStr3

public void setCustomStr3(java.lang.String sCustomStr3)
Sets the custom string3 field of the to do.
Parameters:
sCustomStr3 - the custom string3 field of the to do

getCustomStr4

public java.lang.String getCustomStr4()
Gets the custom string4 field of the to do.
Returns:
the custom string4 field of the to do or null if the custom string4 field is not set

setCustomStr4

public void setCustomStr4(java.lang.String sCustomStr4)
Sets the custom string4 field of the to do.
Parameters:
sCustomStr4 - the custom string4 field of the to do

getAccessManager

public AccessManager getAccessManager()
                               throws AccessManagerException
Gets the access manager for this to do. The access manager is used to modify the permissions.
Returns:
the access manager for this to do
Throws:
AccessManagerException - an error occurs retrieving the access manager
See Also:
ToDoPermission

getParentToDoID

public long getParentToDoID()
Gets the parent to do id of this to do.
Returns:
the parent id of this to do (or 0 if there is no parent)

getParent

public ToDo getParent()
Gets the parent to do of this to do.
Returns:
the parent of this to do (or null if there is no parent)

getToDos

public ToDos getToDos()
Gets the sub-tos of this to do.
Returns:
the sub-tos of this to do

update

public boolean update()
               throws java.security.AccessControlException
Updates the to do (saves the to do entry). This method must be called to commit changes to the to do.
Returns:
true if the update is successful; false otherwise
Throws:
java.security.AccessControlException - occurs if the user does not have permission to edit the to do

update

public boolean update(boolean bForce)
               throws java.security.AccessControlException
Updates the to do (saves the to do entry). This method must be called to commit changes to the to do.
Parameters:
bForce - true to force the update; false otherwise (currently ignored)
Returns:
true if the update is successful; false otherwise
Throws:
java.security.AccessControlException - occurs if the user does not have permission to edit the to do

delete

public void delete()
            throws java.security.AccessControlException
Deletes the to do. Any sub-to dos are also deleted (recursive).
Throws:
java.security.AccessControlException - occurs if the user does not have permission to delete the to do

toVcalendarString

public java.lang.String toVcalendarString()
Creates a string that contains the vCalendar compliant (RFC #2445) representation of the to do. The default vCalendar version is used.
Returns:
the vCalendar string
See Also:
DEFAULT_VCALENDAR_VERSION

toVcalendarString

public java.lang.String toVcalendarString(java.lang.String sVersion)
Creates a string that contains the vCalendar compliant (RFC #2445) representation of the to do.
Parameters:
sVersion - the vCalendar version to present
Returns:
the vCalendar string

toString

public java.lang.String toString()
Returns a string representation of the object.
Overrides:
toString in class java.lang.Object
Returns:
the string representation of the object

Compoze Software, Inc.

Copyright ©1999-2003 Compoze Software, Inc. All rights reserved.