Changeset 116 for trunk/grails-app/conf
- Timestamp:
- Apr 14, 2009, 10:16:05 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/conf/BootStrap.groovy
r114 r116 33 33 println "BootStrapping demo data..." 34 34 35 35 //TypeOfPersonGroup 36 36 def personGroupTypeInstance 37 37 personGroupTypeInstance = new PersonGroupType(name:"Department") … … 42 42 BootStrapSaveAndTest(personGroupTypeInstance) 43 43 44 44 //PersonGroup 45 45 def personGroupInstance 46 46 personGroupInstance = new PersonGroup(personGroupType:PersonGroupType.findByName("Department"), … … 60 60 BootStrapSaveAndTest(personGroupInstance) 61 61 62 62 //Authority 63 63 def authInstance 64 64 … … 75 75 BootStrapSaveAndTest(authInstance) 76 76 77 77 //Person 78 78 def passClearText = "pass" 79 79 def passwordEncoded = authenticateService.encodePassword(passClearText) … … 149 149 personInstance.addToPersonGroups(PersonGroup.findByName("Production")) 150 150 151 151 //TaskGroup 152 152 def taskGroupInstance 153 153 … … 164 164 BootStrapSaveAndTest(taskGroupInstance) 165 165 166 166 //TaskStatus 167 167 def taskStatusInstance 168 168 … … 176 176 BootStrapSaveAndTest(taskStatusInstance) 177 177 178 178 //TaskPriority 179 179 def taskPriorityInstance 180 180 … … 191 191 BootStrapSaveAndTest(taskPriorityInstance) 192 192 193 193 //TaskType 194 194 def taskTypeInstance 195 195 … … 209 209 BootStrapSaveAndTest(taskTypeInstance) 210 210 211 211 //Task 212 212 def taskInstance 213 213 214 //Task #1 214 215 taskInstance = new Task(taskGroup:TaskGroup.findByName("Engineering Activites"), 215 216 taskStatus:TaskStatus.findByName("Not Started"), … … 221 222 BootStrapSaveAndTest(taskInstance) 222 223 224 //Task #2 223 225 taskInstance = new Task(taskGroup:TaskGroup.findByName("Engineering Activites"), 224 226 taskStatus:TaskStatus.findByName("Not Started"), … … 231 233 BootStrapSaveAndTest(taskInstance) 232 234 235 //Task #3 233 236 taskInstance = new Task(taskGroup:TaskGroup.findByName("Engineering Activites"), 234 237 taskStatus:TaskStatus.findByName("Not Started"), … … 241 244 BootStrapSaveAndTest(taskInstance) 242 245 246 //Task #4 243 247 taskInstance = new Task(taskGroup:TaskGroup.findByName("Engineering Activites"), 244 248 taskStatus:TaskStatus.findByName("Not Started"), … … 251 255 BootStrapSaveAndTest(taskInstance) 252 256 257 //Task #5 253 258 taskInstance = new Task(taskGroup:TaskGroup.findByName("Production Activites"), 254 259 taskStatus:TaskStatus.findByName("Not Started"), … … 260 265 BootStrapSaveAndTest(taskInstance) 261 266 267 //Task #6 262 268 taskInstance = new Task(taskGroup:TaskGroup.findByName("New Projects"), 263 269 taskStatus:TaskStatus.findByName("Not Started"), … … 269 275 BootStrapSaveAndTest(taskInstance) 270 276 271 277 //EntryType 272 278 def entryTypeInstance 273 279 … … 284 290 BootStrapSaveAndTest(entryTypeInstance) 285 291 286 292 //Entry 287 293 def entryInstance 288 294 295 //Entry #1 289 296 entryInstance = new Entry(enteredBy: Person.get(6), 290 297 task: Task.get(1), … … 294 301 BootStrapSaveAndTest(entryInstance) 295 302 303 //Entry #2 296 304 entryInstance = new Entry(enteredBy: Person.get(4), 297 305 task: Task.get(1), … … 301 309 BootStrapSaveAndTest(entryInstance) 302 310 311 //Entry #3 303 312 entryInstance = new Entry(enteredBy: Person.get(4), 304 313 task: Task.get(1), … … 308 317 BootStrapSaveAndTest(entryInstance) 309 318 310 319 //ModificationType 311 320 def taskModificationTypeInstance 312 321 taskModificationTypeInstance = new TaskModificationType(name:"Created").save() … … 320 329 taskModificationTypeInstance = new TaskModificationType(name:"NameModified").save() 321 330 322 331 //AssignedPerson 323 332 def assignedPersonInstance 324 333 334 //AssignedPerson #1 325 335 assignedPersonInstance = new AssignedPerson(person: Person.get(4), 326 336 task: Task.get(1), … … 329 339 BootStrapSaveAndTest(assignedPersonInstance) 330 340 341 //AssignedPerson #2 331 342 assignedPersonInstance = new AssignedPerson(person: Person.get(5), 332 343 task: Task.get(1), … … 335 346 BootStrapSaveAndTest(assignedPersonInstance) 336 347 337 338 //Finally did it all work. 348 //Site 349 def siteInstance 350 351 siteInstance = new Site(name: "Commercial Site") 352 BootStrapSaveAndTest(siteInstance) 353 354 //Asset 355 def assetInstance 356 357 assetInstance = new Asset(name: "RockCrusher1") 358 BootStrapSaveAndTest(assetInstance) 359 360 361 //InventoryStore 362 def inventoryStoreInstance = new InventoryStore(site: Site.get(1), 363 name: "Store #1") 364 BootStrapSaveAndTest(inventoryStoreInstance) 365 366 //StoreLocation 367 def storeLocation = new StoreLocation(inventoryStore: InventoryStore.get(1), 368 bin: "A1-2") 369 BootStrapSaveAndTest(storeLocation) 370 371 //UnitOfMeasure 372 def unitOfMeasureInstance 373 374 unitOfMeasureInstance = new UnitOfMeasure(name: "each") 375 BootStrapSaveAndTest(unitOfMeasureInstance) 376 377 unitOfMeasureInstance = new UnitOfMeasure(name: "meter(s)") 378 BootStrapSaveAndTest(unitOfMeasureInstance) 379 380 unitOfMeasureInstance = new UnitOfMeasure(name: "box(es)") 381 BootStrapSaveAndTest(unitOfMeasureInstance) 382 383 unitOfMeasureInstance = new UnitOfMeasure(name: "litre(s)") 384 BootStrapSaveAndTest(unitOfMeasureInstance) 385 386 unitOfMeasureInstance = new UnitOfMeasure(name: "kilogram(s)") 387 BootStrapSaveAndTest(unitOfMeasureInstance) 388 389 //InventoryGroup 390 def inventoryGroupInstance 391 392 inventoryGroupInstance = new InventoryGroup(name: "Misc") 393 BootStrapSaveAndTest(inventoryGroupInstance) 394 395 //InventoryType 396 def inventoryTypeInstance 397 398 inventoryTypeInstance = new InventoryType(name: "Consumable") 399 BootStrapSaveAndTest(inventoryTypeInstance) 400 401 inventoryTypeInstance = new InventoryType(name: "Repairable") 402 BootStrapSaveAndTest(inventoryTypeInstance) 403 404 //InventoryItem 405 def inventoryItemInstance 406 407 inventoryItemInstance = new InventoryItem(inventoryGroup: InventoryGroup.get(1), 408 inventoryType: InventoryType.get(1), 409 unitOfMeasure: UnitOfMeasure.get(1), 410 name: "1051 Bearing", 411 reorderPoint: 0) 412 BootStrapSaveAndTest(inventoryItemInstance) 413 414 //StoredItem 415 def storedItemInstance 416 417 storedItemInstance = new StoredItem(inventoryItem: InventoryItem.get(1), 418 storeLocation: StoreLocation.get(1), 419 quantity: 8) 420 BootStrapSaveAndTest(storedItemInstance) 421 422 //Finally did it all work. 339 423 if(BootStrapDemoDataSuccessful) { 340 424 println "BootStrapping demo data...successful." … … 342 426 else println "BootStrapping demo data...failed." 343 427 } 344 428 429 //Call this function instead of .save() 345 430 void BootStrapSaveAndTest(object) { 346 431 if(!object.save()) {
Note: See TracChangeset
for help on using the changeset viewer.