org.chorem.jtimer.entities
Class TimerTask

java.lang.Object
  extended by org.chorem.jtimer.entities.TimerTask
All Implemented Interfaces:
Serializable, Cloneable, Comparable<TimerTask>
Direct Known Subclasses:
TimerProject

public class TimerTask
extends Object
implements Cloneable, Comparable<TimerTask>, Serializable

Represents a task. This task is cloneable using SerializationUtils (commons-lang).

Version:
$Revision: 2716 $ Last update : $Date: 2009-12-18 10:11:04 +0100 (ven., 18 déc. 2009) $ By : $Author: echatellier $
Author:
chatellier
See Also:
SerializationUtils, Serialized Form

Field Summary
protected  List<TimerAlert> alerts
          Task alerts.
protected  SortedMap<Date,Long> allDaysAndTimes
          Map calendar of day -> time.
protected  SortedMap<Date,String> allDaysAnnotations
          Map date -> annotation text.
protected  boolean closed
          Closed task.
protected  Date creationDate
          Creation date.
protected  String name
          Task name.
protected  int number
          Task number.
protected  TimerTask parent
          Parent Task.
protected  List<TimerTask> subTasks
          Sub tasks.
 
Constructor Summary
TimerTask()
          Constructor.
TimerTask(String name)
          Constructor with name.
 
Method Summary
 void addAlert(TimerAlert alert)
          Add alert.
 void addAnnotation(Date date, String note)
          Add annotation.
 boolean addTask(TimerTask t)
          Add task's subtask.
 TimerTask clone()
          Clone task.
 int compareTo(TimerTask o)
           
 boolean equals(Object o)
           
 List<TimerAlert> getAlerts()
          Get alert list.
 SortedMap<Date,Long> getAllDaysAndTimes()
          Return all data.
 SortedMap<Date,String> getAllDaysAnnotations()
          Return all annotation, sorted on date.
 Date getCreationDate()
          Get task creation date.
 String getName()
          Get task name.
 int getNumber()
          Get task number.
 TimerTask getParent()
          Get parent.
 List<TimerTask> getSubTasks()
          Get task's subtasks.
 long getTime(Date date)
          Get time at date.
 boolean isClosed()
          Get closed task state.
 void setAlert(List<TimerAlert> alerts)
          Set alert.
 void setClosed(boolean closed)
          Set closed.
 void setCreationDate(Date creationDate)
          Set task creation date.
 void setName(String name)
          Set task name.
 void setNumber(int number)
          Set task number.
protected  void setParent(TimerTask parent)
          Set parent.
 void setTime(Date date, Long seconds)
          Add time.
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

number

protected int number
Task number.


name

protected String name
Task name.


creationDate

protected Date creationDate
Creation date.


closed

protected boolean closed
Closed task.


parent

protected TimerTask parent
Parent Task. More convenient


allDaysAndTimes

protected SortedMap<Date,Long> allDaysAndTimes
Map calendar of day -> time. (ordered on keys)


allDaysAnnotations

protected SortedMap<Date,String> allDaysAnnotations
Map date -> annotation text.


subTasks

protected List<TimerTask> subTasks
Sub tasks.


alerts

protected List<TimerAlert> alerts
Task alerts.

Constructor Detail

TimerTask

public TimerTask()
Constructor.


TimerTask

public TimerTask(String name)
Constructor with name.

Parameters:
name - task name
Method Detail

getNumber

public int getNumber()
Get task number.

Returns:
the number

setNumber

public void setNumber(int number)
Set task number.

Parameters:
number - the number to set

getName

public String getName()
Get task name.

Returns:
the name

setName

public void setName(String name)
Set task name.

Parameters:
name - the name to set

getCreationDate

public Date getCreationDate()
Get task creation date.

Returns:
task creation date

setCreationDate

public void setCreationDate(Date creationDate)
Set task creation date.

Parameters:
creationDate - creation date

isClosed

public boolean isClosed()
Get closed task state.

Returns:
true if task is closed

setClosed

public void setClosed(boolean closed)
Set closed.

Parameters:
closed - closed

getParent

public TimerTask getParent()
Get parent. Can be null if there is no parent.

Returns:
the parent

setParent

protected void setParent(TimerTask parent)
Set parent.

Parameters:
parent - the parent to set

getSubTasks

public List<TimerTask> getSubTasks()
Get task's subtasks.

Returns:
the subTasks

addTask

public boolean addTask(TimerTask t)
Add task's subtask. Also add parent reference.

Parameters:
t - the task to add
Returns:
success flag

setTime

public void setTime(Date date,
                    Long seconds)
Add time. Calendar will be forced to 0h00:00.000

Parameters:
date - date
seconds - seconds

getTime

public long getTime(Date date)
Get time at date.

Parameters:
date - date
Returns:
time at specified date

getAllDaysAndTimes

public SortedMap<Date,Long> getAllDaysAndTimes()
Return all data. Sorted on date.

Returns:
total duration of all projects

addAnnotation

public void addAnnotation(Date date,
                          String note)
Add annotation.

Parameters:
date - date
note - note text

getAllDaysAnnotations

public SortedMap<Date,String> getAllDaysAnnotations()
Return all annotation, sorted on date.

Returns:
annotations

addAlert

public void addAlert(TimerAlert alert)
Add alert.

Parameters:
alert -

getAlerts

public List<TimerAlert> getAlerts()
Get alert list.

Returns:
alerts

setAlert

public void setAlert(List<TimerAlert> alerts)
Set alert.

Parameters:
alerts - new alerts list

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

clone

public TimerTask clone()
Clone task.

Overrides:
clone in class Object
Returns:
task copy

compareTo

public int compareTo(TimerTask o)
Specified by:
compareTo in interface Comparable<TimerTask>


Copyright © 2007-2010 CodeLutin. All Rights Reserved.