public class TaskManager extends Object
Modifier and Type | Method and Description |
---|---|
(package private) static void |
generateSelectAndFromClauseForTaskLog(StringBuilder sql)
Generate a select and from clause.
|
DataSource |
getDataSource()
Get the data source.
|
static TaskManager |
getInstance(DataSource ds)
Get an instance of the logger.
|
TaskLog |
getLastLog(Task task)
Get the last log.
|
TaskLog |
getLastTaskLog(Class<? extends Task> type)
Get the task log for the last data conversion.
|
TaskLog |
getTaskLog(int databaseID)
Get a task log by database ID.
|
List<TaskLog> |
getTaskLogs(String identifier,
Long version,
String user,
TaskRunStatus status)
Get TaskLogs that match the specified criteria.
|
List<TaskLog> |
getTaskLogs(Task task)
Get all task logs for the specified task.
|
Map<DataConversion,TaskRunStatus> |
getTaskRunStatusMap(List<DataConversion> tasks)
Get a mapping of task statuses.
|
TaskRunStatus |
getTaskStatus(Task task)
Get the status of a task.
|
(package private) static List<Loggable> |
loadLogs(Connection conn,
int databaseID)
Load the logs.
|
(package private) List<Loggable> |
loadLogs(TaskLog taskLog)
Load the logs.
|
(package private) TaskLog |
loadTaskLog(Connection conn,
ResultSet rs)
Loads a row from a result set.
|
void |
log(TaskLog taskLog)
Write the log to the database.
|
static void generateSelectAndFromClauseForTaskLog(StringBuilder sql)
sql
- the string builder.public DataSource getDataSource()
public static TaskManager getInstance(DataSource ds) throws SQLException
ds
- the data source.SQLException
- if the logger couldn't be initialized.public TaskLog getLastLog(Task task) throws SQLException
task
- the task.SQLException
- if an error occurs.@Nullable public TaskLog getLastTaskLog(Class<? extends Task> type) throws SQLException
type
- the type of Task.SQLException
- on error.@Nullable public TaskLog getTaskLog(int databaseID) throws SQLException
databaseID
- the database ID.SQLException
- if an error occurs.public List<TaskLog> getTaskLogs(String identifier, @Nullable Long version, @Nullable String user, @Nullable TaskRunStatus status) throws SQLException
identifier
- optional Task identifier.version
- optional version.user
- optional user.status
- optional status.SQLException
- if an error occurs.public List<TaskLog> getTaskLogs(Task task) throws SQLException
task
- the task.SQLException
- if an error occurs.public Map<DataConversion,TaskRunStatus> getTaskRunStatusMap(List<DataConversion> tasks) throws SQLException
tasks
- the tasks.SQLException
- on error.public TaskRunStatus getTaskStatus(Task task) throws SQLException
task
- the task.SQLException
- on error.static List<Loggable> loadLogs(Connection conn, int databaseID) throws SQLException
conn
- the database connection.databaseID
- the database ID of the TaskLog to load.SQLException
- on error.final List<Loggable> loadLogs(TaskLog taskLog)
taskLog
- the task log.final TaskLog loadTaskLog(Connection conn, ResultSet rs) throws SQLException
conn
- the connectionrs
- the result set.SQLException
- on error.public void log(TaskLog taskLog) throws SQLException
taskLog
- the log.SQLException
- if an error occurs.