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

Revision 408, 1.0 KB (checked in by keesvb, 4 years ago)

reverted changes which removed domain fields from the domain classes, we are now back again at more or less the situation of #394, added preferredIdentifier property to TemplateField? to facilitate simple import

  • Property svn:keywords set to Date Author Rev
RevLine 
[81]1package dbnp.studycapturing
2
[106]3import dbnp.data.Term
[394]4import dbnp.data.Ontology
[106]5
[84]6/**
7 * The Sample class describes an actual sample which results from a SamplingEvent.
8 */
[232]9class Sample extends TemplateEntity {
[139]10        static searchable = true
[232]11        Subject parentSubject
12        SamplingEvent parentEvent
[84]13
[408]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
[224]16
[397]17        /**
18         * return the domain fields for this domain class
19         * @return List
20         */
[392]21        List<TemplateField> giveDomainFields() {
[397]22                [
23                        new TemplateField(
24                                name: 'name',
[408]25                                type: TemplateFieldType.STRING,
26                                preferredIdentifier: true),
[397]27                        new TemplateField(
28                                name: 'material',
29                                type: TemplateFieldType.ONTOLOGYTERM,
30                                ontologies: [Ontology.findByNcboId(1005)])
31                ]
[375]32        }
33
[232]34        static constraints = {
[288]35                parentSubject(nullable:true)
[232]36        }
[81]37
[288]38        static getSamplesFor( event ) {
39            return  Sample.findAll( 'from Sample s where s.parentEvent =:event', [event:event] )
40        }
41
[81]42}
Note: See TracBrowser for help on using the browser.