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

Last change on this file since 799 was 799, checked in by gav, 13 years ago

Change Task.toString() and display primaryAsset.name in front of description.

File size: 2.0 KB
Line 
1class Task {
2
3    TaskGroup taskGroup
4    TaskStatus taskStatus
5    TaskPriority taskPriority
6    TaskBudgetStatus taskBudgetStatus
7    TaskType taskType
8    Task parentTask
9    Person leadPerson
10    Site site
11    Section section
12    Asset primaryAsset
13    AssetSubItem assetSubItem
14    TaskRecurringSchedule taskRecurringSchedule
15    TaskProcedure taskProcedure
16
17    String description
18    String comment = ""
19    Date targetStartDate = new Date()
20    Date targetCompletionDate = new Date()
21    boolean approved = false
22    boolean trash = false
23    boolean attentionFlag = false
24    boolean safetyRequirement = false
25    boolean regulatoryRequirement = false
26    boolean mandatoryRequirement = false
27    boolean positiveFault = false
28
29    static hasMany = [entries: Entry,
30                        taskModifications: TaskModification,
31                        assignedGroups: AssignedGroup,
32                        assignedPersons: AssignedPerson,
33                        subTasks: Task,
34                        associatedAssets: Asset,
35                        inventoryMovements: InventoryMovement]
36
37    static mappedBy = [taskRecurringSchedule:"task"]
38
39    static belongsTo = [TaskGroup, TaskStatus, Task, Person]
40
41    static constraints = {
42        description(blank:false,maxSize:75)
43        comment(maxSize:1000)
44        targetStartDate()
45        targetCompletionDate(validator: {val, obj ->
46            if(val.before(obj.targetStartDate))
47                return 'before.targetStartDate'
48        })
49        leadPerson()
50        taskPriority()
51        taskBudgetStatus()
52        taskStatus()
53        parentTask(nullable:true)
54        site(nullable:true)
55        section(nullable:true)
56        primaryAsset(nullable:true)
57        assetSubItem(nullable:true)
58        taskRecurringSchedule(nullable:true)
59        taskProcedure(nullable:true)
60
61    }
62
63    String toString() {
64        def s = "#${this.id} - "
65        if(this.primaryAsset)
66            s += "${primaryAsset.name}: "
67        s += "${this.description}"
68    }
69
70}
Note: See TracBrowser for help on using the repository browser.