1 | import org.codehaus.groovy.grails.commons.GrailsApplication |
---|
2 | import grails.util.GrailsUtil |
---|
3 | import dbnp.studycapturing.* |
---|
4 | import intient.nimble.InstanceGenerator |
---|
5 | |
---|
6 | /** |
---|
7 | * Application Bootstrapper |
---|
8 | * @Author Jeroen Wesbeek |
---|
9 | * @Since 20091021 |
---|
10 | * |
---|
11 | * Revision information: |
---|
12 | * $Rev: 95 $ |
---|
13 | * $Author: ademcan $ |
---|
14 | * $Date: 2010-01-19 14:39:33 +0000 (di, 19 jan 2010) $ |
---|
15 | */ |
---|
16 | class BootStrap { |
---|
17 | def init = {servletContext -> |
---|
18 | |
---|
19 | new Study(title:"test",code:"code",researchQuestion:"Rquestion",description:"description",ecCode:"ecCode",dateCreated:new Date(),lastUpdated:new Date(),startDate:new Date()).save() |
---|
20 | |
---|
21 | if (GrailsUtil.environment == GrailsApplication.ENV_DEVELOPMENT) { |
---|
22 | printf("development bootstrapping....\n\n"); |
---|
23 | |
---|
24 | // ontologies |
---|
25 | def speciesOntology = new Ontology( |
---|
26 | name: 'Species', |
---|
27 | shortName: 'Species', |
---|
28 | url: 'http://www.obofoundry.org/cgi-bin/detail.cgi?id=ncbi_taxonomy' |
---|
29 | ).save() |
---|
30 | |
---|
31 | // terms |
---|
32 | def mouseTerm = new Term( |
---|
33 | name: 'Mus musculus', |
---|
34 | ontology: speciesOntology, |
---|
35 | accession: '10090' |
---|
36 | ).save() |
---|
37 | def humanTerm = new Term( |
---|
38 | name: 'Homo sapiens', |
---|
39 | ontology: speciesOntology, |
---|
40 | accession: '9606' |
---|
41 | ).save() |
---|
42 | |
---|
43 | // create system user |
---|
44 | /* |
---|
45 | def systemUser = userService.createUser(InstanceGenerator.user( |
---|
46 | username: 'system', |
---|
47 | pass: 'system', |
---|
48 | passConfirm: 'system', |
---|
49 | enabled: true |
---|
50 | )) |
---|
51 | */ |
---|
52 | |
---|
53 | // define template fields |
---|
54 | def genotypeTemplateField = new TemplateSubjectField( |
---|
55 | name: 'Genotype', |
---|
56 | type: TemplateFieldType.STRINGLIST |
---|
57 | ).save() |
---|
58 | |
---|
59 | // Mouse template |
---|
60 | def mouseTemplate = new Template( |
---|
61 | name: 'Mouse' |
---|
62 | ).addToSubjectFields(genotypeTemplateField).save() |
---|
63 | } |
---|
64 | } |
---|
65 | |
---|
66 | def destroy = { |
---|
67 | } |
---|
68 | } |
---|