Fixes two Roo issues: ROO-1238 (Amit) and ROO-1380 (pdr)
ROO-1238:
* Remove SyncResults.
* Use EntityProxyId and RequestFactory.find(EntityProxyId) instead of the id
field of EntityProxy (or a ProxyImpl with just the id and schema fields).
ROO-1380:
* Removes RequestFactory::getProxy(String), replacing it with
getProxyId(String).
* Removes the EntityProxy.asString() method, and fixes one
incorrect usage of it.
* Adds getToken(EntityProxyId).
* Renames getToken() to getHistoryToken() in RequestFactory.
Review at http://gwt-code-reviews.appspot.com/897801
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@8815 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/samples/dynatablerf/src/com/google/gwt/sample/dynatablerf/client/FavoritesManager.java b/samples/dynatablerf/src/com/google/gwt/sample/dynatablerf/client/FavoritesManager.java
index a158fca..25936c5 100644
--- a/samples/dynatablerf/src/com/google/gwt/sample/dynatablerf/client/FavoritesManager.java
+++ b/samples/dynatablerf/src/com/google/gwt/sample/dynatablerf/client/FavoritesManager.java
@@ -39,7 +39,7 @@
private final EventBus eventBus = new SimpleEventBus();
private final Set<EntityProxyId> favoriteIds = new HashSet<EntityProxyId>();
- public FavoritesManager(RequestFactory requestFactory) {
+ public FavoritesManager(final RequestFactory requestFactory) {
String cookie = Cookies.getCookie(COOKIE_NAME);
if (cookie != null) {
try {
@@ -60,7 +60,7 @@
public void onWindowClosing(ClosingEvent event) {
StringBuilder sb = new StringBuilder();
for (EntityProxyId id : favoriteIds) {
- sb.append(id.asString()).append(",");
+ sb.append(requestFactory.getHistoryToken(id)).append(",");
}
Cookies.setCookie(COOKIE_NAME, sb.toString());
}
diff --git a/samples/dynatablerf/src/com/google/gwt/sample/dynatablerf/client/PersonEditorWorkflow.java b/samples/dynatablerf/src/com/google/gwt/sample/dynatablerf/client/PersonEditorWorkflow.java
index 1db42bc..3b66f5c 100644
--- a/samples/dynatablerf/src/com/google/gwt/sample/dynatablerf/client/PersonEditorWorkflow.java
+++ b/samples/dynatablerf/src/com/google/gwt/sample/dynatablerf/client/PersonEditorWorkflow.java
@@ -26,7 +26,6 @@
import com.google.gwt.requestfactory.shared.ProxyRequest;
import com.google.gwt.requestfactory.shared.Receiver;
import com.google.gwt.requestfactory.shared.RequestObject;
-import com.google.gwt.requestfactory.shared.SyncResult;
import com.google.gwt.requestfactory.shared.Violation;
import com.google.gwt.sample.dynatablerf.client.events.EditPersonEvent;
import com.google.gwt.sample.dynatablerf.client.widgets.PersonEditor;
@@ -113,7 +112,7 @@
}
request.fire(new Receiver<Void>() {
@Override
- public void onSuccess(Void response, Set<SyncResult> syncResults) {
+ public void onSuccess(Void response) {
dialog.hide();
}
@@ -143,7 +142,8 @@
// We could do more with the request, but we just fire it
fetchRequest.fire(new Receiver<PersonProxy>() {
- public void onSuccess(PersonProxy person, Set<SyncResult> syncResults) {
+ @Override
+ public void onSuccess(PersonProxy person) {
// Start the edit process
editorDriver.edit(person,
requestFactory.personRequest().persist(person));
diff --git a/samples/dynatablerf/src/com/google/gwt/sample/dynatablerf/client/widgets/FavoritesWidget.java b/samples/dynatablerf/src/com/google/gwt/sample/dynatablerf/client/widgets/FavoritesWidget.java
index 605cc69..2dcc176 100644
--- a/samples/dynatablerf/src/com/google/gwt/sample/dynatablerf/client/widgets/FavoritesWidget.java
+++ b/samples/dynatablerf/src/com/google/gwt/sample/dynatablerf/client/widgets/FavoritesWidget.java
@@ -25,7 +25,6 @@
import com.google.gwt.requestfactory.shared.EntityProxyId;
import com.google.gwt.requestfactory.shared.Receiver;
import com.google.gwt.requestfactory.shared.RequestFactory;
-import com.google.gwt.requestfactory.shared.SyncResult;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.sample.dynatablerf.client.FavoritesManager;
import com.google.gwt.sample.dynatablerf.client.events.MarkFavoriteEvent;
@@ -40,7 +39,6 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
-import java.util.Set;
/**
* Displays Person objects that the user has selected as a favorite. This
@@ -133,7 +131,8 @@
for (EntityProxyId id : manager.getFavoriteIds()) {
factory.find(id).fire(new Receiver<EntityProxy>() {
- public void onSuccess(EntityProxy response, Set<SyncResult> syncResults) {
+ @Override
+ public void onSuccess(EntityProxy response) {
PersonProxy person = (PersonProxy) response;
onMarkFavorite(new MarkFavoriteEvent(person, true));
}
diff --git a/samples/dynatablerf/src/com/google/gwt/sample/dynatablerf/client/widgets/SummaryWidget.java b/samples/dynatablerf/src/com/google/gwt/sample/dynatablerf/client/widgets/SummaryWidget.java
index 6a36c24..3ed52f2 100644
--- a/samples/dynatablerf/src/com/google/gwt/sample/dynatablerf/client/widgets/SummaryWidget.java
+++ b/samples/dynatablerf/src/com/google/gwt/sample/dynatablerf/client/widgets/SummaryWidget.java
@@ -20,7 +20,6 @@
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.requestfactory.shared.EntityProxyChange;
import com.google.gwt.requestfactory.shared.Receiver;
-import com.google.gwt.requestfactory.shared.SyncResult;
import com.google.gwt.requestfactory.shared.WriteOperation;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.sample.dynatablerf.client.events.EditPersonEvent;
@@ -42,7 +41,6 @@
import java.util.Collections;
import java.util.List;
-import java.util.Set;
/**
* A paging table with summaries of all known people.
@@ -107,7 +105,7 @@
CellTable<PersonProxy> table;
private final EventBus eventBus;
- private int numRows;
+ private final int numRows;
private final DynaTableRequestFactory requestFactory;
private final SingleSelectionModel<PersonProxy> selectionModel = new SingleSelectionModel<PersonProxy>();
@@ -157,8 +155,8 @@
// Record is onscreen and may differ from our data
requestFactory.personRequest().findPerson(record.getId()).fire(
new Receiver<PersonProxy>() {
- public void onSuccess(PersonProxy response,
- Set<SyncResult> syncResults) {
+ @Override
+ public void onSuccess(PersonProxy response) {
// Re-check offset in case of changes while waiting for data
int offset = offsetOf(response);
if (offset != -1) {
@@ -191,8 +189,8 @@
private void fetch(final int start) {
requestFactory.schoolCalendarRequest().getPeople(start, numRows).fire(
new Receiver<List<PersonProxy>>() {
- public void onSuccess(List<PersonProxy> response,
- Set<SyncResult> syncResults) {
+ @Override
+ public void onSuccess(List<PersonProxy> response) {
int responses = response.size();
table.setRowData(start, response);
if (!table.isRowCountExact()) {
diff --git a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseDetails.java b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseDetails.java
index b8b0114..dd96fd6 100644
--- a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseDetails.java
+++ b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseDetails.java
@@ -16,7 +16,6 @@
package com.google.gwt.sample.expenses.client;
import com.google.gwt.cell.client.AbstractEditableCell;
-
import com.google.gwt.cell.client.Cell;
import com.google.gwt.cell.client.DateCell;
import com.google.gwt.cell.client.FieldUpdater;
@@ -44,7 +43,6 @@
import com.google.gwt.requestfactory.shared.EntityProxyChange;
import com.google.gwt.requestfactory.shared.Receiver;
import com.google.gwt.requestfactory.shared.RequestObject;
-import com.google.gwt.requestfactory.shared.SyncResult;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.safehtml.client.SafeHtmlTemplates;
import com.google.gwt.safehtml.shared.SafeHtml;
@@ -83,7 +81,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Set;
/**
* Details about the current expense report on the right side of the app,
@@ -544,8 +541,7 @@
expensesRequestFactory.reportRequest().findReport(
report.getId()).fire(new Receiver<ReportProxy>() {
@Override
- public void onSuccess(
- ReportProxy response, Set<SyncResult> syncResults) {
+ public void onSuccess(ReportProxy response) {
report = response;
setNotesEditState(false, false, response.getNotes());
}
@@ -856,18 +852,6 @@
}
/**
- * Get the error message from a sync operation.
- *
- * @param response the response of the operation
- * @return the error message, or an empty string if no error.
- */
- private String getErrorMessageFromSync(Set<SyncResult> response) {
- String errorMessage = "";
- // TODO: Remove this method..
- return errorMessage;
- }
-
- /**
* Get the columns displayed in the expense table.
*/
private String[] getExpenseColumns() {
@@ -903,8 +887,7 @@
refreshTimer.cancel();
lastReceiver = new Receiver<List<ExpenseProxy>>() {
@Override
- public void onSuccess(List<ExpenseProxy> newValues,
- Set<SyncResult> syncResults) {
+ public void onSuccess(List<ExpenseProxy> newValues) {
if (this == lastReceiver) {
List<ExpenseProxy> list = new ArrayList<ExpenseProxy>(newValues);
if (lastComparator != null) {
@@ -964,13 +947,7 @@
editableReport.setNotes(pendingNotes);
editRequest.fire(new Receiver<Void>() {
@Override
- public void onSuccess(Void ignore, Set<SyncResult> response) {
- // We expect onReportChanged to be called if there are no errors.
- String errorMessage = getErrorMessageFromSync(response);
- if (errorMessage.length() > 0) {
- showErrorPopup(errorMessage);
- setNotesEditState(false, false, report.getNotes());
- }
+ public void onSuccess(Void ignore) {
}
});
}
@@ -1051,12 +1028,10 @@
editableRecord.setReasonDenied(reasonDenied);
editRequest.fire(new Receiver<Void>() {
@Override
- public void onSuccess(Void ignore, Set<SyncResult> response) {
- String errorMessage = getErrorMessageFromSync(response);
- if (errorMessage.length() > 0) {
- syncCommit(record, errorMessage.length() > 0 ? errorMessage : null);
- }
+ public void onSuccess(Void ignore) {
}
+
+ // TODO: use onViolations for checking constraint violations.
});
}
}
diff --git a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseList.java b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseList.java
index 6cc680e..20da657 100644
--- a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseList.java
+++ b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseList.java
@@ -36,7 +36,6 @@
import com.google.gwt.regexp.shared.RegExp;
import com.google.gwt.requestfactory.shared.EntityProxyChange;
import com.google.gwt.requestfactory.shared.Receiver;
-import com.google.gwt.requestfactory.shared.SyncResult;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.safehtml.shared.SafeHtmlUtils;
import com.google.gwt.sample.expenses.client.request.EmployeeProxy;
@@ -228,7 +227,7 @@
@UiField(provided = true)
CellTable<ReportProxy> table;
- private List<SortableHeader> allHeaders = new ArrayList<SortableHeader>();
+ private final List<SortableHeader> allHeaders = new ArrayList<SortableHeader>();
/**
* The department being searched.
@@ -340,6 +339,12 @@
});
}
+ public void init(ExpensesRequestFactory factory, EventBus eventBus) {
+ EntityProxyChange.registerForProxyType(eventBus, ReportProxy.class, this);
+ this.requestFactory = factory;
+ requestReports(false);
+ }
+
public void onProxyChange(EntityProxyChange<ReportProxy> event) {
ReportProxy changed = event.getProxy();
Long changedId = changed.getId();
@@ -379,12 +384,6 @@
this.listener = listener;
}
- public void init(ExpensesRequestFactory factory, EventBus eventBus) {
- EntityProxyChange.registerForProxyType(eventBus, ReportProxy.class, this);
- this.requestFactory = factory;
- requestReports(false);
- }
-
@UiFactory
SimplePager createPager() {
SimplePager p = new SimplePager(TextLocation.RIGHT);
@@ -561,7 +560,7 @@
}
lastDataSizeReceiver = new Receiver<Long>() {
@Override
- public void onSuccess(Long response, Set<SyncResult> syncResults) {
+ public void onSuccess(Long response) {
if (this == lastDataSizeReceiver) {
int count = response.intValue();
// Treat count == 1000 as inexact due to AppEngine limitation
@@ -576,8 +575,7 @@
// Request reports in the current range.
lastDataReceiver = new Receiver<List<ReportProxy>>() {
@Override
- public void onSuccess(List<ReportProxy> newValues,
- Set<SyncResult> syncResults) {
+ public void onSuccess(List<ReportProxy> newValues) {
if (this == lastDataReceiver) {
int size = newValues.size();
if (size < table.getPageSize()) {
diff --git a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseTree.java b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseTree.java
index 3e4b21e..d7af1533 100644
--- a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseTree.java
+++ b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpenseTree.java
@@ -22,7 +22,6 @@
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Overflow;
import com.google.gwt.requestfactory.shared.Receiver;
-import com.google.gwt.requestfactory.shared.SyncResult;
import com.google.gwt.safehtml.client.SafeHtmlTemplates;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
@@ -41,20 +40,12 @@
import com.google.gwt.view.client.TreeViewModel;
import java.util.List;
-import java.util.Set;
/**
* The employee tree located on the left of the app.
*/
public class ExpenseTree extends Composite {
- interface Template extends SafeHtmlTemplates {
- @Template("<span class=\"{0}\">{1}</span>")
- SafeHtml span(String classes, String userName);
- }
-
- private static Template template;
-
/**
* Custom listener for this widget.
*/
@@ -69,6 +60,11 @@
void onSelection(String department, EmployeeProxy employee);
}
+ interface Template extends SafeHtmlTemplates {
+ @Template("<span class=\"{0}\">{1}</span>")
+ SafeHtml span(String classes, String userName);
+ }
+
/**
* A {@link AbstractCell} that represents an {@link EmployeeProxy}.
*/
@@ -128,7 +124,7 @@
requestFactory.employeeRequest().countEmployeesByDepartment(
department).fire(new Receiver<Long>() {
@Override
- public void onSuccess(Long response, Set<SyncResult> syncResults) {
+ public void onSuccess(Long response) {
updateRowCount(response.intValue(), true);
}
});
@@ -141,8 +137,7 @@
department, range.getStart(), range.getLength()).with(
getEmployeeMenuProperties()).fire(new Receiver<List<EmployeeProxy>>(){
@Override
- public void onSuccess(List<EmployeeProxy> response,
- Set<SyncResult> syncResults) {
+ public void onSuccess(List<EmployeeProxy> response) {
updateRowData(0, response);
}});
}
@@ -203,10 +198,12 @@
}
}
+ private static Template template;
+
/**
* The data provider that provides departments.
*/
- private ListDataProvider<String> departments = new ListDataProvider<String>();
+ private final ListDataProvider<String> departments = new ListDataProvider<String>();
/**
* The last selected department.
diff --git a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/Expenses.java b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/Expenses.java
index 4e0755f..75dd8cc 100644
--- a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/Expenses.java
+++ b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/Expenses.java
@@ -23,7 +23,6 @@
import com.google.gwt.requestfactory.client.LoginWidget;
import com.google.gwt.requestfactory.shared.Receiver;
import com.google.gwt.requestfactory.shared.RequestEvent;
-import com.google.gwt.requestfactory.shared.SyncResult;
import com.google.gwt.requestfactory.shared.UserInformationProxy;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.safehtml.shared.SafeHtml;
@@ -39,8 +38,6 @@
import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.google.gwt.view.client.ProvidesKey;
-import java.util.Set;
-
/**
* Entry point for the Expenses app.
*/
@@ -125,7 +122,7 @@
public static final ProvidesKey<ReportProxy> REPORT_RECORD_KEY_PROVIDER =
new ProvidesKey<ReportProxy>() {
public Object getKey(ReportProxy item) {
- return item == null ? null : item.getId();
+ return (item == null) ? null : item.getId();
}
};
@@ -162,7 +159,7 @@
final LoginWidget login = shell.getLoginWidget();
Receiver<UserInformationProxy> receiver = new Receiver<UserInformationProxy>() {
@Override
- public void onSuccess(UserInformationProxy userInformationRecord, Set<SyncResult> syncResults) {
+ public void onSuccess(UserInformationProxy userInformationRecord) {
login.setUserInformation(userInformationRecord);
}
};
diff --git a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpensesMobile.java b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpensesMobile.java
index ff33e51..adc2cda 100644
--- a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpensesMobile.java
+++ b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/ExpensesMobile.java
@@ -23,7 +23,6 @@
import com.google.gwt.requestfactory.client.LoginWidget;
import com.google.gwt.requestfactory.shared.Receiver;
import com.google.gwt.requestfactory.shared.RequestEvent;
-import com.google.gwt.requestfactory.shared.SyncResult;
import com.google.gwt.requestfactory.shared.UserInformationProxy;
import com.google.gwt.sample.expenses.client.request.EmployeeProxy;
import com.google.gwt.sample.expenses.client.request.ExpensesRequestFactory;
@@ -32,8 +31,6 @@
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
-import java.util.Set;
-
/**
* Entry point for the mobile version of the Expenses app.
*/
@@ -104,8 +101,7 @@
requestFactory.employeeRequest().findEmployee(employeeId).fire(
new Receiver<EmployeeProxy>() {
@Override
- public void onSuccess(EmployeeProxy employee,
- Set<SyncResult> syncResults) {
+ public void onSuccess(EmployeeProxy employee) {
final ExpensesMobileShell shell = new ExpensesMobileShell(eventBus,
requestFactory, employee);
RootPanel.get().add(shell);
@@ -117,8 +113,7 @@
final LoginWidget login = shell.getLoginWidget();
Receiver<UserInformationProxy> receiver = new Receiver<UserInformationProxy>() {
@Override
- public void onSuccess(UserInformationProxy userInformationRecord,
- Set<SyncResult> syncResults) {
+ public void onSuccess(UserInformationProxy userInformationRecord) {
login.setUserInformation(userInformationRecord);
}
};
diff --git a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/MobileExpenseDetails.java b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/MobileExpenseDetails.java
index 81ed875..1dce5fe 100644
--- a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/MobileExpenseDetails.java
+++ b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/MobileExpenseDetails.java
@@ -16,14 +16,12 @@
package com.google.gwt.sample.expenses.client;
import com.google.gwt.core.client.GWT;
-
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.requestfactory.shared.EntityProxyChange;
import com.google.gwt.requestfactory.shared.Receiver;
-import com.google.gwt.requestfactory.shared.SyncResult;
import com.google.gwt.sample.expenses.client.request.ExpenseProxy;
import com.google.gwt.sample.expenses.client.request.ExpensesRequestFactory;
import com.google.gwt.uibinder.client.UiBinder;
@@ -32,7 +30,6 @@
import com.google.gwt.user.client.ui.Widget;
import java.util.List;
-import java.util.Set;
/**
* TODO: doc.
@@ -111,7 +108,7 @@
requestFactory.expenseRequest().findExpense(expense.getId()).fire(
new Receiver<ExpenseProxy>() {
@Override
- public void onSuccess(ExpenseProxy response, Set<SyncResult> syncResults) {
+ public void onSuccess(ExpenseProxy response) {
show(response);
}
});
diff --git a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/MobileExpenseEntry.java b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/MobileExpenseEntry.java
index 356950b..a4ad739 100644
--- a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/MobileExpenseEntry.java
+++ b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/MobileExpenseEntry.java
@@ -21,7 +21,6 @@
import com.google.gwt.requestfactory.shared.ProxyListRequest;
import com.google.gwt.requestfactory.shared.Receiver;
import com.google.gwt.requestfactory.shared.RequestObject;
-import com.google.gwt.requestfactory.shared.SyncResult;
import com.google.gwt.sample.expenses.client.request.ExpenseProxy;
import com.google.gwt.sample.expenses.client.request.ExpensesRequestFactory;
import com.google.gwt.sample.expenses.client.request.ReportProxy;
@@ -33,7 +32,6 @@
import com.google.gwt.user.client.ui.Widget;
import java.util.Date;
-import java.util.Set;
/**
* TODO: doc.
@@ -125,16 +123,10 @@
// TODO: wait throbber
requestObject.fire(new Receiver<Void>() {
@Override
- public void onSuccess(Void ignore, Set<SyncResult> response) {
- // Check for commit errors.
- String errorMessage = "";
- // FIXME: Error handling disabled...
- if (errorMessage.length() > 0) {
- errorText.setInnerText(errorMessage);
- } else {
- listener.onExpenseUpdated();
- }
+ public void onSuccess(Void ignore) {
}
+
+ // TODO: use onViolations to check for constraint violations.
});
}
diff --git a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/MobileExpenseList.java b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/MobileExpenseList.java
index 3d51432..2640598 100644
--- a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/MobileExpenseList.java
+++ b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/MobileExpenseList.java
@@ -18,7 +18,6 @@
import com.google.gwt.cell.client.AbstractCell;
import com.google.gwt.core.client.GWT;
import com.google.gwt.requestfactory.shared.Receiver;
-import com.google.gwt.requestfactory.shared.SyncResult;
import com.google.gwt.safehtml.client.SafeHtmlTemplates;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
@@ -43,18 +42,6 @@
*/
public class MobileExpenseList extends Composite implements MobilePage {
- interface Template extends SafeHtmlTemplates {
- @Template("<div class=\"item\">{0}{1} ({2})</div>")
- SafeHtml div(SafeHtml approvalIcon, String description, String amount);
- }
-
- private static Template template;
-
- /**
- * The auto refresh interval in milliseconds.
- */
- private static final int REFRESH_INTERVAL = 5000;
-
/**
* TODO: doc.
*/
@@ -66,6 +53,11 @@
void onExpenseSelected(ExpenseProxy expense);
}
+ interface Template extends SafeHtmlTemplates {
+ @Template("<div class=\"item\">{0}{1} ({2})</div>")
+ SafeHtml div(SafeHtml approvalIcon, String description, String amount);
+ }
+
/**
* The cell used to render {@link ExpenseProxy}s.
*/
@@ -102,6 +94,13 @@
}
}
+ private static Template template;
+
+ /**
+ * The auto refresh interval in milliseconds.
+ */
+ private static final int REFRESH_INTERVAL = 5000;
+
private final ExpensesRequestFactory requestFactory;
private final CellList<ExpenseProxy> expenseList;
private final AsyncDataProvider<ExpenseProxy> expenseDataProvider;
@@ -215,8 +214,7 @@
}
lastReceiver = new Receiver<List<ExpenseProxy>>() {
@Override
- public void onSuccess(
- List<ExpenseProxy> newValues, Set<SyncResult> syncResults) {
+ public void onSuccess(List<ExpenseProxy> newValues) {
if (this == lastReceiver) {
int size = newValues.size();
expenseDataProvider.updateRowCount(size, true);
diff --git a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/MobileReportEntry.java b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/MobileReportEntry.java
index 9ca047f..3ec2fae 100644
--- a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/MobileReportEntry.java
+++ b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/MobileReportEntry.java
@@ -20,7 +20,6 @@
import com.google.gwt.dom.client.Element;
import com.google.gwt.requestfactory.shared.Receiver;
import com.google.gwt.requestfactory.shared.RequestObject;
-import com.google.gwt.requestfactory.shared.SyncResult;
import com.google.gwt.sample.expenses.client.request.EmployeeProxy;
import com.google.gwt.sample.expenses.client.request.ExpensesRequestFactory;
import com.google.gwt.sample.expenses.client.request.ReportProxy;
@@ -32,7 +31,6 @@
import com.google.gwt.user.client.ui.Widget;
import java.util.Date;
-import java.util.Set;
/**
* Form to create a new ReportRecord.
@@ -125,16 +123,10 @@
// TODO: wait throbber
requestObject.fire(new Receiver<Void>() {
@Override
- public void onSuccess(Void ignore, Set<SyncResult> response) {
- // Check for commit errors.
- String errorMessage = "";
- // FIXME: Error handling disabled
- if (errorMessage.length() > 0) {
- errorText.setInnerText(errorMessage);
- } else {
- listener.onReportUpdated();
- }
+ public void onSuccess(Void ignore) {
}
+
+ // use onViolations to check for ConstraintViolations.
});
}
diff --git a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/MobileReportList.java b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/MobileReportList.java
index d1263ed..323e797 100644
--- a/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/MobileReportList.java
+++ b/samples/expenses/src/main/java/com/google/gwt/sample/expenses/client/MobileReportList.java
@@ -17,7 +17,6 @@
import com.google.gwt.cell.client.AbstractCell;
import com.google.gwt.requestfactory.shared.Receiver;
-import com.google.gwt.requestfactory.shared.SyncResult;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.sample.expenses.client.request.EmployeeProxy;
import com.google.gwt.sample.expenses.client.request.ExpensesRequestFactory;
@@ -31,7 +30,6 @@
import com.google.gwt.view.client.SelectionChangeEvent;
import java.util.List;
-import java.util.Set;
/**
* TODO: doc.
@@ -143,7 +141,7 @@
lastReceiver = new Receiver<List<ReportProxy>>() {
@Override
public void onSuccess(
- List<ReportProxy> newValues, Set<SyncResult> syncResults) {
+ List<ReportProxy> newValues) {
int size = newValues.size();
reportDataProvider.updateRowCount(size, true);
reportDataProvider.updateRowData(0, newValues);
diff --git a/user/src/com/google/gwt/app/place/AbstractProxyEditActivity.java b/user/src/com/google/gwt/app/place/AbstractProxyEditActivity.java
index cf35aad..af06fae 100644
--- a/user/src/com/google/gwt/app/place/AbstractProxyEditActivity.java
+++ b/user/src/com/google/gwt/app/place/AbstractProxyEditActivity.java
@@ -16,7 +16,6 @@
package com.google.gwt.app.place;
import com.google.gwt.app.place.ProxyPlace.Operation;
-
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.requestfactory.shared.EntityProxy;
import com.google.gwt.requestfactory.shared.EntityProxyId;
@@ -25,7 +24,6 @@
import com.google.gwt.requestfactory.shared.RequestFactory;
import com.google.gwt.requestfactory.shared.RequestObject;
import com.google.gwt.requestfactory.shared.ServerFailure;
-import com.google.gwt.requestfactory.shared.SyncResult;
import com.google.gwt.requestfactory.shared.Violation;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
@@ -59,12 +57,12 @@
private P record;
private EntityProxyId stableId;
- public AbstractProxyEditActivity(ProxyEditView<P> view, P record,
+ public AbstractProxyEditActivity(ProxyEditView<P> view, EntityProxyId proxyId,
Class<P> proxyType, boolean creating, RequestFactory requests,
PlaceController placeController) {
this.view = view;
- this.record = record;
+ this.stableId = proxyId;
this.proxyType = proxyType;
this.placeController = placeController;
this.creating = creating;
@@ -119,21 +117,10 @@
}
@Override
- public void onSuccess(Void ignore, Set<SyncResult> response) {
+ public void onSuccess(Void ignore) {
if (display == null) {
return;
}
-
- if (creating) {
- // TODO(amitmanjhi) Not needed once events are proxy id based
- for (SyncResult syncResult : response) {
- EntityProxy syncRecord = syncResult.getProxy();
- if (stableId.equals(syncRecord.stableId())) {
- record = cast(syncRecord);
- break;
- }
- }
- }
exit(true);
}
@@ -160,10 +147,11 @@
stableId = tempRecord.stableId();
doStart(display, tempRecord);
} else {
- ProxyRequest<P> findRequest = getFindRequest(getRecord().getId());
+ @SuppressWarnings("unchecked")
+ ProxyRequest<P> findRequest = (ProxyRequest<P>) requests.find(stableId);
findRequest.with(getView().getPaths()).fire(new Receiver<P>() {
@Override
- public void onSuccess(P record, Set<SyncResult> syncResults) {
+ public void onSuccess(P record) {
if (AbstractProxyEditActivity.this.display != null) {
doStart(AbstractProxyEditActivity.this.display, record);
}
@@ -186,22 +174,12 @@
if (!saved && creating) {
display.setWidget(null);
} else {
- placeController.goTo(new ProxyPlace(getRecord(), Operation.DETAILS));
+ placeController.goTo(new ProxyPlace(stableId, Operation.DETAILS));
}
}
- /**
- * Called to fetch the details of the edited record.
- */
- protected abstract ProxyRequest<P> getFindRequest(Long id);
-
protected abstract RequestObject<Void> getPersistRequest(P record);
- @SuppressWarnings("unchecked")
- private P cast(EntityProxy syncRecord) {
- return (P) syncRecord;
- }
-
private void doStart(final AcceptsOneWidget display, P record) {
requestObject = getPersistRequest(record);
P editableRecord = requestObject.edit(record);
@@ -211,3 +189,4 @@
display.setWidget(view);
}
}
+
diff --git a/user/src/com/google/gwt/app/place/AbstractProxyListActivity.java b/user/src/com/google/gwt/app/place/AbstractProxyListActivity.java
index 2a1dc37..a5f9dd6 100644
--- a/user/src/com/google/gwt/app/place/AbstractProxyListActivity.java
+++ b/user/src/com/google/gwt/app/place/AbstractProxyListActivity.java
@@ -20,10 +20,10 @@
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.requestfactory.shared.EntityProxy;
import com.google.gwt.requestfactory.shared.EntityProxyChange;
+import com.google.gwt.requestfactory.shared.EntityProxyId;
import com.google.gwt.requestfactory.shared.ProxyListRequest;
import com.google.gwt.requestfactory.shared.Receiver;
import com.google.gwt.requestfactory.shared.RequestFactory;
-import com.google.gwt.requestfactory.shared.SyncResult;
import com.google.gwt.requestfactory.shared.WriteOperation;
import com.google.gwt.user.cellview.client.AbstractHasData;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
@@ -38,7 +38,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Set;
/**
* <p>
@@ -67,7 +66,7 @@
/**
* This mapping allows us to update individual rows as records change.
*/
- private final Map<Long, Integer> recordToRow = new HashMap<Long, Integer>();
+ private final Map<EntityProxyId, Integer> recordToRow = new HashMap<EntityProxyId, Integer>();
private final RequestFactory requests;
private final PlaceController placeController;
@@ -109,7 +108,7 @@
}
public void createClicked() {
- placeController.goTo(new ProxyPlace(requests.create(proxyType),
+ placeController.goTo(new ProxyPlace(requests.create(proxyType).stableId(),
Operation.CREATE));
}
@@ -133,7 +132,7 @@
final Receiver<List<P>> callback = new Receiver<List<P>>() {
@Override
- public void onSuccess(List<P> values, Set<SyncResult> syncResults) {
+ public void onSuccess(List<P> values) {
if (view == null) {
// This activity is dead
return;
@@ -141,7 +140,7 @@
recordToRow.clear();
for (int i = 0, row = range.getStart(); i < values.size(); i++, row++) {
P record = values.get(i);
- recordToRow.put(record.getId(), row);
+ recordToRow.put(record.stableId(), row);
}
getView().asHasData().setRowData(range.getStart(), values);
if (display != null) {
@@ -218,11 +217,11 @@
/**
* Called when the user chooses a record to view. This default implementation
* sends the {@link PlaceController} to an appropriate {@link ProxyPlace}.
- *
+ *
* @param record the chosen record
*/
protected void showDetails(P record) {
- placeController.goTo(new ProxyPlace(record, Operation.DETAILS));
+ placeController.goTo(new ProxyPlace(record.stableId(), Operation.DETAILS));
}
private void fireRangeRequest(final Range range,
@@ -233,7 +232,7 @@
private void getLastPage() {
fireCountRequest(new Receiver<Long>() {
@Override
- public void onSuccess(Long response, Set<SyncResult> syncResults) {
+ public void onSuccess(Long response) {
HasData<P> table = getView().asHasData();
int rows = response.intValue();
table.setRowCount(rows, true);
@@ -252,7 +251,7 @@
private void init() {
fireCountRequest(new Receiver<Long>() {
@Override
- public void onSuccess(Long response, Set<SyncResult> syncResults) {
+ public void onSuccess(Long response) {
getView().asHasData().setRowCount(response.intValue(), true);
onRangeChanged(view.asHasData());
}
@@ -261,17 +260,17 @@
@SuppressWarnings("unchecked")
private void selectCoerced(Place newPlace) {
- select((P) ((ProxyPlace) newPlace).getProxy());
+ select((P) ((ProxyPlace) newPlace).getProxyId());
}
private void update(P record) {
- final Integer row = recordToRow.get(record.getId());
+ final Integer row = recordToRow.get(record.stableId());
if (row == null) {
return;
}
fireRangeRequest(new Range(row, 1), new Receiver<List<P>>() {
@Override
- public void onSuccess(List<P> response, Set<SyncResult> syncResults) {
+ public void onSuccess(List<P> response) {
getView().asHasData().setRowData(row,
Collections.singletonList(response.get(0)));
}
@@ -282,7 +281,7 @@
if (newPlace instanceof ProxyPlace) {
ProxyPlace proxyPlace = (ProxyPlace) newPlace;
if (proxyPlace.getOperation() != Operation.CREATE
- && requests.getClass(proxyPlace.getProxy()).equals(proxyType)) {
+ && requests.getClass(proxyPlace.getProxyId()).equals(proxyType)) {
selectCoerced(newPlace);
return;
}
diff --git a/user/src/com/google/gwt/app/place/EntityProxyKeyProvider.java b/user/src/com/google/gwt/app/place/EntityProxyKeyProvider.java
index 2e718b6..ac88236 100644
--- a/user/src/com/google/gwt/app/place/EntityProxyKeyProvider.java
+++ b/user/src/com/google/gwt/app/place/EntityProxyKeyProvider.java
@@ -26,6 +26,6 @@
public class EntityProxyKeyProvider<P extends EntityProxy> implements
ProvidesKey<P> {
public Object getKey(P item) {
- return item == null ? null : item.getId();
+ return item == null ? null : item.stableId();
}
}
diff --git a/user/src/com/google/gwt/app/place/ProxyPlace.java b/user/src/com/google/gwt/app/place/ProxyPlace.java
index 4fab0e7..cebed39 100644
--- a/user/src/com/google/gwt/app/place/ProxyPlace.java
+++ b/user/src/com/google/gwt/app/place/ProxyPlace.java
@@ -15,7 +15,7 @@
*/
package com.google.gwt.app.place;
-import com.google.gwt.requestfactory.shared.EntityProxy;
+import com.google.gwt.requestfactory.shared.EntityProxyId;
import com.google.gwt.requestfactory.shared.RequestFactory;
/**
@@ -43,26 +43,26 @@
public ProxyPlace getPlace(String token) {
String bits[] = token.split("@");
- return new ProxyPlace(requests.getProxy(bits[0]),
+ return new ProxyPlace(requests.getProxyId(bits[0]),
Operation.valueOf(bits[1]));
}
public String getToken(ProxyPlace place) {
- return requests.getToken(place.getProxy()) + "@" + place.getOperation();
+ return requests.getHistoryToken(place.getProxyId()) + "@" + place.getOperation();
}
}
- private final EntityProxy proxy;
+ private final EntityProxyId proxyId;
private final Operation operation;
- public ProxyPlace(EntityProxy record) {
+ public ProxyPlace(EntityProxyId record) {
this(record, Operation.DETAILS);
}
-
- public ProxyPlace(EntityProxy record, Operation operation) {
+
+ public ProxyPlace(EntityProxyId proxyId, Operation operation) {
this.operation = operation;
- this.proxy = record;
+ this.proxyId = proxyId;
}
@Override
@@ -80,21 +80,18 @@
if (!operation.equals(other.operation)) {
return false;
}
- if (!proxy.getId().equals(other.proxy.getId())) {
- return false;
- }
- if (!proxy.getClass().equals(other.proxy.getClass())) {
+ if (!proxyId.equals(other.proxyId)) {
return false;
}
return true;
}
-
+
public Operation getOperation() {
return operation;
}
- public EntityProxy getProxy() {
- return proxy;
+ public EntityProxyId getProxyId() {
+ return proxyId;
}
@Override
@@ -102,13 +99,12 @@
final int prime = 31;
int result = 1;
result = prime * result + operation.hashCode();
- result = prime * result + proxy.getId().hashCode();
- result = prime * result + proxy.getClass().hashCode();
+ result = prime * result + proxyId.hashCode();
return result;
}
@Override
public String toString() {
- return "ProxyPlace [operation=" + operation + ", proxy=" + proxy + "]";
+ return "ProxyPlace [operation=" + operation + ", proxy=" + proxyId + "]";
}
}
diff --git a/user/src/com/google/gwt/app/place/ProxyPlaceToListPlace.java b/user/src/com/google/gwt/app/place/ProxyPlaceToListPlace.java
index 1c41c3b..1dd16dc 100644
--- a/user/src/com/google/gwt/app/place/ProxyPlaceToListPlace.java
+++ b/user/src/com/google/gwt/app/place/ProxyPlaceToListPlace.java
@@ -29,7 +29,7 @@
/**
* Required by {@link FilteredActivityMapper.Filter}, calls
- * {@link #getProxy()}.
+ * {@link #proxyListPlaceFor()}.
*/
public Place filter(Place place) {
return proxyListPlaceFor(place);
@@ -50,6 +50,6 @@
}
ProxyPlace proxyPlace = (ProxyPlace) place;
- return new ProxyListPlace(requests.getClass(proxyPlace.getProxy()));
+ return new ProxyListPlace(requests.getClass(proxyPlace.getProxyId()));
}
}
diff --git a/user/src/com/google/gwt/requestfactory/client/RequestFactoryLogHandler.java b/user/src/com/google/gwt/requestfactory/client/RequestFactoryLogHandler.java
index a8c89c6..49bdfff 100644
--- a/user/src/com/google/gwt/requestfactory/client/RequestFactoryLogHandler.java
+++ b/user/src/com/google/gwt/requestfactory/client/RequestFactoryLogHandler.java
@@ -20,9 +20,7 @@
import com.google.gwt.logging.shared.SerializableLogRecord;
import com.google.gwt.requestfactory.shared.LoggingRequest;
import com.google.gwt.requestfactory.shared.Receiver;
-import com.google.gwt.requestfactory.shared.SyncResult;
-import java.util.Set;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
@@ -42,7 +40,7 @@
private class LoggingReceiver extends Receiver<Long> {
@Override
- public void onSuccess(Long response, Set<SyncResult> syncResults) {
+ public void onSuccess(Long response) {
if (response > 0) {
logger.finest("Remote logging successful");
} else {
@@ -105,7 +103,7 @@
requestProvider.getLoggingRequest().logMessage(json).fire(
new Receiver<Boolean>() {
@Override
- public void onSuccess(Boolean response, Set<SyncResult> syncResults) {
+ public void onSuccess(Boolean response) {
if (!response) {
wireLogger.severe("Remote Logging failed to parse JSON");
}
diff --git a/user/src/com/google/gwt/requestfactory/client/SyncResultImpl.java b/user/src/com/google/gwt/requestfactory/client/SyncResultImpl.java
deleted file mode 100644
index 7dd6bdd..0000000
--- a/user/src/com/google/gwt/requestfactory/client/SyncResultImpl.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.google.gwt.requestfactory.client;
-
-import com.google.gwt.requestfactory.shared.EntityProxy;
-import com.google.gwt.requestfactory.shared.SyncResult;
-
-/**
- * <p>
- * <span style="color:red">Experimental API: This class is still under rapid
- * development, and is very likely to be deleted. Use it at your own risk.
- * </span>
- * </p>
- * Concrete implementation of SyncResult.
- */
-public class SyncResultImpl implements SyncResult {
-
- private final EntityProxy record;
- private final Object futureId;
-
- public SyncResultImpl(EntityProxy record, Object futureId) {
- this.record = record;
- this.futureId = futureId;
- }
-
- public Object getFutureId() {
- return futureId;
- }
-
- public EntityProxy getProxy() {
- return record;
- }
-}
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractBigDecimalRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractBigDecimalRequest.java
index 31f4c12..8faa91e 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractBigDecimalRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractBigDecimalRequest.java
@@ -15,10 +15,7 @@
*/
package com.google.gwt.requestfactory.client.impl;
-import com.google.gwt.requestfactory.shared.SyncResult;
-
import java.math.BigDecimal;
-import java.util.Set;
/**
* <p>
@@ -38,9 +35,8 @@
}
@Override
- public void handlePrimitiveResult(String responseText,
- Set<SyncResult> syncResults) {
- receiver.onSuccess(new BigDecimal(responseText), syncResults);
+ public void handlePrimitiveResult(String responseText) {
+ receiver.onSuccess(new BigDecimal(responseText));
}
@Override
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractBigIntegerRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractBigIntegerRequest.java
index 8a6081c..d2c2454 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractBigIntegerRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractBigIntegerRequest.java
@@ -15,11 +15,8 @@
*/
package com.google.gwt.requestfactory.client.impl;
-import com.google.gwt.requestfactory.shared.SyncResult;
-
import java.math.BigDecimal;
import java.math.BigInteger;
-import java.util.Set;
/**
* <p>
@@ -39,9 +36,8 @@
}
@Override
- public void handlePrimitiveResult(String responseText,
- Set<SyncResult> syncResults) {
- receiver.onSuccess(new BigDecimal(responseText).toBigInteger(), syncResults);
+ public void handlePrimitiveResult(String responseText) {
+ receiver.onSuccess(new BigDecimal(responseText).toBigInteger());
}
@Override
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractBooleanRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractBooleanRequest.java
index 34486f3..b4a4273 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractBooleanRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractBooleanRequest.java
@@ -15,10 +15,6 @@
*/
package com.google.gwt.requestfactory.client.impl;
-import com.google.gwt.requestfactory.shared.SyncResult;
-
-import java.util.Set;
-
/**
* <p>
* <span style="color:red">Experimental API: This class is still under rapid
@@ -37,9 +33,8 @@
}
@Override
- public void handlePrimitiveResult(String responseText,
- Set<SyncResult> syncResults) {
- receiver.onSuccess(Boolean.valueOf(responseText), syncResults);
+ public void handlePrimitiveResult(String responseText) {
+ receiver.onSuccess(Boolean.valueOf(responseText));
}
@Override
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractByteRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractByteRequest.java
index b8f8983..22b5f64 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractByteRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractByteRequest.java
@@ -15,10 +15,6 @@
*/
package com.google.gwt.requestfactory.client.impl;
-import com.google.gwt.requestfactory.shared.SyncResult;
-
-import java.util.Set;
-
/**
* <p>
* <span style="color:red">Experimental API: This class is still under rapid
@@ -37,9 +33,8 @@
}
@Override
- public void handlePrimitiveResult(String responseText,
- Set<SyncResult> syncResults) {
- receiver.onSuccess(Integer.valueOf(responseText).byteValue(), syncResults);
+ public void handlePrimitiveResult(String responseText) {
+ receiver.onSuccess(Integer.valueOf(responseText).byteValue());
}
@Override
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractCharacterRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractCharacterRequest.java
index bb9d401..ab469e1 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractCharacterRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractCharacterRequest.java
@@ -15,10 +15,6 @@
*/
package com.google.gwt.requestfactory.client.impl;
-import com.google.gwt.requestfactory.shared.SyncResult;
-
-import java.util.Set;
-
/**
* <p>
* <span style="color:red">Experimental API: This class is still under rapid
@@ -37,9 +33,8 @@
}
@Override
- public void handlePrimitiveResult(String responseText,
- Set<SyncResult> syncResults) {
- receiver.onSuccess(responseText.charAt(0), syncResults);
+ public void handlePrimitiveResult(String responseText) {
+ receiver.onSuccess(responseText.charAt(0));
}
@Override
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractDateRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractDateRequest.java
index edbbf09..8ee7761 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractDateRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractDateRequest.java
@@ -15,10 +15,7 @@
*/
package com.google.gwt.requestfactory.client.impl;
-import com.google.gwt.requestfactory.shared.SyncResult;
-
import java.util.Date;
-import java.util.Set;
/**
* <p>
@@ -38,9 +35,8 @@
}
@Override
- public void handlePrimitiveResult(String responseText,
- Set<SyncResult> syncResults) {
- receiver.onSuccess(new Date(Long.valueOf(responseText)), syncResults);
+ public void handlePrimitiveResult(String responseText) {
+ receiver.onSuccess(new Date(Long.valueOf(responseText)));
}
@Override
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractDoubleRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractDoubleRequest.java
index 669cc3a..ff22ed9 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractDoubleRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractDoubleRequest.java
@@ -15,10 +15,6 @@
*/
package com.google.gwt.requestfactory.client.impl;
-import com.google.gwt.requestfactory.shared.SyncResult;
-
-import java.util.Set;
-
/**
* <p>
* <span style="color:red">Experimental API: This class is still under rapid
@@ -37,9 +33,8 @@
}
@Override
- public void handlePrimitiveResult(String responseText,
- Set<SyncResult> syncResults) {
- receiver.onSuccess(Double.valueOf(responseText), syncResults);
+ public void handlePrimitiveResult(String responseText) {
+ receiver.onSuccess(Double.valueOf(responseText));
}
@Override
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractEnumRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractEnumRequest.java
index c1ebeed..36387a8 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractEnumRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractEnumRequest.java
@@ -15,10 +15,6 @@
*/
package com.google.gwt.requestfactory.client.impl;
-import com.google.gwt.requestfactory.shared.SyncResult;
-
-import java.util.Set;
-
/**
* <p>
* <span style="color:red">Experimental API: This class is still under rapid
@@ -34,7 +30,7 @@
public abstract class AbstractEnumRequest<E extends Enum<E>> extends
AbstractPrimitiveRequest<Integer, AbstractEnumRequest<E>> {
- private E[] enumValues;
+ private final E[] enumValues;
public AbstractEnumRequest(RequestFactoryJsonImpl requestFactory, E[] enumValues) {
super(requestFactory);
@@ -42,12 +38,11 @@
}
@Override
- public void handlePrimitiveResult(String responseText,
- Set<SyncResult> syncResults) {
+ public void handlePrimitiveResult(String responseText) {
int ordinal = Integer.valueOf(responseText);
for (E e : enumValues) {
if (ordinal == e.ordinal()) {
- receiver.onSuccess(ordinal, syncResults);
+ receiver.onSuccess(ordinal);
}
}
throw new IllegalArgumentException("Invalid enum ordinal value " + ordinal);
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractFloatRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractFloatRequest.java
index 793f7d9..6a94270 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractFloatRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractFloatRequest.java
@@ -15,10 +15,6 @@
*/
package com.google.gwt.requestfactory.client.impl;
-import com.google.gwt.requestfactory.shared.SyncResult;
-
-import java.util.Set;
-
/**
* <p>
* <span style="color:red">Experimental API: This class is still under rapid
@@ -37,9 +33,8 @@
}
@Override
- public void handlePrimitiveResult(String responseText,
- Set<SyncResult> syncResults) {
- receiver.onSuccess(Float.valueOf(responseText), syncResults);
+ public void handlePrimitiveResult(String responseText) {
+ receiver.onSuccess(Float.valueOf(responseText));
}
@Override
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractIntegerRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractIntegerRequest.java
index e514dbf..cb3db69 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractIntegerRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractIntegerRequest.java
@@ -15,10 +15,6 @@
*/
package com.google.gwt.requestfactory.client.impl;
-import com.google.gwt.requestfactory.shared.SyncResult;
-
-import java.util.Set;
-
/**
* <p>
* <span style="color:red">Experimental API: This class is still under rapid
@@ -37,9 +33,8 @@
}
@Override
- public void handlePrimitiveResult(String responseText,
- Set<SyncResult> syncResults) {
- receiver.onSuccess(Integer.valueOf(responseText), syncResults);
+ public void handlePrimitiveResult(String responseText) {
+ receiver.onSuccess(Integer.valueOf(responseText));
}
@Override
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractJsonListRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractJsonListRequest.java
index ba6b2b7..bed6f06 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractJsonListRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractJsonListRequest.java
@@ -19,11 +19,9 @@
import com.google.gwt.core.client.JsArray;
import com.google.gwt.requestfactory.shared.EntityProxy;
import com.google.gwt.requestfactory.shared.ProxyListRequest;
-import com.google.gwt.requestfactory.shared.SyncResult;
import java.util.ArrayList;
import java.util.List;
-import java.util.Set;
/**
* <p>
@@ -51,12 +49,7 @@
}
@Override
- public void handleResult(Object jsoResult, Set<SyncResult> syncResults) {
- // TODO (amitmanjhi): remove this check once Receiver has the onViolations method.
- if (jsoResult == null) {
- receiver.onSuccess(null, syncResults);
- return;
- }
+ public void handleResult(Object jsoResult) {
@SuppressWarnings("unchecked")
JsArray<JavaScriptObject> rawJsos = (JsArray<JavaScriptObject>) jsoResult;
@@ -80,6 +73,6 @@
T proxy = (T) schema.create(jso);
proxies.add(proxy);
}
- receiver.onSuccess(proxies, syncResults);
+ receiver.onSuccess(proxies);
}
}
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractJsonObjectRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractJsonObjectRequest.java
index 9c2acca..29ab810 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractJsonObjectRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractJsonObjectRequest.java
@@ -18,9 +18,6 @@
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.requestfactory.shared.EntityProxy;
import com.google.gwt.requestfactory.shared.ProxyRequest;
-import com.google.gwt.requestfactory.shared.SyncResult;
-
-import java.util.Set;
/**
* <p> <span style="color:red">Experimental API: This class is still under rapid
@@ -45,12 +42,7 @@
}
@Override
- public void handleResult(Object result, Set<SyncResult> syncResults) {
- // TODO (amitmanjhi): remove this check once Receiver has the onViolations method.
- if (result == null) {
- receiver.onSuccess(null, syncResults);
- return;
- }
+ public void handleResult(Object result) {
JavaScriptObject rawJso = (JavaScriptObject) result;
ProxyJsoImpl jso = ProxyJsoImpl.create(rawJso, schema, requestFactory);
@@ -66,6 +58,6 @@
*/
@SuppressWarnings("unchecked")
T proxy = (T) schema.create(jso);
- receiver.onSuccess(proxy, syncResults);
+ receiver.onSuccess(proxy);
}
}
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractLongRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractLongRequest.java
index 9b685ab..eed7468 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractLongRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractLongRequest.java
@@ -15,10 +15,6 @@
*/
package com.google.gwt.requestfactory.client.impl;
-import com.google.gwt.requestfactory.shared.SyncResult;
-
-import java.util.Set;
-
/**
* <p>
* <span style="color:red">Experimental API: This class is still under rapid
@@ -37,9 +33,8 @@
}
@Override
- public void handlePrimitiveResult(String responseText,
- Set<SyncResult> syncResults) {
- receiver.onSuccess(Long.valueOf(responseText), syncResults);
+ public void handlePrimitiveResult(String responseText) {
+ receiver.onSuccess(Long.valueOf(responseText));
}
@Override
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractPrimitiveRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractPrimitiveRequest.java
index 9ccacd7..64525bb 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractPrimitiveRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractPrimitiveRequest.java
@@ -15,10 +15,6 @@
*/
package com.google.gwt.requestfactory.client.impl;
-import com.google.gwt.requestfactory.shared.SyncResult;
-
-import java.util.Set;
-
/**
* <p>
* <span style="color:red">Experimental API: This class is still under rapid
@@ -39,15 +35,9 @@
}
@Override
- public void handleResult(Object result, Set<SyncResult> syncResults) {
- // TODO (amitmanjhi): remove this check once Receiver has the onViolations method.
- if (result == null) {
- handlePrimitiveResult(null, syncResults);
- return;
- }
- handlePrimitiveResult(asString(result), syncResults);
+ public void handleResult(Object result) {
+ handlePrimitiveResult(asString(result));
}
- protected abstract void handlePrimitiveResult(String responseText,
- Set<SyncResult> syncResults);
+ protected abstract void handlePrimitiveResult(String responseText);
}
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractRequest.java
index 90e781f..063c4a5 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractRequest.java
@@ -24,7 +24,6 @@
import com.google.gwt.requestfactory.shared.Receiver;
import com.google.gwt.requestfactory.shared.RequestObject;
import com.google.gwt.requestfactory.shared.ServerFailure;
-import com.google.gwt.requestfactory.shared.SyncResult;
import com.google.gwt.requestfactory.shared.Violation;
import com.google.gwt.requestfactory.shared.impl.Property;
import com.google.gwt.requestfactory.shared.impl.RequestData;
@@ -152,8 +151,8 @@
receiver.onViolation(errors);
} else {
- handleResult(results.getResult(),
- deltaValueStore.commit(results.getSideEffects()));
+ deltaValueStore.commit(results.getSideEffects());
+ handleResult(results.getResult());
}
}
@@ -187,8 +186,7 @@
*/
protected abstract R getThis();
- protected abstract void handleResult(Object result,
- Set<SyncResult> syncResults);
+ protected abstract void handleResult(Object result);
protected native void processRelated(JavaScriptObject related) /*-{
for(var recordKey in related) {
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractShortRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractShortRequest.java
index 6cec124..d52d35f 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractShortRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractShortRequest.java
@@ -15,10 +15,6 @@
*/
package com.google.gwt.requestfactory.client.impl;
-import com.google.gwt.requestfactory.shared.SyncResult;
-
-import java.util.Set;
-
/**
* <p>
* <span style="color:red">Experimental API: This class is still under rapid
@@ -37,9 +33,8 @@
}
@Override
- public void handlePrimitiveResult(String responseText,
- Set<SyncResult> syncResults) {
- receiver.onSuccess(Short.valueOf(responseText), syncResults);
+ public void handlePrimitiveResult(String responseText) {
+ receiver.onSuccess(Short.valueOf(responseText));
}
@Override
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractStringRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractStringRequest.java
index 4c29e94..327a6da 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractStringRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractStringRequest.java
@@ -15,10 +15,6 @@
*/
package com.google.gwt.requestfactory.client.impl;
-import com.google.gwt.requestfactory.shared.SyncResult;
-
-import java.util.Set;
-
/**
* <p>
* <span style="color:red">Experimental API: This class is still under rapid
@@ -37,9 +33,8 @@
}
@Override
- public void handlePrimitiveResult(String responseText,
- Set<SyncResult> syncResults) {
- receiver.onSuccess(responseText, syncResults);
+ public void handlePrimitiveResult(String responseText) {
+ receiver.onSuccess(responseText);
}
@Override
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractVoidRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractVoidRequest.java
index d596cd7..0c05b6e 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractVoidRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractVoidRequest.java
@@ -15,10 +15,6 @@
*/
package com.google.gwt.requestfactory.client.impl;
-import com.google.gwt.requestfactory.shared.SyncResult;
-
-import java.util.Set;
-
/**
* <p>
* <span style="color:red">Experimental API: This class is still under rapid
@@ -37,9 +33,8 @@
}
@Override
- public void handlePrimitiveResult(String responseText,
- Set<SyncResult> syncResults) {
- receiver.onSuccess(null, syncResults);
+ public void handlePrimitiveResult(String responseText) {
+ receiver.onSuccess(null);
}
@Override
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/DeltaValueStoreJsonImpl.java b/user/src/com/google/gwt/requestfactory/client/impl/DeltaValueStoreJsonImpl.java
index 567ff7f..98666ac 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/DeltaValueStoreJsonImpl.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/DeltaValueStoreJsonImpl.java
@@ -18,10 +18,8 @@
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;
-import com.google.gwt.requestfactory.client.SyncResultImpl;
import com.google.gwt.requestfactory.shared.EntityProxy;
import com.google.gwt.requestfactory.shared.EntityProxyId;
-import com.google.gwt.requestfactory.shared.SyncResult;
import com.google.gwt.requestfactory.shared.WriteOperation;
import com.google.gwt.requestfactory.shared.impl.Property;
@@ -103,12 +101,6 @@
}-*/;
}
- // TODO: remove this method when SyncResult is removed.
- static SyncResultImpl makeSyncResult(ProxyJsoImpl jso,
- Object futureId) {
- return new SyncResultImpl(jso.getSchema().create(jso), futureId);
- }
-
private final ValueStoreJsonImpl master;
private final RequestFactoryJsonImpl requestFactory;
@@ -131,8 +123,7 @@
throw new UnsupportedOperationException("Auto-generated method stub");
}
- public Set<SyncResult> commit(JavaScriptObject returnedJso) {
- Set<SyncResult> syncResults = new HashSet<SyncResult>();
+ public void commit(JavaScriptObject returnedJso) {
HashSet<String> keys = new HashSet<String>();
ReturnRecord.fillKeys(returnedJso, keys);
@@ -165,7 +156,6 @@
ProxyJsoImpl masterRecord = master.records.get(futureKey);
assert masterRecord == null;
requestFactory.postChangeEvent(copy, WriteOperation.CREATE);
- syncResults.add(makeSyncResult(copy, futureKey.id));
}
}
processToRemove(toRemove, WriteOperation.CREATE);
@@ -184,7 +174,6 @@
requestFactory);
requestFactory.postChangeEvent(copy, WriteOperation.DELETE);
master.records.remove(key);
- syncResults.add(makeSyncResult(copy, null));
}
}
@@ -212,11 +201,9 @@
copy.merge(value);
toRemove.add(key);
}
- syncResults.add(makeSyncResult(copy, null));
}
}
processToRemove(toRemove, WriteOperation.UPDATE);
- return syncResults;
}
public boolean isChanged() {
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/ProxySchema.java b/user/src/com/google/gwt/requestfactory/client/impl/ProxySchema.java
index 4ded154..27f812f 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/ProxySchema.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/ProxySchema.java
@@ -81,7 +81,7 @@
private boolean isCorrectClass(EntityProxy proxy) {
// What we really want to check is isAssignableFrom. Sigh.
Class<? extends EntityProxy> actual = ((ProxyImpl) proxy).asJso().getRequestFactory().getClass(
- proxy);
+ proxy.stableId());
Class<? extends EntityProxy> expected = getProxyClass();
boolean equals = actual.equals(expected);
return equals;
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/RequestFactoryEditorDelegate.java b/user/src/com/google/gwt/requestfactory/client/impl/RequestFactoryEditorDelegate.java
index 4ae8773..eb59dad 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/RequestFactoryEditorDelegate.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/RequestFactoryEditorDelegate.java
@@ -26,12 +26,10 @@
import com.google.gwt.requestfactory.shared.Receiver;
import com.google.gwt.requestfactory.shared.RequestFactory;
import com.google.gwt.requestfactory.shared.RequestObject;
-import com.google.gwt.requestfactory.shared.SyncResult;
import com.google.gwt.requestfactory.shared.WriteOperation;
import java.util.ArrayList;
import java.util.List;
-import java.util.Set;
/**
* Base class for generated EditorDelegates using a RequestFactory as the
@@ -61,7 +59,7 @@
private class SubscriptionReceiver extends Receiver<EntityProxy> {
@Override
- public void onSuccess(EntityProxy response, Set<SyncResult> syncResults) {
+ public void onSuccess(EntityProxy response) {
@SuppressWarnings("unchecked")
P cast = (P) response;
refresh(cast);
@@ -108,7 +106,7 @@
// Can't just use getObject().getClass() because it's not the proxy type
@SuppressWarnings("unchecked")
- Class<EntityProxy> clazz = (Class<EntityProxy>) factory.getClass((EntityProxy) getObject());
+ Class<EntityProxy> clazz = (Class<EntityProxy>) factory.getClass(((EntityProxy) getObject()).stableId());
HandlerRegistration toReturn = EntityProxyChange.<EntityProxy> registerForProxyType(
eventBus, clazz, new SubscriptionHandler());
return toReturn;
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/RequestFactoryJsonImpl.java b/user/src/com/google/gwt/requestfactory/client/impl/RequestFactoryJsonImpl.java
index e310b62..4adf742 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/RequestFactoryJsonImpl.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/RequestFactoryJsonImpl.java
@@ -122,8 +122,8 @@
});
}
- public Class<? extends EntityProxy> getClass(EntityProxy proxy) {
- return ((ProxyImpl) proxy).getSchema().getProxyClass();
+ public Class<? extends EntityProxy> getClass(EntityProxyId proxyId) {
+ return ((EntityProxyIdImpl) proxyId).schema.getProxyClass();
}
public RequestTransport getRequestTransport() {
@@ -170,32 +170,20 @@
return schema.getProxyClass();
}
- /**
- * TODO(amitmanjhi): remove this method, use getProxyId instead.
- */
- protected EntityProxy getProxy(String token, ProxyToTypeMap recordToTypeMap) {
- String[] bits = token.split("-");
- if (bits.length < 2 || bits.length > 3) {
- return null;
+ protected String getHistoryToken(EntityProxyId proxyId, ProxyToTypeMap recordToTypeMap) {
+ EntityProxyIdImpl entityProxyId = (EntityProxyIdImpl) proxyId;
+ Class<? extends EntityProxy> proxyClass = entityProxyId.schema.getProxyClass();
+ String rtn = recordToTypeMap.getClassToken(proxyClass) + "-";
+ Object datastoreId = entityProxyId.id;
+ if (entityProxyId.isFuture) {
+ datastoreId = futureToDatastoreMap.get(entityProxyId.id);
}
-
- ProxySchema<? extends EntityProxy> schema = recordToTypeMap.getType(bits[0]);
- if (schema == null) {
- return null;
+ if (datastoreId == null) {
+ rtn += "0-FUTURE";
+ } else {
+ rtn += datastoreId;
}
-
- if (bits.length == 3) {
- return createFuture(schema);
- }
-
- Long id = null;
- try {
- id = Long.valueOf(bits[1]);
- } catch (NumberFormatException e) {
- return null;
- }
-
- return schema.create(ProxyJsoImpl.create(id, -1, schema, this));
+ return rtn;
}
protected EntityProxyId getProxyId(String token,
@@ -221,20 +209,6 @@
return new EntityProxyIdImpl(id, schema, false, futureId);
}
- /*
- * can this method use the EntityProxyIdImpl.asString() method?
- */
- protected String getToken(EntityProxy record, ProxyToTypeMap recordToTypeMap) {
- Class<? extends EntityProxy> proxyClass = ((ProxyImpl) record).getSchema().getProxyClass();
- String rtn = recordToTypeMap.getClassToken(proxyClass) + "-";
- if (((ProxyImpl) record).isFuture()) {
- rtn += "0-FUTURE";
- } else {
- rtn += record.getId();
- }
- return rtn;
- }
-
ValueStoreJsonImpl getValueStore() {
return valueStore;
}
diff --git a/user/src/com/google/gwt/requestfactory/rebind/RequestFactoryGenerator.java b/user/src/com/google/gwt/requestfactory/rebind/RequestFactoryGenerator.java
index 6c20ed5..9a0b8bc 100644
--- a/user/src/com/google/gwt/requestfactory/rebind/RequestFactoryGenerator.java
+++ b/user/src/com/google/gwt/requestfactory/rebind/RequestFactoryGenerator.java
@@ -346,6 +346,7 @@
f.addImport(interfaceType.getQualifiedSourceName());
f.addImport(ProxyToTypeMap.class.getName());
f.addImport(EntityProxy.class.getName());
+ f.addImport(EntityProxyId.class.getName());
f.addImport(ProxySchema.class.getName());
f.addImplementedInterface(interfaceType.getName());
f.setSuperclass(RequestFactoryJsonImpl.class.getSimpleName());
@@ -404,6 +405,22 @@
sw.println("}");
sw.println();
+ // write getHistoryToken(proxyId)
+ sw.println("public String getHistoryToken(EntityProxyId proxyId) {");
+ sw.indent();
+ sw.println("return getHistoryToken(proxyId, new " + proxyToTypeMapName + "());");
+ sw.outdent();
+ sw.println("}");
+ sw.println();
+
+ // write getToken(Class)
+ sw.println("public String getToken(Class clazz) {");
+ sw.indent();
+ sw.println("return new " + proxyToTypeMapName + "().getClassToken(clazz);");
+ sw.outdent();
+ sw.println("}");
+ sw.println();
+
// write getClass(String)
sw.println("public Class<? extends " + EntityProxy.class.getName()
+ "> getClass(String token) {");
@@ -413,15 +430,6 @@
sw.println("}");
sw.println();
- // write getProxy(String)
- sw.println("public " + EntityProxy.class.getName()
- + " getProxy(String token) {");
- sw.indent();
- sw.println("return getProxy(token, new " + proxyToTypeMapName + "());");
- sw.outdent();
- sw.println("}");
- sw.println();
-
// write getProxyId(String)
sw.println("public " + EntityProxyId.class.getName()
+ " getProxyId(String token) {");
@@ -431,22 +439,6 @@
sw.println("}");
sw.println();
- // write getToken(Proxy)
- sw.println("public String getToken(EntityProxy proxy) {");
- sw.indent();
- sw.println("return getToken(proxy, new " + proxyToTypeMapName + "());");
- sw.outdent();
- sw.println("}");
- sw.println();
-
- // write getToken(Class)
- sw.println("public String getToken(Class clazz) {");
- sw.indent();
- sw.println("return new " + proxyToTypeMapName + "().getClassToken(clazz);");
- sw.outdent();
- sw.println("}");
- sw.println();
-
sw.println("public ProxySchema<? extends EntityProxy> getSchema(String schemaToken) {");
sw.indent();
sw.println("return new " + proxyToTypeMapName + "().getType(schemaToken);");
diff --git a/user/src/com/google/gwt/requestfactory/shared/EntityProxyId.java b/user/src/com/google/gwt/requestfactory/shared/EntityProxyId.java
index 77336a3..d5f5ac6 100644
--- a/user/src/com/google/gwt/requestfactory/shared/EntityProxyId.java
+++ b/user/src/com/google/gwt/requestfactory/shared/EntityProxyId.java
@@ -23,13 +23,4 @@
* copy of foo after being persisted have equal {@link EntityProxyId}.
*/
public interface EntityProxyId {
- /**
- * Returns a stable string that remains the same across updates and creates on
- * the client. Note that calling this method on an instance that has not been
- * persisted throws IllegalStateException.
- *
- * @return a stable string that remains the same across updates and creates on
- * the client.
- */
- String asString();
}
diff --git a/user/src/com/google/gwt/requestfactory/shared/Receiver.java b/user/src/com/google/gwt/requestfactory/shared/Receiver.java
index 957d49c..8e031d8 100644
--- a/user/src/com/google/gwt/requestfactory/shared/Receiver.java
+++ b/user/src/com/google/gwt/requestfactory/shared/Receiver.java
@@ -45,7 +45,7 @@
/**
* Called when a RequestObject has been successfully executed on the server.
*/
- public abstract void onSuccess(V response, Set<SyncResult> syncResults);
+ public abstract void onSuccess(V response);
/**
* Called if an object sent to the server could not be validated. The default
diff --git a/user/src/com/google/gwt/requestfactory/shared/RequestFactory.java b/user/src/com/google/gwt/requestfactory/shared/RequestFactory.java
index 0b25860..d987945 100644
--- a/user/src/com/google/gwt/requestfactory/shared/RequestFactory.java
+++ b/user/src/com/google/gwt/requestfactory/shared/RequestFactory.java
@@ -1,12 +1,12 @@
/*
* Copyright 2010 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -44,23 +44,24 @@
* metadata system, calls to the proxy's getClass() method will not serve this
* purpose.
*/
- Class<? extends EntityProxy> getClass(EntityProxy proxy);
+ Class<? extends EntityProxy> getClass(EntityProxyId proxyId);
-/**
+ /**
* Return the class object which may be used to create new instances of the
* type of this token, via {@link #create}. The token may represent either a
- * proxy instance (see {@link #getToken(Proxy)) or a proxy class (see
- *
+ * proxy instance (see {@link #getHistoryToken(Proxy)) or a proxy class (see
* @link #getToken(Class)}).
*/
Class<? extends EntityProxy> getClass(String token);
/**
- * Return the appropriate proxy, which may have only its id attribute set.
- *
- * @deprecated, use the getProxyId method below.
+ * Get a {@link com.google.gwt.user.client.History} compatible token that
+ * represents the given proxy. It can be processed by
+ * {@link #getProxyId(String)} and {@link #getClass(String)}.
+ *
+ * @return a {@link com.google.gwt.user.client.History} compatible token
*/
- EntityProxy getProxy(String token);
+ String getHistoryToken(EntityProxyId proxy);
/**
* Return the appropriate {@link EntityProxyId}, a stable id for the Proxy.
@@ -71,21 +72,12 @@
* Get a {@link com.google.gwt.user.client.History} compatible token that
* represents the given class. It can be processed by
* {@link #getClass(String)}
- *
+ *
* @return a {@link com.google.gwt.user.client.History} compatible token
*/
String getToken(Class<? extends EntityProxy> clazz);
/**
- * Get a {@link com.google.gwt.user.client.History} compatible token that
- * represents the given proxy. It can be processed by
- * {@link #getClass(String)} and {@link #getClass(EntityProxy)}.
- *
- * @return a {@link com.google.gwt.user.client.History} compatible token
- */
- String getToken(EntityProxy proxy);
-
- /**
* Start this request factory with a
* {@link com.google.gwt.requestfactory.client.DefaultRequestTransport}.
*/
diff --git a/user/src/com/google/gwt/requestfactory/shared/SyncResult.java b/user/src/com/google/gwt/requestfactory/shared/SyncResult.java
deleted file mode 100644
index 35c7031..0000000
--- a/user/src/com/google/gwt/requestfactory/shared/SyncResult.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.google.gwt.requestfactory.shared;
-
-/**
- * <p>
- * <span style="color:red">Experimental API: This class is still under rapid
- * development, and is very likely to be deleted. Use it at your own risk.
- * </span>
- * </p>
- * Result per record of a SyncRequest.
- */
-public interface SyncResult {
- // TODO: futureId isn't working out so well, leaving soon
- Object getFutureId();
-
- EntityProxy getProxy();
-}
diff --git a/user/test/com/google/gwt/requestfactory/client/EditorTest.java b/user/test/com/google/gwt/requestfactory/client/EditorTest.java
index 1631bd8..96fcfaa 100644
--- a/user/test/com/google/gwt/requestfactory/client/EditorTest.java
+++ b/user/test/com/google/gwt/requestfactory/client/EditorTest.java
@@ -28,7 +28,7 @@
import com.google.gwt.requestfactory.shared.Receiver;
import com.google.gwt.requestfactory.shared.SimpleBarProxy;
import com.google.gwt.requestfactory.shared.SimpleFooProxy;
-import com.google.gwt.requestfactory.shared.SyncResult;
+
import com.google.gwt.requestfactory.shared.Violation;
import java.util.Arrays;
@@ -107,8 +107,9 @@
req.simpleFooRequest().findSimpleFooById(0L).with(driver.getPaths()).fire(
new Receiver<SimpleFooProxy>() {
- public void onSuccess(SimpleFooProxy response,
- Set<SyncResult> syncResults) {
+ @Override
+ public void onSuccess(SimpleFooProxy response) {
+
driver.edit(response, req.simpleFooRequest().persistAndReturnSelf(
response).with(driver.getPaths()));
@@ -121,8 +122,8 @@
editor.barName.setValue("ignored");
driver.<SimpleFooProxy> flush().fire(
new Receiver<SimpleFooProxy>() {
- public void onSuccess(SimpleFooProxy response,
- Set<SyncResult> syncResults) {
+ @Override
+ public void onSuccess(SimpleFooProxy response) {
assertEquals("EditorFooTest", response.getUserName());
assertEquals("EditorBarTest",
response.getBarField().getUserName());
@@ -145,8 +146,8 @@
req.simpleFooRequest().findSimpleFooById(0L).with(driver.getPaths()).fire(
new Receiver<SimpleFooProxy>() {
- public void onSuccess(SimpleFooProxy response,
- Set<SyncResult> syncResults) {
+ @Override
+ public void onSuccess(SimpleFooProxy response) {
// Set up driver in read-only mode
driver.edit(response, null);
assertNotNull(editor.delegate.subscribe());
@@ -162,8 +163,8 @@
response.setUserName("updated");
request.fire(new Receiver<SimpleFooProxy>() {
- public void onSuccess(SimpleFooProxy response,
- Set<SyncResult> syncResults) {
+ @Override
+ public void onSuccess(SimpleFooProxy response) {
// EventBus notifications occur after the onSuccess()
Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {
public boolean execute() {
@@ -192,8 +193,9 @@
req.simpleFooRequest().findSimpleFooById(0L).with(driver.getPaths()).fire(
new Receiver<SimpleFooProxy>() {
- public void onSuccess(SimpleFooProxy response,
- Set<SyncResult> syncResults) {
+ @Override
+ public void onSuccess(SimpleFooProxy response) {
+
driver.edit(response, req.simpleFooRequest().persistAndReturnSelf(
response).with(driver.getPaths()));
// Set to an illegal value
@@ -202,8 +204,7 @@
driver.<SimpleFooProxy> flush().fire(
new Receiver<SimpleFooProxy>() {
@Override
- public void onSuccess(SimpleFooProxy response,
- Set<SyncResult> syncResults) {
+ public void onSuccess(SimpleFooProxy response) {
fail("Expected errors");
}
@@ -229,3 +230,4 @@
}
}
+
diff --git a/user/test/com/google/gwt/requestfactory/client/FindServiceTest.java b/user/test/com/google/gwt/requestfactory/client/FindServiceTest.java
index 1e02fa0..657a8e5 100644
--- a/user/test/com/google/gwt/requestfactory/client/FindServiceTest.java
+++ b/user/test/com/google/gwt/requestfactory/client/FindServiceTest.java
@@ -19,9 +19,7 @@
import com.google.gwt.requestfactory.shared.EntityProxyId;
import com.google.gwt.requestfactory.shared.Receiver;
import com.google.gwt.requestfactory.shared.SimpleFooProxy;
-import com.google.gwt.requestfactory.shared.SyncResult;
-import java.util.Set;
/**
* Tests for {@link com.google.gwt.requestfactory.shared.RequestFactory}.
@@ -36,22 +34,21 @@
return "com.google.gwt.requestfactory.RequestFactorySuite";
}
+
public void testFetchEntity() {
final boolean relationsAbsent = false;
delayTestFinish(5000);
req.simpleFooRequest().findSimpleFooById(999L).fire(
new Receiver<SimpleFooProxy>() {
@Override
- public void onSuccess(SimpleFooProxy response,
- Set<SyncResult> syncResult) {
+ public void onSuccess(SimpleFooProxy response) {
checkReturnedProxy(response, relationsAbsent);
final EntityProxyId stableId = response.stableId();
req.find(stableId).fire(new Receiver<EntityProxy>() {
@Override
- public void onSuccess(EntityProxy returnedProxy,
- Set<SyncResult> syncResults) {
+ public void onSuccess(EntityProxy returnedProxy) {
assertEquals(stableId, returnedProxy.stableId());
checkReturnedProxy((SimpleFooProxy) returnedProxy,
relationsAbsent);
@@ -68,8 +65,7 @@
req.simpleFooRequest().findSimpleFooById(999L).with("barField").fire(
new Receiver<SimpleFooProxy>() {
@Override
- public void onSuccess(SimpleFooProxy response,
- Set<SyncResult> syncResult) {
+ public void onSuccess(SimpleFooProxy response) {
checkReturnedProxy(response, relationsPresent);
final EntityProxyId stableId = response.stableId();
@@ -77,8 +73,7 @@
new Receiver<EntityProxy>() {
@Override
- public void onSuccess(EntityProxy returnedProxy,
- Set<SyncResult> syncResults) {
+ public void onSuccess(EntityProxy returnedProxy) {
assertEquals(stableId, returnedProxy.stableId());
checkReturnedProxy((SimpleFooProxy) returnedProxy,
relationsPresent);
@@ -103,3 +98,4 @@
}
}
}
+
diff --git a/user/test/com/google/gwt/requestfactory/client/RequestFactoryExceptionHandlerTest.java b/user/test/com/google/gwt/requestfactory/client/RequestFactoryExceptionHandlerTest.java
index e3ba01e..304a0c0 100644
--- a/user/test/com/google/gwt/requestfactory/client/RequestFactoryExceptionHandlerTest.java
+++ b/user/test/com/google/gwt/requestfactory/client/RequestFactoryExceptionHandlerTest.java
@@ -19,7 +19,6 @@
import com.google.gwt.requestfactory.shared.RequestObject;
import com.google.gwt.requestfactory.shared.ServerFailure;
import com.google.gwt.requestfactory.shared.SimpleFooProxy;
-import com.google.gwt.requestfactory.shared.SyncResult;
import com.google.gwt.requestfactory.shared.Violation;
import java.util.Set;
@@ -61,8 +60,7 @@
fail("Failure expected but onViolation() was called");
}
- public void onSuccess(SimpleFooProxy response,
- Set<SyncResult> syncResult) {
+ public void onSuccess(SimpleFooProxy response) {
fail("Failure expected but onSuccess() was called");
}
});
diff --git a/user/test/com/google/gwt/requestfactory/client/RequestFactoryTest.java b/user/test/com/google/gwt/requestfactory/client/RequestFactoryTest.java
index b40edef..2fe5e68 100644
--- a/user/test/com/google/gwt/requestfactory/client/RequestFactoryTest.java
+++ b/user/test/com/google/gwt/requestfactory/client/RequestFactoryTest.java
@@ -1,12 +1,12 @@
/*
* Copyright 2010 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -16,14 +16,13 @@
package com.google.gwt.requestfactory.client;
import com.google.gwt.requestfactory.client.impl.ProxyImpl;
-import com.google.gwt.requestfactory.shared.EntityProxy;
import com.google.gwt.requestfactory.shared.EntityProxyId;
import com.google.gwt.requestfactory.shared.Receiver;
import com.google.gwt.requestfactory.shared.RequestObject;
import com.google.gwt.requestfactory.shared.ServerFailure;
import com.google.gwt.requestfactory.shared.SimpleBarProxy;
import com.google.gwt.requestfactory.shared.SimpleFooProxy;
-import com.google.gwt.requestfactory.shared.SyncResult;
+
import com.google.gwt.requestfactory.shared.Violation;
import java.util.Set;
@@ -45,14 +44,14 @@
}
@Override
- public void onSuccess(T response, Set<SyncResult> syncResults) {
+ public void onSuccess(T response) {
/*
* Make sure your class path includes:
- *
- * tools/apache/log4j/log4j-1.2.16.jar
- * tools/hibernate/validator/hibernate-validator-4.1.0.Final.jar
- * tools/slf4j/slf4j-api/slf4j-api-1.6.1.jar
- * tools/slf4j/slf4j-log4j12/slf4j-log4j12-1.6.1.jar
+ *
+ * tools/lib/apache/log4j/log4j-1.2.16.jar
+ * tools/lib/hibernate/validator/hibernate-validator-4.1.0.Final.jar
+ * tools/lib/slf4j/slf4j-api/slf4j-api-1.6.1.jar
+ * tools/lib/slf4j/slf4j-log4j12/slf4j-log4j12-1.6.1.jar
*/
fail("Violations expected (you might be missing some jars, "
+ "see the comment above this line)");
@@ -64,8 +63,8 @@
Violation error = errors.iterator().next();
assertEquals("userName", error.getPath());
assertEquals("size must be between 3 and 30", error.getMessage());
- assertEquals("Did not receive expeceted id", expectedId,
- error.getProxyId());
+ assertEquals(
+ "Did not receive expeceted id", expectedId, error.getProxyId());
finishTestAndReset();
}
}
@@ -82,13 +81,11 @@
Object futureId = foo.getId();
assertEquals(futureId, foo.getId());
assertTrue(((ProxyImpl) foo).isFuture());
- RequestObject<SimpleFooProxy> fooReq = req.simpleFooRequest().persistAndReturnSelf(
- foo);
+ RequestObject<SimpleFooProxy> fooReq = req.simpleFooRequest().persistAndReturnSelf(foo);
fooReq.fire(new Receiver<SimpleFooProxy>() {
@Override
- public void onSuccess(final SimpleFooProxy returned,
- Set<SyncResult> syncResults) {
+ public void onSuccess(final SimpleFooProxy returned) {
Object futureId = foo.getId();
assertEquals(futureId, foo.getId());
assertTrue(((ProxyImpl) foo).isFuture());
@@ -104,8 +101,7 @@
req.simpleFooRequest().findSimpleFooById(999L).fire(
new Receiver<SimpleFooProxy>() {
@Override
- public void onSuccess(SimpleFooProxy response,
- Set<SyncResult> syncResult) {
+ public void onSuccess(SimpleFooProxy response) {
assertEquals(42, (int) response.getIntId());
assertEquals("GWT", response.getUserName());
assertEquals(8L, (long) response.getLongField());
@@ -122,8 +118,7 @@
req.simpleFooRequest().findSimpleFooById(999L).with("barField").fire(
new Receiver<SimpleFooProxy>() {
@Override
- public void onSuccess(SimpleFooProxy response,
- Set<SyncResult> syncResult) {
+ public void onSuccess(SimpleFooProxy response) {
assertEquals(42, (int) response.getIntId());
assertEquals("GWT", response.getUserName());
assertEquals(8L, (long) response.getLongField());
@@ -137,8 +132,8 @@
/*
* tests that (a) any method can have a side effect that is handled correctly.
- * (b) instance methods are handled correctly and (c) you don't grow horns
- * or anything if you reuse the request object
+ * (b) instance methods are handled correctly and (c) you don't grow horns or
+ * anything if you reuse the request object
*/
public void testMethodWithSideEffects() {
delayTestFinish(5000);
@@ -147,29 +142,23 @@
new Receiver<SimpleFooProxy>() {
@Override
- public void onSuccess(SimpleFooProxy newFoo,
- Set<SyncResult> syncResults) {
- final RequestObject<Long> fooReq = req.simpleFooRequest().countSimpleFooWithUserNameSideEffect(
- newFoo);
+ public void onSuccess(SimpleFooProxy newFoo) {
+ final RequestObject<Long> fooReq = req.simpleFooRequest().countSimpleFooWithUserNameSideEffect(newFoo);
newFoo = fooReq.edit(newFoo);
newFoo.setUserName("Ray");
fooReq.fire(new Receiver<Long>() {
@Override
- public void onSuccess(Long response, Set<SyncResult> syncResults) {
+ public void onSuccess(Long response) {
assertEquals(new Long(1L), response);
+ // TODO: listen to create events instead.
// confirm that there was a sideEffect.
- assertEquals(1, syncResults.size());
- SyncResult syncResultArray[] = syncResults.toArray(new SyncResult[0]);
- assertNull(syncResultArray[0].getFutureId());
- EntityProxy proxy = syncResultArray[0].getProxy();
- assertEquals(new Long(999L), proxy.getId());
+
// confirm that the instance method did have the desired
// sideEffect.
req.simpleFooRequest().findSimpleFooById(999L).fire(
new Receiver<SimpleFooProxy>() {
@Override
- public void onSuccess(SimpleFooProxy finalFoo,
- Set<SyncResult> syncResults) {
+ public void onSuccess(SimpleFooProxy finalFoo) {
assertEquals("Ray", finalFoo.getUserName());
finishTestAndReset();
}
@@ -178,23 +167,22 @@
});
/*
- * Firing the request a second time just to show that we
- * can. Note that we *do not* try to change the value,
- * as we're unclear which response will come back first,
- * and who should win. That's not the point. The point
- * is that both callbacks get called.
+ * Firing the request a second time just to show that we can. Note
+ * that we *do not* try to change the value, as we're unclear which
+ * response will come back first, and who should win. That's not the
+ * point. The point is that both callbacks get called.
*/
-
- newFoo.setUserName("Barney"); // Just to prove we can, used to fail assert
- newFoo.setUserName("Ray"); // Change it back to diminish chance of flakes
- fooReq.fire(new Receiver<Long>() {
+ newFoo.setUserName("Barney"); // Just to prove we can, used to
+ // fail assert
+ newFoo.setUserName("Ray"); // Change it back to diminish chance of
+ // flakes
+ fooReq.fire(new Receiver<Long>() {
@Override
- public void onSuccess(Long response, Set<SyncResult> syncResults) {
+ public void onSuccess(Long response) {
req.simpleFooRequest().findSimpleFooById(999L).fire(
new Receiver<SimpleFooProxy>() {
@Override
- public void onSuccess(SimpleFooProxy finalFoo,
- Set<SyncResult> syncResults) {
+ public void onSuccess(SimpleFooProxy finalFoo) {
assertEquals("Ray", finalFoo.getUserName());
finishTestAndReset();
}
@@ -215,21 +203,19 @@
req.simpleBarRequest().findSimpleBarById(999L).fire(
new Receiver<SimpleBarProxy>() {
@Override
- public void onSuccess(final SimpleBarProxy barProxy,
- Set<SyncResult> syncResults) {
+ public void onSuccess(final SimpleBarProxy barProxy) {
req.simpleFooRequest().findSimpleFooById(999L).fire(
new Receiver<SimpleFooProxy>() {
@Override
- public void onSuccess(SimpleFooProxy fooProxy,
- Set<SyncResult> syncResults) {
+ public void onSuccess(SimpleFooProxy fooProxy) {
RequestObject<Void> updReq = req.simpleFooRequest().persist(
fooProxy);
fooProxy = updReq.edit(fooProxy);
fooProxy.setBarField(barProxy);
updReq.fire(new Receiver<Void>() {
@Override
- public void onSuccess(Void response,
- Set<SyncResult> syncResults) {
+ public void onSuccess(Void response) {
+
finishTestAndReset();
}
});
@@ -255,26 +241,23 @@
req.simpleFooRequest().findSimpleFooById(999L).fire(
new Receiver<SimpleFooProxy>() {
@Override
- public void onSuccess(SimpleFooProxy response,
- Set<SyncResult> syncResults) {
+ public void onSuccess(SimpleFooProxy response) {
RequestObject<Void> fooReq = req.simpleFooRequest().persist(
response);
response = fooReq.edit(response);
response.setBarField(finalNewBar);
fooReq.fire(new Receiver<Void>() {
@Override
- public void onSuccess(Void response, Set<SyncResult> syncResults) {
+ public void onSuccess(Void response) {
req.simpleFooRequest().findSimpleFooById(999L).with(
"barField.userName").fire(new Receiver<SimpleFooProxy>() {
@Override
- public void onSuccess(SimpleFooProxy finalFooProxy,
- Set<SyncResult> syncResults) {
+ public void onSuccess(SimpleFooProxy finalFooProxy) {
// barReq hasn't been persisted, so old value
- assertEquals("FOO",
- finalFooProxy.getBarField().getUserName());
+ assertEquals(
+ "FOO", finalFooProxy.getBarField().getUserName());
finishTestAndReset();
}
-
});
}
});
@@ -299,17 +282,15 @@
req.simpleBarRequest().findSimpleBarById(999L).fire(
new Receiver<SimpleBarProxy>() {
@Override
- public void onSuccess(SimpleBarProxy response,
- Set<SyncResult> syncResults) {
+ public void onSuccess(SimpleBarProxy response) {
finalFoo.setBarField(response);
fooReq.fire(new Receiver<Void>() {
@Override
- public void onSuccess(Void response, Set<SyncResult> syncResults) {
+ public void onSuccess(Void response) {
req.simpleFooRequest().findSimpleFooById(999L).fire(
new Receiver<SimpleFooProxy>() {
@Override
- public void onSuccess(SimpleFooProxy finalFooProxy,
- Set<SyncResult> syncResults) {
+ public void onSuccess(SimpleFooProxy finalFooProxy) {
// newFoo hasn't been persisted, so userName is the old
// value.
assertEquals("GWT", finalFooProxy.getUserName());
@@ -331,25 +312,21 @@
SimpleFooProxy newFoo = req.create(SimpleFooProxy.class);
SimpleBarProxy newBar = req.create(SimpleBarProxy.class);
- final RequestObject<SimpleFooProxy> fooReq = req.simpleFooRequest().persistAndReturnSelf(
- newFoo);
+ final RequestObject<SimpleFooProxy> fooReq = req.simpleFooRequest().persistAndReturnSelf(newFoo);
newFoo = fooReq.edit(newFoo);
newFoo.setUserName("Ray");
- final RequestObject<SimpleBarProxy> barReq = req.simpleBarRequest().persistAndReturnSelf(
- newBar);
+ final RequestObject<SimpleBarProxy> barReq = req.simpleBarRequest().persistAndReturnSelf(newBar);
newBar = barReq.edit(newBar);
newBar.setUserName("Amit");
fooReq.fire(new Receiver<SimpleFooProxy>() {
@Override
- public void onSuccess(final SimpleFooProxy persistedFoo,
- Set<SyncResult> syncResult) {
+ public void onSuccess(final SimpleFooProxy persistedFoo) {
barReq.fire(new Receiver<SimpleBarProxy>() {
@Override
- public void onSuccess(final SimpleBarProxy persistedBar,
- Set<SyncResult> syncResults) {
+ public void onSuccess(final SimpleBarProxy persistedBar) {
assertEquals("Ray", persistedFoo.getUserName());
final RequestObject<Void> fooReq2 = req.simpleFooRequest().persist(
persistedFoo);
@@ -357,14 +334,13 @@
editablePersistedFoo.setBarField(persistedBar);
fooReq2.fire(new Receiver<Void>() {
@Override
- public void onSuccess(Void response, Set<SyncResult> syncResults) {
+ public void onSuccess(Void response) {
req.simpleFooRequest().findSimpleFooById(999L).with(
"barField.userName").fire(new Receiver<SimpleFooProxy>() {
@Override
- public void onSuccess(SimpleFooProxy finalFooProxy,
- Set<SyncResult> syncResults) {
- assertEquals("Amit",
- finalFooProxy.getBarField().getUserName());
+ public void onSuccess(SimpleFooProxy finalFooProxy) {
+ assertEquals(
+ "Amit", finalFooProxy.getBarField().getUserName());
finishTestAndReset();
}
});
@@ -380,15 +356,13 @@
delayTestFinish(5000);
SimpleFooProxy rayFoo = req.create(SimpleFooProxy.class);
- final RequestObject<SimpleFooProxy> persistRay = req.simpleFooRequest().persistAndReturnSelf(
- rayFoo);
+ final RequestObject<SimpleFooProxy> persistRay = req.simpleFooRequest().persistAndReturnSelf(rayFoo);
rayFoo = persistRay.edit(rayFoo);
rayFoo.setUserName("Ray");
rayFoo.setFooField(rayFoo);
persistRay.fire(new Receiver<SimpleFooProxy>() {
@Override
- public void onSuccess(final SimpleFooProxy persistedRay,
- Set<SyncResult> ignored) {
+ public void onSuccess(final SimpleFooProxy persistedRay) {
finishTestAndReset();
}
});
@@ -398,36 +372,29 @@
delayTestFinish(5000);
SimpleFooProxy rayFoo = req.create(SimpleFooProxy.class);
- final RequestObject<SimpleFooProxy> persistRay = req.simpleFooRequest().persistAndReturnSelf(
- rayFoo);
+ final RequestObject<SimpleFooProxy> persistRay = req.simpleFooRequest().persistAndReturnSelf(rayFoo);
rayFoo = persistRay.edit(rayFoo);
rayFoo.setUserName("Ray");
persistRay.fire(new Receiver<SimpleFooProxy>() {
@Override
- public void onSuccess(final SimpleFooProxy persistedRay,
- Set<SyncResult> ignored) {
-
+ public void onSuccess(final SimpleFooProxy persistedRay) {
SimpleBarProxy amitBar = req.create(SimpleBarProxy.class);
- final RequestObject<SimpleBarProxy> persistAmit = req.simpleBarRequest().persistAndReturnSelf(
- amitBar);
+ final RequestObject<SimpleBarProxy> persistAmit = req.simpleBarRequest().persistAndReturnSelf(amitBar);
amitBar = persistAmit.edit(amitBar);
amitBar.setUserName("Amit");
persistAmit.fire(new Receiver<SimpleBarProxy>() {
@Override
- public void onSuccess(SimpleBarProxy persistedAmit,
- Set<SyncResult> ignored) {
+ public void onSuccess(SimpleBarProxy persistedAmit) {
- final RequestObject<SimpleFooProxy> persistRelationship = req.simpleFooRequest().persistAndReturnSelf(
- persistedRay).with("barField");
+ final RequestObject<SimpleFooProxy> persistRelationship = req.simpleFooRequest().persistAndReturnSelf(persistedRay).with("barField");
SimpleFooProxy newRec = persistRelationship.edit(persistedRay);
newRec.setBarField(persistedAmit);
persistRelationship.fire(new Receiver<SimpleFooProxy>() {
@Override
- public void onSuccess(SimpleFooProxy relatedRay,
- Set<SyncResult> ignored) {
+ public void onSuccess(SimpleFooProxy relatedRay) {
assertEquals("Amit", relatedRay.getBarField().getUserName());
finishTestAndReset();
}
@@ -443,8 +410,7 @@
req.simpleFooRequest().findSimpleFooById(999L).fire(
new Receiver<SimpleFooProxy>() {
@Override
- public void onSuccess(SimpleFooProxy response,
- Set<SyncResult> syncResult) {
+ public void onSuccess(SimpleFooProxy response) {
SimpleBarProxy bar = req.create(SimpleBarProxy.class);
RequestObject<String> helloReq = req.simpleFooRequest().hello(
response, bar);
@@ -452,7 +418,7 @@
bar.setUserName("BAR");
helloReq.fire(new Receiver<String>() {
@Override
- public void onSuccess(String response, Set<SyncResult> syncResults) {
+ public void onSuccess(String response) {
assertEquals("Greetings BAR from GWT", response);
finishTestAndReset();
}
@@ -465,8 +431,7 @@
delayTestFinish(5000);
SimpleFooProxy rayFoo = req.create(SimpleFooProxy.class);
- final RequestObject<SimpleFooProxy> persistRay = req.simpleFooRequest().persistAndReturnSelf(
- rayFoo);
+ final RequestObject<SimpleFooProxy> persistRay = req.simpleFooRequest().persistAndReturnSelf(rayFoo);
rayFoo = persistRay.edit(rayFoo);
// 42 is the crash causing magic number
rayFoo.setPleaseCrash(42);
@@ -485,8 +450,7 @@
fail("Failure expected but onViolation() was called");
}
- public void onSuccess(SimpleFooProxy response,
- Set<SyncResult> syncResult) {
+ public void onSuccess(SimpleFooProxy response) {
fail("Failure expected but onSuccess() was called");
}
});
@@ -498,8 +462,7 @@
final SimpleFooProxy foo = req.create(SimpleFooProxy.class);
final Object futureId = foo.getId();
assertTrue(((ProxyImpl) foo).isFuture());
- RequestObject<SimpleFooProxy> fooReq = req.simpleFooRequest().persistAndReturnSelf(
- foo);
+ RequestObject<SimpleFooProxy> fooReq = req.simpleFooRequest().persistAndReturnSelf(foo);
final SimpleFooProxy newFoo = fooReq.edit(foo);
assertEquals(futureId, foo.getId());
@@ -511,8 +474,7 @@
fooReq.fire(new Receiver<SimpleFooProxy>() {
@Override
- public void onSuccess(final SimpleFooProxy returned,
- Set<SyncResult> syncResults) {
+ public void onSuccess(final SimpleFooProxy returned) {
assertEquals(futureId, foo.getId());
assertTrue(((ProxyImpl) foo).isFuture());
assertEquals(futureId, newFoo.getId());
@@ -523,15 +485,13 @@
checkStableIdEquals(foo, returned);
checkStableIdEquals(newFoo, returned);
- RequestObject<SimpleFooProxy> editRequest = req.simpleFooRequest().persistAndReturnSelf(
- returned);
+ RequestObject<SimpleFooProxy> editRequest = req.simpleFooRequest().persistAndReturnSelf(returned);
final SimpleFooProxy editableFoo = editRequest.edit(returned);
editableFoo.setUserName("GWT power user");
editRequest.fire(new Receiver<SimpleFooProxy>() {
@Override
- public void onSuccess(SimpleFooProxy returnedAfterEdit,
- Set<SyncResult> syncResults) {
+ public void onSuccess(SimpleFooProxy returnedAfterEdit) {
checkStableIdEquals(editableFoo, returnedAfterEdit);
assertEquals(returnedAfterEdit.getId(), returned.getId());
finishTestAndReset();
@@ -552,8 +512,8 @@
fooReq.fire(new Receiver<Void>() {
@Override
- public void onSuccess(Void ignore, Set<SyncResult> syncResults) {
- assertEquals(1, syncResults.size());
+ public void onSuccess(Void ignore) {
+
finishTestAndReset();
}
});
@@ -575,23 +535,21 @@
delayTestFinish(5000);
SimpleFooProxy newFoo = req.create(SimpleFooProxy.class);
- final RequestObject<SimpleFooProxy> fooReq = req.simpleFooRequest().persistAndReturnSelf(
- newFoo);
+ final RequestObject<SimpleFooProxy> fooReq = req.simpleFooRequest().persistAndReturnSelf(newFoo);
newFoo = fooReq.edit(newFoo);
newFoo.setUserName("GWT User");
fooReq.fire(new Receiver<SimpleFooProxy>() {
@Override
- public void onSuccess(SimpleFooProxy returned, Set<SyncResult> syncResults) {
- assertEquals(1, syncResults.size());
-
+ public void onSuccess(SimpleFooProxy returned) {
RequestObject<Void> editRequest = req.simpleFooRequest().persist(
returned);
SimpleFooProxy editableFoo = editRequest.edit(returned);
editableFoo.setUserName("A");
- editRequest.fire(new ShouldNotSuccedReceiver<Void>(returned.stableId()));
+ editRequest.fire(
+ new ShouldNotSuccedReceiver<Void>(returned.stableId()));
}
});
}
@@ -600,30 +558,26 @@
delayTestFinish(5000);
SimpleFooProxy newFoo = req.create(SimpleFooProxy.class);
- final RequestObject<SimpleFooProxy> fooReq = req.simpleFooRequest().persistAndReturnSelf(
- newFoo);
+ final RequestObject<SimpleFooProxy> fooReq = req.simpleFooRequest().persistAndReturnSelf(newFoo);
newFoo = fooReq.edit(newFoo);
newFoo.setUserName("GWT User");
fooReq.fire(new Receiver<SimpleFooProxy>() {
@Override
- public void onSuccess(SimpleFooProxy returned, Set<SyncResult> syncResults) {
- assertEquals(1, syncResults.size());
-
- RequestObject<SimpleFooProxy> editRequest = req.simpleFooRequest().persistAndReturnSelf(
- returned);
+ public void onSuccess(SimpleFooProxy returned) {
+ RequestObject<SimpleFooProxy> editRequest = req.simpleFooRequest().persistAndReturnSelf(returned);
SimpleFooProxy editableFoo = editRequest.edit(returned);
editableFoo.setUserName("A");
- editRequest.fire(new ShouldNotSuccedReceiver<SimpleFooProxy>(
- returned.stableId()));
+ editRequest.fire(
+ new ShouldNotSuccedReceiver<SimpleFooProxy>(returned.stableId()));
}
});
}
- private void checkStableIdEquals(SimpleFooProxy expected,
- SimpleFooProxy actual) {
+ private void checkStableIdEquals(
+ SimpleFooProxy expected, SimpleFooProxy actual) {
assertNotSame(expected.stableId(), actual.stableId());
assertEquals(expected.stableId(), actual.stableId());
assertEquals(expected.stableId().hashCode(), actual.stableId().hashCode());
diff --git a/user/test/com/google/gwt/requestfactory/client/RequestFactoryTestBase.java b/user/test/com/google/gwt/requestfactory/client/RequestFactoryTestBase.java
index 5def0cb..792b51a 100644
--- a/user/test/com/google/gwt/requestfactory/client/RequestFactoryTestBase.java
+++ b/user/test/com/google/gwt/requestfactory/client/RequestFactoryTestBase.java
@@ -21,9 +21,6 @@
import com.google.gwt.junit.client.GWTTestCase;
import com.google.gwt.requestfactory.shared.Receiver;
import com.google.gwt.requestfactory.shared.SimpleRequestFactory;
-import com.google.gwt.requestfactory.shared.SyncResult;
-
-import java.util.Set;
/**
* A base class for anything that makes use of the SimpleRequestFactory.
@@ -46,7 +43,7 @@
protected void finishTestAndReset() {
final boolean[] reallyDone = {false, false};
req.simpleFooRequest().reset().fire(new Receiver<Void>() {
- public void onSuccess(Void response, Set<SyncResult> syncResults) {
+ public void onSuccess(Void response) {
reallyDone[0] = true;
if (reallyDone[0] && reallyDone[1]) {
finishTest();
@@ -54,7 +51,7 @@
}
});
req.simpleBarRequest().reset().fire(new Receiver<Void>() {
- public void onSuccess(Void response, Set<SyncResult> syncResults) {
+ public void onSuccess(Void response) {
reallyDone[1] = true;
if (reallyDone[0] && reallyDone[1]) {
finishTest();