Last change
on this file since 635 was
626,
checked in by keesvb, 13 years ago
|
removed example templates and studies from BootStrap? to separate files
|
-
Property svn:keywords set to
Author Rev Date
|
File size:
1.3 KB
|
Line | |
---|
1 | import dbnp.studycapturing.* |
---|
2 | |
---|
3 | import dbnp.data.Ontology |
---|
4 | import dbnp.data.Term |
---|
5 | import org.codehaus.groovy.grails.commons.GrailsApplication |
---|
6 | import grails.util.GrailsUtil |
---|
7 | |
---|
8 | /** |
---|
9 | * Application Bootstrapper |
---|
10 | * @Author Jeroen Wesbeek |
---|
11 | * @Since 20091021 |
---|
12 | * |
---|
13 | * Revision information: |
---|
14 | * $Rev: 626 $ |
---|
15 | * $Author: duh $ |
---|
16 | * $Date: 2010-06-25 14:03:14 +0000 (vr, 25 jun 2010) $ |
---|
17 | */ |
---|
18 | class BootStrap { |
---|
19 | def init = {servletContext -> |
---|
20 | // define timezone |
---|
21 | System.setProperty('user.timezone', 'CET') |
---|
22 | |
---|
23 | if (Template.count() == 0) { |
---|
24 | println "No templates in the current database."; |
---|
25 | // Add example study, subject, event etc. templates |
---|
26 | BootStrapTemplates.initTemplates() |
---|
27 | |
---|
28 | // Add example studies |
---|
29 | if (Study.count() == 0 && grails.util.GrailsUtil.environment == GrailsApplication.ENV_DEVELOPMENT) { |
---|
30 | |
---|
31 | // When the code is properly refactored, BootStrapStudies.addExampleStudies() may be called here |
---|
32 | } |
---|
33 | } |
---|
34 | |
---|
35 | /** |
---|
36 | * attach ontologies in runtime. Possible problem is that you need |
---|
37 | * an internet connection when bootstrapping though. |
---|
38 | * @see dbnp.studycapturing.Subject |
---|
39 | * @see dbnp.studycapturing.Sample |
---|
40 | */ |
---|
41 | TemplateEntity.getField(Subject.domainFields, 'species').ontologies = [Ontology.getOrCreateOntologyByNcboId(1132)] |
---|
42 | TemplateEntity.getField(Sample.domainFields, 'material').ontologies = [Ontology.getOrCreateOntologyByNcboId(1005)] |
---|
43 | } |
---|
44 | |
---|
45 | def destroy = { |
---|
46 | } |
---|
47 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.