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

Last change on this file since 540 was 540, checked in by duh, 11 years ago
  • fixed indentation shite!!!
  • samples dev commit
  • 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        static List<TemplateField> giveDomainFields() { return Sample.domainFields }
22        static List<TemplateField> domainFields = [
23                new TemplateField(
24                        name: 'name',
25                        type: TemplateFieldType.STRING,
26                        preferredIdentifier: true
27                ),
28                new TemplateField(
29                        name: 'material',
30                        type: TemplateFieldType.ONTOLOGYTERM
31                )
32        ]
33
34        static constraints = {
35                parentSubject(nullable:true)
36        }
37
38        static getSamplesFor( event ) {
39                return  Sample.findAll( 'from Sample s where s.parentEvent =:event', [event:event] )
40        }
41}
Note: See TracBrowser for help on using the repository browser.