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

Last change on this file since 496 was 496, checked in by duh, 13 years ago
  • set svn keyword expansion
  • Property svn:keywords set to Date Rev Author
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        Subject parentSubject
12        SamplingEvent parentEvent
13
14        String name     // should be unique with respect to the parent study (which can be inferred)
15        Term material   // a member that describes the quantity of the sample? --> should be in the templates
16
17        /**
18         * return the domain fields for this domain class
19         * @return List
20         */
21        List<TemplateField> giveDomainFields() { return Sample.domainFields }
22        static List<TemplateField> domainFields =
23                [
24                        new TemplateField(
25                                name: 'name',
26                                type: TemplateFieldType.STRING,
27                                preferredIdentifier: true),
28                        new TemplateField(
29                                name: 'material',
30                                type: TemplateFieldType.ONTOLOGYTERM )
31                ]
32
33        static constraints = {
34                parentSubject(nullable:true)
35        }
36
37        static getSamplesFor( event ) {
38            return  Sample.findAll( 'from Sample s where s.parentEvent =:event', [event:event] )
39        }
40
41}
Note: See TracBrowser for help on using the repository browser.