Package com.almis.awe.scheduler.dao
Class TaskDAO
java.lang.Object
com.almis.awe.config.ServiceConfig
com.almis.awe.scheduler.dao.TaskDAO
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
-
Constructor Summary
ConstructorDescriptionTaskDAO
(org.quartz.Scheduler scheduler, int storedExecutions, String executionLogPath, QueryService queryService, MaintainService maintainService, QueryUtil queryUtil, CalendarDAO calendarDAO, ServerDAO serverDAO, FileChecker fileChecker) Autowired constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
addTaskToScheduler
(Task task) Add task to the schedulerchangeStatus
(Task task, TaskExecution execution, TaskStatus status, String reason) Change a task statusdeleteTask
(Integer ideTsk) Delete a single task from schedulerdeleteTask
(List<Integer> ideTsk) Delete a task from schedulerendTask
(Task task, TaskExecution execution) End a taskvoid
executeDependency
(Integer taskId, TaskExecution parentExecution) Execute the task ask dependencyexecuteTaskNow
(Integer taskId, String user) Execute the selected task nowgetAverageTime
(Integer taskId) Get the average time as stringgetElapsedTime
(Date startDate) Retrieve elapsed time from a start date (without ms)getExecutionsToPurge
(Integer taskId, Integer executions) Retrieve executions to purge (sorted)long
getProgress
(Date initialDate, long averageExecution) Retrieve progresscom.fasterxml.jackson.databind.node.ObjectNode
getProgressNode
(long percentage) Retrieve progress nodecom.fasterxml.jackson.databind.node.ObjectNode
getStatusIcon
(TaskExecution execution) Generate status iconLoad task from task idgetTask
(Integer taskId, TaskLaunchType launchType) Load task from task idgetTask
(Integer taskId, String database, TaskLaunchType launchType) Load task from task idgetTask
(org.quartz.JobDetail jobDetail) Load task from job detailgetTask
(org.quartz.Trigger trigger) Load task from triggergetTaskExecution
(Task task, Integer executionId) Get execution from DatabasegetTaskExecution
(Integer taskId, Integer executionId) Get execution from DatabasegetTaskExecution
(org.quartz.Trigger trigger) Get task execution from triggergetTaskExecutionList
(Integer taskId) Retrieve task execution list fixedgetTaskList
(TaskListCriteria taskListCriteria) Retrieve the task listinsertTask
(Integer taskId) Insert and schedule a new taskboolean
isTaskExecutionAllowed
(Task task) Check if task is allowed to be launchedloadExecutionScreen
(String path, com.fasterxml.jackson.databind.node.ObjectNode address) Load execution screen parametersloadMaintainVariables
(String maintainStr) Load needed variables from the selected maintainvoid
onFinishTask
(Task task, TaskExecution execution) On finish task eventPause the selected taskpurgeExecutionLogFiles
(Integer taskId, Integer executions) Purge execution log filesPurge executions at startreloadExecutionScreen
(Integer taskId, Integer executionId) Reload execution task parametersresumeTask
(Task task) Resume the selected taskStart a taskupdateExecutionTime
(Integer taskId, Integer executionId) Update execution timeUpdate running task status [4] to interrupted [6]updateTask
(Integer taskId) Update and reschedule a taskMethods inherited from class com.almis.awe.config.ServiceConfig
containsBean, getApplicationContext, getBean, getBean, getElements, getLocale, getLocale, getProperty, getProperty, getRequest, getSession, setApplicationContext
-
Constructor Details
-
TaskDAO
public TaskDAO(org.quartz.Scheduler scheduler, int storedExecutions, String executionLogPath, QueryService queryService, MaintainService maintainService, QueryUtil queryUtil, CalendarDAO calendarDAO, ServerDAO serverDAO, FileChecker fileChecker) Autowired constructor- Parameters:
scheduler
- SchedulerstoredExecutions
- Stored executionexecutionLogPath
- Execution log pathqueryService
- Query servicemaintainService
- Maintain servicequeryUtil
- Query utilitiescalendarDAO
- Calendar DAOserverDAO
- Server DAOfileChecker
- File checker
-
-
Method Details
-
getTask
Load task from trigger- Parameters:
trigger
- Trigger- Returns:
- Generated task
-
getTask
Load task from job detail- Parameters:
jobDetail
- Job detail- Returns:
- Generated task
-
getTask
Load task from task id- Parameters:
taskId
- Task id- Returns:
- Generated task
- Throws:
AWException
- Error retrieving task
-
getTask
@Async("schedulerTaskPool") public Future<Task> getTask(Integer taskId, TaskLaunchType launchType) throws AWException Load task from task id- Parameters:
taskId
- Task idlaunchType
- forced launch type- Returns:
- Generated task
- Throws:
AWException
- Error retrieving task
-
getTask
@Async("schedulerTaskPool") public Future<Task> getTask(Integer taskId, String database, TaskLaunchType launchType) throws AWException Load task from task id- Parameters:
taskId
- Task iddatabase
- DatabaselaunchType
- forced launch type- Returns:
- Generated task
- Throws:
AWException
- Error retrieving task
-
isTaskExecutionAllowed
Check if task is allowed to be launched- Parameters:
task
- Task- Returns:
- Task is allowed
-
startTask
Start a task- Parameters:
task
- Task- Returns:
- Task execution
- Throws:
AWException
-
endTask
End a task- Parameters:
task
- Taskexecution
- Task execution- Returns:
- Task execution
- Throws:
AWException
-
getExecutionsToPurge
Retrieve executions to purge (sorted)- Parameters:
taskId
- Task identifierexecutions
- Executions to purge- Returns:
- Purge results
- Throws:
AWException
- Error retrieving executions to be purged
-
purgeExecutionLogFiles
Purge execution log files- Parameters:
taskId
- Task identifier- Throws:
AWException
- Error on purge
-
purgeExecutionsAtStart
Purge executions at start- Throws:
AWException
- Error on purge
-
updateInterruptedTasks
Update running task status [4] to interrupted [6]- Returns:
- Interrupt task status
- Throws:
AWException
-
changeStatus
public ServiceData changeStatus(Task task, TaskExecution execution, TaskStatus status, String reason) throws AWException Change a task status- Parameters:
execution
- Task executionstatus
- New status- Returns:
- Change status
- Throws:
AWException
-
addTaskToScheduler
Add task to the scheduler- Parameters:
task
- Task to add- Throws:
AWException
- Error adding task to scheduler
-
insertTask
Insert and schedule a new task- Parameters:
taskId
- Task identifier- Returns:
- ServiceData
- Throws:
AWException
- Error inserting task
-
updateTask
Update and reschedule a task- Parameters:
taskId
- Task identifier list- Returns:
- ServiceData
- Throws:
AWException
- Error updating task
-
deleteTask
Delete a task from scheduler- Parameters:
ideTsk
- Task identifier list- Returns:
- ServiceData
- Throws:
AWException
- Error deleting task
-
deleteTask
Delete a single task from scheduler- Parameters:
ideTsk
- Task i dentifier list- Returns:
- ServiceData
- Throws:
AWException
- Error deleting task
-
updateExecutionTime
Update execution time- Parameters:
taskId
- Task id- Returns:
- Execution time
- Throws:
AWException
- Error updating execution time
-
getTaskExecutionList
Retrieve task execution list fixed- Parameters:
taskId
- Task id- Returns:
- Task execution list fixed
- Throws:
AWException
- Error retrieving task execution list
-
getProgressNode
public com.fasterxml.jackson.databind.node.ObjectNode getProgressNode(long percentage) Retrieve progress node- Parameters:
percentage
- Percentage- Returns:
- Progress node
-
getStatusIcon
Generate status icon- Parameters:
execution
- Execution- Returns:
- Status icon
-
getProgress
Retrieve progress- Parameters:
initialDate
- Initial dateaverageExecution
- Average execution- Returns:
- Progress
-
getElapsedTime
Retrieve elapsed time from a start date (without ms)- Parameters:
startDate
- Start date- Returns:
- Elapsed time
-
executeTaskNow
Execute the selected task now- Parameters:
taskId
- Task identifier- Returns:
- ServiceData
- Throws:
AWException
- Error executing immediate task
-
executeDependency
Execute the task ask dependency- Parameters:
taskId
- Task identifierparentExecution
- Parent execution- Throws:
AWException
- Error executing dependency task
-
pauseTask
Pause the selected task- Parameters:
task
- Task to pause- Returns:
- ServiceData
- Throws:
org.quartz.SchedulerException
- Error pausing task
-
resumeTask
Resume the selected task- Parameters:
task
- Task to resume- Returns:
- ServiceData
- Throws:
AWException
- Error resuming task
-
getTaskList
Retrieve the task list- Returns:
- ServiceData
- Throws:
AWException
- Error retrieving task list
-
loadMaintainVariables
Load needed variables from the selected maintain- Parameters:
maintainStr
- Maintain identifier- Returns:
- ServiceData
- Throws:
AWException
- Error loading maintain variables
-
loadExecutionScreen
public ServiceData loadExecutionScreen(String path, com.fasterxml.jackson.databind.node.ObjectNode address) throws AWException Load execution screen parameters- Parameters:
path
- Log pathaddress
- Button address- Returns:
- ServiceData
- Throws:
AWException
-
reloadExecutionScreen
Reload execution task parameters- Parameters:
taskId
- Task identifierexecutionId
- Execution identifier- Returns:
- Service Data
- Throws:
AWException
- Error reloading execution screen
-
getTaskExecution
Get task execution from trigger- Parameters:
trigger
- Trigger- Returns:
- Task execution from trigger
-
getTaskExecution
Get execution from Database- Parameters:
taskId
- Task idexecutionId
- Execution id- Returns:
- Task execution
- Throws:
AWException
- Error retrieving task execution from database
-
getTaskExecution
Get execution from Database- Parameters:
task
- TaskexecutionId
- Execution id- Returns:
- Task execution
- Throws:
AWException
- Error retrieving task execution from database
-
getAverageTime
Get the average time as string- Parameters:
taskId
- Task identifier- Returns:
- Average time as string
- Throws:
AWException
- Error retrieving average time
-
onFinishTask
On finish task event- Parameters:
task
- Finished taskexecution
- Task execution- Throws:
AWException
-