Guest User

Untitled

a guest
May 25th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. import grails.util.GrailsUtil
  2.  
  3. class BootStrap {
  4.  
  5. def init = { servletContext ->
  6. if (GrailsUtil.isDevelopmentEnv()) {
  7. Book.collection.drop()
  8.  
  9. def node = new Book(title: "Groovy for Enterprise")
  10. node.tags = ["A", "B"]
  11. node.authors = ["A. Brown", "B. Jones"]
  12. node.mongoInsert()
  13. node = new Book(title: "MongoDB for BI")
  14. node.tags = ["B", "C"]
  15. node.authors = ["A. Brown", "C. Homes"]
  16. node.mongoInsert()
  17. node = new Book(title: "Grails for the WEB")
  18. node.tags = ["A", "C"]
  19. node.authors = ["A. Birds", "B. Simsons"]
  20. node.mongoInsert()
  21. (100..199).each {
  22. node = new Book(title: "Journal of Health Technology Vol: $it")
  23. node.mongoInsert()
  24. }
  25. }
  26. }
  27. def destroy = {
  28. }
  29. }
Add Comment
Please, Sign In to add comment