org.juniverse.jorganizer.todos
Class ToDoManager

java.lang.Object
  |
  +--org.juniverse.jorganizer.todos.ToDoManager
All Implemented Interfaces:
IToDoManager

public class ToDoManager
extends java.lang.Object
implements IToDoManager

This businesslogic class handles basic operatons like save, delete and delivere ToDo's

Author:
alexander ilg

Field Summary
private  java.lang.String rootDir
           
static java.lang.String SUFFIX
           
private  java.util.Vector todos
           
 
Constructor Summary
ToDoManager()
          Standardconstrutor for ToDoManager
This construtor uses the rootDir spezified in the org.juniverse.jorganizer.todos.Environment ResourceBundle

The constructor loads all ToDos
ToDoManager(java.lang.String rootDir)
          This constructor for the ToDoManager loads all ToDos from the directory spezified in the rootDir parameter
 
Method Summary
 void delete(ToDo todo)
          This method delete's the passed in ToDo object.
private  java.lang.String generateFileName(ToDo todo)
          This private method generates a filename for a *.todo file
Filenames are created by the following rules:
{timestamp_create_day_only} + "t" + {timestamp_as_unique_id} + "_" + {userid} + "_." + {SUFFIX}
 java.util.Vector getToDoByDate(java.util.Date date)
          Returns an Vector of ToDo objects with all ToDo's from a special date.
 java.util.Vector getToDos()
          This method returns an Vector of ToDo objects with all ToDo's that are stored in the system.
 java.util.Vector getToDosByFrom(int userid)
          Returns an Vector of ToDo objects with all ToDo's for a single user, that is specified in the userid attribute.
private  java.util.Vector load()
          This private method load's all *.todo files from the rootDir and saves them in the todos Vector.
 void save(ToDo todo)
          This method saves the passed in ToDo object if it is new.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rootDir

private java.lang.String rootDir

todos

private java.util.Vector todos

SUFFIX

public static final java.lang.String SUFFIX
See Also:
Constant Field Values
Constructor Detail

ToDoManager

public ToDoManager()
Standardconstrutor for ToDoManager
This construtor uses the rootDir spezified in the org.juniverse.jorganizer.todos.Environment ResourceBundle

The constructor loads all ToDos


ToDoManager

public ToDoManager(java.lang.String rootDir)
This constructor for the ToDoManager loads all ToDos from the directory spezified in the rootDir parameter

Parameters:
rootDir - the directory, where the todo files are stored.
Method Detail

load

private java.util.Vector load()
This private method load's all *.todo files from the rootDir and saves them in the todos Vector.


getToDos

public java.util.Vector getToDos()
Description copied from interface: IToDoManager
This method returns an Vector of ToDo objects with all ToDo's that are stored in the system.

Specified by:
getToDos in interface IToDoManager
Returns:
all ToDo's in a Vector
See Also:
IToDoManager.getToDos()

getToDosByFrom

public java.util.Vector getToDosByFrom(int userid)
Description copied from interface: IToDoManager
Returns an Vector of ToDo objects with all ToDo's for a single user, that is specified in the userid attribute.

Specified by:
getToDosByFrom in interface IToDoManager
Parameters:
userid - a valid userid of an JOrganizer user
Returns:
an Vector of ToDo's
See Also:
org.juniverse.jorganizer.todos.IToDoManager#getToDosByUserId(int)

getToDoByDate

public java.util.Vector getToDoByDate(java.util.Date date)
Description copied from interface: IToDoManager
Returns an Vector of ToDo objects with all ToDo's from a special date.

Specified by:
getToDoByDate in interface IToDoManager
Parameters:
date - a java.util.date object
Returns:
an Vector of ToDo's
See Also:
IToDoManager.getToDoByDate(Date)

save

public void save(ToDo todo)
Description copied from interface: IToDoManager
This method saves the passed in ToDo object if it is new. If it already exists, it will be updated

Specified by:
save in interface IToDoManager
Parameters:
todo - a ToDo object
See Also:
IToDoManager.save(ToDo)

generateFileName

private java.lang.String generateFileName(ToDo todo)
This private method generates a filename for a *.todo file
Filenames are created by the following rules:
{timestamp_create_day_only} + "t" + {timestamp_as_unique_id} + "_" + {userid} + "_." + {SUFFIX}


delete

public void delete(ToDo todo)
Description copied from interface: IToDoManager
This method delete's the passed in ToDo object.

Specified by:
delete in interface IToDoManager
Parameters:
todo - a ToDo object
See Also:
IToDoManager.delete(ToDo)