source: trunk/grails-app/jobs/TaskRecurringScheduleJob.groovy @ 152

Last change on this file since 152 was 137, checked in by gav, 15 years ago

Update to grails-1.1.1 release.
Fix WorkDone? and Fault entries not showing after update, now using criteria.
Work on TaskRecurringSchedule, add DateUtilService class, regenerate views to suite.
Finally have correct rollback behaviour on TaskRecurringSchedule? domain object updates by using transactions.
Added name to copyright since the license has no meaning without it.

File size: 2.0 KB
RevLine 
[123]1
[126]2class TaskRecurringScheduleJob {/*
[137]3    def timeout = 1000 // execute job once in 1 seconds
4//     def timeout = 60000
[123]5
6    def execute() {
[137]7        println "TaskRecurringScheduleJob: tick"
8        println "TaskRecurringScheduleJob: tock"/*
[123]9        def recurringScheduleInstanceList = RecurringSchedule.list()
10        def now = new Date()
11
12        recurringScheduleInstanceList.each() {
13
[125]14            if ( now > it.nextDueDate) {
[123]15                def taskInstance = it.task
16                def subTaskInstance = new Task()
17   
18                //Make our new Task a subTask.
19                subTaskInstance.parentTask = taskInstance
20   
21                // Set the required properties
22                subTaskInstance.description = "Generated recurring task: "+taskInstance.description
23                subTaskInstance.comment = taskInstance.comment
24                subTaskInstance.taskGroup = taskInstance.taskGroup
25                subTaskInstance.taskStatus = TaskStatus.findByName("Not Started")
26                subTaskInstance.taskPriority = TaskPriority.get(2)
27                subTaskInstance.taskType = TaskType.get(1)
28                subTaskInstance.leadPerson = taskInstance.leadPerson
[125]29                subTaskInstance.save()
30//                 if(subTaskInstance.save()){println "yes"}
[123]31   
32                //Set the assignedPersons
33                taskInstance.assignedPersons.each() {
34   
35                def assignedPerson = new AssignedPerson(person: it.person,
36                                                                                        task: subTaskInstance,
37                                                                                        estimatedHour: it.estimatedHour,
38                                                                                        estimatedMinute: it.estimatedMinute).save()
39                }
40
41                //Set the nextDueDate so that we don't loop ;-)
[125]42                it.nextDueDate = it.nextDueDate + 1
[123]43   
44            }
45        }//recurringScheduleInstanceList.each()
[126]46    }*/
[123]47}
Note: See TracBrowser for help on using the repository browser.