Request Factory Proxy Variable Null problem

41 views
Skip to first unread message

Mark Wengranowski

unread,
Sep 28, 2011, 2:40:57 PM9/28/11
to Google Web Toolkit
Hi Everyone,

I'm stuck on figuring out why a List Variable "lineItems" from my
entity comes back as null when passing it through the entity proxy.
All the other getter methods return values but for some reason the
list is null. When stepping through the code i can see that the list
variable is populated in the service method which populated the class.
This is how im trying to make things work and have based it on the
ListWidget program source. Everything is identical (i think). Any Help
would be greatly appreciated.

1. define my entity

@entity
public class Invoice extends EntityBase {

private String invoiceID;

private String invoice;
private String dateOrdered;
private String dateInvoiced;
private String invoiceTotal;
private String balanceOwing;
private String age;
private String amountPaid;
private String adjustments;
private String poNum;
private String accountMgr;
private String terms;
private String customerContact;
private String shippedVia;
@Embedded private List<InvoiceDetails> lineItems;
.
.
.

2. define the entity proxy


@ProxyFor(value = Invoice.class, locator = EntityLocator.class)
public interface InvoiceProxy extends EntityProxy
{

String getInvoiceID();
void setInvoiceID(String invoiceID);
String getPoNum();
void setPoNum(String poNum);
String getInvoice();
void setInvoice(String invoice);
String getDateOrdered();
void setDateOrdered(String dateOrdered);
String getDateInvoiced();
void setDateInvoiced(String dateInvoiced);
String getInvoiceTotal();
void setInvoiceTotal(String invoiceTotal);
String getBalanceOwing();
void setBalanceOwing(String balanceOwing);
String getAge();
void setAge(String age);
String getAmountPaid();
void setAmountPaid(String amountPaid);
String getAdjustments();
void setAdjustments(String adjustments);
String getAccountMgr();
void setAccountMgr(String accountMgr);
String getTerms();
void setTerms(String terms);
String getCustomerContact();
void setCustomerContact(String customerContact);
String getShippedVia();
void setShippedVia(String shippedVia);

List<InvoiceDetailsProxy> getLineItems();
void setLineItems(List<InvoiceDetailsProxy> lineItems);

}


3. Call the Server Side method in the onStart of my activity



InvoiceService rs2 =
clientFactory.getRequestFactory().invoiceService();
rs2.getInvoiceWithDetails(clientFactory.getUser()
+view.getInvoice()).fire(new Receiver<InvoiceProxy>()
{
@Override
public void onSuccess(InvoiceProxy invoicepx)
{
// Gotcha--if do this, must call panel.setWidget in onSuccess
// also
assert (view != null);
assert invoicepx != null;
invoice = invoicepx;
List<InvoiceDetailsProxy> invoiceList=invoicepx.getLineItems();

Julian

unread,
Sep 28, 2011, 4:42:59 PM9/28/11
to google-we...@googlegroups.com

Mark Wengranowski

unread,
Sep 28, 2011, 5:57:42 PM9/28/11
to Google Web Toolkit
It could be but im not really sure how i should use it? How do you
determine what parameter gown in with("param")

would i just change this line of code
rs2.getInvoiceWithDetails(clientFactory.getUser()
+view.getInvoice()).fire(new Receiver<InvoiceProxy>()

to
rs2.getInvoiceWithDetails(clientFactory.getUser()
+view.getInvoice()).with("").fire(new Receiver<InvoiceProxy>()

Cheers,
-Mark


On Sep 28, 1:42 pm, Julian <julian.petter...@gmail.com> wrote:
> Could this be related?
>
> https://groups.google.com/forum/#!searchin/google-web-toolkit/request...

Jens

unread,
Sep 28, 2011, 6:17:46 PM9/28/11
to google-we...@googlegroups.com
You have to use the property name of the entity proxy. So in your case .with("lineItems"). If you need more than one property you can just add it to the parameter list, e.g. .with("lineItems", "otherPropertyName"). You can also go down the hierarchy with a dot notation. Imagine your InvoiceDetailsProxy contains a property "A" (which is an entity proxy) and you also want that property to be not null, you would add it to the with method like: .with("lineItems", "lineItems.a"). 
Your other properties are already filled because they are primitive types ( = no entity proxy). Only properties that are entity proxies or lists of entity proxies are null when you do not add these properties to the .with() method.

If you use the Editor Framework from GWT there is also a getPaths() method on the editor driver which returns an array of strings with all the property names the editor needs to be loaded. So you would do .with(editorDriver.getPaths()).

-- J.



Mark Wengranowski

unread,
Sep 28, 2011, 6:30:36 PM9/28/11
to Google Web Toolkit
Awsome!

Thanks for you help with this guys. Everything is working properly
now.

Cheers,
-Mark

Julian

unread,
Sep 28, 2011, 6:47:23 PM9/28/11
to google-we...@googlegroups.com
Your other properties are already filled because they are primitive types ( = no entity proxy). Only properties that are entity proxies or lists of entity proxies are null when you do not add these properties to the .with() method.
This also applies to instances of ValueProxy.
Reply all
Reply to author
Forward
0 new messages