Last change
on this file since 652 was
652,
checked in by keesvb, 13 years ago
|
relocated getExternalSampleId to name
|
-
Property svn:keywords set to
Date Rev Author
|
File size:
1.4 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 = { [only: ['name']] } |
---|
11 | |
---|
12 | Subject parentSubject |
---|
13 | SamplingEvent parentEvent |
---|
14 | |
---|
15 | String name // should be unique with respect to the parent study (which can be inferred) |
---|
16 | Term material // material of the sample (should normally be bound to the BRENDA ontology) |
---|
17 | |
---|
18 | def getExternalSampleId() { name } |
---|
19 | |
---|
20 | // TODO: Write a validation method that checks if the externalSampleId (currently defined as name) |
---|
21 | // is really unique within each parent study of this sample. |
---|
22 | // Maybe this could also be a constraint, but we might run into trouble creating new Sample objects in e.g. the create wizard. |
---|
23 | // To be checked. |
---|
24 | |
---|
25 | /** |
---|
26 | * return the domain fields for this domain class |
---|
27 | * @return List |
---|
28 | */ |
---|
29 | static List<TemplateField> giveDomainFields() { return Sample.domainFields } |
---|
30 | static List<TemplateField> domainFields = [ |
---|
31 | new TemplateField( |
---|
32 | name: 'name', |
---|
33 | type: TemplateFieldType.STRING, |
---|
34 | preferredIdentifier: true |
---|
35 | ), |
---|
36 | new TemplateField( |
---|
37 | name: 'material', |
---|
38 | type: TemplateFieldType.ONTOLOGYTERM |
---|
39 | ) |
---|
40 | ] |
---|
41 | |
---|
42 | static constraints = { |
---|
43 | parentSubject(nullable:true) |
---|
44 | } |
---|
45 | |
---|
46 | static getSamplesFor( event ) { |
---|
47 | return Sample.findAll( 'from Sample s where s.parentEvent =:event', [event:event] ) |
---|
48 | } |
---|
49 | |
---|
50 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.