well it's done - I made a patch now using jira-135 patch from Marvin van 
Schalkwyk who implemented a plugabble factory for custom validations ...

I tried to derive from hibernates ClassValidator but without success - too many 
private variables and procedures ...

Thus created a SeamClassValidator of my own (nearly a copy of hibernate 
ClassValidator with small changes ...) and plugged it into Marvins patch (nice 
work ;-) ...

the syntax now is as follows ...


  | @Stateful
  | @Name("myController")
  | @Interceptors(SeamInterceptor.class)
  | public class MyController {
  | 
  |         // this entity will be set from form-1
  |         @In (value="user",create=true)
  |         @Valid
  |     protected User user;
  | 
  |         // this entity will be set from form-2
  |         @In (value="address",create=true)
  |         @Valid
  |     protected Address address;
  | 
  |         /**
  |          * this only validates user in contrast to the original 
implementation
  |          * where user and address was validated
  |          **/
  |         @IfInvalid (validate={"user"}, outcome=Outcome.REDISPLAY)
  |         public String pressButtonOneHandlingUsers() {
  |              ... do something ... 
  |         }
  | 
  |         // this should validate user and address
  |         @IfInvalid (validate={"address","user"}, outcome=Outcome.REDISPLAY)
  |         public String pressButtonTwoHandlingAddressAndUser() {
  |              ... do something ...
  |         } 
  | 
  |          /**
  |           * this should also validate user and address, because the default
  |           * is the same as it was without the patch ...
  |           */ 
  |         @IfInvalid (outcome=Outcome.REDISPLAY)
  |         public String pressButtonThreeHandlingAddressAndUser() {
  |              ... do something ...
  |         } 
  | }
  | 


If anybody is interested in the patch I can deliver it - I would suggest to add 
the patch to jira-135, beause I had to make minor changes to the this patch, too

give me a short notice please ...

thx


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3927564#3927564

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3927564


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to