/*
* File: BasicTaskManager.java
* Author: Daniel Rogers
* Created on Jan 4, 2010
*
*/
package gri.tasks.managers;
import gri.tasks.TaskDef;
import gri.tasks.AsyncTask;
import gri.tasks.Task;
/**
* TaskManager which simply stores a list of TaskEntry objects.
*
* @author rogersda
*/
public class BasicTaskManager implements TaskManager {
TaskCollection entries;
// --------------------------------------------- Constructors
public BasicTaskManager(TaskCollection entries) {
this.entries = entries;
}
// ------------------------------------------------ Accessors
public TaskCollection getTasks() {return entries;}
// ------------------------------------------- Implementation
public String [] getTaskIds() {
return entries.getTaskIds();
}
public TaskEntry getTaskEntry(String id) {
return entries.getTaskEntry(id);
}
public TaskDescription getTaskDescription(String id) {
TaskEntry entry = getTaskEntry(id);
return entry == null ?
null : entry.getTaskDescription();
}
public TaskDef getTaskDefinition(String id) {
Task task = getTask(id);
return task == null ?
null : task.getTaskDef();
}
public Task getTask(String id) {
TaskEntry entry = getTaskEntry(id);
return entry == null ?
null : entry.getTask();
}
public AsyncTask getAsyncTask(String id) {
TaskEntry entry = getTaskEntry(id);
return entry == null ?
null : entry.getAsyncTask();
}
}