Last change
on this file since 224 was
224,
checked in by keesvb, 11 years ago
|
revised templating system: templates are now per entity rather than per study, moved samples to Study
|
-
Property svn:keywords set to
Rev Date Author
|
File size:
1.1 KB
|
Line | |
---|
1 | package dbnp.studycapturing |
---|
2 | |
---|
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 study and subject entities is implemented. |
---|
7 | * |
---|
8 | * Revision information: |
---|
9 | * $Rev: 224 $ |
---|
10 | * $Author: keesvb $ |
---|
11 | * $Date: 2010-03-02 17:10:52 +0000 (di, 02 mrt 2010) $ |
---|
12 | */ |
---|
13 | class Template implements Serializable { |
---|
14 | |
---|
15 | String name |
---|
16 | Class entity |
---|
17 | //nimble.User owner |
---|
18 | |
---|
19 | static hasMany = [fields: TemplateField] |
---|
20 | |
---|
21 | static constraints = { |
---|
22 | name(unique:['entity']) |
---|
23 | |
---|
24 | } |
---|
25 | |
---|
26 | def String toString() { |
---|
27 | return this.name; |
---|
28 | } |
---|
29 | |
---|
30 | /** |
---|
31 | * Look up the type of a certain template subject field |
---|
32 | * @param fieldName The name of the template field |
---|
33 | * @return The type (static member of TemplateFieldType) of the field, or null of the field does not exist |
---|
34 | */ |
---|
35 | def TemplateFieldType getFieldType(String fieldName) { |
---|
36 | def field = fields.find { |
---|
37 | it.name == fieldName |
---|
38 | } |
---|
39 | field?.type |
---|
40 | } |
---|
41 | |
---|
42 | def getFieldsByType(TemplateFieldType fieldType) { |
---|
43 | def result = fields.findAll { |
---|
44 | it.type == fieldType |
---|
45 | } |
---|
46 | return result; |
---|
47 | } |
---|
48 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.