Ignore:
Timestamp:
Apr 22, 2010, 9:31:50 AM (11 years ago)
Author:
roberth
Message:

Updated studies list to handle the new data model.
Updated the bootstrap to contain some studies with attached events and persons in order to test the updated studies list
Added fieldExists method to TemplateEntity? to check whether a given field exists or not

Location:
trunk/grails-app/domain/dbnp/studycapturing
Files:
3 edited

Legend:

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

    r359 r370  
    8888
    8989        def String toString() {
    90                 return eventDescription ? eventDescription.name : ""
     90                return fieldExists( 'Description' ) ? getFieldValue( 'Description') : ""
    9191        }
    9292
  • trunk/grails-app/domain/dbnp/studycapturing/Study.groovy

    r359 r370  
    6060        }
    6161
     62        /**
     63         * Return the unique Event templates that are used in this study
     64         */
     65        def Set<Template> giveEventTemplates() {
     66                TemplateEntity.giveTemplates(events);
     67        }
    6268
     69        /**
     70         * Return the unique SamplingEvent templates that are used in this study
     71         */
     72        def Set<Template> giveSamplingEventTemplates() {
     73                TemplateEntity.giveTemplates(events);
     74        }
     75       
    6376        /**
    6477         * Returns the template of all subjects in the study
  • trunk/grails-app/domain/dbnp/studycapturing/TemplateEntity.groovy

    r359 r370  
    263263
    264264        /**
     265         * Check whether a given template field exists or not
     266         * @param fieldName The name of the template field
     267         * @return true if the given field exists and false otherwise
     268         */
     269        def fieldExists(String fieldName) {
     270                TemplateFieldType fieldType = template.getFieldType(fieldName)
     271
     272                // If the field is found, a TemplateFieldType is returned
     273                // otherwise null
     274                if (fieldType) {
     275                    return true
     276                } else {
     277                    return false
     278                }
     279        }
     280
     281        /**
    265282         * Set a template/entity field value
    266283         * @param fieldName The name of the template or entity field
Note: See TracChangeset for help on using the changeset viewer.