Changeset 809 for trunk/grails-app/domain
- Timestamp:
- Feb 16, 2011, 8:10:39 PM (14 years ago)
- Location:
- trunk/grails-app/domain
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/domain/DocumentReference.groovy
r798 r809 10 10 // static hasMany = [] 11 11 12 static belongsTo = [TaskProcedure] 12 static belongsTo = [TaskProcedure, TaskProcedureRevision] 13 14 static mapping = { 15 batchSize 10 16 } 13 17 14 18 static constraints = { -
trunk/grails-app/domain/MaintenanceAction.groovy
r798 r809 1 1 class MaintenanceAction { 2 2 3 TaskProcedure taskProcedure4 3 MaintenancePolicy maintenancePolicy 5 4 Section section … … 17 16 // static hasMany = [] 18 17 19 static belongsTo = [TaskProcedure] 18 static mapping = { 19 batchSize 10 20 } 21 22 static belongsTo = [TaskProcedure, TaskProcedureRevision] 20 23 21 24 static constraints = { … … 26 29 procedureStepNumber(nullable:true) 27 30 description(blank:false,maxSize:100) 28 pageRef(maxSize: 100)31 pageRef(maxSize:25) 29 32 } 30 33 -
trunk/grails-app/domain/Task.groovy
r807 r809 13 13 AssetSubItem assetSubItem 14 14 TaskRecurringSchedule taskRecurringSchedule 15 TaskProcedure taskProcedure15 TaskProcedureRevision taskProcedureRevision 16 16 17 17 String description … … 61 61 assetSubItem(nullable:true) 62 62 taskRecurringSchedule(nullable:true) 63 taskProcedure (nullable:true)63 taskProcedureRevision(nullable:true) 64 64 65 65 } -
trunk/grails-app/domain/TaskProcedure.groovy
r798 r809 5 5 6 6 Task linkedTask 7 Person createdBy8 Person lastUpdatedBy9 Date dateCreated = new Date() // autoTimestamp10 Date lastUpdated = new Date() // autoTimestamp11 7 12 8 def getDescription() { linkedTask.description } … … 15 11 List maintenanceActions = new ArrayList() 16 12 List documentReferences = new ArrayList() 13 List revisions = new ArrayList() 17 14 18 static hasMany = [ tasks: Task,19 maintenanceActions: MaintenanceAction,20 documentReferences: DocumentReference]15 static hasMany = [maintenanceActions: MaintenanceAction, 16 documentReferences: DocumentReference, 17 revisions: TaskProcedureRevision] 21 18 22 19 def getMaintenanceActionLazyList() { … … 28 25 } 29 26 30 static mappedBy = [tasks:"taskProcedure"] 27 // The current revision number is equal to the count of the revisions created. 28 // More efficient than loading the entire revisions list and using size(). 29 // WithTransaction is used to allow calling in a transaction however objects 30 // in the current transaction must not trigger DataIntegrityViolationException. 31 def getRevision() { 32 def revision 33 TaskProcedure.withTransaction { 34 revision = TaskProcedureRevision.countByTaskProcedure(this) 35 } 36 return revision 37 } 38 39 // Get a specific revision. 40 def getRevision(revision) { 41 def taskProcedureRevision 42 TaskProcedure.withTransaction { 43 taskProcedureRevision = TaskProcedureRevision.findByTaskProcedureAndRevision(this, revision) 44 } 45 return taskProcedureRevision 46 } 47 48 // Get the latest revision of this procedure. 49 def getLatestRevision() { 50 def taskProcedureRevision 51 TaskProcedure.withTransaction { 52 taskProcedureRevision = TaskProcedureRevision.findByTaskProcedureAndRevision(this, this.revision) 53 } 54 return taskProcedureRevision 55 } 31 56 32 57 static mapping = { 58 linkedTask lazy:false 59 revisions batchSize: 10 33 60 maintenanceActions cascade:"all-delete-orphan" 34 61 documentReferences cascade:"all-delete-orphan" 62 revisions cascade:"all-delete-orphan" 35 63 } 36 64
Note: See TracChangeset
for help on using the changeset viewer.