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

Last change on this file since 392 was 392, checked in by keesvb, 9 years ago

switched back from the fancy 'integrate domain fields as system fields directly into the Template object at the time of creation' method to the plain 'implement getFieldValue, setFieldValue and giveFields to work for both domain and template fields'. NB: this might affect Events, since until now startTime and endTime were moved directly into template! Switch any Event.template.fields to Event.giveFields()

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