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

Last change on this file since 229 was 229, checked in by keesvb, 10 years ago

updated study/show to show multiple subject templates

  • 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: 229 $
8 * $Author: keesvb $
9 * $Date: 2010-03-03 11:50:40 +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                samples: Sample,
31                assays: Assay,
32                persons: StudyPerson,
33                publications: Publication
34        ]
35
36        static constraints = {
37                owner(nullable: true, blank: true)
38                title(nullable: false, blank: false)
39                template(nullable: true, blank: true)
40        }
41
42        static mapping = {
43                researchQuestion type: 'text'
44                description type: 'text'
45                autoTimestamp true
46        }
47
48        def String toString() {
49                return title;
50        }
51
52        /**
53         * Return the unique Subject templates that are used in this study
54         */
55        def Set<Template> giveSubjectTemplates() {
56                TemplateEntity.giveTemplates(subjects);
57        }
58
59
60        /**
61         * Returns the template of all subjects in the study
62         * Throws an error if there are no or multiple subject templates
63         */
64        // outcommented, we shouldn't make it too easy for ourselves by introducing uncertain assumptions (1 distinct template)
65        //def Template giveSubjectTemplate() {
66        //      TemplateEntity.giveTemplate(subjects);
67        //}
68
69        /**
70         * Returns the unique Sample templates that are used in the study
71         */
72        def Template giveSampleTemplates() {
73                TemplateEntity.giveTemplates(samples);
74        }
75        /**
76         * Returns the template of the study
77         */
78        def Template giveStudyTemplate() {
79                return this.template;
80        }
81}
Note: See TracBrowser for help on using the repository browser.