Package com.openkm.service
Class TaskService
- java.lang.Object
-
- com.openkm.service.TaskService
-
@Service public class TaskService extends Object
Task service. Register every periodic task and execute in a pool.- Author:
- jabad
-
-
Constructor Summary
Constructors Constructor Description TaskService()Public constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeleteExecutionEvents(long id)Delete execution events.voiddeleteTask(FormProperties formProperties)Delete task from system.voidexecuteTask(FormProperties formProperties)Create task from form properties.Set<Long>findExecutionWithErrorsNotRevised()Find executions with errors.List<TaskExecutionEvent>getExecutionEvents(long id)Get execution event from an execution.List<TaskExecution>getExecutions(long id)Get executions for a task.TaskExecutiongetTaskExecutionById(String id)Load a task execution by id.longinsertTask(FormProperties properties)Insert task.longinsertTaskExecution(long id)Insert task execution.voidinsertTaskExecutionEvent(long taskExecutionId, String description, String type)Insert task execution event.List<FormProperties>loadAllTasks()Load all tasks.FormPropertiesloadTaskById(long id)Load task by id.voidmarkAllAsRevised(String id)MArk every execution for a task as revised.voidmarkAsRevised(String id)Mark an execution as revised.voidstopAllTasks()Stop all tasks.voidstopTask(FormProperties formProperties)Stop task.voidupdateTask(FormProperties properties)Update task data.voidupdateTaskExecution(long taskExecutionId, String state)Update task execution.voidupdateTaskRunningState(long id, boolean state)Update running state for an execution.
-
-
-
Method Detail
-
executeTask
public void executeTask(FormProperties formProperties)
Create task from form properties.- Parameters:
formProperties- form properties
-
stopTask
public void stopTask(FormProperties formProperties)
Stop task.- Parameters:
formProperties- for properties
-
findExecutionWithErrorsNotRevised
public Set<Long> findExecutionWithErrorsNotRevised() throws ParseException, SQLException
Find executions with errors.- Returns:
- a list of id
- Throws:
ParseExceptionSQLException
-
loadTaskById
public FormProperties loadTaskById(long id) throws SQLException
Load task by id.- Parameters:
id- task id- Returns:
- task
- Throws:
SQLException
-
markAsRevised
public void markAsRevised(String id) throws SQLException
Mark an execution as revised.- Parameters:
id- execution id- Throws:
SQLException
-
markAllAsRevised
public void markAllAsRevised(String id) throws SQLException
MArk every execution for a task as revised.- Parameters:
id- task id- Throws:
SQLException
-
getExecutions
public List<TaskExecution> getExecutions(long id) throws SQLException, ParseException
Get executions for a task.- Parameters:
id- task id- Returns:
- a list of executions
- Throws:
SQLExceptionParseException
-
getTaskExecutionById
public TaskExecution getTaskExecutionById(String id) throws SQLException, ParseException
Load a task execution by id.- Parameters:
id- execution id- Returns:
- the execution
- Throws:
SQLExceptionParseException
-
getExecutionEvents
public List<TaskExecutionEvent> getExecutionEvents(long id) throws SQLException
Get execution event from an execution.- Parameters:
id- execution id- Returns:
- list of events
- Throws:
SQLException
-
insertTask
public long insertTask(FormProperties properties) throws SQLException
Insert task.- Parameters:
properties- task properties- Returns:
- the id of the inserted row
- Throws:
SQLException- exception
-
updateTask
public void updateTask(FormProperties properties) throws SQLException
Update task data.- Parameters:
properties- task properties- Throws:
SQLException
-
stopAllTasks
public void stopAllTasks() throws SQLExceptionStop all tasks.- Throws:
SQLException
-
loadAllTasks
public List<FormProperties> loadAllTasks() throws SQLException
Load all tasks.- Returns:
- a list of tasks
- Throws:
SQLException
-
insertTaskExecution
public long insertTaskExecution(long id) throws SQLExceptionInsert task execution.- Parameters:
id- task id- Returns:
- the id of the row inserted
- Throws:
SQLException
-
updateTaskRunningState
public void updateTaskRunningState(long id, boolean state) throws SQLExceptionUpdate running state for an execution.- Parameters:
id- execution idstate- state- Throws:
SQLException
-
updateTaskExecution
public void updateTaskExecution(long taskExecutionId, String state) throws SQLExceptionUpdate task execution.- Parameters:
taskExecutionId- task execution idstate- state- Throws:
SQLException
-
insertTaskExecutionEvent
public void insertTaskExecutionEvent(long taskExecutionId, String description, String type) throws SQLExceptionInsert task execution event.- Parameters:
taskExecutionId- execution iddescription- descriptiontype- type- Throws:
SQLException
-
deleteTask
public void deleteTask(FormProperties formProperties) throws SQLException
Delete task from system.- Parameters:
formProperties- form properties- Throws:
SQLException
-
deleteExecutionEvents
public void deleteExecutionEvents(long id) throws SQLExceptionDelete execution events.- Parameters:
id- task id- Throws:
SQLException
-
-