Last change
on this file since 348 was
348,
checked in by keesvb, 13 years ago
|
added ontology list for ontology template fields
|
-
Property svn:keywords set to
Date Rev Author
|
File size:
1.2 KB
|
Line | |
---|
1 | package dbnp.studycapturing |
---|
2 | |
---|
3 | /** |
---|
4 | * This is the class for template fields. These should be part of one or more templates via Template.fields |
---|
5 | * |
---|
6 | * Revision information: |
---|
7 | * $Rev: 348 $ |
---|
8 | * $Author: keesvb $ |
---|
9 | * $Date: 2010-04-19 10:01:09 +0000 (ma, 19 apr 2010) $ |
---|
10 | */ |
---|
11 | class TemplateField implements Serializable { |
---|
12 | String name |
---|
13 | TemplateFieldType type |
---|
14 | String unit |
---|
15 | String comment // help string for the user interface |
---|
16 | |
---|
17 | List listEntries |
---|
18 | static hasMany = [listEntries : TemplateFieldListItem, |
---|
19 | // to store the entries to choose from when the type is 'item from predefined list' |
---|
20 | ontologies : Ontology // to store the ontologies to choose from when the type is 'ontology term' |
---|
21 | ] |
---|
22 | static constraints = { |
---|
23 | name(unique: true) |
---|
24 | unit(nullable: true, blank: true) |
---|
25 | comment(nullable:true, blank: true) |
---|
26 | } |
---|
27 | |
---|
28 | static mapping = { |
---|
29 | comment type: 'text' |
---|
30 | } |
---|
31 | |
---|
32 | String toString() { |
---|
33 | return name |
---|
34 | } |
---|
35 | |
---|
36 | |
---|
37 | /** |
---|
38 | * return an escaped name which can be used in business logic |
---|
39 | * @return String |
---|
40 | */ |
---|
41 | def String escapedName() { |
---|
42 | return name.toLowerCase().replaceAll("([^a-z0-9])","_") |
---|
43 | } |
---|
44 | |
---|
45 | //TODO: make a convenience setter for a string array |
---|
46 | /*def setListEntries(ArrayList entries) { |
---|
47 | list=[] |
---|
48 | entries.each { |
---|
49 | list.add(new TemplateFieldListItem(name: it)) |
---|
50 | } |
---|
51 | this |
---|
52 | }*/ |
---|
53 | |
---|
54 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.