Interface TaskStore
- All Known Implementing Classes:
TaskStoreImpl
public interface TaskStore
This interface describes basic Task storing functionality, where every Task is uniquely represented by both its ID,
and the Facility and Service it contains.
Storage is meant to be in-memory pool.
-
Method Summary
Modifier and TypeMethodDescriptionAdd Task to TaskStore.void
clear()
Clear all Tasks from TaskStore.Get all Tasks present in a TaskStore.int
getSize()
Get current size of TaskStore (number of Tasks stored).getTask
(int id) Get Task by its ID.Get Task by its Facility and Service.getTasksWithStatus
(Task.TaskStatus... status) Get all Tasks which are in any of specified statuses.removeTask
(int id, int runId) Remove Task from TaskStore by its ID.removeTask
(Task task) Remove Task from TaskStore
-
Method Details
-
addTask
Add Task to TaskStore.- Parameters:
task
- Task to be added- Returns:
- Added Task
- Throws:
TaskStoreException
- When Task can't be added because of some kind of inconsistency
-
clear
void clear()Clear all Tasks from TaskStore. -
getAllTasks
Collection<Task> getAllTasks()Get all Tasks present in a TaskStore.- Returns:
- All Tasks from TaskStore
-
getSize
int getSize()Get current size of TaskStore (number of Tasks stored).- Returns:
- Number of Tasks stored in a TaskStore
-
getTask
Get Task by its ID.- Parameters:
id
- ID of Task to get- Returns:
- Task by its ID
-
getTask
Get Task by its Facility and Service.- Parameters:
facility
- Facility to get Task forservice
- Service to get Task for- Returns:
- Task by its Facility and Service
-
getTasksWithStatus
Get all Tasks which are in any of specified statuses.- Parameters:
status
- Array of expected TaskStatuses- Returns:
- All Tasks which are in any of expected statuses.
- See Also:
-
removeTask
Remove Task from TaskStore by its ID.- Parameters:
id
- ID of Task to be removedrunId
- run ID of Task to be removed- Returns:
- Removed Task
- Throws:
TaskStoreException
- When Task can't be removed because of some kind of inconsistency
-
removeTask
Remove Task from TaskStore- Parameters:
task
- Task to be removed- Returns:
- Removed Task
- Throws:
TaskStoreException
- When Task can't be removed because of some kind of inconsistency
-