Ignore:
Timestamp:
Mar 2, 2010, 6:10:52 PM (9 years ago)
Author:
keesvb
Message:

revised templating system: templates are now per entity rather than per study, moved samples to Study

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/domain/dbnp/studycapturing/Template.groovy

    r212 r224  
    1212 */
    1313class Template implements Serializable {
     14
    1415        String name
     16        Class entity
    1517        //nimble.User owner
    1618
    17         static hasMany = [studyFields: TemplateStudyField, subjectFields: TemplateSubjectField]
     19        static hasMany = [fields: TemplateField]
    1820
    1921        static constraints = {
    20                 name(unique: true)
     22                name(unique:['entity'])
     23
    2124        }
    2225
     
    3033         * @return The type (static member of TemplateFieldType) of the field, or null of the field does not exist
    3134         */
    32         def TemplateFieldType getSubjectFieldType(String fieldName) {
    33                 def field = subjectFields.find {
     35        def TemplateFieldType getFieldType(String fieldName) {
     36                def field = fields.find {
    3437                        it.name == fieldName   
    3538                }
    3639                field?.type
    3740        }
     41
     42        def getFieldsByType(TemplateFieldType fieldType) {
     43                def result = fields.findAll {
     44                        it.type == fieldType
     45                }
     46                return result;
     47        }
    3848}
Note: See TracChangeset for help on using the changeset viewer.