Ignore:
Timestamp:
Nov 28, 2009, 2:17:34 PM (15 years ago)
Author:
gav
Message:

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.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        1 stacktrace.log
         1*.log
        22*.war
  • trunk/grails-app/domain/Period.groovy

    r136 r199  
    33    String period
    44    boolean isActive = true
    5 
    6     static hasMany = [taskRecurringSchedules: TaskRecurringSchedule]
    7    
    8     static mappedBy = [taskRecurringSchedules:"recurPeriod"]
    95
    106//     static belongsTo = []
  • trunk/grails-app/domain/TaskRecurringSchedule.groovy

    r195 r199  
    55    Task lastGeneratedSubTask
    66    Period recurPeriod
    7     Period generateAheadPeriod
    87    Period taskDurationPeriod
    98
     
    1110    Integer taskDuration = 0
    1211    Integer generateAhead = 1
    13     Date startDate = new Date()
    14     Date lastGeneratedDate
     12    Integer subTasksGenerated = 0
     13    Date nextGenerationDate = new Date()
    1514    Date nextTargetStartDate = new Date()
    1615    Date nextTargetCompletionDate = new Date()
    17     Date nextGenerationDate = new Date()
    18     boolean isEnabled = true
     16    boolean enabled = true
    1917
    2018//     static hasMany = []
     
    2523        recurEvery(min:1, max:365)
    2624        taskDuration(min:0, max:365)
    27         generateAhead(min:0, max:365)
    28         lastGeneratedDate(nullable:true)
     25        generateAhead(min:0, max:62)
    2926        lastGeneratedSubTask(nullable:true)
    3027    }
     
    3835    // in the hope that this will be fixed in future versions.
    3936    def beforeInsert = {
    40         nextTargetStartDate = startDate
    4137        setNextGenerationDate()
    4238        setNextTargetCompletionDate()
    4339    }
    4440
    45     public void setNextGenerationDate() {
    46         switch (generateAheadPeriod.period) {
     41    public void setNextTargetStartDate() {
     42        switch (recurPeriod.period) {
    4743            case "Day(s)":
    4844                use(TimeCategory) {
    49                     nextGenerationDate = nextTargetStartDate - generateAhead.days
     45                    nextTargetStartDate = nextTargetStartDate + recurEvery.days
    5046                }
    5147                break
    5248            case "Week(s)":
    5349                use(TimeCategory) {
    54                     nextGenerationDate = nextTargetStartDate - generateAhead.weeks
     50                    nextTargetStartDate = nextTargetStartDate + recurEvery.weeks
    5551                }
    5652                break
    5753            case "Month(s)":
    5854                use(TimeCategory) {
    59                     nextGenerationDate = nextTargetStartDate - generateAhead.months
     55                    nextTargetStartDate = nextTargetStartDate + recurEvery.months
    6056                }
    6157                break
    6258            case "Year(s)":
    6359                use(TimeCategory) {
    64                     nextGenerationDate = nextTargetStartDate - generateAhead.years
     60                    nextTargetStartDate = nextTargetStartDate + recurEvery.years
    6561                }
    6662                break
    6763        default:
     64                log.error "No case for recurPeriod.period: ${recurPeriod.period}"
    6865                break
     66        }
     67    }
     68
     69    public void setNextGenerationDate() {
     70        use(TimeCategory) {
     71            nextGenerationDate = nextTargetStartDate - generateAhead.days
    6972        }
    7073        def now = new Date()
     
    9598                break
    9699            default:
     100                log.error "No case for taskDurationPeriod.period: ${taskDurationPeriod.period}"
    97101                break
    98102        }
Note: See TracChangeset for help on using the changeset viewer.