Tiles for Roo

Written by: | Posted on:

I love Roo! Ben Alex and his team have made a great job making starting a Spring project a breeze. However, I've shied away from using Java for XHTML/JS/CSS since 2003, so while I know the underlying technologies with Roo (JPA, the databases, Spring, JUnit, Tomcat, etc etc) I don't know Apache Tiles at all. So I figured I'd like to learn it, at least until Roo 1.1 hits in a few weeks, when I'll probably want to learn GWT. ;-) Stay tuned...

So, for learning this I'm going to make a project I've been planning ever since I released my awesome tuner for early music musicians: Well Tempered for the iPhone:  Open Temperament. It's going to be an open database for tuning temperaments. So, first step, register the domain (let's hope this isn't going to be one of those many great ideas that are parked on a domain due to lack of time ;-) ), done, and let's get the basic Roo script up:

project -topLevelPackage net.opentemperament
persistence setup -provider OPENJPA -database HYPERSONIC_PERSISTENT

entity -class ~.entities.Family -testAutomatically
field string -fieldName name

entity -class ~.entities.Temperament -testAutomatically
field string -fieldName title
field string -fieldName description
field string -fieldName originalAuthor
field reference -type ~entities.Family -fieldName family

entity -class ~.entities.OnlineUser
field string -fieldName fullname
field string -fieldName email
field reference -class ~.entities.Temperament -fieldName onlineAuthor -type ~.entities.OnlineUser

entity -class ~.entities.Note -testAutomatically
field string -fieldName name
field reference -type ~.entities.Note -fieldName enharmonicTwin
field number -fieldName indexFromA -type java.lang.Integer

field reference -fieldName startingNote -type ~.entities.Note -class ~.entities.Temperament

entity -class ~.entities.Comma -testAutomatically
field string -fieldName name -notNull
field number -fieldName ratio -type java.lang.Double
field number -fieldName ratioInCents -type java.lang.Double
field reference -type ~.entities.Comma -fieldName alias

enum type -class ~.enums.IntervalType
enum constant -name MinorSecond
enum constant -name MajorSecond
enum constant -name MinorThird
enum constant -name MajorThird
enum constant -name PureFourth
enum constant -name PureFifth

entity -class ~.entities.Deviation -testAutomatically
field reference -type ~.entities.Note -fieldName lowestNote -notNull
field enum -type ~.enums.IntervalType -fieldName intervalType -notNull
field reference -type ~.entities.Comma -fieldName deviationType -notNull
field number -fieldName deviationValue -type java.lang.Double

field set -class ~.entities.Temperament -element ~.entities.Deviation -fieldName deviations

controller all -package ~.web
logging setup -level DEBUG
security setup

json add -class ~.entities.Family
json add -class ~.entities.Temperament
json add -class ~.entities.OnlineUser
json add -class ~.entities.Note
json add -class ~.entities.Comma
json add -class ~.entities.Deviation

perform eclipse
perform test

Image Image

Father, husband, software developer, musician and photographer.


Get to know what I'm up to

© 2020 Niklas Saers Contact Me