- Timestamp:
- Feb 8, 2010, 12:42:46 PM (11 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/SandboxController.groovy
r162 r176 11 11 def f = st.template.subjectFields 12 12 13 //println st.giveAllFields() 14 13 15 // This is a way to iterate over the fields in your controller 14 16 // And print them to the console … … 22 24 def subject = Subject.findByName('A1') 23 25 println st.template.getSubjectFieldType('Age') 24 println subject.getFieldValue('Age') 25 26 26 println subject.getFieldValue('Genotype') 27 subject.setFieldValue('Genotype','wildtype') 28 println subject.getFieldValue('Genotype') 29 subject.setFieldValue('name','hallo') 30 println subject.name 31 27 32 // Specify which variables we want to be available in the controller (implicit return statement) 28 33 [fields: f, subjects: st.subjects] -
trunk/grails-app/domain/dbnp/studycapturing/Study.groovy
r162 r176 45 45 return title; 46 46 } 47 48 Map giveAllFields() { 49 def result = [:] 50 51 // Using reflection here gives way too many properties, like searchable, hasMany, 52 // and it will probably extend when we use new plugins 53 // It is probably best 54 // - to either hardcode the above given properties 55 // - or to move all fields to the template 56 57 this.properties.each{ //public fields only 58 println it.name 59 result[it.name] = it.type.name //name of field and name of type 60 } 61 62 return result; 63 } 47 64 } -
trunk/grails-app/domain/dbnp/studycapturing/Subject.groovy
r162 r176 53 53 } 54 54 } 55 56 def setFieldValue(String fieldName, value) { 57 this.properties.each { println it} 58 if (this.properties.containsKey(fieldName)) { 59 this[fieldName] = value 60 } 61 else if (templateStringFields.containsKey(fieldName) && value.class == String) { 62 this.templateStringFields[fieldName] = value 63 } 64 else { 65 println "Field ${fieldName} not found" 66 } 67 } 55 68 } -
trunk/grails-app/domain/dbnp/studycapturing/Template.groovy
r162 r176 15 15 //nimble.User owner 16 16 17 static hasMany = [s ubjectFields: TemplateSubjectField]17 static hasMany = [studyFields: TemplateStudyField, subjectFields: TemplateSubjectField] 18 18 19 19 static constraints = { -
trunk/grails-app/domain/dbnp/studycapturing/TemplateField.groovy
r162 r176 21 21 } 22 22 23 defString toString() {23 String toString() { 24 24 return name 25 25 }
Note: See TracChangeset
for help on using the changeset viewer.