root/trunk/grails-app/domain/dbnp/studycapturing/Sample.groovy @ 643

Revision 643, 1.1 KB (checked in by jahn, 4 years ago)

This setting of searchable features seems not to provoke searchable errors for the time being.

  • Property svn:keywords set to Date Rev Author
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
18        /**
19         * return the domain fields for this domain class
20         * @return List
21         */
22        static List<TemplateField> giveDomainFields() { return Sample.domainFields }
23        static List<TemplateField> domainFields = [
24                new TemplateField(
25                        name: 'name',
26                        type: TemplateFieldType.STRING,
27                        preferredIdentifier: true
28                ),
29                new TemplateField(
30                        name: 'material',
31                        type: TemplateFieldType.ONTOLOGYTERM
32                )
33        ]
34
35        static constraints = {
36                parentSubject(nullable:true)
37        }
38
39        static getSamplesFor( event ) {
40                return  Sample.findAll( 'from Sample s where s.parentEvent =:event', [event:event] )
41        }
42}
Note: See TracBrowser for help on using the browser.