How I resolved this:
public class MyServiceLayerDecorator extends ServiceLayerDecorator {

        public <T extends Object>
java.util.Set<javax.validation.ConstraintViolation<T>> validate(T
domainObject) {
                Set<ConstraintViolation<?>> set = new 
HashSet<ConstraintViolation<?
>>();
                PathImpl path = PathImpl.createNewPath("name");
                ConstraintViolation<T> voilation = (ConstraintViolation<T>)new
ConstraintViolationImpl<Person>("custom bean error", "custom bean
error", Person.class, (Person)domainObject, (Person)domainObject,
((Person)domainObject).getAddress(), path, null, ElementType.FIELD);
                Set<ConstraintViolation<T>> voilations =
super.validate(domainObject);
                voilations.add(voilation);
                return voilations;
        };


On Oct 18, 11:02 am, rakesh wagh <rake...@gmail.com> wrote:
> with that said, what is the right way to reconstruct server side
> business validations(ConstraintViolation) on client (so that they can
> be directly added to editor.setErrors(voilations))?
>
> Also, I didnt understand how to set a callback in Request (to catch
> server exception). At this point as you rightly noted I am using
> requestContext's fire/Receiver pair.
>
> Thanks
>
> On Oct 18, 4:35 am, Thomas Broyer <t.bro...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Validation in RequestFactory is done after the object graph has been
> > reconstructed but before any service method is invoked. It's the only place
> > where validation errors will lead to onConstraintViolations being called
> > back on the client side (for all the Receivers attached to the
> > RequestContext).
> > When service method invocations are processed, each one can succeed or
> > throw, independently of the others, and will cause the onSuccess or
> > onFailure of the Receiver _for that particular invocation_ (the one passed
> > to the to() or fire() method of Request –but not the fire() method of
> > RequestContext!–) to be called back.
> > FYI, the global Receiver's (the one passed to the fire() method of
> > RequestContext) onFailure method is only called when the object graph cannot
> > be reconstructed or serialized on the server-side; in that case, the
> > onFailure of all Receivers is also called. In any other case (except
> > onConstraintViolations), onSuccess will be called (even if all invocations
> > failed).

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to