source: trunk/grails-app/domain/Entry.groovy @ 967

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

Domain change, add highestSeverity to Entry, with custom validation.

File size: 1.0 KB
Line 
1class Entry {
2    Person enteredBy
3    Task task
4    EntryType entryType
5    ConditionSeverity highestSeverity
6    ProductionReference productionReference
7
8    String comment
9    Date dateDone = new Date()
10    Date dateEntered = new Date()
11    Integer durationHour = 0
12    Integer durationMinute = 0
13
14    static belongsTo = [EntryType, Task, Person]
15
16    static constraints = {
17        task()
18        comment(blank:false,maxSize:500)
19        dateDone()
20        durationHour(min:0,max:16)
21        durationMinute(min:0,max:59)
22        productionReference(nullable: true)
23        // Nullable unless PM Entry Type.
24        highestSeverity(nullable:true, validator: {val, obj ->
25            if(val == null && (obj.entryType.id == 6))
26                return 'not.nullable.for.pm.entry'
27        })
28    }
29
30    String toString() {
31        "${this.comment} - ${this.enteredBy}, ${this.dateDone}"
32    }
33
34    String toShortString() {
35        "${enteredBy.firstName} ${enteredBy.lastName} - ${durationHour}h : ${durationMinute}min"
36    }
37}
38
Note: See TracBrowser for help on using the repository browser.