Monday, August 3, 2009

ANN: Grails RefCode Plugin 0.2

Marcel Overdijk released RefCode plugin May 2008. The plugin provides an easy solution for 'code/description' reference/lookup data. Often in your business model you have simple reference/lookup tables with just code and description columns; e.g. Country (uk=United Kingdom, nl=Netherlands, ...), OrderStatus (C=Cancelled, N=New, P=Pending, S=Shipped), OrganizationType, ...

The latest release of the plugin include the refCode Custom Constraint to make validation against the domain valued even easier.

Assuming you a have a domain of "USStates", you can now setup a constraint like so:


class Person {
String name
String street
String city
String state
String zip

static constraints = {
name()
street()
city()
state(refCode:"USStates")
zip()
}
}


You can find out more about the RefCode Plugin at: http://www.grails.org/Ref+Code+Plugin