I make a workaround to support validating by groups. Because RequestFactory validation, validate each received object separately, validation groups have to be transported separated from payload.
The workaround: In the client code I create one helper object called, ValidationHelper. This object have static methods and fields. With calling static method addGroups() I define sequence from validation groups, that will be used for validating all object transfered by payload. I override configureRequestBuilder() and send() methods in DefaultRequestTransport, and I make to add all validation group sequence to be added in the request header. On the server code I get this header from request, split groups to get group class name, and I use reflection to get proper group instances. I provide this groups in ServiceLayerDecorator class and get them every time when validate() method is called. Here is the example of how this thing work. https://gist.github.com/837364 Cheers. On Sun, Feb 20, 2011 at 11:22 AM, Lars <[email protected]> wrote: > I'm also wondering about this. Another example would be if you want to > use the User-bean for creation of users - as well as editing > (different constraints). > I guess there's no way to do this today? One possible way to implement > this could perhaps be to allow annotations on the methods in the > (extensions of) RequestContext. E.g: > @ValidationGroup(value={group1, group2}) > > /Lars > > On Feb 7, 3:11 pm, Lazo Apostolovski <[email protected]> > wrote: >> Hello group. >> >> I use GWT RequestFactory and Hibernate validation to make syntactic >> validation. >> I have one object who need to be validated, but in different cases I need >> validation on different fields. >> >> Short example: >> >> class User { >> @NotNull >> private String name; >> >> @NotNull >> private String nickName; >> >> } >> >> In one case I want to load User by name, and want to perform syntactic >> validation only by name field. In other case validation need to be performed >> by nickname. >> Is there any way to use Validating Groups? >> >> any other solution? > > -- > You received this message because you are subscribed to the Google Groups > "Google Web Toolkit" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
