source: trunk/grails-app/conf/BootStrap.groovy @ 639

Last change on this file since 639 was 639, checked in by jahn, 13 years ago

Removed minor bug.

  • Property svn:keywords set to Author Rev Date
File size: 1.5 KB
Line 
1import dbnp.studycapturing.*
2
3import dbnp.data.Ontology
4import dbnp.data.Term
5import dbnp.rest.common.CommunicationManager
6import org.codehaus.groovy.grails.commons.GrailsApplication
7import grails.util.GrailsUtil
8
9/**
10 * Application Bootstrapper
11 * @Author Jeroen Wesbeek
12 * @Since 20091021
13 *
14 * Revision information:
15 * $Rev: 639 $
16 * $Author: jahn $
17 * $Date: 2010-07-01 15:29:46 +0000 (do, 01 jul 2010) $
18 */
19class BootStrap {
20        def init = {servletContext ->
21                // define timezone
22                System.setProperty('user.timezone', 'CET')
23
24                if (Template.count() == 0) {
25                        println "No templates in the current database.";
26                        // Add example study, subject, event etc. templates
27                        BootStrapTemplates.initTemplates()
28
29                        // Add example studies
30                        if (Study.count() == 0 && grails.util.GrailsUtil.environment == GrailsApplication.ENV_DEVELOPMENT) {
31
32                                // When the code is properly refactored, BootStrapStudies.addExampleStudies() may be called here
33                        }
34                }
35
36                /**
37                 * attach ontologies in runtime. Possible problem is that you need
38                 * an internet connection when bootstrapping though.
39                 * @see dbnp.studycapturing.Subject
40                 * @see dbnp.studycapturing.Sample
41                 */
42                TemplateEntity.getField(Subject.domainFields, 'species').ontologies = [Ontology.getOrCreateOntologyByNcboId(1132)]
43                TemplateEntity.getField(Sample.domainFields, 'material').ontologies = [Ontology.getOrCreateOntologyByNcboId(1005)]
44
45                // register methods for accessing SAM's Rest services
46                CommunicationManager.SAMServerURL = 'nbx5.nugo.org/sam'
47        CommunicationManager.registerRestWrapperMethodsSAMtoGSCF()
48        }
49
50        def destroy = {
51        }
52} 
Note: See TracBrowser for help on using the repository browser.