- Timestamp:
- Oct 9, 2009, 9:47:11 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/conf/BootStrap.groovy
r145 r149 1 1 import grails.util.GrailsUtil 2 2 3 class BootStrap 3 class BootStrap 4 4 { 5 //Required to be right here for Acegi plugin. 6 def authenticateService 7 Boolean BootStrapDemoDataSuccessful = true 5 def createDataService 8 6 9 7 def init = { servletContext -> 10 8 11 9 println "**** BootStrap GrailsUtil.environment = ${GrailsUtil.environment}" 12 10 13 11 switch (GrailsUtil.environment) 14 12 { 15 13 case "development": 16 bootStrapDemoData() 14 createDataService.ensureAdminAccess() 15 createDataService.createBaseData() 16 createDataService.createDemoData() 17 17 break 18 18 case "test": 19 createDataService.ensureAdminAccess() 19 20 break 20 21 case "production": 21 bootStrapDemoData()22 createDataService.ensureAdminAccess() 22 23 break 23 24 } 24 25 25 26 } 26 27 27 28 def destroy = { 28 29 } 29 30 //Insert some demo/startup data.31 void bootStrapDemoData()32 {33 println "BootStrapping demo data..."34 3.times{println it}35 36 /***********************37 START OF UTILITIES38 ***********************/39 40 //Site41 def siteInstance42 43 siteInstance = new Site(name: "Creek Mill")44 BootStrapSaveAndTest(siteInstance)45 46 siteInstance = new Site(name: "Jasper Street Depot")47 BootStrapSaveAndTest(siteInstance)48 49 //UnitOfMeasure50 def unitOfMeasureInstance51 52 //UnitOfMeasure #153 unitOfMeasureInstance = new UnitOfMeasure(name: "each")54 BootStrapSaveAndTest(unitOfMeasureInstance)55 56 //UnitOfMeasure #257 unitOfMeasureInstance = new UnitOfMeasure(name: "meter(s)")58 BootStrapSaveAndTest(unitOfMeasureInstance)59 60 //UnitOfMeasure #361 unitOfMeasureInstance = new UnitOfMeasure(name: "box(es)")62 BootStrapSaveAndTest(unitOfMeasureInstance)63 64 //UnitOfMeasure #465 unitOfMeasureInstance = new UnitOfMeasure(name: "litre(s)")66 BootStrapSaveAndTest(unitOfMeasureInstance)67 68 //UnitOfMeasure #569 unitOfMeasureInstance = new UnitOfMeasure(name: "kilogram(s)")70 BootStrapSaveAndTest(unitOfMeasureInstance)71 72 //Period73 def periodInstance74 75 //Period #176 periodInstance = new Period(period: "Day(s)")77 BootStrapSaveAndTest(periodInstance)78 79 //Period #280 periodInstance = new Period(period: "Week(s)")81 BootStrapSaveAndTest(periodInstance)82 83 //Period #384 periodInstance = new Period(period: "Month(s)")85 BootStrapSaveAndTest(periodInstance)86 87 //Period #488 periodInstance = new Period(period: "Year(s)")89 BootStrapSaveAndTest(periodInstance)90 91 /*********************92 START OF PERSON93 *********************/94 95 //TypeOfPersonGroup96 def personGroupTypeInstance97 personGroupTypeInstance = new PersonGroupType(name:"Department")98 BootStrapSaveAndTest(personGroupTypeInstance)99 personGroupTypeInstance = new PersonGroupType(name:"Contractor")100 BootStrapSaveAndTest(personGroupTypeInstance)101 personGroupTypeInstance = new PersonGroupType(name:"ProjectTeam")102 BootStrapSaveAndTest(personGroupTypeInstance)103 104 //PersonGroup105 def personGroupInstance106 personGroupInstance = new PersonGroup(personGroupType:PersonGroupType.findByName("Department"),107 name:"Electrical")108 BootStrapSaveAndTest(personGroupInstance)109 personGroupInstance = new PersonGroup(personGroupType:PersonGroupType.findByName("Department"),110 name:"Mechanical")111 BootStrapSaveAndTest(personGroupInstance)112 personGroupInstance = new PersonGroup(personGroupType:PersonGroupType.findByName("Department"),113 name:"Production")114 BootStrapSaveAndTest(personGroupInstance)115 personGroupInstance = new PersonGroup(personGroupType:PersonGroupType.get(2),116 name:"Kewl AirCon Guys")117 BootStrapSaveAndTest(personGroupInstance)118 personGroupInstance = new PersonGroup(personGroupType:PersonGroupType.get(3),119 name:"gnuMims")120 BootStrapSaveAndTest(personGroupInstance)121 122 //Authority123 def authInstance124 125 authInstance = new Authority(description:"Application Admin, not required for daily use! Grants full admin access to the application.",126 authority:"ROLE_AppAdmin")127 BootStrapSaveAndTest(authInstance)128 129 authInstance = new Authority(description:"Business manager, grants full management access.",130 authority:"ROLE_Manager")131 BootStrapSaveAndTest(authInstance)132 133 authInstance = new Authority(description:"Application User, all application users need this base role to allow login.",134 authority:"ROLE_AppUser")135 BootStrapSaveAndTest(authInstance)136 137 //Person138 def passClearText = "pass"139 def passwordEncoded = authenticateService.encodePassword(passClearText)140 def personInstance141 142 //Person #1143 personInstance = new Person(loginName:"admin",144 firstName:"Admin",145 lastName:"Powers",146 pass:passClearText,147 password:passwordEncoded,148 email:"admin@example.com")149 BootStrapSaveAndTest(personInstance)150 personInstance.addToAuthorities(Authority.get(1))151 personInstance.addToAuthorities(Authority.get(2))152 personInstance.addToAuthorities(Authority.get(3))153 personInstance.addToPersonGroups(PersonGroup.findByName("gnuMims"))154 155 //Person #2156 personInstance = new Person(loginName:"manager",157 firstName:"Demo",158 lastName:"Manager",159 pass:passClearText,160 password:passwordEncoded,161 email:"manager@example.com")162 BootStrapSaveAndTest(personInstance)163 personInstance.addToAuthorities(Authority.get(2))164 personInstance.addToAuthorities(Authority.get(3))165 personInstance.addToPersonGroups(PersonGroup.findByName("gnuMims"))166 167 //Person #3168 personInstance = new Person(loginName:"user",169 firstName:"Demo",170 lastName:"User",171 pass:passClearText,172 password:passwordEncoded,173 email:"user@example.com")174 BootStrapSaveAndTest(personInstance)175 personInstance.addToAuthorities(Authority.get(3))176 personInstance.addToPersonGroups(PersonGroup.findByName("Electrical"))177 178 //Person #4179 personInstance = new Person(loginName:"craig",180 firstName:"Craig",181 lastName:"SuperSparky",182 pass:passClearText,183 password:passwordEncoded,184 email:"user@example.com")185 BootStrapSaveAndTest(personInstance)186 personInstance.addToAuthorities(Authority.get(3))187 personInstance.addToPersonGroups(PersonGroup.findByName("Electrical"))188 189 //Person #5190 personInstance = new Person(loginName:"john",191 firstName:"John",192 lastName:"SuperFitter",193 pass:passClearText,194 password:passwordEncoded,195 email:"user@example.com")196 BootStrapSaveAndTest(personInstance)197 personInstance.addToAuthorities(Authority.get(3))198 personInstance.addToPersonGroups(PersonGroup.findByName("Mechanical"))199 200 //Person #6201 personInstance = new Person(loginName:"mann",202 firstName:"Production",203 lastName:"Mann",204 pass:passClearText,205 password:passwordEncoded,206 email:"user@example.com")207 BootStrapSaveAndTest(personInstance)208 personInstance.addToAuthorities(Authority.get(3))209 personInstance.addToPersonGroups(PersonGroup.findByName("Production"))210 211 /*********************212 START OF TASK213 *********************/214 215 //TaskGroup216 def taskGroupInstance217 218 taskGroupInstance = new TaskGroup(name:"Engineering Activites",219 description:"Engineering daily activities")220 BootStrapSaveAndTest(taskGroupInstance)221 222 taskGroupInstance = new TaskGroup(name:"Production Activites",223 description:"Production daily activities")224 BootStrapSaveAndTest(taskGroupInstance)225 226 taskGroupInstance = new TaskGroup(name:"New Projects",227 description:" ")228 BootStrapSaveAndTest(taskGroupInstance)229 230 //TaskStatus231 def taskStatusInstance232 233 taskStatusInstance = new TaskStatus(name:"Not Started")234 BootStrapSaveAndTest(taskStatusInstance)235 236 taskStatusInstance = new TaskStatus(name:"In Progress")237 BootStrapSaveAndTest(taskStatusInstance)238 239 taskStatusInstance = new TaskStatus(name:"Completed")240 BootStrapSaveAndTest(taskStatusInstance)241 242 //TaskPriority243 def taskPriorityInstance244 245 taskPriorityInstance = new TaskPriority(name:"Normal")246 BootStrapSaveAndTest(taskPriorityInstance)247 248 taskPriorityInstance = new TaskPriority(name:"Low")249 BootStrapSaveAndTest(taskPriorityInstance)250 251 taskPriorityInstance = new TaskPriority(name:"High")252 BootStrapSaveAndTest(taskPriorityInstance)253 254 taskPriorityInstance = new TaskPriority(name:"Immediate")255 BootStrapSaveAndTest(taskPriorityInstance)256 257 //TaskType258 def taskTypeInstance259 260 taskTypeInstance = new TaskType(name:"Unscheduled Breakin")261 BootStrapSaveAndTest(taskTypeInstance)262 263 taskTypeInstance = new TaskType(name:"Preventative Maintenance")264 BootStrapSaveAndTest(taskTypeInstance)265 266 taskTypeInstance = new TaskType(name:"Project")267 BootStrapSaveAndTest(taskTypeInstance)268 269 taskTypeInstance = new TaskType(name:"Turnaround")270 BootStrapSaveAndTest(taskTypeInstance)271 272 taskTypeInstance = new TaskType(name:"Production Run")273 BootStrapSaveAndTest(taskTypeInstance)274 275 //Task276 def taskInstance277 278 //Task #1279 taskInstance = new Task(taskGroup:TaskGroup.findByName("Engineering Activites"),280 taskStatus:TaskStatus.findByName("Not Started"),281 taskPriority:TaskPriority.get(2),282 taskType:TaskType.get(1),283 leadPerson:Person.get(2),284 description:"Check specific level sensor",285 comment:"Has been noted as problematic, try recalibrating.",286 targetStartDate:new Date())287 BootStrapSaveAndTest(taskInstance)288 289 //Task #2290 taskInstance = new Task(taskGroup:TaskGroup.findByName("Engineering Activites"),291 taskStatus:TaskStatus.findByName("Not Started"),292 taskPriority:TaskPriority.get(2),293 taskType:TaskType.get(1),294 leadPerson:Person.get(5),295 description:"Some follow-up work",296 comment:"Some help required",297 targetStartDate:new Date()+1,298 parentTask: Task.get(1))299 BootStrapSaveAndTest(taskInstance)300 301 //Task #3302 taskInstance = new Task(taskGroup:TaskGroup.findByName("Engineering Activites"),303 taskStatus:TaskStatus.findByName("Not Started"),304 taskPriority:TaskPriority.get(2),305 taskType:TaskType.get(1),306 leadPerson:Person.get(5),307 description:"A Sub Task can be created by setting the Parent Task value",308 comment:"Some help required",309 targetStartDate:new Date()-1,310 parentTask: Task.get(1))311 BootStrapSaveAndTest(taskInstance)312 313 //Task #4314 taskInstance = new Task(taskGroup:TaskGroup.findByName("Engineering Activites"),315 taskStatus:TaskStatus.findByName("Not Started"),316 taskPriority:TaskPriority.get(2),317 taskType:TaskType.get(1),318 leadPerson:Person.get(4),319 description:"Replace sensor at next opportunity.",320 comment:"Nothing else has worked.",321 targetStartDate:new Date()+7,322 parentTask: Task.get(1))323 BootStrapSaveAndTest(taskInstance)324 325 //Task #5326 taskInstance = new Task(taskGroup:TaskGroup.findByName("Production Activites"),327 taskStatus:TaskStatus.findByName("Not Started"),328 taskPriority:TaskPriority.get(2),329 taskType:TaskType.get(5),330 leadPerson:Person.get(6),331 description:"Production Report",332 comment:"Production report for specific production run or shift",333 targetStartDate:new Date()-7)334 BootStrapSaveAndTest(taskInstance)335 336 //Task #6337 taskInstance = new Task(taskGroup:TaskGroup.findByName("New Projects"),338 taskStatus:TaskStatus.findByName("Not Started"),339 taskPriority:TaskPriority.get(2),340 taskType:TaskType.get(3),341 leadPerson:Person.get(1),342 description:"Make killer CMMS app",343 comment:"Use Grails and get a move on!",344 targetStartDate:new Date()-6)345 BootStrapSaveAndTest(taskInstance)346 347 //EntryType348 def entryTypeInstance349 350 entryTypeInstance = new EntryType(name:"Fault")351 BootStrapSaveAndTest(entryTypeInstance)352 353 entryTypeInstance = new EntryType(name:"WorkDone")354 BootStrapSaveAndTest(entryTypeInstance)355 356 entryTypeInstance = new EntryType(name:"Production Note")357 BootStrapSaveAndTest(entryTypeInstance)358 359 entryTypeInstance = new EntryType(name:"Work Request")360 BootStrapSaveAndTest(entryTypeInstance)361 362 //Entry363 def entryInstance364 365 //Entry #1366 entryInstance = new Entry(enteredBy: Person.get(3),367 task: Task.get(1),368 entryType: EntryType.findByName("Fault"),369 comment: "This level sensor is causing us trouble.",370 durationMinute: 20)371 BootStrapSaveAndTest(entryInstance)372 373 //Entry #2374 entryInstance = new Entry(enteredBy: Person.get(4),375 task: Task.get(1),376 entryType: EntryType.findByName("WorkDone"),377 comment: "Cleaned sensor, see how it goes.",378 durationMinute: 30)379 BootStrapSaveAndTest(entryInstance)380 381 //Entry #3382 entryInstance = new Entry(enteredBy: Person.get(4),383 task: Task.get(1),384 entryType: EntryType.findByName("WorkDone"),385 comment: "Checked up on it later and sensor is dropping out intermittently, created subTask to replace sensor.",386 durationMinute: 20)387 BootStrapSaveAndTest(entryInstance)388 389 //ModificationType390 def taskModificationTypeInstance391 taskModificationTypeInstance = new TaskModificationType(name:"Created").save()392 taskModificationTypeInstance = new TaskModificationType(name:"Completed").save()393 taskModificationTypeInstance = new TaskModificationType(name:"Closed").save()394 taskModificationTypeInstance = new TaskModificationType(name:"Altered").save()395 taskModificationTypeInstance = new TaskModificationType(name:"TargetDateModified").save()396 taskModificationTypeInstance = new TaskModificationType(name:"ScheduledDateModified").save()397 taskModificationTypeInstance = new TaskModificationType(name:"DescriptionModified").save()398 taskModificationTypeInstance = new TaskModificationType(name:"AssignedToModified").save()399 taskModificationTypeInstance = new TaskModificationType(name:"NameModified").save()400 401 //AssignedPerson402 def assignedPersonInstance403 404 //AssignedPerson #1405 assignedPersonInstance = new AssignedPerson(person: Person.get(4),406 task: Task.get(1),407 estimatedHour: 1,408 estimatedMinute: 20)409 BootStrapSaveAndTest(assignedPersonInstance)410 411 //AssignedPerson #2412 assignedPersonInstance = new AssignedPerson(person: Person.get(5),413 task: Task.get(1),414 estimatedHour: 3,415 estimatedMinute: 30)416 BootStrapSaveAndTest(assignedPersonInstance)417 418 //TaskRecurringSchedule419 def taskRecurringScheduleInstance420 421 //TaskRecurringSchedule #1422 taskRecurringScheduleInstance = new TaskRecurringSchedule(task: Task.get(1),423 recurEvery: 1,424 recurPeriod: Period.get(1),425 startDate: new Date(),426 generateAhead: 1,427 generateAheadPeriod: Period.get(1),428 taskDuration: 1,429 taskDurationPeriod: Period.get(1))430 BootStrapSaveAndTest(taskRecurringScheduleInstance)431 432 //TaskRecurringSchedule #2433 taskRecurringScheduleInstance = new TaskRecurringSchedule(task: Task.get(2),434 recurEvery: 1,435 recurPeriod: Period.get(1),436 startDate: new Date(),437 generateAhead: 1,438 generateAheadPeriod: Period.get(1),439 taskDuration: 1,440 taskDurationPeriod: Period.get(1))441 BootStrapSaveAndTest(taskRecurringScheduleInstance)442 443 /*************************444 START OF INVENTORY445 **************************/446 447 //InventoryStore448 def inventoryStoreInstance449 450 inventoryStoreInstance = new InventoryStore(site: Site.get(1), name: "Store #1")451 BootStrapSaveAndTest(inventoryStoreInstance)452 453 inventoryStoreInstance = new InventoryStore(site: Site.get(2), name: "Store #2")454 BootStrapSaveAndTest(inventoryStoreInstance)455 456 //StoreLocation457 def storeLocation458 459 storeLocation = new StoreLocation(inventoryStore: InventoryStore.get(1), bin: "A1-2")460 BootStrapSaveAndTest(storeLocation)461 462 storeLocation = new StoreLocation(inventoryStore: InventoryStore.get(1), bin: "C55")463 BootStrapSaveAndTest(storeLocation)464 465 //InventoryGroup466 def inventoryGroupInstance467 468 //InventoryGroup #1469 inventoryGroupInstance = new InventoryGroup(name: "Misc")470 BootStrapSaveAndTest(inventoryGroupInstance)471 472 //InventoryGroup #2473 inventoryGroupInstance = new InventoryGroup(name: "Electrical")474 BootStrapSaveAndTest(inventoryGroupInstance)475 476 //InventoryGroup #3477 inventoryGroupInstance = new InventoryGroup(name: "Mechanical")478 BootStrapSaveAndTest(inventoryGroupInstance)479 480 //InventoryGroup #4481 inventoryGroupInstance = new InventoryGroup(name: "Production")482 BootStrapSaveAndTest(inventoryGroupInstance)483 484 //InventoryType485 def inventoryTypeInstance486 487 inventoryTypeInstance = new InventoryType(name: "Consumable")488 BootStrapSaveAndTest(inventoryTypeInstance)489 490 inventoryTypeInstance = new InventoryType(name: "Repairable")491 BootStrapSaveAndTest(inventoryTypeInstance)492 493 //InventoryItem494 def inventoryItemInstance495 496 //InventoryItem #1497 inventoryItemInstance = new InventoryItem(inventoryGroup: InventoryGroup.get(1),498 inventoryType: InventoryType.get(1),499 unitOfMeasure: UnitOfMeasure.get(2),500 name: "J-Rope",501 description: "Twine wound J-Rope",502 reorderPoint: 0)503 BootStrapSaveAndTest(inventoryItemInstance)504 505 //InventoryItem #2506 inventoryItemInstance = new InventoryItem(inventoryGroup: InventoryGroup.get(1),507 inventoryType: InventoryType.get(1),508 unitOfMeasure: UnitOfMeasure.get(2),509 name: "L-Rope",510 description: "Twine wound L-Rope",511 alternateItems: InventoryItem.get(1),512 reorderPoint: 0)513 BootStrapSaveAndTest(inventoryItemInstance)514 515 //InventoryItem #3516 inventoryItemInstance = new InventoryItem(inventoryGroup: InventoryGroup.get(3),517 inventoryType: InventoryType.get(1),518 unitOfMeasure: UnitOfMeasure.get(1),519 name: "2305-2RS",520 description: "Bearing 25x62x24mm double row self aligning ball",521 reorderPoint: 2)522 BootStrapSaveAndTest(inventoryItemInstance)523 524 //InventoryItem #4525 inventoryItemInstance = new InventoryItem(inventoryGroup: InventoryGroup.get(2),526 inventoryType: InventoryType.get(1),527 unitOfMeasure: UnitOfMeasure.get(1),528 name: "L1592-K10",529 description: "10kW contactor",530 reorderPoint: 0)531 BootStrapSaveAndTest(inventoryItemInstance)532 533 //InventoryItem #5534 inventoryItemInstance = new InventoryItem(inventoryGroup: InventoryGroup.get(3),535 inventoryType: InventoryType.get(1),536 unitOfMeasure: UnitOfMeasure.get(1),537 name: "6205-ZZ",538 description: "Bearing 25x52x15mm single row ball shielded",539 reorderPoint: 2)540 BootStrapSaveAndTest(inventoryItemInstance)541 542 //StoredItem543 def storedItemInstance544 545 //StoredItem #1546 storedItemInstance = new StoredItem(inventoryItem: InventoryItem.get(1),547 storeLocation: StoreLocation.get(1),548 quantity: 8)549 BootStrapSaveAndTest(storedItemInstance)550 551 //StoredItem #2552 storedItemInstance = new StoredItem(inventoryItem: InventoryItem.get(1),553 storeLocation: StoreLocation.get(2),554 quantity: 4)555 BootStrapSaveAndTest(storedItemInstance)556 557 //StoredItem #3558 storedItemInstance = new StoredItem(inventoryItem: InventoryItem.get(2),559 storeLocation: StoreLocation.get(1),560 quantity: 2)561 BootStrapSaveAndTest(storedItemInstance)562 563 //StoredItem #4564 storedItemInstance = new StoredItem(inventoryItem: InventoryItem.get(3),565 storeLocation: StoreLocation.get(1),566 quantity: 2)567 BootStrapSaveAndTest(storedItemInstance)568 569 //StoredItem #5570 storedItemInstance = new StoredItem(inventoryItem: InventoryItem.get(4),571 storeLocation: StoreLocation.get(1),572 quantity: 30)573 BootStrapSaveAndTest(storedItemInstance)574 575 /*******************576 START OF ASSET577 *******************/578 579 //LifePlan580 def lifeplanInstance581 582 lifeplanInstance = new LifePlan(name: "Initial Plan")583 BootStrapSaveAndTest(lifeplanInstance)584 585 //MaintenancePolicy586 def maintenancePolicyInstance587 588 //MaintenancePolicy #1589 maintenancePolicyInstance = new MaintenancePolicy(name: "Fixed Time")590 BootStrapSaveAndTest(maintenancePolicyInstance)591 592 //MaintenancePolicy #2593 maintenancePolicyInstance = new MaintenancePolicy(name: "Condition Based Online")594 BootStrapSaveAndTest(maintenancePolicyInstance)595 596 //MaintenancePolicy #3597 maintenancePolicyInstance = new MaintenancePolicy(name: "Condition Based Offline")598 BootStrapSaveAndTest(maintenancePolicyInstance)599 600 //MaintenancePolicy #4601 maintenancePolicyInstance = new MaintenancePolicy(name: "Design Out")602 BootStrapSaveAndTest(maintenancePolicyInstance)603 604 //MaintenancePolicy #5605 maintenancePolicyInstance = new MaintenancePolicy(name: "Operate To Failure")606 BootStrapSaveAndTest(maintenancePolicyInstance)607 608 //TaskProcedure609 def taskProcedureInstance610 611 taskProcedureInstance = new TaskProcedure(name: "Daily check")612 BootStrapSaveAndTest(taskProcedureInstance)613 taskProcedureInstance.addToTasks(Task.get(1))614 615 //MaintenanceAction616 def maintenanceActionInstance617 618 //MaintenanceAction #1619 maintenanceActionInstance = new MaintenanceAction(description: "Check all E-stops, activate E-stops S1-S12 and ensure machine cannot run",620 procedureStepNumber: 1,621 maintenancePolicy: MaintenancePolicy.get(1),622 taskProcedure: TaskProcedure.get(1))623 BootStrapSaveAndTest(maintenanceActionInstance)624 625 //MaintenanceAction #2626 maintenanceActionInstance = new MaintenanceAction(description: "Do more pushups",627 procedureStepNumber: 2,628 maintenancePolicy: MaintenancePolicy.get(1),629 taskProcedure: TaskProcedure.get(1))630 BootStrapSaveAndTest(maintenanceActionInstance)631 632 //MaintenanceAction #3633 maintenanceActionInstance = new MaintenanceAction(description: "Ok just one more pushup",634 procedureStepNumber: 3,635 maintenancePolicy: MaintenancePolicy.get(1),636 taskProcedure: TaskProcedure.get(1))637 BootStrapSaveAndTest(maintenanceActionInstance)638 639 //SystemSection640 def systemSectionInstance641 642 //SystemSection #1643 systemSectionInstance = new SystemSection(name: "Press Section",644 site: Site.get(1))645 BootStrapSaveAndTest(systemSectionInstance)646 647 //SystemSection #2648 systemSectionInstance = new SystemSection(name: "RO System",649 site: Site.get(2))650 BootStrapSaveAndTest(systemSectionInstance)651 652 //SystemSection #3653 systemSectionInstance = new SystemSection(name: "Auxilliray Section",654 site: Site.get(1))655 BootStrapSaveAndTest(systemSectionInstance)656 657 //AssetType658 def assetTypeInstance659 660 //AssetType #1661 assetTypeInstance = new AssetType(name: "Print Unit")662 BootStrapSaveAndTest(assetTypeInstance)663 664 //AssetType #2665 assetTypeInstance = new AssetType(name: "Reactor Tower")666 BootStrapSaveAndTest(assetTypeInstance)667 668 //Assembly669 def assemblyInstance670 671 //Assembly #1672 assemblyInstance = new Assembly(name: "Print Couple",673 assetType: AssetType.get(1))674 BootStrapSaveAndTest(assemblyInstance)675 // assemblyInstance.addToMaintenanceActions(MaintenanceAction.get(1))676 677 //Assembly #2678 assemblyInstance = new Assembly(name: "Agitator",679 assetType: AssetType.get(2))680 BootStrapSaveAndTest(assemblyInstance)681 682 //SubAssembly683 def subAssemblyInstance684 685 //SubAssembly #1686 subAssemblyInstance = new SubAssembly(name: "Cylinder",687 assembly: Assembly.get(1))688 BootStrapSaveAndTest(subAssemblyInstance)689 690 //SubAssembly #2691 subAssemblyInstance = new SubAssembly(name: "Gearmotor",692 assembly: Assembly.get(2))693 BootStrapSaveAndTest(subAssemblyInstance)694 695 //ComponentItem696 def componentItemInstance697 698 //ComponentItem #1699 componentItemInstance = new ComponentItem(name: "Bearing",700 subAssembly: SubAssembly.get(1))701 BootStrapSaveAndTest(componentItemInstance)702 703 //ComponentItem #2704 componentItemInstance = new ComponentItem(name: "Drive shaft oil seal",705 subAssembly: SubAssembly.get(2))706 BootStrapSaveAndTest(componentItemInstance)707 708 //Asset709 def assetInstance710 711 //Asset #1712 assetInstance = new Asset(name: "Print Unit 22",713 assetType: AssetType.get(1),714 systemSection: SystemSection.get(1))715 BootStrapSaveAndTest(assetInstance)716 // assetInstance.addToMaintenanceActions(MaintenanceAction.get(1))717 718 //Asset #2719 assetInstance = new Asset(name: "Print Unit 21",720 assetType: AssetType.get(1),721 systemSection: SystemSection.get(1))722 BootStrapSaveAndTest(assetInstance)723 724 //Asset #3725 assetInstance = new Asset(name: "Print Unit 23",726 assetType: AssetType.get(1),727 systemSection: SystemSection.get(1))728 BootStrapSaveAndTest(assetInstance)729 730 //Asset #4731 assetInstance = new Asset(name: "RO 1",732 assetType: AssetType.get(2),733 systemSection: SystemSection.get(2))734 BootStrapSaveAndTest(assetInstance)735 736 //AssetExtendedAttributeType737 def assetExtendedAttributeInstanceType738 739 //AssetExtendedAttributeType #1740 assetExtendedAttributeInstanceType = new AssetExtendedAttributeType(name: "Model Number")741 BootStrapSaveAndTest(assetExtendedAttributeInstanceType)742 743 //AssetExtendedAttributeType #2744 assetExtendedAttributeInstanceType = new AssetExtendedAttributeType(name: "Purchase Cost")745 BootStrapSaveAndTest(assetExtendedAttributeInstanceType)746 747 //AssetExtendedAttributeType #3748 assetExtendedAttributeInstanceType = new AssetExtendedAttributeType(name: "Serial Number")749 BootStrapSaveAndTest(assetExtendedAttributeInstanceType)750 751 //AssetExtendedAttributeType #4752 assetExtendedAttributeInstanceType = new AssetExtendedAttributeType(name: "Manufactured Date")753 BootStrapSaveAndTest(assetExtendedAttributeInstanceType)754 755 //AssetExtendedAttributeType #5756 assetExtendedAttributeInstanceType = new AssetExtendedAttributeType(name: "Location Description")757 BootStrapSaveAndTest(assetExtendedAttributeInstanceType)758 759 //AssetExtendedAttribute760 def assetExtendedAttributeInstance761 762 //AssetExtendedAttribute #1763 assetExtendedAttributeInstance = new AssetExtendedAttribute(value: "PU Mark 2",764 asset: Asset.get(1),765 assetExtendedAttributeType: AssetExtendedAttributeType.get(1))766 BootStrapSaveAndTest(assetExtendedAttributeInstance)767 768 //AssetExtendedAttribute #2769 assetExtendedAttributeInstance = new AssetExtendedAttribute(value: "On the far side of Tank 5",770 asset: Asset.get(1),771 assetExtendedAttributeType: AssetExtendedAttributeType.get(5))772 BootStrapSaveAndTest(assetExtendedAttributeInstance)773 774 /*************************775 Finally did it all work.776 **************************/777 if(BootStrapDemoDataSuccessful) {778 println "BootStrapping demo data...successful."779 }780 else println "BootStrapping demo data...failed."781 }782 783 /****************************************784 Call this function instead of .save()785 *****************************************/786 void BootStrapSaveAndTest(object) {787 if(!object.save()) {788 BootStrapDemoDataSuccessful = false789 println "'${object}' failed to save!"790 println object.errors791 792 }793 }794 30 } -
trunk/grails-app/conf/Config.groovy
r147 r149 78 78 subItems: [ 79 79 [order:10, controller:'appCore', title:'Start', action:'start', isVisible: { true }], 80 [order:20, controller:'appCore', title:'Manager', action:'manager', isVisible: { authenticateService.ifA llGranted('ROLE_Manager') }],80 [order:20, controller:'appCore', title:'Manager', action:'manager', isVisible: { authenticateService.ifAnyGranted('ROLE_Manager,ROLE_AppAdmin') }], 81 81 [order:30, controller:'appCore', title:'Admin', action:'appAdmin', isVisible: { authenticateService.ifAllGranted('ROLE_AppAdmin') }], 82 82 [order:90, controller:'appCore', title:'Timeout', action:'changeSessionTimeout', isVisible: { params.action == 'changeSessionTimeout' }], -
trunk/grails-app/conf/DataSource.groovy
r148 r149 1 1 dataSource { 2 2 pooled = true 3 /** HSQLDB */4 driverClassName = "org.hsqldb.jdbcDriver"5 username = "sa"6 password = ""7 /** MySQL */8 // driverClassName = "com.mysql.jdbc.Driver"9 // username = "gnumimsadmin"10 // password = "gnumimsadmin"11 3 } 12 4 hibernate { … … 17 9 18 10 // Environment specific settings. 19 // create-drop: drop tables and data between sessions, then call Bootstrap.20 // create: drop data between sessions, can't explain the rest of the behaviour.21 // update: keep data, update tables as required, then call BootStrap.11 // create-drop: Drop and re-create the database between sessions. Deletes existing data. 12 // create: Create the database if it doesn't exist, but don't modify it if it does. Deletes existing data. 13 // update: Create the database if it doesn't exist, and modify it if it does exist. Keep data. 22 14 environments { 23 15 development { 24 16 dataSource { 25 17 /** HSQLDB - In memory */ 18 driverClassName = "org.hsqldb.jdbcDriver" 19 username = "sa" 20 password = "" 26 21 dbCreate = "create-drop" 27 22 url = "jdbc:hsqldb:mem:devDB" 28 23 /** MySQL */ 24 // driverClassName = "com.mysql.jdbc.Driver" 25 // username = "gnumimsadmin" 26 // password = "gnumimsadmin" 29 27 // dbCreate = "create-drop" 30 28 // url = "jdbc:mysql://host:3306/gnumims_dev" … … 34 32 dataSource { 35 33 /** HSQLDB - In memory */ 34 driverClassName = "org.hsqldb.jdbcDriver" 35 username = "sa" 36 password = "" 36 37 dbCreate = "update" 37 38 url = "jdbc:hsqldb:mem:devDb" 38 39 /** MySQL */ 40 // driverClassName = "com.mysql.jdbc.Driver" 41 // username = "gnumimsadmin" 42 // password = "gnumimsadmin" 39 43 // dbCreate = "update" 40 44 // url = "jdbc:mysql://host:3306/gnumims_test" … … 43 47 production { 44 48 dataSource { 49 /* Delete dbCreate line after setup! */ 45 50 /** HSQLDB - In memory */ 46 //Delete dbCreate line after setup! 47 dbCreate = "create-drop" 48 url = "jdbc:hsqldb:mem:devDB" 51 // driverClassName = "org.hsqldb.jdbcDriver" 52 // username = "sa" 53 // password = "" 54 // dbCreate = "create-drop" 55 // url = "jdbc:hsqldb:mem:devDB" 49 56 /** HSQLDB - In file */ 57 // driverClassName = "org.hsqldb.jdbcDriver" 58 // username = "sa" 59 // password = "" 50 60 // dbCreate = "update" 51 61 // url = "jdbc:hsqldb:file:prodDb;shutdown=true" 52 62 /** MySQL */ 53 // dbCreate = "update" 54 // url = "jdbc:mysql://host:3306/gnumims_prod" 63 driverClassName = "com.mysql.jdbc.Driver" 64 username = "gnumimsadmin" 65 password = "gnumimsadmin" 66 dbCreate = "update" 67 url = "jdbc:mysql://gnumimssql01:3306/gnumims_prod" 55 68 } 56 69 } -
trunk/grails-app/controllers/AppCoreController.groovy
r139 r149 4 4 5 5 def authenticateService 6 def createDataService 6 7 7 8 def index = { redirect(action:start,params:params) } … … 45 46 } 46 47 } 47 } 48 } 48 49 49 50 def changePassword = { … … 78 79 render(view:'changePassword',model:[personInstance:personInstance]) 79 80 } 80 81 } 81 82 } 82 83 } 83 84 84 @Secured(['ROLE_Manager' ])85 @Secured(['ROLE_Manager','ROLE_AppAdmin']) 85 86 def manager = { 86 87 } 87 88 88 @Secured(['ROLE_AppAdmin']) 89 @Secured(['ROLE_AppAdmin']) 89 90 def appAdmin = { 90 91 } 91 92 93 @Secured(['ROLE_AppAdmin']) 94 def createBaseData = { 95 createDataService.createBaseData() 96 redirect(action:appAdmin) 97 } 98 99 @Secured(['ROLE_AppAdmin']) 100 def createDemoData = { 101 createDataService.createDemoData() 102 redirect(action:appAdmin) 103 } 104 92 105 } -
trunk/grails-app/controllers/BaseController.groovy
r71 r149 1 1 import org.codehaus.groovy.grails.plugins.springsecurity.Secured 2 2 3 @Secured(['ROLE_AppUser' ])3 @Secured(['ROLE_AppUser', 'ROLE_AppAdmin']) 4 4 abstract class BaseController { 5 5 def whatsit() { -
trunk/grails-app/controllers/PersonController.groovy
r147 r149 1 1 import org.codehaus.groovy.grails.plugins.springsecurity.Secured 2 2 3 @Secured(['ROLE_Manager' ])3 @Secured(['ROLE_Manager','ROLE_AppAdmin']) 4 4 class PersonController extends BaseAppAdminController { 5 5 -
trunk/grails-app/views/appCore/appAdmin.gsp
r139 r149 11 11 </div> 12 12 <div class="body"> 13 <h1>Application Admin</h1> 13 <g:if test="${flash.message}"> 14 <div class="message">${flash.message}</div> 15 </g:if> 16 <div class="dialog"> 17 <table> 18 <tbody> 19 20 <tr class="prop"> 21 <td valign="top" class="name"> 22 <label>Create:</label> 23 </td> 24 <td valign="top" class="value"> 25 <g:link action="createBaseData">Base</g:link> - Create the base data required for the application to function. 26 <br /> 27 <g:link action="createDemoData">Demo</g:link> - Create demo data for some example sites. 28 </td> 29 </tr> 30 31 </tbody> 32 </table> 33 </div> <!--End dialog--> 34 <br /> 35 <br /> 14 36 <div class="errors"> 15 37 Warning!<br /> -
trunk/lib
- Property svn:ignore
-
old new 1 mysql-connector-java-5.1.7-bin.jar 1
-
- Property svn:ignore
Note: See TracChangeset
for help on using the changeset viewer.