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