[58] | 1 | import grails.util.GrailsUtil |
---|
[55] | 2 | |
---|
[58] | 3 | class BootStrap |
---|
| 4 | { |
---|
| 5 | //Required to be right here for Acegi plugin. |
---|
| 6 | def authenticateService |
---|
| 7 | Boolean BootStrapDemoDataSuccessful = true |
---|
| 8 | |
---|
| 9 | def init = { servletContext -> |
---|
| 10 | |
---|
| 11 | println "**** BootStrap GrailsUtil.environment = ${GrailsUtil.environment}" |
---|
| 12 | |
---|
| 13 | switch (GrailsUtil.environment) |
---|
| 14 | { |
---|
| 15 | case "development": |
---|
| 16 | bootStrapDemoData() |
---|
| 17 | break |
---|
| 18 | case "test": |
---|
| 19 | break |
---|
| 20 | case "production": |
---|
| 21 | bootStrapDemoData() |
---|
| 22 | break |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | def destroy = { |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | //Insert some demo/startup data. |
---|
| 31 | void bootStrapDemoData() |
---|
| 32 | { |
---|
| 33 | println "BootStrapping demo data..." |
---|
| 34 | |
---|
[116] | 35 | //TypeOfPersonGroup |
---|
[64] | 36 | def personGroupTypeInstance |
---|
| 37 | personGroupTypeInstance = new PersonGroupType(name:"Department") |
---|
| 38 | BootStrapSaveAndTest(personGroupTypeInstance) |
---|
| 39 | personGroupTypeInstance = new PersonGroupType(name:"Contractor") |
---|
| 40 | BootStrapSaveAndTest(personGroupTypeInstance) |
---|
| 41 | personGroupTypeInstance = new PersonGroupType(name:"ProjectTeam") |
---|
| 42 | BootStrapSaveAndTest(personGroupTypeInstance) |
---|
[58] | 43 | |
---|
[116] | 44 | //PersonGroup |
---|
[64] | 45 | def personGroupInstance |
---|
| 46 | personGroupInstance = new PersonGroup(personGroupType:PersonGroupType.findByName("Department"), |
---|
| 47 | name:"Electrical") |
---|
| 48 | BootStrapSaveAndTest(personGroupInstance) |
---|
| 49 | personGroupInstance = new PersonGroup(personGroupType:PersonGroupType.findByName("Department"), |
---|
| 50 | name:"Mechanical") |
---|
| 51 | BootStrapSaveAndTest(personGroupInstance) |
---|
| 52 | personGroupInstance = new PersonGroup(personGroupType:PersonGroupType.findByName("Department"), |
---|
| 53 | name:"Production") |
---|
| 54 | BootStrapSaveAndTest(personGroupInstance) |
---|
| 55 | personGroupInstance = new PersonGroup(personGroupType:PersonGroupType.get(2), |
---|
| 56 | name:"Kewl AirCon Guys") |
---|
| 57 | BootStrapSaveAndTest(personGroupInstance) |
---|
| 58 | personGroupInstance = new PersonGroup(personGroupType:PersonGroupType.get(3), |
---|
| 59 | name:"gnuMims") |
---|
| 60 | BootStrapSaveAndTest(personGroupInstance) |
---|
[58] | 61 | |
---|
[116] | 62 | //Authority |
---|
[59] | 63 | def authInstance |
---|
| 64 | |
---|
[102] | 65 | authInstance = new Authority(description:"Application Admin, not required for daily use! Grants full admin access to the application.", |
---|
[71] | 66 | authority:"ROLE_AppAdmin") |
---|
[59] | 67 | BootStrapSaveAndTest(authInstance) |
---|
| 68 | |
---|
[91] | 69 | authInstance = new Authority(description:"Business manager, grants full management access.", |
---|
| 70 | authority:"ROLE_Manager") |
---|
| 71 | BootStrapSaveAndTest(authInstance) |
---|
| 72 | |
---|
| 73 | authInstance = new Authority(description:"Application User, all application users need this base role to allow login.", |
---|
[71] | 74 | authority:"ROLE_AppUser") |
---|
[59] | 75 | BootStrapSaveAndTest(authInstance) |
---|
[58] | 76 | |
---|
[116] | 77 | //Person |
---|
[73] | 78 | def passClearText = "pass" |
---|
| 79 | def passwordEncoded = authenticateService.encodePassword(passClearText) |
---|
[59] | 80 | def personInstance |
---|
[58] | 81 | |
---|
[102] | 82 | //Person #1 |
---|
[59] | 83 | personInstance = new Person(loginName:"admin", |
---|
[58] | 84 | firstName:"Admin", |
---|
| 85 | lastName:"Powers", |
---|
[73] | 86 | pass:passClearText, |
---|
[59] | 87 | password:passwordEncoded, |
---|
[58] | 88 | email:"admin@example.com") |
---|
| 89 | BootStrapSaveAndTest(personInstance) |
---|
[59] | 90 | personInstance.addToAuthorities(Authority.get(1)) |
---|
| 91 | personInstance.addToAuthorities(Authority.get(2)) |
---|
[91] | 92 | personInstance.addToAuthorities(Authority.get(3)) |
---|
[66] | 93 | personInstance.addToPersonGroups(PersonGroup.findByName("gnuMims")) |
---|
[58] | 94 | |
---|
[102] | 95 | //Person #2 |
---|
[91] | 96 | personInstance = new Person(loginName:"manager", |
---|
| 97 | firstName:"Meca", |
---|
| 98 | lastName:"Manager", |
---|
[73] | 99 | pass:passClearText, |
---|
| 100 | password:passwordEncoded, |
---|
[91] | 101 | email:"manager@example.com") |
---|
[73] | 102 | BootStrapSaveAndTest(personInstance) |
---|
| 103 | personInstance.addToAuthorities(Authority.get(2)) |
---|
[91] | 104 | personInstance.addToAuthorities(Authority.get(3)) |
---|
[73] | 105 | personInstance.addToPersonGroups(PersonGroup.findByName("gnuMims")) |
---|
| 106 | |
---|
[102] | 107 | //Person #3 |
---|
[59] | 108 | personInstance = new Person(loginName:"user", |
---|
| 109 | firstName:"Demo", |
---|
[102] | 110 | lastName:"User", |
---|
[73] | 111 | pass:passClearText, |
---|
[59] | 112 | password:passwordEncoded, |
---|
| 113 | email:"user@example.com") |
---|
| 114 | BootStrapSaveAndTest(personInstance) |
---|
[91] | 115 | personInstance.addToAuthorities(Authority.get(3)) |
---|
[66] | 116 | personInstance.addToPersonGroups(PersonGroup.findByName("Electrical")) |
---|
[58] | 117 | |
---|
[102] | 118 | //Person #4 |
---|
[59] | 119 | personInstance = new Person(loginName:"craig", |
---|
| 120 | firstName:"Craig", |
---|
[102] | 121 | lastName:"SuperSparky", |
---|
[73] | 122 | pass:passClearText, |
---|
[59] | 123 | password:passwordEncoded, |
---|
| 124 | email:"user@example.com") |
---|
| 125 | BootStrapSaveAndTest(personInstance) |
---|
[91] | 126 | personInstance.addToAuthorities(Authority.get(3)) |
---|
[66] | 127 | personInstance.addToPersonGroups(PersonGroup.findByName("Electrical")) |
---|
[58] | 128 | |
---|
[102] | 129 | //Person #5 |
---|
[73] | 130 | personInstance = new Person(loginName:"john", |
---|
| 131 | firstName:"John", |
---|
[102] | 132 | lastName:"SuperFitter", |
---|
[73] | 133 | pass:passClearText, |
---|
[59] | 134 | password:passwordEncoded, |
---|
| 135 | email:"user@example.com") |
---|
| 136 | BootStrapSaveAndTest(personInstance) |
---|
[91] | 137 | personInstance.addToAuthorities(Authority.get(3)) |
---|
[66] | 138 | personInstance.addToPersonGroups(PersonGroup.findByName("Mechanical")) |
---|
[58] | 139 | |
---|
[102] | 140 | //Person #6 |
---|
[59] | 141 | personInstance = new Person(loginName:"mann", |
---|
| 142 | firstName:"Production", |
---|
| 143 | lastName:"Mann", |
---|
[73] | 144 | pass:passClearText, |
---|
[59] | 145 | password:passwordEncoded, |
---|
| 146 | email:"user@example.com") |
---|
| 147 | BootStrapSaveAndTest(personInstance) |
---|
[91] | 148 | personInstance.addToAuthorities(Authority.get(3)) |
---|
[66] | 149 | personInstance.addToPersonGroups(PersonGroup.findByName("Production")) |
---|
| 150 | |
---|
[116] | 151 | //TaskGroup |
---|
[69] | 152 | def taskGroupInstance |
---|
| 153 | |
---|
| 154 | taskGroupInstance = new TaskGroup(name:"Engineering Activites", |
---|
| 155 | description:"Engineering daily activities") |
---|
| 156 | BootStrapSaveAndTest(taskGroupInstance) |
---|
| 157 | |
---|
| 158 | taskGroupInstance = new TaskGroup(name:"Production Activites", |
---|
| 159 | description:"Production daily activities") |
---|
| 160 | BootStrapSaveAndTest(taskGroupInstance) |
---|
| 161 | |
---|
| 162 | taskGroupInstance = new TaskGroup(name:"New Projects", |
---|
| 163 | description:" ") |
---|
| 164 | BootStrapSaveAndTest(taskGroupInstance) |
---|
| 165 | |
---|
[116] | 166 | //TaskStatus |
---|
[66] | 167 | def taskStatusInstance |
---|
| 168 | |
---|
| 169 | taskStatusInstance = new TaskStatus(name:"Not Started") |
---|
| 170 | BootStrapSaveAndTest(taskStatusInstance) |
---|
| 171 | |
---|
| 172 | taskStatusInstance = new TaskStatus(name:"In Progress") |
---|
| 173 | BootStrapSaveAndTest(taskStatusInstance) |
---|
| 174 | |
---|
| 175 | taskStatusInstance = new TaskStatus(name:"Completed") |
---|
| 176 | BootStrapSaveAndTest(taskStatusInstance) |
---|
| 177 | |
---|
[116] | 178 | //TaskPriority |
---|
[69] | 179 | def taskPriorityInstance |
---|
[66] | 180 | |
---|
[69] | 181 | taskPriorityInstance = new TaskPriority(name:"Low") |
---|
| 182 | BootStrapSaveAndTest(taskPriorityInstance) |
---|
[66] | 183 | |
---|
[69] | 184 | taskPriorityInstance = new TaskPriority(name:"Normal") |
---|
| 185 | BootStrapSaveAndTest(taskPriorityInstance) |
---|
[66] | 186 | |
---|
[69] | 187 | taskPriorityInstance = new TaskPriority(name:"High") |
---|
| 188 | BootStrapSaveAndTest(taskPriorityInstance) |
---|
[66] | 189 | |
---|
[69] | 190 | taskPriorityInstance = new TaskPriority(name:"Immediate") |
---|
| 191 | BootStrapSaveAndTest(taskPriorityInstance) |
---|
| 192 | |
---|
[116] | 193 | //TaskType |
---|
[69] | 194 | def taskTypeInstance |
---|
| 195 | |
---|
| 196 | taskTypeInstance = new TaskType(name:"Unscheduled Breakin") |
---|
| 197 | BootStrapSaveAndTest(taskTypeInstance) |
---|
| 198 | |
---|
| 199 | taskTypeInstance = new TaskType(name:"Planned Maintenance") |
---|
| 200 | BootStrapSaveAndTest(taskTypeInstance) |
---|
| 201 | |
---|
| 202 | taskTypeInstance = new TaskType(name:"Project") |
---|
| 203 | BootStrapSaveAndTest(taskTypeInstance) |
---|
| 204 | |
---|
| 205 | taskTypeInstance = new TaskType(name:"Turnaround") |
---|
| 206 | BootStrapSaveAndTest(taskTypeInstance) |
---|
| 207 | |
---|
| 208 | taskTypeInstance = new TaskType(name:"Production Run") |
---|
| 209 | BootStrapSaveAndTest(taskTypeInstance) |
---|
| 210 | |
---|
[116] | 211 | //Task |
---|
[66] | 212 | def taskInstance |
---|
[58] | 213 | |
---|
[116] | 214 | //Task #1 |
---|
[66] | 215 | taskInstance = new Task(taskGroup:TaskGroup.findByName("Engineering Activites"), |
---|
| 216 | taskStatus:TaskStatus.findByName("Not Started"), |
---|
[69] | 217 | taskPriority:TaskPriority.get(2), |
---|
| 218 | taskType:TaskType.get(1), |
---|
[66] | 219 | leadPerson:Person.get(3), |
---|
| 220 | description:"Check specific level sensor", |
---|
| 221 | comment:"Has been noted as problematic, try recallibrating") |
---|
| 222 | BootStrapSaveAndTest(taskInstance) |
---|
| 223 | |
---|
[116] | 224 | //Task #2 |
---|
[114] | 225 | taskInstance = new Task(taskGroup:TaskGroup.findByName("Engineering Activites"), |
---|
| 226 | taskStatus:TaskStatus.findByName("Not Started"), |
---|
| 227 | taskPriority:TaskPriority.get(2), |
---|
| 228 | taskType:TaskType.get(1), |
---|
| 229 | leadPerson:Person.get(5), |
---|
| 230 | description:"Some follow-up work", |
---|
| 231 | comment:"Some help required", |
---|
| 232 | parentTask: Task.get(1)) |
---|
| 233 | BootStrapSaveAndTest(taskInstance) |
---|
[69] | 234 | |
---|
[116] | 235 | //Task #3 |
---|
[114] | 236 | taskInstance = new Task(taskGroup:TaskGroup.findByName("Engineering Activites"), |
---|
| 237 | taskStatus:TaskStatus.findByName("Not Started"), |
---|
| 238 | taskPriority:TaskPriority.get(2), |
---|
| 239 | taskType:TaskType.get(1), |
---|
| 240 | leadPerson:Person.get(5), |
---|
| 241 | description:"A Sub Task can be created by setting the Parent Task value", |
---|
| 242 | comment:"Some help required", |
---|
| 243 | parentTask: Task.get(1)) |
---|
| 244 | BootStrapSaveAndTest(taskInstance) |
---|
| 245 | |
---|
[116] | 246 | //Task #4 |
---|
[114] | 247 | taskInstance = new Task(taskGroup:TaskGroup.findByName("Engineering Activites"), |
---|
[84] | 248 | taskStatus:TaskStatus.findByName("Not Started"), |
---|
| 249 | taskPriority:TaskPriority.get(2), |
---|
| 250 | taskType:TaskType.get(1), |
---|
[102] | 251 | leadPerson:Person.get(4), |
---|
[84] | 252 | description:"Replace sensor at next opportunity.", |
---|
[114] | 253 | comment:"Nothing else has worked.", |
---|
| 254 | parentTask: Task.get(1)) |
---|
| 255 | BootStrapSaveAndTest(taskInstance) |
---|
[84] | 256 | |
---|
[116] | 257 | //Task #5 |
---|
[66] | 258 | taskInstance = new Task(taskGroup:TaskGroup.findByName("Production Activites"), |
---|
| 259 | taskStatus:TaskStatus.findByName("Not Started"), |
---|
[69] | 260 | taskPriority:TaskPriority.get(2), |
---|
| 261 | taskType:TaskType.get(5), |
---|
[102] | 262 | leadPerson:Person.get(6), |
---|
[66] | 263 | description:"Production Report", |
---|
| 264 | comment:"Production report for specific production run or shift") |
---|
| 265 | BootStrapSaveAndTest(taskInstance) |
---|
| 266 | |
---|
[116] | 267 | //Task #6 |
---|
[69] | 268 | taskInstance = new Task(taskGroup:TaskGroup.findByName("New Projects"), |
---|
[66] | 269 | taskStatus:TaskStatus.findByName("Not Started"), |
---|
[69] | 270 | taskPriority:TaskPriority.get(2), |
---|
| 271 | taskType:TaskType.get(3), |
---|
[66] | 272 | leadPerson:Person.get(1), |
---|
| 273 | description:"Make killer CMMS app", |
---|
| 274 | comment:"Use Grails and get a move on!") |
---|
| 275 | BootStrapSaveAndTest(taskInstance) |
---|
| 276 | |
---|
[116] | 277 | //EntryType |
---|
[66] | 278 | def entryTypeInstance |
---|
[58] | 279 | |
---|
[66] | 280 | entryTypeInstance = new EntryType(name:"Fault") |
---|
| 281 | BootStrapSaveAndTest(entryTypeInstance) |
---|
| 282 | |
---|
| 283 | entryTypeInstance = new EntryType(name:"WorkDone") |
---|
| 284 | BootStrapSaveAndTest(entryTypeInstance) |
---|
| 285 | |
---|
[69] | 286 | entryTypeInstance = new EntryType(name:"Production Note") |
---|
[66] | 287 | BootStrapSaveAndTest(entryTypeInstance) |
---|
| 288 | |
---|
| 289 | entryTypeInstance = new EntryType(name:"Work Request") |
---|
| 290 | BootStrapSaveAndTest(entryTypeInstance) |
---|
| 291 | |
---|
[116] | 292 | //Entry |
---|
[84] | 293 | def entryInstance |
---|
| 294 | |
---|
[116] | 295 | //Entry #1 |
---|
[84] | 296 | entryInstance = new Entry(enteredBy: Person.get(6), |
---|
| 297 | task: Task.get(1), |
---|
| 298 | entryType: EntryType.findByName("Fault"), |
---|
| 299 | comment: "This level sensor is causing us trouble.", |
---|
| 300 | durationMinute: 20) |
---|
| 301 | BootStrapSaveAndTest(entryInstance) |
---|
| 302 | |
---|
[116] | 303 | //Entry #2 |
---|
[84] | 304 | entryInstance = new Entry(enteredBy: Person.get(4), |
---|
| 305 | task: Task.get(1), |
---|
| 306 | entryType: EntryType.findByName("WorkDone"), |
---|
| 307 | comment: "Cleaned sensor, see how it goes.", |
---|
| 308 | durationMinute: 30) |
---|
| 309 | BootStrapSaveAndTest(entryInstance) |
---|
| 310 | |
---|
[116] | 311 | //Entry #3 |
---|
[84] | 312 | entryInstance = new Entry(enteredBy: Person.get(4), |
---|
| 313 | task: Task.get(1), |
---|
| 314 | entryType: EntryType.findByName("WorkDone"), |
---|
| 315 | comment: "Checked up on it later and sensor is dropping out intermittently, created subTask to replace sensor.", |
---|
| 316 | durationMinute: 20) |
---|
| 317 | BootStrapSaveAndTest(entryInstance) |
---|
| 318 | |
---|
[116] | 319 | //ModificationType |
---|
[93] | 320 | def taskModificationTypeInstance |
---|
| 321 | taskModificationTypeInstance = new TaskModificationType(name:"Created").save() |
---|
| 322 | taskModificationTypeInstance = new TaskModificationType(name:"Completed").save() |
---|
| 323 | taskModificationTypeInstance = new TaskModificationType(name:"Closed").save() |
---|
| 324 | taskModificationTypeInstance = new TaskModificationType(name:"Altered").save() |
---|
| 325 | taskModificationTypeInstance = new TaskModificationType(name:"TargetDateModified").save() |
---|
| 326 | taskModificationTypeInstance = new TaskModificationType(name:"ScheduledDateModified").save() |
---|
| 327 | taskModificationTypeInstance = new TaskModificationType(name:"DescriptionModified").save() |
---|
| 328 | taskModificationTypeInstance = new TaskModificationType(name:"AssignedToModified").save() |
---|
| 329 | taskModificationTypeInstance = new TaskModificationType(name:"NameModified").save() |
---|
[96] | 330 | |
---|
[116] | 331 | //AssignedPerson |
---|
[96] | 332 | def assignedPersonInstance |
---|
| 333 | |
---|
[116] | 334 | //AssignedPerson #1 |
---|
[96] | 335 | assignedPersonInstance = new AssignedPerson(person: Person.get(4), |
---|
| 336 | task: Task.get(1), |
---|
| 337 | estimatedHour: 1, |
---|
| 338 | estimatedMinute: 20) |
---|
| 339 | BootStrapSaveAndTest(assignedPersonInstance) |
---|
| 340 | |
---|
[116] | 341 | //AssignedPerson #2 |
---|
[96] | 342 | assignedPersonInstance = new AssignedPerson(person: Person.get(5), |
---|
| 343 | task: Task.get(1), |
---|
| 344 | estimatedHour: 3, |
---|
| 345 | estimatedMinute: 30) |
---|
| 346 | BootStrapSaveAndTest(assignedPersonInstance) |
---|
| 347 | |
---|
[116] | 348 | //Site |
---|
| 349 | def siteInstance |
---|
[96] | 350 | |
---|
[116] | 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. |
---|
[58] | 423 | if(BootStrapDemoDataSuccessful) { |
---|
| 424 | println "BootStrapping demo data...successful." |
---|
| 425 | } |
---|
| 426 | else println "BootStrapping demo data...failed." |
---|
| 427 | } |
---|
[116] | 428 | |
---|
| 429 | //Call this function instead of .save() |
---|
[58] | 430 | void BootStrapSaveAndTest(object) { |
---|
| 431 | if(!object.save()) { |
---|
| 432 | BootStrapDemoDataSuccessful = false |
---|
| 433 | println "'${object}' failed to save!" |
---|
| 434 | println object.errors |
---|
| 435 | |
---|
| 436 | } |
---|
| 437 | } |
---|
| 438 | } |
---|