Changeset 139 for trunk/grails-app/domain
- Timestamp:
- Jan 27, 2010, 9:58:59 AM (11 years ago)
- Location:
- trunk/grails-app/domain/dbnp
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/domain/dbnp/data/Term.groovy
r138 r139 7 7 * The Term object should point to an existing term in an online ontology, therefore instances of this class can also 8 8 * be seen as a cache of elements of the external ontology. 9 *10 * Revision information:11 * $Rev$12 * $Author$13 * $Date$14 9 */ 15 class Term implements Serializable { 16 String name 17 Ontology ontology 18 String accession 10 class Term { 11 static searchable = true 12 String name 13 Ontology ontology 14 String accession 19 15 20 21 16 static constraints = { 17 } 22 18 23 def String toString() { 24 return name 25 } 19 def String toString() { 20 return name 21 } 22 23 26 24 } -
trunk/grails-app/domain/dbnp/studycapturing/Event.groovy
r124 r139 2 2 3 3 import groovy.time.* 4 5 4 6 5 /** … … 11 10 class Event { 12 11 13 Subject subject 14 EventDescription eventDescription 15 Date startTime 16 Date endTime 12 Subject subject 13 EventDescription eventDescription 14 Date startTime 15 Date endTime 16 Map parameterStringValues 17 Map parameterIntegerValues 18 Map parameterFloatValues 19 20 static hasMany = [ 21 parameterStringValues : String, // stores both STRING and STRINGLIST items (latter should be checked against the list) 22 parameterIntegerValues : int, 23 parameterFloatValues : float 24 ] 25 26 // static constraints = { } 27 28 def getDuration() { 29 //endTime - startTime // this is not documented and does not work either 30 // so, it's useless. 31 // thus, do this manually as follows 32 33 def timeMillis = (endTime.getTime() - startTime.getTime()).abs() 34 def days = (timeMillis / (1000 * 60 * 60 * 24)).toInteger() 35 def hours = (timeMillis / (1000 * 60 * 60)).toInteger() 36 def minutes = (timeMillis / (1000 * 60)).toInteger() 37 def seconds = (timeMillis / 1000).toInteger() 38 def millis = (timeMillis % 1000).toInteger() 39 40 return new Duration(days, hours, minutes, seconds, millis) 41 } 17 42 18 43 19 // static constraints = { } 20 def getDuration() { 21 //endTime - startTime // this is not documented and does not work either 22 // so, it's useless. 23 // thus, do this manually as follows 24 25 def timeMillis = (endTime.getTime() - startTime.getTime()).abs() 26 def days = (timeMillis/(1000*60*60*24)).toInteger() 27 def hours = (timeMillis/(1000*60*60)).toInteger() 28 def minutes = (timeMillis/(1000*60)).toInteger() 29 def seconds = (timeMillis/1000).toInteger() 30 def millis = (timeMillis%1000).toInteger() 31 32 return new Duration(days,hours,minutes,seconds,millis) 33 } 34 35 36 def getDurationString() 37 { 38 def d = getDuration() 39 return "${d.days} days, ${d.hours} hrs, ${d.minutes} min, ${d.seconds} sec." 40 } 44 def getDurationString() { 45 def d = getDuration() 46 return "${d.days} days, ${d.hours} hrs, ${d.minutes} min, ${d.seconds} sec." 47 } 41 48 42 49 -
trunk/grails-app/domain/dbnp/studycapturing/EventDescription.groovy
r116 r139 13 13 String description 14 14 Term classification 15 Protocol Instanceprotocol15 Protocol protocol 16 16 17 17 static constraints = { -
trunk/grails-app/domain/dbnp/studycapturing/ProtocolInstance.groovy
r112 r139 1 1 package dbnp.studycapturing 2 3 // this class is now obsolete, should be deleted by Jahn when he's done with Event controller/views 2 4 3 5 /** … … 9 11 10 12 11 // TODO: check how the values can be indexed so that they can be mapped to their respective parameters (should we use maps here?)12 static hasMany = [values : ProtocolParameterInstance]13 13 static constraints = { 14 14 } -
trunk/grails-app/domain/dbnp/studycapturing/ProtocolParameter.groovy
r114 r139 10 10 11 11 String name 12 String type // development. replace by:ProtocolParameterType type12 ProtocolParameterType type 13 13 String unit 14 14 String description … … 18 18 19 19 static constraints = { 20 unit(nullable: true) 21 reference(nullable: true) 22 description(nullable: true) 20 23 } 21 24 } -
trunk/grails-app/domain/dbnp/studycapturing/ProtocolParameterInstance.groovy
r115 r139 1 1 package dbnp.studycapturing 2 2 3 // this class is now obsolete, should be deleted by Jahn when he's done with Event controller/views 3 4 class ProtocolParameterInstance { 4 5 -
trunk/grails-app/domain/dbnp/studycapturing/ProtocolParameterType.groovy
r84 r139 6 6 public enum ProtocolParameterType { 7 7 STRING('String'), 8 NUMBER('Number'), 8 INTEGER('Integer number'), 9 FLOAT('Decimal number'), 9 10 STRINGLIST('List') 10 11 … … 16 17 17 18 static list() { 18 [STRING, NUMBER, STRINGLIST]19 [STRING, INTEGER, FLOAT, STRINGLIST] 19 20 } 20 21 -
trunk/grails-app/domain/dbnp/studycapturing/Sample.groovy
r106 r139 7 7 */ 8 8 class Sample { 9 static searchable = true 9 10 10 11 // TODO: should Sample also carry a reference to its parent study, -
trunk/grails-app/domain/dbnp/studycapturing/Study.groovy
r138 r139 10 10 */ 11 11 class Study implements Serializable { 12 static searchable = true 12 13 nimble.User owner 13 14 String title -
trunk/grails-app/domain/dbnp/studycapturing/Subject.groovy
r138 r139 1 1 package dbnp.studycapturing 2 2 3 import dbnp.data.Term 3 4 4 5 /** 5 6 * This domain class describes the subjects in a study. 6 *7 * Revision information:8 * $Rev$9 * $Author$10 * $Date$11 7 */ 12 class Subject implements Serializable { 8 class Subject { 9 static searchable = true 13 10 String name 14 11 Term species 15 12 Map templateStringFields 16 Map template NumberFields17 Map template StringListFields13 Map templateIntegerFields 14 Map templateFloatFields 18 15 Map templateTermFields 19 16 20 17 static hasMany = [ 21 templateStringFields: String,22 template NumberFields: float,23 template StringListFields: String,24 templateTermFields : Term18 templateStringFields : String, // stores both STRING and STRINGLIST items (latter should be checked against the list) 19 templateIntegerFields : int, 20 templateFloatFields : float, 21 templateTermFields : Term 25 22 ] 26 23 27 24 static constraints = { 28 25 } -
trunk/grails-app/domain/dbnp/studycapturing/TemplateFieldType.groovy
r84 r139 6 6 public enum TemplateFieldType { 7 7 STRING('String'), 8 NUMBER('Number'), 9 STRINGLIST('List'), 8 INTEGER('Integer number'), 9 FLOAT('Decimal number'), 10 STRINGLIST('List of items'), 10 11 ONTOLOGYTERM('Ontology Reference') 11 12 … … 17 18 18 19 static list() { 19 [STRING, NUMBER, STRINGLIST, ONTOLOGYTERM]20 [STRING, INTEGER, FLOAT, STRINGLIST, ONTOLOGYTERM] 20 21 } 21 22
Note: See TracChangeset
for help on using the changeset viewer.