source: trunk/grails-app/domain/dbnp/studycapturing/TemplateField.groovy @ 408

Last change on this file since 408 was 408, checked in by keesvb, 13 years ago

reverted changes which removed domain fields from the domain classes, we are now back again at more or less the situation of #394, added preferredIdentifier property to TemplateField? to facilitate simple import

  • Property svn:keywords set to Date Author Rev
File size: 1.3 KB
Line 
1package dbnp.studycapturing
2
3import dbnp.data.Ontology
4
5/**
6 * This is the class for template fields. These should be part of one or more templates via Template.fields
7 *
8 * Revision information:
9 * $Rev: 408 $
10 * $Author: keesvb $
11 * $Date: 2010-05-11 14:41:05 +0000 (di, 11 mei 2010) $
12 */
13class TemplateField implements Serializable {
14        String name
15        TemplateFieldType type
16        String unit
17        String comment // help string for the user interface
18        List listEntries
19        boolean required
20        boolean preferredIdentifier
21
22    static hasMany = [
23                listEntries     : TemplateFieldListItem,        // to store the entries to choose from when the type is 'item from predefined list'
24                ontologies      : Ontology                                      // to store the ontologies to choose from when the type is 'ontology term'
25        ]
26       
27        static constraints = {
28                // TODO: verify that TemplateField names are unique within templates of each super entity
29                unit(nullable: true, blank: true)
30                comment(nullable:true, blank: true)
31                required(default: false)
32                preferredIdentifier(default: false)
33        }
34
35        static mapping = {
36                comment type: 'text'
37        }
38
39        String toString() {
40                return name
41        }
42
43        /**
44         * return an escaped name which can be used in business logic
45         * @return String
46         */
47        def String escapedName() {
48                return name.toLowerCase().replaceAll("([^a-z0-9])","_")
49        }
50}
Note: See TracBrowser for help on using the repository browser.