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

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

updated TemplateEntity? to include empty maps, also added the EventGroups? to EventGroup? collection in BootStrap?

  • Property svn:keywords set to Rev Date Author
File size: 1.8 KB
RevLine 
[77]1package dbnp.studycapturing
2
3/**
4 * Domain class describing the basic entity in the study capture part: the Study class.
[103]5 *
6 * Revision information:
7 * $Rev: 236 $
8 * $Author: keesvb $
9 * $Date: 2010-03-05 13:20:10 +0000 (vr, 05 mrt 2010) $
[77]10 */
[212]11class Study extends TemplateEntity implements Serializable {
[139]12        static searchable = true
[92]13        nimble.User owner
14        String title
[236]15
16        // TODO: The following 4 fields should be moved into templates
[92]17        String code
18        String researchQuestion
19        String description
20        String ecCode
[236]21
[92]22        Date dateCreated
23        Date lastUpdated
24        Date startDate
[77]25
[212]26        static hasMany = [
27                editors: nimble.User,
28                readers: nimble.User,
29                subjects: Subject,
30                groups: SubjectGroup,
31                events: Event,
32                samplingEvents: SamplingEvent,
[232]33                eventGroups: EventGroup,
[224]34                samples: Sample,
[212]35                assays: Assay,
36                persons: StudyPerson,
37                publications: Publication
[103]38        ]
[77]39
[92]40        static constraints = {
[101]41                owner(nullable: true, blank: true)
42                title(nullable: false, blank: false)
43                template(nullable: true, blank: true)
[92]44        }
[77]45
[92]46        static mapping = {
47                researchQuestion type: 'text'
48                description type: 'text'
[136]49                autoTimestamp true
[92]50        }
[100]51
[103]52        def String toString() {
53                return title;
54        }
[176]55
[228]56        /**
[229]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        /**
[228]65         * Returns the template of all subjects in the study
66         * Throws an error if there are no or multiple subject templates
67         */
[229]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        //}
[228]72
73        /**
[229]74         * Returns the unique Sample templates that are used in the study
[228]75         */
[229]76        def Template giveSampleTemplates() {
77                TemplateEntity.giveTemplates(samples);
[228]78        }
79        /**
80         * Returns the template of the study
81         */
82        def Template giveStudyTemplate() {
83                return this.template;
84        }
[77]85}
Note: See TracBrowser for help on using the repository browser.