source: trunk/grails-app/domain/dbnp/studycapturing/Sample.groovy @ 394

Last change on this file since 394 was 394, checked in by keesvb, 11 years ago

added ontology specifications to Subject species and Sample material domain fields

  • Property svn:keywords set to Date Author Rev
File size: 1.0 KB
Line 
1package dbnp.studycapturing
2
3import dbnp.data.Term
4import dbnp.data.Ontology
5
6/**
7 * The Sample class describes an actual sample which results from a SamplingEvent.
8 */
9class Sample extends TemplateEntity {
10        static searchable = true
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
17        // a member that describes the quantity of the sample? --> should be in the templates
18
19        List<TemplateField> giveDomainFields() {
20                [ new TemplateField(
21                            name: 'name',
22                            type: TemplateFieldType.STRING),
23                        new TemplateField(
24                            name: 'material',
25                            type: TemplateFieldType.ONTOLOGYTERM,
26                            ontologies: [Ontology.findByNcboId(1005)])
27                ];
28        }
29
30        static constraints = {
31                parentSubject(nullable:true)
32        }
33
34        static getSamplesFor( event ) {
35            return  Sample.findAll( 'from Sample s where s.parentEvent =:event', [event:event] )
36        }
37
38}
Note: See TracBrowser for help on using the repository browser.