source: trunk/grails-app/domain/Task.groovy @ 446

Last change on this file since 446 was 446, checked in by gav, 14 years ago

Add constraints to Task domain class for targetCompletionDate and comment.

File size: 1.6 KB
RevLine 
[66]1class Task {
[121]2
[66]3    TaskGroup taskGroup
4    TaskStatus taskStatus
[69]5    TaskPriority taskPriority
[252]6    TaskBudgetStatus taskBudgetStatus
[69]7    TaskType taskType
[168]8    Task parentTask
[66]9    Person leadPerson
[116]10    Asset primaryAsset
[131]11    TaskRecurringSchedule taskRecurringSchedule
12    TaskProcedure taskProcedure
[121]13
[66]14    String description
15    String comment = ""
16    Date targetStartDate = new Date()
17    Date targetCompletionDate = new Date()
[181]18    boolean scheduled = false
19    boolean approved = false
20    boolean trash = false
[418]21    boolean attentionFlag = false
[66]22
[418]23    static hasMany = [entries: Entry,
[147]24                        taskModifications: TaskModification,
[242]25                        assignedGroups: AssignedGroup,
[241]26                        assignedPersons: AssignedPerson,
[116]27                        subTasks: Task,
28                        associatedAssets: Asset,
29                        inventoryMovements: InventoryMovement]
[66]30
[131]31    static mappedBy = [taskRecurringSchedule:"task"]
32
[69]33    static belongsTo = [TaskGroup, TaskStatus, Task, Person]
[66]34
35    static constraints = {
[131]36        description(blank:false,maxSize:75)
[446]37        comment(maxSize:1000)
[66]38        targetStartDate()
[446]39        targetCompletionDate(validator: {val, obj ->
40            if(val.before(obj.targetStartDate))
41                return 'before.targetStartDate'
42        })
[66]43        leadPerson()
[69]44        taskPriority()
[252]45        taskBudgetStatus()
[66]46        taskStatus()
[146]47        parentTask(nullable:true)
48        primaryAsset(nullable:true)
49        taskRecurringSchedule(nullable:true)
50        taskProcedure(nullable:true)
51
[66]52    }
53
[123]54    String toString() {"${this.id} - ${this.description}"}
[66]55}
Note: See TracBrowser for help on using the repository browser.