Wednesday, September 28, 2011

Request Factory Proxy Variable Null problem

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();

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment