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

Last change on this file since 651 was 651, checked in by jahn, 7 years ago

Added externalSampleId for SAM communication.

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