Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 0.93 KB | None | 0 0
  1. import grailsbb.*
  2.  
  3. class BootStrap {
  4.  
  5.     def springSecurityService
  6.    
  7.     def init = { servletContext ->
  8.         def user = new User(
  9.             firstName:"Chris",
  10.             lastName:"Jordan",
  11.             email:"chris.s.jordan@gmail.com",
  12.             username:"cjordan",
  13.             password:springSecurityService.encodePassword("csj001"),
  14.             enabled: true
  15.         ).save()
  16.         def forum = new Forum(title:"Grails",description:"Stuff about Grails").save()
  17.         forum.addToModerators(user);
  18.         def subForum = new Forum(parent:forum,title:"Grails Development", description:"This is where we will discuss development revolving around the Grails framework.").save()
  19.         //forum.addToSubForums(subForum); // This is no longer needed sine we have defined a bidirectional relationship
  20.         def thread = new Thread(subject:"GrailsBB Rocks!", forum:subForum, author:user).save()
  21.         def post = new Post(subject:thread.subject,body:"This is the body!",author:user,thread:thread).save()
  22.     }
  23.     def destroy = {
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement