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

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

Domain change, add ConditionSeverity.

File size: 2.1 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    TaskProcedureRevision taskProcedureRevision
16    ConditionSeverity highestSeverity
17
18    String description
19    String comment = ""
20    Date targetStartDate = new Date()
21    Date targetCompletionDate = new Date()
22    boolean approved = false
23    boolean trash = false
24    boolean attentionFlag = false
25    boolean safetyRequirement = false
26    boolean regulatoryRequirement = false
27    boolean mandatoryRequirement = false
28    boolean positiveFault = false
29
30    static hasMany = [entries: Entry,
31                        taskModifications: TaskModification,
32                        assignedGroups: AssignedGroup,
33                        assignedPersons: AssignedPerson,
34                        subTasks: Task,
35                        associatedAssets: Asset,
36                        inventoryMovements: InventoryMovement]
37
38    static mappedBy = [taskRecurringSchedule:"task"]
39
40    static mapping = {
41        primaryAsset lazy:false
42    }
43
44    static belongsTo = [TaskGroup, TaskStatus, Task, Person]
45
46    static constraints = {
47        description(blank:false,maxSize:75)
48        comment(maxSize:1000)
49        targetStartDate()
50        targetCompletionDate(validator: {val, obj ->
51            if(val.before(obj.targetStartDate))
52                return 'before.targetStartDate'
53        })
54        leadPerson()
55        taskPriority()
56        taskBudgetStatus()
57        taskStatus()
58        parentTask(nullable:true)
59        site(nullable:true)
60        section(nullable:true)
61        primaryAsset(nullable:true)
62        assetSubItem(nullable:true)
63        taskRecurringSchedule(nullable:true)
64        taskProcedureRevision(nullable:true)
65        highestSeverity(nullable:true)
66    }
67
68    String toString() {
69        def s = "#${this.id} - "
70        if(this.primaryAsset)
71            s += "${primaryAsset.name}: "
72        s += "${this.description}"
73    }
74
75}
Note: See TracBrowser for help on using the repository browser.