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

Last change on this file since 397 was 397, checked in by duh, 10 years ago
  • reformatted source code
  • added mega huge big ASCII comments to UNDOCUMMENTED of not properly DOCUMENTED classess... we have agreed many many MANY times that everyone should document their code according to JavaDoc? style... but why does nobody do it, or just keep SLACKING! /annoyed modus
  • Property svn:keywords set to Date Author Rev
File size: 1.2 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: 397 $
10 * $Author: duh $
11 * $Date: 2010-05-07 12:53:11 +0000 (vr, 07 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
21    static hasMany = [
22                listEntries     : TemplateFieldListItem,        // to store the entries to choose from when the type is 'item from predefined list'
23                ontologies      : Ontology                                      // to store the ontologies to choose from when the type is 'ontology term'
24        ]
25       
26        static constraints = {
27                // TODO: verify that TemplateField names are unique within templates of each super entity
28                unit(nullable: true, blank: true)
29                comment(nullable:true, blank: true)
30                required(default: false)
31        }
32
33        static mapping = {
34                comment type: 'text'
35        }
36
37        String toString() {
38                return name
39        }
40
41        /**
42         * return an escaped name which can be used in business logic
43         * @return String
44         */
45        def String escapedName() {
46                return name.toLowerCase().replaceAll("([^a-z0-9])","_")
47        }
48}
Note: See TracBrowser for help on using the repository browser.