Last change
on this file since 640 was
640,
checked in by vinlud, 13 years ago
|
Setting Searchable only to search in known string fields
|
-
Property svn:keywords set to
Date Rev Author
|
File size:
1.1 KB
|
Line | |
---|
1 | package dbnp.studycapturing |
---|
2 | |
---|
3 | import dbnp.data.Term |
---|
4 | import dbnp.data.Ontology |
---|
5 | |
---|
6 | /** |
---|
7 | * The Sample class describes an actual sample which results from a SamplingEvent. |
---|
8 | */ |
---|
9 | class Sample extends TemplateEntity { |
---|
10 | static searchable = { |
---|
11 | [only: ['name']] |
---|
12 | } |
---|
13 | |
---|
14 | Subject parentSubject |
---|
15 | SamplingEvent parentEvent |
---|
16 | |
---|
17 | String name // should be unique with respect to the parent study (which can be inferred) |
---|
18 | Term material // a member that describes the quantity of the sample? --> should be in the templates |
---|
19 | |
---|
20 | /** |
---|
21 | * return the domain fields for this domain class |
---|
22 | * @return List |
---|
23 | */ |
---|
24 | static List<TemplateField> giveDomainFields() { return Sample.domainFields } |
---|
25 | static List<TemplateField> domainFields = [ |
---|
26 | new TemplateField( |
---|
27 | name: 'name', |
---|
28 | type: TemplateFieldType.STRING, |
---|
29 | preferredIdentifier: true |
---|
30 | ), |
---|
31 | new TemplateField( |
---|
32 | name: 'material', |
---|
33 | type: TemplateFieldType.ONTOLOGYTERM |
---|
34 | ) |
---|
35 | ] |
---|
36 | |
---|
37 | static constraints = { |
---|
38 | parentSubject(nullable:true) |
---|
39 | } |
---|
40 | |
---|
41 | static getSamplesFor( event ) { |
---|
42 | return Sample.findAll( 'from Sample s where s.parentEvent =:event', [event:event] ) |
---|
43 | } |
---|
44 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.