RequestFactory Inheritance
Hi All, Have 3 entity persisted in same table: - Contact - PersonContact extends Contact - CompanyContact extends Contact I can create request which will return Contact... Something like Requestjava.util.ListContactProxy findContactEntries(). The problem is what this ContactProxy will contain only fields in ContactProxy... How to return a List which will contain both PersonContact CompanyContact proxies? How to parameterize request in this case, cause Requestjava.util.Listjava.lang.Object not gonna work. Thx! -- 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.
Re: RequestFactory Inheritance
the issue http://code.google.com/p/google-web-toolkit/issues/detail?id=5367 a workaround https://groups.google.com/d/msg/google-web-toolkit/DMiuK_TBEh4/jSmPC-K2e_YJ -- 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.
Re: RequestFactory Inheritance
Thank you! On Feb 10, 9:07 pm, Y2i yur...@gmail.com wrote: the issuehttp://code.google.com/p/google-web-toolkit/issues/detail?id=5367 a workaroundhttps://groups.google.com/d/msg/google-web-toolkit/DMiuK_TBEh4/jSmPC-... -- 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.
Re: RequestFactory Inheritance
Could you provide more detailed example of workaround? How to use it? I'll appreciate... Thx! On Feb 10, 9:07 pm, Y2i yur...@gmail.com wrote: the issuehttp://code.google.com/p/google-web-toolkit/issues/detail?id=5367 a workaroundhttps://groups.google.com/d/msg/google-web-toolkit/DMiuK_TBEh4/jSmPC-... -- 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.
Re: RequestFactory Inheritance
It's ugly but it works. If you have a better workaround please share. The idea is instead of querying for ListContactProxy you query for ListContactWrapperProxy. Then you call ContactWrapper.getPersonContact(). If it returns non-null value then it's a person. Otherwise you call ContactWrapper.getCompanyContact() and repeat the check. Server: class ContactWrapper { private PersonContact personContact; private CompanyContact companyContact; // returns null if not a PersonContact public PersonContact getPersonContact() { return personContact; } public void setPersonContact(PersonContact personContact) { this.personContact = personContact; } // returns null if not a CompanyContact public CompanyContact getCompanyContact() { return companyContact; } public void setCompanyContact(CompanyContact companyContact) { this.companyContact = companyContact; } } class SomeService { public static ListContactWrapper queryContracts() { final ListContact contacts = // polymorphic JPA query final ListContactWrapper ret = new ArrayListContactWrapper(contacts.size()); for(Contact c : contacts) { final ContactWrapper w = new ContactWrapper(); if(contact intanceof CompanyContact) { w.setCompanyContact((CompanyContact)c) } else if(contact intanceof PersonContact) { w.setPersonContact((PersonContact)c) } ret.add(w); } return ret; } } Client: @ProxyFor(ContactWrapper.class) interface ContactWrapperProxy extends ValueProxy ( PersonContactProxy getPersonContact(); CompanyContact getCompanyContact(); } @Service(SomeService.class) interface SomeServiceRequest exntends RequestContext { // return ListContactWrapperProxy instead of ListContactProxy ListContactWrapperProxy queryContracts(); } -- 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.
Re: RequestFactory Inheritance
Thank you! Yeah, that's ugly, but that's great :) On Feb 10, 10:20 pm, Y2i yur...@gmail.com wrote: It's ugly but it works. If you have a better workaround please share. The idea is instead of querying for ListContactProxy you query for ListContactWrapperProxy. Then you call ContactWrapper.getPersonContact(). If it returns non-null value then it's a person. Otherwise you call ContactWrapper.getCompanyContact() and repeat the check. Server: class ContactWrapper { private PersonContact personContact; private CompanyContact companyContact; // returns null if not a PersonContact public PersonContact getPersonContact() { return personContact; } public void setPersonContact(PersonContact personContact) { this.personContact = personContact; } // returns null if not a CompanyContact public CompanyContact getCompanyContact() { return companyContact; } public void setCompanyContact(CompanyContact companyContact) { this.companyContact = companyContact; } } class SomeService { public static ListContactWrapper queryContracts() { final ListContact contacts = // polymorphic JPA query final ListContactWrapper ret = new ArrayListContactWrapper(contacts.size()); for(Contact c : contacts) { final ContactWrapper w = new ContactWrapper(); if(contact intanceof CompanyContact) { w.setCompanyContact((CompanyContact)c) } else if(contact intanceof PersonContact) { w.setPersonContact((PersonContact)c) } ret.add(w); } return ret; } } Client: @ProxyFor(ContactWrapper.class) interface ContactWrapperProxy extends ValueProxy ( PersonContactProxy getPersonContact(); CompanyContact getCompanyContact(); } @Service(SomeService.class) interface SomeServiceRequest exntends RequestContext { // return ListContactWrapperProxy instead of ListContactProxy ListContactWrapperProxy queryContracts(); } -- 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.
Re: RequestFactory Inheritance
Some server-side ugliness can be hidden if the type check and field assignments are done in the ContactWrapper(Contact c) constructor but it does not help when a ContactWrapperProxy is created on the client side. -- 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.