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

Last change on this file since 636 was 636, checked in by jahn, 11 years ago

Updated CommunicationManager? to support URL generation for SAM views.
The REST methods and Grails views used in inter module communcation
are now added in the CommunicationManager? from BootStrap?.

  • Property svn:keywords set to Author Rev Date
File size: 1.6 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: 636 $
16 * $Author: jahn $
17 * $Date: 2010-07-01 14:19: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.setSAMServerURL = 'nbx5.nugo.org/sam'
47        CommunicationManager.registerRestWrapperMethodsSAMtoGSCF()
48        CommunicationManager.registerRestWrapperMethodsSAMtoGSCF()
49        }
50
51        def destroy = {
52        }
53} 
Note: See TracBrowser for help on using the repository browser.