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

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

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

File size: 1.0 KB
RevLine 
[66]1class Entry {
2    Person enteredBy
3    Task task
4    EntryType entryType
[837]5    ConditionSeverity highestSeverity
[431]6    ProductionReference productionReference
7
[66]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()
[98]20        durationHour(min:0,max:16)
[66]21        durationMinute(min:0,max:59)
[431]22        productionReference(nullable: true)
[837]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        })
[66]28    }
29
30    String toString() {
31        "${this.comment} - ${this.enteredBy}, ${this.dateDone}"
32    }
[586]33
34    String toShortString() {
35        "${enteredBy.firstName} ${enteredBy.lastName} - ${durationHour}h : ${durationMinute}min"
36    }
[66]37}
38
Note: See TracBrowser for help on using the repository browser.