public interface TaskDAO
Modifier and Type | Method and Description |
---|---|
void |
acceptTask(java.sql.Connection connection,
int taskId)
Change a task from free to unavailable.
|
void |
addTask(java.sql.Connection connection,
int id,
java.lang.String name,
java.lang.String description,
java.sql.Timestamp start_time,
java.sql.Timestamp end_time,
double price,
boolean creator_accepted,
double location_latitude,
double location_longitude)
Persists a task into the database given a Task object.
|
void |
cancelTask(java.sql.Connection connection,
int taskId)
Changes a task from unavailable to free.
|
void |
copyTaskToFinished(java.sql.Connection connection,
int taskId)
Transfer task from Task table to Finish_Task table.
|
AbstractTask |
getTask(java.sql.Connection connection,
int task_id)
Returns version of the task currently in database.
|
java.util.List<AbstractTask> |
getTaskList(java.sql.Connection connection) |
java.util.List<AbstractTask> |
getTaskList(java.sql.Connection connection,
int count,
int startingIndex,
java.util.List<TaskFilter> filters)
Returns a list of tasks that user can complete
|
void |
removeTask(java.sql.Connection connection,
int task_id)
Remove task from database.
|
void addTask(java.sql.Connection connection, int id, java.lang.String name, java.lang.String description, java.sql.Timestamp start_time, java.sql.Timestamp end_time, double price, boolean creator_accepted, double location_latitude, double location_longitude) throws UserRetrievalException, java.sql.SQLException
connection
- database connectionid
- id of the username
- Name of the user.description
- description of the new taskstart_time
- start time of the task. Format should be 'MM-DD-YY HH:mm'end_time
- end time of the task. Format should be 'MM-DD-YY HH:mm'price
- compensation amount of the task.creator_accepted
- 1 if creator accepted, 0 if not.location_latitude
- latitude of the task locationlocation_longitude
- longitude of the task locationUserRetrievalException
- Attempt to add task with no valid userjava.sql.SQLException
- for failure of SQL executionvoid removeTask(java.sql.Connection connection, int task_id) throws java.sql.SQLException
connection
- Mysql connection.task_id
- Task to be deleted.java.sql.SQLException
- SQL execution.AbstractTask getTask(java.sql.Connection connection, int task_id) throws TaskRetrievalException, java.sql.SQLException
connection
- database connectiontask_id
- task ID assigned to the Task.TaskRetrievalException
- for failure in retrieving a corresponding taskjava.sql.SQLException
- for failure in sql executionjava.util.List<AbstractTask> getTaskList(java.sql.Connection connection, int count, int startingIndex, java.util.List<TaskFilter> filters) throws java.sql.SQLException
connection
- Database connection.count
- Number of tasks in the task list.startingIndex
- The beginning index to be viewed.filters
- The list of filters to be appliedjava.sql.SQLException
- For failure in sql execution.java.util.List<AbstractTask> getTaskList(java.sql.Connection connection) throws java.sql.SQLException
connection
- Database connection.java.sql.SQLException
- When connection fails.void acceptTask(java.sql.Connection connection, int taskId) throws java.sql.SQLException
connection
- Database connectiontaskId
- Task to be accepted.java.sql.SQLException
- When connection fails.void cancelTask(java.sql.Connection connection, int taskId) throws java.sql.SQLException
connection
- Database connection.taskId
- Task to be freed.java.sql.SQLException
- When connection fails.void copyTaskToFinished(java.sql.Connection connection, int taskId) throws java.sql.SQLException
connection
- Database connection.taskId
- Task to transferred.java.sql.SQLException
- When connection fails.