Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/grails-app/conf/BootStrap.groovy

    r25 r20  
    1 import grails.util.GrailsUtil
     1class BootStrap {
    22
    3 class BootStrap
    4 {
    5     def init = { servletContext ->
     3     def init = { servletContext ->
    64
    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     }
     5        //TypeOfPersonGroup
     6         new TypeOfPersonGroup(name:"Department").save()
     7         new TypeOfPersonGroup(name:"Contractor").save()
     8         new TypeOfPersonGroup(name:"ProjectTeam").save()
     9         
     10         //PersonGroup
     11         new PersonGroup(typeOfPersonGroup:TypeOfPersonGroup.get(1),
     12             name:"Electrical").save()
     13         new PersonGroup(typeOfPersonGroup:TypeOfPersonGroup.get(2),
     14             name:"Kewl AirCon Guys").save()
     15         new PersonGroup(typeOfPersonGroup:TypeOfPersonGroup.get(3),
     16             name:"openMim").save()
     17     }
    2618
    2719    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:"openMim").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     }
    86    
    87     //---------------------------------------------------------
    88     void configureForTest()
    89     {
    90         println "BootStrap configureForTest() called"
    91     }
    92    
    93     //---------------------------------------------------------
    94     void configureForProduction()
    95     {
    96         println "BootStrap configureForProduction() called"
    97     }
    98 
     20     }
    9921}
Note: See TracChangeset for help on using the changeset viewer.