Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java model validation

We are looking for a Java library/system/package which not only does basic validation but also can do relationship validation. We need to be able to express validation criteria which is based on multiple related entities.

Most of the validation models Spring Validation, JSR303 are specifically targeted at validation of bean's attributes. But we need something that would go across beans.

Our requirements are to come up with a method of validating a model state while externalizing validation logic out of the java code.

In the above definition a Bean is just a POJO, and a model is a collection of related Beans. So, for example, if Account has a collection of Addresses and the Account.countryOfResidence is set to USA, I would like to have a validation rule that will ensure that all Addresses have a country of USA in them.

So during the "operation" of adding an Address to the Account, a validation would kick off ensuring that Address.country is the same as Account.countryOfResidence.

We were looking into DRULES, but wanted to see if there were other options available.

Any suggestions on how to proceed?

like image 619
apara Avatar asked Nov 18 '11 16:11

apara


1 Answers

Not sure how active this project is, but I used it a while ago and it provided capabilities to do what you're describing - take a look and see if it might be helpful:

http://i-screen.org/docs/index.html

And of course there's Jess: http://www.jessrules.com/jess/

It also might be worth taking a look at this, although I don't know much about it. Vlad: http://www.sapia-oss.org/projects/vlad/

like image 75
Shaun Avatar answered Oct 20 '22 06:10

Shaun