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

Last change on this file since 34 was 34, checked in by gav, 16 years ago

Re-added launch and tmproj with correct name, added more BootStrap? values, change code to use .png files

File size: 3.8 KB
Line 
1import grails.util.GrailsUtil
2
3class BootStrap 
4{
5    def init = { servletContext ->
6
7    println "**** BootStrap; GrailsUtil.environment: ${GrailsUtil.environment}"
8   
9        switch (GrailsUtil.environment)
10        {
11            case "development":
12                        println "**** BootStrap detected development"
13                        configureForDevelopment()
14                        break
15            case "test":
16                        println "**** BootStrap detected test"
17                        configureForTest()
18                        break
19            case "production":
20                        println "**** BootStrap detected production"
21                        configureForProduction()
22                        break 
23        }
24   
25    }
26
27    def destroy = {
28    }
29   
30    /*
31        Tasks to do when Grails is running in each environment.
32    */
33    void configureForDevelopment()
34    {
35        println "BootStrap configureForDevelopment() called"
36   
37        //TypeOfPersonGroup
38        new PersonGroupType(name:"Department").save()
39        new PersonGroupType(name:"Contractor").save()
40        new PersonGroupType(name:"ProjectTeam").save()
41   
42        //PersonGroup
43        new PersonGroup(personGroupType:PersonGroupType.findByName("Department"),
44                        name:"Electrical").save()
45        new PersonGroup(personGroupType:PersonGroupType.get(2),
46                        name:"Kewl AirCon Guys").save()
47        new PersonGroup(personGroupType:PersonGroupType.get(3),
48                        name:"gnuMims").save()
49           
50        //Person
51        new Person(personGroup:PersonGroup.get(1),
52                   firstName:"FirstNameTech1",
53                   lastName:"LastNameTech1").save()
54        new Person(personGroup:PersonGroup.get(2),
55                   firstName:"Joe",
56                   lastName:"Samples").save()
57               
58        //TaskGroup
59        new TaskGroup(name:"Engineering",
60                      description:"Engineering task group").save()
61        new TaskGroup(name:"Production",
62                      description:"Production task group").save()
63        new TaskGroup(name:"NewProject(s)",
64                      description:" ").save()
65                     
66       
67        //Task
68        new Task(taskGroup:TaskGroup.findByName("Engineering"),
69                 person:Person.get(1),
70                 name:"Check specific level sensor",
71                 description:"Has been noted as problematic, try recallibrating",
72                 scheduledDate: new Date(),
73                 targetDate: new Date() ).save()
74        new Task(taskGroup:TaskGroup.findByName("Production"),
75                 person:Person.get(2),
76                 name:"Production Report",
77                 description:"Production report for specific production run or shift",
78                 scheduledDate: new Date(),
79                 targetDate: new Date() ).save()
80
81        //EntryType
82        new EntryType(name:"Fault").save()
83        new EntryType(name:"WorkDone").save()
84
85        //ModificationType
86        new ModificationType(name:"Created").save()
87        new ModificationType(name:"Completed").save()
88        new ModificationType(name:"Closed").save()
89        new ModificationType(name:"Altered").save()
90        new ModificationType(name:"TargetDateModified").save()
91        new ModificationType(name:"ScheduledDateModified").save()
92        new ModificationType(name:"DescriptionModified").save()
93        new ModificationType(name:"AssignedToModified").save()
94        new ModificationType(name:"NameModified").save()
95
96
97   
98    }
99   
100    //---------------------------------------------------------
101    void configureForTest()
102    {
103        println "BootStrap configureForTest() called"
104    }
105   
106    //---------------------------------------------------------
107    void configureForProduction()
108    {
109        println "BootStrap configureForProduction() called"
110    }
111
112}
Note: See TracBrowser for help on using the repository browser.