Community
Participate
Working Groups
Currently our IValidator story works great for 1) validating that a particular value can be successfully converted back to the model data type 2) ensuring that the target's value meets specific formatting requirements enforced by the model, ie: that an email address string is formatted properly. I call these kinds of validation "syntactic validation". However, there is another kind of validation that happens in all nontrivial business applications that I call "semantic validation". These rules are things like the following: - The sum of these fields must equal 100. - A sales rep must have at least $1000 worth of orders in a month in order for it to be applied to her commission. These kinds of rules are not associated with a particular control, but rather need to be bound whenever any control in some group of bindings changes. Right now, we have no "master validation listener" anywhere in our API where clients can register such a validator. To that end, I suggest that we add the following interface: public interface IMasterValidator { public String validate(); } The semantics for the return value are identical to our existing validators (or maybe something similar to IStatus), but there is no argument since this validator would be created custom for a specific group of business objects. Each IMasterValidator implementation would have to know how to find the objects it is responsible for validating. An IMasterValidator is hooked up to a group of bindings by setting it on a data binding context before creating those bindings. This can be done repeatedly in order to specify different master validators for different groups of controls. ie: dbc.setMasterValidator(v1); dbc.bind(u1, u2, null); dbc.bind(u3, u4, null); dbc.setMasterValidator(v2); dbc.bind(u5, u6, null); dbc.bind(u7, u8, null); So in the above example, u1-u4 would be validated by v1 and u5-u8 by v2. If a syntactic validator is specified either through a validator factory or explicitly on a dbc.bind call, the syntactic validator will be called first. And then if the syntactic validator succeeds, the semantic validator will be called. For example, given: dbc.setMasterValidator(v1); dbc.bind(u1, u2, new BindSpec(null, new DateValidator()); the date validator would be called first, and then if it succeeds, the master validator v1 would be called.
I certanlly would like to attach my "Spring Rules" (org.springframework.rules - Spring RCP) validation engine to the IMasterValidator , whats the status of this proposal? Thanks
(In reply to comment #1) > I certanlly would like to attach my "Spring Rules" (org.springframework.rules - > Spring RCP) validation engine to the IMasterValidator , whats the status of > this proposal? It's basically a bunch of work that needs someone to do it. My priorities are currently on other bugs and, and I think the other developers have other priorities right now too. If you want to take a look at it, the change would be straightforward, and this would be a great way to get into the framework. It also agree that it would be really cool to have.
This is really a symptom of bug 120582. *** This bug has been marked as a duplicate of 120582 ***