Friday, May 04, 2007

Roma framework validation

Today I've successfull integrated the Validation Rules inside Roma Meta Framework.

(1) New annotation attribute to validate against RegExp rule:

Example:
public class Account{
...
@ViewField(match="^[_a-z0-9-]+(\\.?[_a-z0-9-]*)*@?[a-z0-9-]*(\\.?[a-z0-9-]*)*$")
private String email;
...
}


(2) Integrated the Informagen-Components Component library written by Will Gilbert.

Now Roma uses:

- IntegerTextField for int/Integer attributes
- NumericTextField for float/double/Float/Double attributes
- RegExpTextField for String attributes with "match" annotation (via Java5 annotation or Xml Annotation)

(3) New mean for min/max annotations

Now Roma uses:
- In String fields min/max are the minimum/maximum length
- In number fields min/max are the minimum/maximum value

Example:

public class Account{
...
@ViewField(min=3, max=32)
private String name;

@ViewField(min=18, max=130)
private String age;
...
}

4 comments:

Richard Sullivan said...

sorry because this is off-topic here - I had a problem posting it to the mailing list today so I'm trying the backdoor ..


Subject: Roma RAD
Hi Luca,

sorry I don't have time to contribute anything (except this suggestion) at the moment.

I've not even had the time to play with ROMA although I would love to use it for a real website someday.

I'm not sure if an IDE from scratch is the best way to go and a webapp could be (even with ROMA) slow to develop and less easy to use than a fat-gui app.

Why not try to use an existing modeling and code-generation tool such as
AndroMDA from http://www.andromda.org/

I've never used AndroMDA but it looks quite mature (just the eclipse plugin is beta).

My idea would be to get AndroMDA or a similar tool to offer a graphical interface which should then be able to generate (via templates or the so-called cartridges) whatever sources or definitions ROMA would need.

Hope it helps,
Richard

Anonymous said...

Really good. What about security features? Has Roma Framework some annotation for it? Like @Role or @SecurityRole or something else.

Cheers,
aGeek

Luca Garulli said...

Hi,
for security and permissions there is the USERS module. You can define at POJO level what a user see.

Example:

HomePage.logout = false

Tells to not display the logout button. While:

HomePage.logout.enabled = false

Tells to display but not to enable the logout button.

Anonymous said...

Really good, thanks ;-)