//This Roo 1.2 Script creates the basic maven coursemanager project from the book
//"Spring Roo In Action" (Manning 2012). Tested under jdk1.5 but should work
//in later versions. In order to use this project on jdk1.5 you need to explicitly add
//jaxb-api and jaxb-impl as dependencies in the pom.xml
project --topLevelPackage org.rooina.coursemanager --projectName coursemanager_ch5
//Create this db with the user assigned the proper permissions prior to running the script
//or change database below (You can do this after creating the project too)
jpa setup --database MYSQL --provider HIBERNATE --databaseName coursemanager_web --userName sa
entity jpa --class ~.model.Course --testAutomatically
entity jpa --class ~.model.TrainingProgram --testAutomatically
field string --fieldName name
focus --class ~.model.Course
field reference --fieldName trainingProgram --type ~.model.TrainingProgram --cardinality MANY_TO_ONE
focus --class ~.model.TrainingProgram
field set --fieldName courses --type ~.model.Course --cardinality ONE_TO_MANY --mappedBy trainingProgram
entity jpa --class ~.model.Tag --testAutomatically
field string --fieldName tag --sizeMin 1 --sizeMax 25 --notNull
field string --fieldName description --sizeMax 250 --notNull
field set --fieldName courses --type ~.model.Course --cardinality MANY_TO_MANY
focus --class ~.model.Course
field set --fieldName tags --type ~.model.Tag --cardinality MANY_TO_MANY --mappedBy courses
entity jpa --class ~.model.Offering --abstract --inheritanceType SINGLE_TABLE
entity jpa --class ~.model.SingleEvent --testAutomatically --extends ~.model.Offering
entity jpa --class ~.model.PeriodicCourse --testAutomatically --extends ~.model.Offering
focus --class ~.model.Course
field set --fieldName offerings --type ~.model.Offering --cardinality ONE_TO_MANY --mappedBy course
focus --class ~.model.Offering
field reference --fieldName course --type ~.model.Course --cardinality MANY_TO_ONE
enum type --class ~.model.FrequencyType
enum constant --name WEEKLY
enum constant --name MONTHLY
enum constant --name BIWEEKLY
focus --class ~.model.PeriodicCourse
field date --fieldName startDate --type java.util.Date
field enum --fieldName frequency --type ~.model.FrequencyType --notNull
field date --fieldName endDate --type java.util.Date --notNull
web mvc setup
web mvc all --package ~.web