Doing an important TODO in RecordEditActivity.
Patch by: amitmanjhi
Review by: rjrjr
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@8584 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/app/place/AbstractRecordEditActivity.java b/user/src/com/google/gwt/app/place/AbstractRecordEditActivity.java
index 80f5415..a6e8ded 100644
--- a/user/src/com/google/gwt/app/place/AbstractRecordEditActivity.java
+++ b/user/src/com/google/gwt/app/place/AbstractRecordEditActivity.java
@@ -118,33 +118,23 @@
}
boolean hasViolations = false;
- // TODO(amit) at the moment we only get one response, and futures are
- // buggy. So forcing the issue for now, but the more involved code may
- // have to come back when bugs are fixed
- assert response.size() == 1;
- SyncResult syncResult = response.iterator().next();
- record = cast(syncResult.getRecord());
- if (syncResult.hasViolations()) {
- hasViolations = true;
- view.showErrors(syncResult.getViolations());
+ for (SyncResult syncResult : response) {
+ Record syncRecord = syncResult.getRecord();
+ if (creating) {
+ if (futureId == null || !futureId.equals(syncResult.getFutureId())) {
+ continue;
+ }
+ record = cast(syncRecord);
+ } else {
+ if (!syncRecord.getId().equals(record.getId())) {
+ continue;
+ }
+ }
+ if (syncResult.hasViolations()) {
+ hasViolations = true;
+ view.showErrors(syncResult.getViolations());
+ }
}
- // for (SyncResult syncResult : response) {
- // Record syncRecord = syncResult.getRecord();
- // if (creating) {
- // if (futureId == null || !futureId.equals(syncResult.getFutureId())) {
- // continue;
- // }
- // record = cast(syncRecord);
- // } else {
- // if (!syncRecord.getId().equals(record.getId())) {
- // continue;
- // }
- // }
- // if (syncResult.hasViolations()) {
- // hasViolations = true;
- // view.showErrors(syncResult.getViolations());
- // }
- // }
if (!hasViolations) {
exit(true);
} else {