source: trunk/grails-app/domain/nl/tno/metagenomics/Sample.groovy @ 9

Last change on this file since 9 was 9, checked in by robert@…, 12 years ago
File size: 836 bytes
Line 
1package nl.tno.metagenomics
2
3/**
4* Minimal representation of a sample. The sampleToken is the link with a sample object in GSCF.
5*
6* @see GscfService.getSample
7*/
8class Sample {
9        String  sampleToken             // Unique within a study
10        String  name
11        String  subject
12        String  event
13       
14        static belongsTo    = [ study: Study ]
15        static hasMany      = [ assaySamples: AssaySample ]
16        static mapping = {
17                columns {
18                        assayToken index:'sampletoken_idx'
19                }
20                assaySamples cascade: "all-delete-orphan"
21        }
22        static constraints = {
23                subject(nullable: true)
24                event(nullable: true)
25        }
26       
27        public static cloneSample( Sample otherSample, String newSampleToken, Study otherStudy ) {
28                return new Sample( 
29                        sampleToken: newSampleToken, 
30                        name: otherSample.name, 
31                        subject: otherSample.subject, 
32                        event: otherSample.event, 
33                        study: otherStudy
34                );
35        }
36}
Note: See TracBrowser for help on using the repository browser.