Roo (in the) Corner - new features in trunk...
Join the DZone community and get the full member experience.Join For Free
I've been spending my time readying Roo in Action for publication. Turns out, the Roo team had other ideas - including lots of new things you may want to be aware of if you are looking to support Roo 1.2 once it is released.
Keep in mind these changes are in-flight. If you don't need to work on trunk, DO NOT WORK ON TRUNK. This is something other platform afficianados do - for example, the Rails development community commonly calls this working on the "edge". So, let's get edgy.
There are some really, really cool things in here. I've seen them move toward opening up for all modes of development - some want JSF, so there is a JSF add-on. They use PrimeFaces, and a dialog motif for adding new elements. I'm sure they will tweak this as it goes along, but it looks more like the GWT or Flex mode of editing I saw before.
Breaking Changes (so far) - you may need to edit your code - I know I have to for now, but this is a temporary pain for some consistency gain within Roo.
- @RooEntity -> @RooJpaActiveRecord
- @RooWebScaffold - now a .scaffold. package after .controller.
- @RooConversionService - now a .converter. package after .controller.
- New @RooEquals - and a shell command for equals - this has been here for a little while, but is something that can be of use when defining models or other objects that need to be compared. You can exclude fields from the factoring of the comparison.
- new entity flags (recent anyway) to set entity name, table, and other attributes on entities - this is great, and includes the ability to define transaction manager names for cases where you are working with multiple JDBC datasources - nice! Also, it lets you specify the entity manager - so if you have two persistence units to separate transaction managers (reporting database -vs- transactions) you have that option. Again, not a huge deal, but lets you stay within Roo to get things done, without digging into code for a configuration option. You can even set the table name, entity name, etc...
- New settings for the json command - --deepSerialize and --rootName - I am not sure if these have been here long, but they are good to know about.
- New —packaging element in project - includes POM or JAR right now. Also includes --parent. This could be great, as I think they are going to implement multi-pom support in Roo 1.2. We'll stay tuned on that, and perhaps write a quick blog entry on what we've found.
- New support for database dot com - a new database provider - I don't know much about it.
- New date field support for both dateTimeFormatPattern AND dateFormat - I am unsure that the scaffold would deal with dateTimeFormatPattern.
- JSF scaffolding in place - uses PrimeFaces for the widgets - this is interesting, and has a different look and feel, native to PrimeFaces. But, it does exactly the same work as the scaffold in MVC. So, if you're looking at complexities and benefits of each, go for it. The CI build server is here, and you just need to follow these rules to get it to use trunk.
It was so easy to switch between JSF and MVC for my testing, I used these two scripts:
Roo with MVC
project --topLevelPackage foo.bar.mvc --packaging JAR --projectName mvcrules jpa setup --database HYPERSONIC_PERSISTENT --provider OPENJPA entity jpa --class ~.model.Course --testAutomatically field string --fieldName name field date --fieldName runDate --type java.util.Date --dateFormat SHORT web mvc setup<br>web mvc all --package ~.mvc quit
Roo with JSF
project --topLevelPackage foo.bar.jsf.sortarules --packaging JAR --projectName jsfsortarules jpa setup --database HYPERSONIC_PERSISTENT --provider OPENJPA entity jpa --class ~.model.Course --testAutomatically field string --fieldName namefield date --fieldName runDate --type java.util.Date --dateFormat SHORT web mvc setupweb mvc all --package ~.mvc quit
I will attempt to update this article as I find new things... No promises, as the primary artifact is the book. But hopefully this is a warning shot across the bow that change is indeed a-coming.
Opinions expressed by DZone contributors are their own.