source: branches/features/taskProcedureRework/grails-app/domain/TaskProcedure.groovy @ 796

Last change on this file since 796 was 793, checked in by gav, 14 years ago

Domain change, add DocumentReference.

File size: 1.3 KB
RevLine 
[762]1import org.apache.commons.collections.list.LazyList
2import org.apache.commons.collections.FactoryUtils
[760]3
[131]4class TaskProcedure {
5
[762]6    Task linkedTask
[772]7    Person createdBy
8    Person lastUpdatedBy
9    Date dateCreated = new Date() // autoTimestamp
10    Date lastUpdated = new Date() // autoTimestamp
[762]11
12    def getDescription() { linkedTask.description }
13    def getAsset() { linkedTask.primaryAsset }
14
[760]15    List maintenanceActions = new ArrayList()
[793]16    List documentReferences = new ArrayList()
[762]17
[793]18    static hasMany = [tasks: Task,
19                                    maintenanceActions: MaintenanceAction,
20                                    documentReferences: DocumentReference]
[131]21
[762]22    def getMaintenanceActionLazyList() {
23        return LazyList.decorate(maintenanceActions, FactoryUtils.instantiateFactory(MaintenanceAction.class))
24    }
25
[793]26    def getDocumentReferenceLazyList() {
27        return LazyList.decorate(documentReferences, FactoryUtils.instantiateFactory(DocumentReference.class))
28    }
29
[758]30    static mappedBy = [tasks:"taskProcedure"]
31
[760]32    static mapping = {
[762]33        maintenanceActions cascade:"all-delete-orphan"
[793]34        documentReferences cascade:"all-delete-orphan"
[760]35    }
36
[131]37//     static belongsTo = []
38
39    static constraints = {
40    }
41
42    String toString() {
[754]43        "${this.id}"
[131]44    }
45}
Note: See TracBrowser for help on using the repository browser.