source: trunk/grails-app/domain/dbnp/studycapturing/Study.groovy @ 232

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

adjusted Event-Sample relationship to go into EventGroup?, added EventGroups? in BootStrap?, added a Study template to BootStrap?

  • Property svn:keywords set to Rev Date Author
File size: 1.7 KB
Line 
1package dbnp.studycapturing
2
3/**
4 * Domain class describing the basic entity in the study capture part: the Study class.
5 *
6 * Revision information:
7 * $Rev: 232 $
8 * $Author: keesvb $
9 * $Date: 2010-03-03 16:18:22 +0000 (wo, 03 mrt 2010) $
10 */
11class Study extends TemplateEntity implements Serializable {
12        static searchable = true
13        nimble.User owner
14        String title
15        String code
16        String researchQuestion
17        String description
18        String ecCode
19        Date dateCreated
20        Date lastUpdated
21        Date startDate
22
23        static hasMany = [
24                editors: nimble.User,
25                readers: nimble.User,
26                subjects: Subject,
27                groups: SubjectGroup,
28                events: Event,
29                samplingEvents: SamplingEvent,
30                eventGroups: EventGroup,
31                samples: Sample,
32                assays: Assay,
33                persons: StudyPerson,
34                publications: Publication
35        ]
36
37        static constraints = {
38                owner(nullable: true, blank: true)
39                title(nullable: false, blank: false)
40                template(nullable: true, blank: true)
41        }
42
43        static mapping = {
44                researchQuestion type: 'text'
45                description type: 'text'
46                autoTimestamp true
47        }
48
49        def String toString() {
50                return title;
51        }
52
53        /**
54         * Return the unique Subject templates that are used in this study
55         */
56        def Set<Template> giveSubjectTemplates() {
57                TemplateEntity.giveTemplates(subjects);
58        }
59
60
61        /**
62         * Returns the template of all subjects in the study
63         * Throws an error if there are no or multiple subject templates
64         */
65        // outcommented, we shouldn't make it too easy for ourselves by introducing uncertain assumptions (1 distinct template)
66        //def Template giveSubjectTemplate() {
67        //      TemplateEntity.giveTemplate(subjects);
68        //}
69
70        /**
71         * Returns the unique Sample templates that are used in the study
72         */
73        def Template giveSampleTemplates() {
74                TemplateEntity.giveTemplates(samples);
75        }
76        /**
77         * Returns the template of the study
78         */
79        def Template giveStudyTemplate() {
80                return this.template;
81        }
82}
Note: See TracBrowser for help on using the repository browser.