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

Last change on this file since 246 was 246, checked in by duh, 9 years ago
  • increased session lifetime to 7 days
  • improved wizard study template selector
  • wizard study page now contains study template fields (which are not yet handled)
  • added protocol selector to event descriptions page
  • renamed the 'blood sampling' protocol to 'Blood sampling' (it was duplicately named 'Liver sampling')
  • Property svn:keywords set to Rev Date Author
File size: 1.8 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: 246 $
8 * $Author: duh $
9 * $Date: 2010-03-08 17:25:07 +0000 (ma, 08 mrt 2010) $
10 */
11class Study extends TemplateEntity implements Serializable {
12        static searchable = true
13        nimble.User owner
14        String title
15
16        // TODO: The following 4 fields should be moved into templates
17        String code
18        String researchQuestion
19        String description
20        String ecCode
21
22        Date dateCreated
23        Date lastUpdated
24        Date startDate
25
26        static hasMany = [
27                editors: nimble.User,
28                readers: nimble.User,
29                subjects: Subject,
30                groups: SubjectGroup,
31                events: Event,
32                samplingEvents: SamplingEvent,
33                eventGroups: EventGroup,
34                samples: Sample,
35                assays: Assay,
36                persons: StudyPerson,
37                publications: Publication
38        ]
39
40        static constraints = {
41                owner(nullable: true, blank: true)
42                title(nullable: false, blank: false)
43                template(nullable: false, blank: false)
44        }
45
46        static mapping = {
47                researchQuestion type: 'text'
48                description type: 'text'
49                autoTimestamp true
50        }
51
52        def String toString() {
53                return title;
54        }
55
56        /**
57         * Return the unique Subject templates that are used in this study
58         */
59        def Set<Template> giveSubjectTemplates() {
60                TemplateEntity.giveTemplates(subjects);
61        }
62
63
64        /**
65         * Returns the template of all subjects in the study
66         * Throws an error if there are no or multiple subject templates
67         */
68        // outcommented, we shouldn't make it too easy for ourselves by introducing uncertain assumptions (1 distinct template)
69        //def Template giveSubjectTemplate() {
70        //      TemplateEntity.giveTemplate(subjects);
71        //}
72
73        /**
74         * Returns the unique Sample templates that are used in the study
75         */
76        def Template giveSampleTemplates() {
77                TemplateEntity.giveTemplates(samples);
78        }
79        /**
80         * Returns the template of the study
81         */
82        def Template giveStudyTemplate() {
83                return this.template;
84        }
85}
Note: See TracBrowser for help on using the repository browser.