1 | package 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: 421 $ |
---|
8 | * $Author: keesvb $ |
---|
9 | * $Date: 2010-05-17 13:26:48 +0000 (ma, 17 mei 2010) $ |
---|
10 | */ |
---|
11 | class Study extends TemplateEntity implements Serializable { |
---|
12 | static searchable = true |
---|
13 | nimble.User owner |
---|
14 | String title |
---|
15 | Date dateCreated |
---|
16 | Date lastUpdated |
---|
17 | Date startDate |
---|
18 | |
---|
19 | /** |
---|
20 | * return the domain fields for this domain class |
---|
21 | * @return List |
---|
22 | */ |
---|
23 | List<TemplateField> giveDomainFields() { |
---|
24 | [ |
---|
25 | new TemplateField( |
---|
26 | name: 'title', |
---|
27 | type: TemplateFieldType.STRING), |
---|
28 | new TemplateField( |
---|
29 | name: 'startDate', |
---|
30 | type: TemplateFieldType.DATE) |
---|
31 | ] |
---|
32 | } |
---|
33 | |
---|
34 | static hasMany = [ |
---|
35 | editors: nimble.User, |
---|
36 | readers: nimble.User, |
---|
37 | subjects: Subject, |
---|
38 | events: Event, |
---|
39 | samplingEvents: SamplingEvent, |
---|
40 | eventGroups: EventGroup, |
---|
41 | samples: Sample, |
---|
42 | assays: Assay, |
---|
43 | persons: StudyPerson, |
---|
44 | publications: Publication |
---|
45 | ] |
---|
46 | |
---|
47 | static constraints = { |
---|
48 | owner(nullable: true, blank: true) |
---|
49 | } |
---|
50 | |
---|
51 | static mapping = { |
---|
52 | researchQuestion type: 'text' |
---|
53 | description type: 'text' |
---|
54 | autoTimestamp true |
---|
55 | } |
---|
56 | |
---|
57 | /** |
---|
58 | * return the title of this study |
---|
59 | */ |
---|
60 | def String toString() { |
---|
61 | return title; |
---|
62 | } |
---|
63 | |
---|
64 | /** |
---|
65 | * Return the unique Subject templates that are used in this study |
---|
66 | */ |
---|
67 | def Set<Template> giveSubjectTemplates() { |
---|
68 | TemplateEntity.giveTemplates(subjects); |
---|
69 | } |
---|
70 | |
---|
71 | /** |
---|
72 | * Return the unique Event and SamplingEvent templates that are used in this study |
---|
73 | */ |
---|
74 | Set<Template> giveAllEventTemplates() { |
---|
75 | // For some reason, giveAllEventTemplates() + giveAllSamplingEventTemplates() |
---|
76 | // gives trouble when asking .size() to the result |
---|
77 | // So we also use giveTemplates here |
---|
78 | TemplateEntity.giveTemplates(events + samplingEvents); |
---|
79 | } |
---|
80 | |
---|
81 | |
---|
82 | /** |
---|
83 | * Return the unique Event templates that are used in this study |
---|
84 | */ |
---|
85 | Set<Template> giveEventTemplates() { |
---|
86 | TemplateEntity.giveTemplates(events); |
---|
87 | } |
---|
88 | |
---|
89 | /** |
---|
90 | * Return the unique SamplingEvent templates that are used in this study |
---|
91 | */ |
---|
92 | Set<Template> giveSamplingEventTemplates() { |
---|
93 | TemplateEntity.giveTemplates(samplingEvents); |
---|
94 | } |
---|
95 | |
---|
96 | /** |
---|
97 | * Returns the unique Sample templates that are used in the study |
---|
98 | */ |
---|
99 | Set<Template> giveSampleTemplates() { |
---|
100 | TemplateEntity.giveTemplates(samples); |
---|
101 | } |
---|
102 | /** |
---|
103 | * Returns the template of the study |
---|
104 | */ |
---|
105 | Template giveStudyTemplate() { |
---|
106 | return this.template; |
---|
107 | } |
---|
108 | } |
---|