Just a quick note to say the source code for groovy awards is now on github under an Apache2 license. Go forth and clone! It’s a tiny app - sans plugins - so you should be able to get your head around it by a quick browse of the NominateController.

When I get a bit more downtime I’ll write up some of the trickier bits. I’m particularly happy about is how the browse page highlights only those letters that have matching entries. It’s implemented pretty inefficiently at the moment… but it does work.

Today I also added a tagcloud of comment numbers for each nominee. Turns out that I could do this with a single Criteria query taking advantage of Hibernate Projections. Here’s the final query from the “home” action:

        // build data for tagcloud using a projection
        def resList = FanBoy.withCriteria {
            createAlias("nomination", "n")
            projections {
                groupProperty('n.name')
                count('id')
            }
        }

        // projection returns a list of name,count -- but tagcloud needs a map. Convert it here.
        def commentMap = resList.inject([ : ]) { map, res -> map[ res[0] ] = res[1]; map }

Hibernate projections are uber-powerful for grouping and reporting operations. I’m only just getting a feel for them, but they will feature in the “Advanced GORM Kungfu” chapter of Grails In Action. (I really hope they let me call it that in the final book… :-)

I’m glad so many of you are contributing to the site. It’s been great to hear so much positive feedback for so many in the community. You guys rock!