Index: /trunk/application.properties
===================================================================
--- /trunk/application.properties	(revision 122)
+++ /trunk/application.properties	(revision 123)
@@ -1,4 +1,4 @@
 #utf-8
-#Thu Apr 08 00:43:51 EST 2009
+#Mon May 04 01:41:27 EST 2009
 plugins.help-balloons=1.2
 app.version=
@@ -7,3 +7,4 @@
 app.grails.version=1.1
 plugins.hibernate=1.1
+plugins.quartz=0.4.1-SNAPSHOT
 app.name=gnuMims
Index: /trunk/grails-app/domain/RecurringSchedule.groovy
===================================================================
--- /trunk/grails-app/domain/RecurringSchedule.groovy	(revision 122)
+++ /trunk/grails-app/domain/RecurringSchedule.groovy	(revision 123)
@@ -7,4 +7,6 @@
     Integer recurEvery
     Date startDate = new Date()
+    Date lastExecutedDate
+    Date nextDueDate
     boolean isActive = true
 
@@ -15,4 +17,6 @@
     static constraints = {
         plannedMaintenance(blank:true, nullable:true)
+        lastExecutedDate(blank:true, nullable:true)
+        nextDueDate(blank:true, nullable:true)
     }
 
Index: /trunk/grails-app/domain/Task.groovy
===================================================================
--- /trunk/grails-app/domain/Task.groovy	(revision 122)
+++ /trunk/grails-app/domain/Task.groovy	(revision 123)
@@ -40,4 +40,4 @@
     }
 
-    String toString() {"${this.description}"}
+    String toString() {"${this.id} - ${this.description}"}
 }
Index: /trunk/grails-app/jobs/TaskRecurringScheduleJob.groovy
===================================================================
--- /trunk/grails-app/jobs/TaskRecurringScheduleJob.groovy	(revision 123)
+++ /trunk/grails-app/jobs/TaskRecurringScheduleJob.groovy	(revision 123)
@@ -0,0 +1,44 @@
+
+class TaskRecurringScheduleJob {
+    def timeout = 5000 // execute job once in 5 seconds
+
+    def execute() {
+        println "5"
+        def recurringScheduleInstanceList = RecurringSchedule.list()
+        def now = new Date()
+
+        recurringScheduleInstanceList.each() {
+
+            if ( now < it.nextDueDate) {
+                def taskInstance = it.task
+                def subTaskInstance = new Task()
+    
+                //Make our new Task a subTask.
+                subTaskInstance.parentTask = taskInstance
+    
+                // Set the required properties
+                subTaskInstance.description = "Generated recurring task: "+taskInstance.description
+                subTaskInstance.comment = taskInstance.comment
+                subTaskInstance.taskGroup = taskInstance.taskGroup
+                subTaskInstance.taskStatus = TaskStatus.findByName("Not Started")
+                subTaskInstance.taskPriority = TaskPriority.get(2)
+                subTaskInstance.taskType = TaskType.get(1)
+                subTaskInstance.leadPerson = taskInstance.leadPerson
+                if(subTaskInstance.save()){println "yes"}
+    
+                //Set the assignedPersons
+                taskInstance.assignedPersons.each() {
+    
+                def assignedPerson = new AssignedPerson(person: it.person,
+                                                                                        task: subTaskInstance,
+                                                                                        estimatedHour: it.estimatedHour,
+                                                                                        estimatedMinute: it.estimatedMinute).save()
+                }
+
+                //Set the nextDueDate so that we don't loop ;-)
+//                 it.nextDueDate = new DateTime(date:2.weeks.from.now)
+    
+            }
+        }//recurringScheduleInstanceList.each()
+    }
+}
Index: /trunk/grails-app/views/recurringSchedule/create.gsp
===================================================================
--- /trunk/grails-app/views/recurringSchedule/create.gsp	(revision 122)
+++ /trunk/grails-app/views/recurringSchedule/create.gsp	(revision 123)
@@ -33,4 +33,22 @@
                                 <td valign="top" class="value ${hasErrors(bean:recurringScheduleInstance,field:'plannedMaintenance','errors')}">
                                     <g:select optionKey="id" from="${PlannedMaintenance.list()}" name="plannedMaintenance.id" value="${recurringScheduleInstance?.plannedMaintenance?.id}" noSelection="['null':'']"></g:select>
+                                </td>
+                            </tr> 
+                        
+                            <tr class="prop">
+                                <td valign="top" class="name">
+                                    <label for="lastExecutedDate">Last Executed Date:</label>
+                                </td>
+                                <td valign="top" class="value ${hasErrors(bean:recurringScheduleInstance,field:'lastExecutedDate','errors')}">
+                                    <g:datePicker name="lastExecutedDate" value="${recurringScheduleInstance?.lastExecutedDate}" noSelection="['':'']"></g:datePicker>
+                                </td>
+                            </tr> 
+                        
+                            <tr class="prop">
+                                <td valign="top" class="name">
+                                    <label for="nextDueDate">Next Due Date:</label>
+                                </td>
+                                <td valign="top" class="value ${hasErrors(bean:recurringScheduleInstance,field:'nextDueDate','errors')}">
+                                    <g:datePicker name="nextDueDate" value="${recurringScheduleInstance?.nextDueDate}" noSelection="['':'']"></g:datePicker>
                                 </td>
                             </tr> 
Index: /trunk/grails-app/views/recurringSchedule/edit.gsp
===================================================================
--- /trunk/grails-app/views/recurringSchedule/edit.gsp	(revision 122)
+++ /trunk/grails-app/views/recurringSchedule/edit.gsp	(revision 123)
@@ -36,4 +36,22 @@
                                 <td valign="top" class="value ${hasErrors(bean:recurringScheduleInstance,field:'plannedMaintenance','errors')}">
                                     <g:select optionKey="id" from="${PlannedMaintenance.list()}" name="plannedMaintenance.id" value="${recurringScheduleInstance?.plannedMaintenance?.id}" noSelection="['null':'']"></g:select>
+                                </td>
+                            </tr> 
+                        
+                            <tr class="prop">
+                                <td valign="top" class="name">
+                                    <label for="lastExecutedDate">Last Executed Date:</label>
+                                </td>
+                                <td valign="top" class="value ${hasErrors(bean:recurringScheduleInstance,field:'lastExecutedDate','errors')}">
+                                    <g:datePicker name="lastExecutedDate" value="${recurringScheduleInstance?.lastExecutedDate}" noSelection="['':'']"></g:datePicker>
+                                </td>
+                            </tr> 
+                        
+                            <tr class="prop">
+                                <td valign="top" class="name">
+                                    <label for="nextDueDate">Next Due Date:</label>
+                                </td>
+                                <td valign="top" class="value ${hasErrors(bean:recurringScheduleInstance,field:'nextDueDate','errors')}">
+                                    <g:datePicker name="nextDueDate" value="${recurringScheduleInstance?.nextDueDate}" noSelection="['':'']"></g:datePicker>
                                 </td>
                             </tr> 
Index: /trunk/grails-app/views/recurringSchedule/list.gsp
===================================================================
--- /trunk/grails-app/views/recurringSchedule/list.gsp	(revision 122)
+++ /trunk/grails-app/views/recurringSchedule/list.gsp	(revision 123)
@@ -26,12 +26,12 @@
                    	        <th>Planned Maintenance</th>
                    	    
+                   	        <g:sortableColumn property="lastExecutedDate" title="Last Executed Date" />
+                        
+                   	        <g:sortableColumn property="nextDueDate" title="Next Due Date" />
+                        
                    	        <g:sortableColumn property="isActive" title="Is Active" />
                         
                    	        <th>Period</th>
                    	    
-                   	        <g:sortableColumn property="recurEvery" title="Recur Every" />
-                        
-                   	        <g:sortableColumn property="startDate" title="Start Date" />
-                        
                         </tr>
                     </thead>
@@ -44,11 +44,11 @@
                             <td>${fieldValue(bean:recurringScheduleInstance, field:'plannedMaintenance')}</td>
                         
+                            <td>${fieldValue(bean:recurringScheduleInstance, field:'lastExecutedDate')}</td>
+                        
+                            <td>${fieldValue(bean:recurringScheduleInstance, field:'nextDueDate')}</td>
+                        
                             <td>${fieldValue(bean:recurringScheduleInstance, field:'isActive')}</td>
                         
                             <td>${fieldValue(bean:recurringScheduleInstance, field:'period')}</td>
-                        
-                            <td>${fieldValue(bean:recurringScheduleInstance, field:'recurEvery')}</td>
-                        
-                            <td>${fieldValue(bean:recurringScheduleInstance, field:'startDate')}</td>
                         
                         </tr>
Index: /trunk/grails-app/views/recurringSchedule/show.gsp
===================================================================
--- /trunk/grails-app/views/recurringSchedule/show.gsp	(revision 122)
+++ /trunk/grails-app/views/recurringSchedule/show.gsp	(revision 123)
@@ -34,4 +34,18 @@
                             
                             <td valign="top" class="value"><g:link controller="plannedMaintenance" action="show" id="${recurringScheduleInstance?.plannedMaintenance?.id}">${recurringScheduleInstance?.plannedMaintenance?.encodeAsHTML()}</g:link></td>
+                            
+                        </tr>
+                    
+                        <tr class="prop">
+                            <td valign="top" class="name">Last Executed Date:</td>
+                            
+                            <td valign="top" class="value">${fieldValue(bean:recurringScheduleInstance, field:'lastExecutedDate')}</td>
+                            
+                        </tr>
+                    
+                        <tr class="prop">
+                            <td valign="top" class="name">Next Due Date:</td>
+                            
+                            <td valign="top" class="value">${fieldValue(bean:recurringScheduleInstance, field:'nextDueDate')}</td>
                             
                         </tr>
Index: /trunk/test/unit/TaskRecurringScheduleJobTests.groovy
===================================================================
--- /trunk/test/unit/TaskRecurringScheduleJobTests.groovy	(revision 123)
+++ /trunk/test/unit/TaskRecurringScheduleJobTests.groovy	(revision 123)
@@ -0,0 +1,15 @@
+import grails.test.*
+
+class TaskRecurringScheduleJobTests extends GrailsUnitTestCase {
+    protected void setUp() {
+        super.setUp()
+    }
+
+    protected void tearDown() {
+        super.tearDown()
+    }
+
+    void testSomething() {
+
+    }
+}
