source: trunk/grails-app/domain/dbnp/studycapturing/Template.groovy @ 190

Last change on this file since 190 was 190, checked in by duh, 9 years ago
  • set keyword expansion
  • Property svn:keywords set to Rev Date Author
File size: 1005 bytes
RevLine 
[77]1package dbnp.studycapturing
2
[84]3/**
4 * The Template class describes a study template, which is basically an extension of the study capture entities
5 * in terms of extra fields (described by classes that extend the TemplateField class).
6 * At this moment, only extension of the subject entity is implemented.
[140]7 *
8 * Revision information:
9 * $Rev: 190 $
10 * $Author: duh $
11 * $Date: 2010-02-10 16:36:10 +0000 (wo, 10 feb 2010) $
[84]12 */
[140]13class Template implements Serializable {
[146]14        String name
15        //nimble.User owner
[84]16
[176]17        static hasMany = [studyFields: TemplateStudyField, subjectFields: TemplateSubjectField]
[80]18
[146]19        static constraints = {
20                name(unique: true)
21        }
22
23        def String toString() {
24                return this.name;
25        }
26
27        /**
28         * Look up the type of a certain template subject field
29         * @param fieldName The name of the template field
30         * @return The type (static member of TemplateFieldType) of the field, or null of the field does not exist
31         */
32        def TemplateFieldType getSubjectFieldType(String fieldName) {
33                def field = subjectFields.find {
34                        it.name == fieldName   
35                }
36                field?.type
37        }
[77]38}
Note: See TracBrowser for help on using the repository browser.