Last change
on this file since 199 was
199,
checked in by gav, 15 years ago
|
Upgrade quartz plugin to 0.4.1 propper.
Refactor and enable quartz scheduling for recurring tasks.
Adjust svn ignores to ignore all log files.
Create a pseudo system person for automated insertions.
|
File size:
1.1 KB
|
Rev | Line | |
---|
[199] | 1 | class TaskRecurringScheduleService { |
---|
| 2 | |
---|
| 3 | boolean transactional = false |
---|
| 4 | |
---|
| 5 | def dateUtilService |
---|
| 6 | def taskService |
---|
| 7 | |
---|
| 8 | def generateAll() { |
---|
| 9 | |
---|
| 10 | /// @todo: disable recurringSchedule when moving a task to trash. |
---|
| 11 | def taskRecurringScheduleList = TaskRecurringSchedule.findAllByEnabled(true) |
---|
| 12 | |
---|
| 13 | taskRecurringScheduleList.each() { |
---|
| 14 | |
---|
| 15 | if ( dateUtilService.getTomorrow() > it.nextGenerationDate) { |
---|
| 16 | def p = [:] |
---|
| 17 | p.targetStartDate = it.nextTargetStartDate |
---|
| 18 | p.targetCompletionDate = it.nextTargetCompletionDate |
---|
| 19 | def result = taskService.createSubTask(it.task, p) |
---|
| 20 | if( !result.error ) { |
---|
| 21 | it.lastGeneratedSubTask = result.taskInstance |
---|
| 22 | it.subTasksGenerated++ |
---|
| 23 | it.setNextTargetStartDate() |
---|
| 24 | it.setNextGenerationDate() |
---|
| 25 | it.setNextTargetCompletionDate() |
---|
| 26 | } |
---|
| 27 | else { |
---|
| 28 | log.error result |
---|
| 29 | } |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | } |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | } // end of class |
---|
Note: See
TracBrowser
for help on using the repository browser.