Revision: 8587
Author: [email protected]
Date: Thu Aug 19 17:13:42 2010
Log: Add support for Record types as method params in RequestFactory. Misc
bug fixes.
Patch by [email protected]
Review by [email protected], [email protected]
http://gwt-code-reviews.appspot.com/767802
Review by: [email protected]
http://code.google.com/p/google-web-toolkit/source/detail?r=8587
Modified:
/trunk/bikeshed/src/com/google/gwt/sample/expenses/server/domain/Report.java
/trunk/user/src/com/google/gwt/requestfactory/client/impl/RecordJsoImpl.java
/trunk/user/src/com/google/gwt/requestfactory/client/impl/RecordToTypeMap.java
/trunk/user/src/com/google/gwt/requestfactory/client/impl/RequestFactoryJsonImpl.java
/trunk/user/src/com/google/gwt/requestfactory/rebind/RequestFactoryGenerator.java
/trunk/user/src/com/google/gwt/requestfactory/server/JsonRequestProcessor.java
/trunk/user/src/com/google/gwt/requestfactory/shared/RequestFactory.java
/trunk/user/test/com/google/gwt/requestfactory/RequestFactorySuite.java
/trunk/user/test/com/google/gwt/requestfactory/client/impl/DeltaValueStoreJsonImplTest.java
/trunk/user/test/com/google/gwt/valuestore/ValueStoreSuite.java
/trunk/user/test/com/google/gwt/valuestore/client/RequestFactoryTest.java
/trunk/user/test/com/google/gwt/valuestore/server/SimpleBar.java
/trunk/user/test/com/google/gwt/valuestore/server/SimpleFoo.java
/trunk/user/test/com/google/gwt/valuestore/shared/SimpleBarRequest.java
/trunk/user/test/com/google/gwt/valuestore/shared/SimpleFooRequest.java
=======================================
---
/trunk/bikeshed/src/com/google/gwt/sample/expenses/server/domain/Report.java
Fri Aug 13 14:38:39 2010
+++
/trunk/bikeshed/src/com/google/gwt/sample/expenses/server/domain/Report.java
Thu Aug 19 17:13:42 2010
@@ -436,6 +436,10 @@
em.close();
}
}
+
+ public void setApprovedSupervisor(Employee reporter) {
+ approvedSupervisorKey = reporter == null ? null : reporter.getId();
+ }
public void setApprovedSupervisorKey(Long approvedSupervisorKey) {
this.approvedSupervisorKey = approvedSupervisorKey;
=======================================
---
/trunk/user/src/com/google/gwt/requestfactory/client/impl/RecordJsoImpl.java
Wed Aug 18 19:31:21 2010
+++
/trunk/user/src/com/google/gwt/requestfactory/client/impl/RecordJsoImpl.java
Thu Aug 19 17:13:42 2010
@@ -82,7 +82,10 @@
Integer version = jso.get(Record.version);
final RecordSchema<?> schema = jso.getSchema();
- return create(id, version, schema);
+ RecordJsoImpl copy = create(id, version, schema);
+ copy.setRequestFactory(jso.getRequestFactory());
+ copy.setValueStore(jso.getValueStore());
+ return copy;
}
public static native RecordJsoImpl fromJson(String json) /*-{
@@ -310,10 +313,12 @@
setBoolean(property.getName(), ((Boolean) value).booleanValue());
}
- if (value instanceof Record) {
- setString(property.getName(),
-
getRequestFactory().getSchema(value.getClass().getName()).getToken().getName()
- + "-" + String.valueOf(((Record) value).getId()));
+ if (value instanceof RecordImpl) {
+ RequestFactoryJsonImpl requestFactory = getRequestFactory();
+ RecordSchema<?> schema = ((RecordImpl)value).getSchema();
+ Class<?> token = schema.getToken();
+ setString(property.getName(), ((RecordImpl) value).getUniqueId());
+ return;
}
throw new UnsupportedOperationException(
=======================================
---
/trunk/user/src/com/google/gwt/requestfactory/client/impl/RecordToTypeMap.java
Fri Aug 13 14:38:39 2010
+++
/trunk/user/src/com/google/gwt/requestfactory/client/impl/RecordToTypeMap.java
Thu Aug 19 17:13:42 2010
@@ -27,6 +27,6 @@
* Record class to its internal "type" representation.
*/
public interface RecordToTypeMap {
- RecordSchema<? extends Record> getType(Class<? extends Record>
recordClass);
+ <R extends Record> RecordSchema<R> getType(Class<R> recordClass);
RecordSchema<? extends Record> getType(String token);
}
=======================================
---
/trunk/user/src/com/google/gwt/requestfactory/client/impl/RequestFactoryJsonImpl.java
Wed Aug 18 15:12:56 2010
+++
/trunk/user/src/com/google/gwt/requestfactory/client/impl/RequestFactoryJsonImpl.java
Thu Aug 19 17:13:42 2010
@@ -68,10 +68,10 @@
private EventBus eventBus;
- public com.google.gwt.valuestore.shared.Record create(
- Class<? extends Record> token, RecordToTypeMap recordToTypeMap) {
-
- RecordSchema<? extends Record> schema = recordToTypeMap.getType(token);
+ public <R extends Record> R create(Class<R> token,
+ RecordToTypeMap recordToTypeMap) {
+
+ RecordSchema<R> schema = recordToTypeMap.getType(token);
if (schema == null) {
throw new IllegalArgumentException("Unknown proxy type: " + token);
}
@@ -97,7 +97,7 @@
wireLogger.finest("Response received");
if (200 == response.getStatusCode()) {
String text = response.getText();
- ((AbstractRequest) requestObject).handleResponseText(text);
+ ((AbstractRequest<?, ?>) requestObject).handleResponseText(text);
} else if (Response.SC_UNAUTHORIZED == response.getStatusCode()) {
wireLogger.finest("Need to log in");
} else if (response.getStatusCode() > 0) {
@@ -126,7 +126,7 @@
return ((RecordImpl) proxy).getSchema().getToken();
}
- public abstract RecordSchema getSchema(String token);
+ public abstract RecordSchema<?> getSchema(String token);
public String getToken(Record record) {
String rtn = ((RecordImpl) record).getSchema().getToken().getName()
+ "-";
@@ -199,12 +199,12 @@
* unpopulated copy of the record.
*/
newJsoRecord = RecordJsoImpl.emptyCopy(newJsoRecord);
- Record javaRecord = newJsoRecord.getSchema().create(newJsoRecord);
+ Record javaRecord = newJsoRecord.getSchema().create(newJsoRecord);
eventBus.fireEvent(newJsoRecord.getSchema().createChangeEvent(javaRecord,
op));
}
- private Record createFuture(RecordSchema<? extends Record> schema) {
+ private <R extends Record> R createFuture(RecordSchema<R> schema) {
Long futureId = ++currentFutureId;
RecordJsoImpl newRecord = RecordJsoImpl.create(futureId,
INITIAL_VERSION,
schema);
=======================================
---
/trunk/user/src/com/google/gwt/requestfactory/rebind/RequestFactoryGenerator.java
Wed Aug 18 19:31:21 2010
+++
/trunk/user/src/com/google/gwt/requestfactory/rebind/RequestFactoryGenerator.java
Thu Aug 19 17:13:42 2010
@@ -194,10 +194,8 @@
sw.println();
String simpleImplName = publicRecordType.getSimpleSourceName()
+ "Impl";
- printRequestImplClass(sw, publicRecordType, simpleImplName, true,
- typeOracle);
- printRequestImplClass(sw, publicRecordType, simpleImplName, false,
- typeOracle);
+ printRequestImplClass(sw, publicRecordType, simpleImplName, true);
+ printRequestImplClass(sw, publicRecordType, simpleImplName, false);
sw.println();
sw.println(String.format(
@@ -211,7 +209,6 @@
sw.println("super(jso, isFuture);");
sw.outdent();
sw.println("}");
- JClassType recordBaseType =
typeOracle.findType(Record.class.getName());
// getter methods
for (JField field : publicRecordType.getFields()) {
@@ -742,7 +739,7 @@
* Prints a ListRequestImpl or ObjectRequestImpl class.
*/
private void printRequestImplClass(SourceWriter sw, JClassType
returnType,
- String returnImplTypeName, boolean list, TypeOracle typeOracle) {
+ String returnImplTypeName, boolean list) {
String name = list ? "ListRequestImpl" : "ObjectRequestImpl";
Class<?> superClass = list ? AbstractJsonListRequest.class
=======================================
---
/trunk/user/src/com/google/gwt/requestfactory/server/JsonRequestProcessor.java
Thu Aug 19 13:24:10 2010
+++
/trunk/user/src/com/google/gwt/requestfactory/server/JsonRequestProcessor.java
Thu Aug 19 17:13:42 2010
@@ -56,7 +56,7 @@
public class JsonRequestProcessor implements RequestProcessor<String> {
// TODO should we consume String, InputStream, or JSONObject?
- private class DvsData {
+ private static class DvsData {
private final JSONObject jsonObject;
private final WriteOperation writeOperation;
@@ -66,7 +66,7 @@
}
}
- private class EntityData {
+ private static class EntityData {
private final Object entityInstance;
// TODO: violations should have more structure than JSONObject
private final JSONObject violations;
@@ -77,7 +77,7 @@
}
}
- private class EntityKey {
+ private static class EntityKey {
private final boolean isFuture;
// TODO: update for non-long id?
private final long id;
@@ -107,7 +107,7 @@
}
}
- private class SerializedEntity {
+ private static class SerializedEntity {
// the field value of the entityInstance might change from under us.
private final Object entityInstance;
@@ -200,7 +200,7 @@
public Object decodeParameterValue(Type genericParameterType,
String parameterValue) {
Class<?>parameterType = null;
- if (genericParameterType instanceof Class) {
+ if (genericParameterType instanceof Class<?>) {
parameterType = (Class<?>) genericParameterType;
}
if (genericParameterType instanceof ParameterizedType) {
@@ -283,31 +283,29 @@
*
* 2. Merge the following and the object resolution code in
getEntityKey.
* 3. Update the involvedKeys set.
- */
+ */
DataTransferObject service =
parameterType.getAnnotation(DataTransferObject.class);
if (service != null) {
Class<?> sClass = service.value();
- String schemaAndId[] = parameterValue.toString().split("-", 3);
- // ignore schema for now and use Property type
- String findMeth = null;
+ EntityKey entityKey = getEntityKey(parameterValue.toString());
+ DvsData dvsData = dvsDataMap.get(entityKey);
try {
- findMeth = getMethodNameFromPropertyName(sClass.getSimpleName(),
- "find");
- Method meth = sClass.getMethod(findMeth, Long.class);
- return meth.invoke(null, Long.valueOf(schemaAndId[0]));
+ if (dvsData != null) {
+ EntityData entityData = getEntityDataForRecord(entityKey,
+ dvsData.jsonObject, dvsData.writeOperation);
+ return entityData.entityInstance;
+ } else {
+ Method findMeth =
sClass.getMethod(getMethodNameFromPropertyName(sClass.getSimpleName(), "find"),
Long.class);
+ return findMeth.invoke(null, entityKey.id);
+ }
} catch (NoSuchMethodException e) {
- e.printStackTrace();
throw new IllegalArgumentException(
- sClass + " no method named " + findMeth);
+ "No such method " + getMethodNameFromPropertyName(
+ sClass.getSimpleName(), "find"), e);
} catch (InvocationTargetException e) {
- e.printStackTrace();
-
- throw new IllegalArgumentException(
- sClass + " can't invoke method named " + findMeth);
+ throw new IllegalArgumentException("Can't invoke method", e);
} catch (IllegalAccessException e) {
- e.printStackTrace();
- throw new IllegalArgumentException(
- sClass + " can't access method named " + findMeth);
+ throw new IllegalArgumentException("Can't invoke method", e);
}
}
}
@@ -359,13 +357,18 @@
propertyType)
+ "-" + id;
addRelatedObject(keyRef, returnValue,
- (Class<? extends Record>) propertyType,
+ castToRecordClass(propertyType),
propertyContext.getProperty(propertyName));
// replace value with id reference
return keyRef;
}
return encodePropertyValue(returnValue);
}
+
+ @SuppressWarnings("unchecked")
+ private Class<? extends Record> castToRecordClass(Class<?> propertyType)
{
+ return (Class<? extends Record>) propertyType;
+ }
/**
* Generate an ID for a new record. The default behavior is to return
null and
@@ -385,12 +388,13 @@
* A <i>set</i> might have side-effects, but we don't handle that.
*/
public EntityData getEntityDataForRecord(EntityKey entityKey,
- JSONObject recordObject, WriteOperation writeOperation) throws
JSONException {
+ JSONObject recordObject, WriteOperation writeOperation) {
try {
Class<?> entity = getEntityFromRecordAnnotation(entityKey.record);
Map<String, Class<?>> propertiesInRecord =
getPropertiesFromRecord(entityKey.record);
+ Map<String, Class<?>> propertiesToDTO = new HashMap<String,
Class<?>>(propertiesInRecord);
validateKeys(recordObject, propertiesInRecord.keySet());
updatePropertyTypes(propertiesInRecord, entity);
@@ -411,7 +415,7 @@
}
} else {
Object propertyValue = getPropertyValueFromRequest(recordObject,
key,
- propertyType);
+ propertiesToDTO.get(key));
entity.getMethod(getMethodNameFromPropertyName(key, "set"),
propertyType).invoke(entityInstance, propertyValue);
}
@@ -441,7 +445,7 @@
} catch (Exception ex) {
log.severe(String.format("Caught exception [%s] %s",
ex.getClass().getName(), ex.getLocalizedMessage()));
- return getEntityDataForException(entityKey, ex);
+ return getEntityDataForException(ex);
}
}
@@ -698,8 +702,7 @@
if (result instanceof List<?>) {
envelop.put(RequestData.RESULT_TOKEN, toJsonArray(operation,
result));
envelop.put(RequestData.SIDE_EFFECTS_TOKEN, sideEffects);
- return envelop;
- } else if (result instanceof Number || result instanceof Enum
+ } else if (result instanceof Number || result instanceof Enum<?>
|| result instanceof String || result instanceof Date
|| result instanceof Character || result instanceof Boolean) {
envelop.put(RequestData.RESULT_TOKEN, result);
@@ -708,7 +711,6 @@
JSONObject jsonObject = toJsonObject(operation, result);
envelop.put(RequestData.RESULT_TOKEN, jsonObject);
envelop.put(RequestData.SIDE_EFFECTS_TOKEN, sideEffects);
- return envelop;
}
envelop.put(RequestData.RELATED_TOKEN, encodeRelatedObjectsToJson());
return envelop;
@@ -775,7 +777,6 @@
Class<? extends Record> propertyType, RequestProperty
propertyContext)
throws JSONException, IllegalAccessException, NoSuchMethodException,
InvocationTargetException {
- Class<? extends Record> clazz = (Class<? extends Record>)
returnValue.getClass();
relatedObjects.put(keyRef, getJsonObject(returnValue, propertyType,
propertyContext));
@@ -785,7 +786,7 @@
* @throws JSONException
*
*/
- private void constructAfterDvsDataMap() throws JSONException {
+ private void constructAfterDvsDataMap() {
afterDvsDataMap = new HashMap<EntityKey, EntityData>();
for (EntityKey entityKey : involvedKeys) {
// use the beforeDataMap and dvsDataMap
@@ -924,7 +925,7 @@
return returnObject;
}
- private EntityData getEntityDataForException(EntityKey entityKey,
Exception ex) {
+ private EntityData getEntityDataForException(Exception ex) {
JSONObject violations = null;
try {
@@ -1060,9 +1061,8 @@
Method idMethod = returnValue.getClass().getMethod("getId");
Long id = (Long) idMethod.invoke(returnValue);
- propertyValue =
operationRegistry.getSecurityProvider().encodeClassType(
- p.getType())
- + "-" + id;
+ propertyValue = id + "-NO-" +
operationRegistry.getSecurityProvider().encodeClassType(
+ p.getType());
} else {
propertyValue = encodePropertyValue(returnValue);
}
=======================================
---
/trunk/user/src/com/google/gwt/requestfactory/shared/RequestFactory.java
Tue Aug 17 09:57:01 2010
+++
/trunk/user/src/com/google/gwt/requestfactory/shared/RequestFactory.java
Thu Aug 19 17:13:42 2010
@@ -32,7 +32,7 @@
// TODO: this must be configurable
String URL = "gwtRequest";
- Record create(Class token);
+ <R extends Record> R create(Class<R> token);
/**
* Return the class object which may be used to create new instances of
the
=======================================
--- /trunk/user/test/com/google/gwt/requestfactory/RequestFactorySuite.java
Thu Aug 12 17:13:04 2010
+++ /trunk/user/test/com/google/gwt/requestfactory/RequestFactorySuite.java
Thu Aug 19 17:13:42 2010
@@ -22,7 +22,8 @@
import junit.framework.Test;
/**
- *
+ * Tests of RequestFactory that require GWT.
+ * @see com.google.gwt.valuestore.ValueStoreSuite
*/
public class RequestFactorySuite {
public static Test suite() {
=======================================
---
/trunk/user/test/com/google/gwt/requestfactory/client/impl/DeltaValueStoreJsonImplTest.java
Thu Aug 19 13:59:07 2010
+++
/trunk/user/test/com/google/gwt/requestfactory/client/impl/DeltaValueStoreJsonImplTest.java
Thu Aug 19 17:13:42 2010
@@ -44,10 +44,10 @@
}
final RecordToTypeMap typeMap = new RecordToTypeMap() {
- public RecordSchema<? extends Record> getType(
- Class<? extends Record> recordClass) {
+ @SuppressWarnings("unchecked")
+ public <R extends Record> RecordSchema<R> getType(Class<R>
recordClass) {
if (recordClass.equals(SimpleFooRecord.class)) {
- return SimpleFooRecordImpl.SCHEMA;
+ return (RecordSchema<R>) SimpleFooRecordImpl.SCHEMA;
}
throw new IllegalArgumentException("Unknown token " + recordClass);
}
@@ -75,12 +75,12 @@
valueStore = new ValueStoreJsonImpl();
requestFactory = new RequestFactoryJsonImpl() {
- public Record create(Class token) {
+ public <R extends Record> R create(Class<R> token) {
return create(token, typeMap);
}
@Override
- public RecordSchema getSchema(String token) {
+ public RecordSchema<?> getSchema(String token) {
return typeMap.getType(token);
}
@@ -195,7 +195,7 @@
deltaValueStore.set(SimpleFooRecord.userName, mockRecord, "bovik");
assertTrue(deltaValueStore.isChanged());
String jsonString = deltaValueStore.toJson();
- JSONObject jsonObject = (JSONObject) JSONParser.parse(jsonString);
+ JSONObject jsonObject = (JSONObject)
JSONParser.parseLenient(jsonString);
assertFalse(jsonObject.containsKey(WriteOperation.DELETE.name()));
assertTrue(jsonObject.containsKey(WriteOperation.CREATE.name()));
assertTrue(jsonObject.containsKey(WriteOperation.UPDATE.name()));
@@ -230,7 +230,7 @@
private JSONObject testAndGetChangeRecord(String jsonString,
WriteOperation currentWriteOperation) {
- JSONObject jsonObject = (JSONObject) JSONParser.parse(jsonString);
+ JSONObject jsonObject = (JSONObject)
JSONParser.parseLenient(jsonString);
for (WriteOperation writeOperation : WriteOperation.values()) {
if (writeOperation != currentWriteOperation) {
assertFalse(jsonObject.containsKey(writeOperation.name()));
=======================================
--- /trunk/user/test/com/google/gwt/valuestore/ValueStoreSuite.java Mon Aug
16 20:22:31 2010
+++ /trunk/user/test/com/google/gwt/valuestore/ValueStoreSuite.java Thu Aug
19 17:13:42 2010
@@ -22,6 +22,7 @@
/**
* Tests of the valuestore package that require GWT.
+ * @see com.google.gwt.requestfactory.RequestFactorySuite
*/
public class ValueStoreSuite {
public static Test suite() {
=======================================
---
/trunk/user/test/com/google/gwt/valuestore/client/RequestFactoryTest.java
Thu Aug 19 13:24:10 2010
+++
/trunk/user/test/com/google/gwt/valuestore/client/RequestFactoryTest.java
Thu Aug 19 17:13:42 2010
@@ -33,39 +33,41 @@
*/
public class RequestFactoryTest extends GWTTestCase {
- public void disabled_testPersistRelation() {
+ public void testPersistRelation() {
final SimpleRequestFactory req =
GWT.create(SimpleRequestFactory.class);
HandlerManager hm = new HandlerManager(null);
req.init(hm);
- delayTestFinish(5000);
- SimpleFooRecord newFoo = (SimpleFooRecord)
req.create(SimpleFooRecord.class);
- SimpleBarRecord newBar = (SimpleBarRecord)
req.create(SimpleBarRecord.class);
-
- final RequestObject<Void> fooReq =
req.simpleFooRequest().persist(newFoo);
-
- newFoo = fooReq.edit(newFoo);
- newFoo.setUserName("Ray");
-
- final RequestObject<Void> barReq =
req.simpleBarRequest().persist(newBar);
- newBar = barReq.edit(newBar);
- newBar.setUserName("Amit");
-
- final SimpleBarRecord finalNewBar = newBar;
- final SimpleFooRecord finalNewFoo = newFoo;
- fooReq.fire(new Receiver<Void>() {
- public void onSuccess(Void response, Set<SyncResult> syncResultSet1)
{
- for (SyncResult syncResult1 : syncResultSet1) {
- // update id.
- }
- barReq.fire(new Receiver<Void>() {
- public void onSuccess(Void response, Set<SyncResult>
syncResultSet2) {
- final RequestObject<Void> fooReq2 =
req.simpleFooRequest().persist(
- finalNewFoo);
- SimpleFooRecord newRec = fooReq2.edit(finalNewFoo);
- newRec.setBarField(finalNewBar);
-
- fooReq2.fire(new Receiver<Void>() {
- public void onSuccess(Void response, Set<SyncResult>
syncResultSet3) {
+ delayTestFinish(500000);
+
+ SimpleFooRecord rayFoo = req.create(SimpleFooRecord.class);
+ final RequestObject<SimpleFooRecord> persistRay =
req.simpleFooRequest().persistAndReturnSelf(
+ rayFoo);
+ rayFoo = persistRay.edit(rayFoo);
+ rayFoo.setUserName("Ray");
+
+ persistRay.fire(new Receiver<SimpleFooRecord>() {
+ public void onSuccess(final SimpleFooRecord persistedRay,
+ Set<SyncResult> ignored) {
+
+ SimpleBarRecord amitBar = req.create(SimpleBarRecord.class);
+ final RequestObject<SimpleBarRecord> persistAmit =
req.simpleBarRequest().persistAndReturnSelf(
+ amitBar);
+ amitBar = persistAmit.edit(amitBar);
+ amitBar.setUserName("Amit");
+
+ persistAmit.fire(new Receiver<SimpleBarRecord>() {
+ public void onSuccess(SimpleBarRecord persistedAmit,
+ Set<SyncResult> ignored) {
+
+ final RequestObject<SimpleFooRecord> persistRelationship =
req.simpleFooRequest().persistAndReturnSelf(
+ persistedRay).with("barField");
+ SimpleFooRecord newRec =
persistRelationship.edit(persistedRay);
+ newRec.setBarField(persistedAmit);
+
+ persistRelationship.fire(new Receiver<SimpleFooRecord>() {
+ public void onSuccess(SimpleFooRecord relatedRay,
+ Set<SyncResult> ignored) {
+ assertEquals("Amit",
relatedRay.getBarField().getUserName());
finishTest();
}
});
@@ -130,13 +132,14 @@
new Receiver<SimpleFooRecord>() {
public void onSuccess(SimpleFooRecord response,
Set<SyncResult> syncResult) {
- SimpleBarRecord bar = (SimpleBarRecord)
req.create(SimpleBarRecord.class);
+ SimpleBarRecord bar = req.create(SimpleBarRecord.class);
RequestObject<String> helloReq =
req.simpleFooRequest().hello(response, bar);
bar = helloReq.edit(bar);
+ bar.setUserName("BAR");
helloReq.fire(new Receiver<String>() {
public void onSuccess(String response,
Set<SyncResult> syncResults) {
- assertEquals("Greetings FOO from GWT", response);
+ assertEquals("Greetings BAR from GWT", response);
finishTest();
}
});
=======================================
--- /trunk/user/test/com/google/gwt/valuestore/server/SimpleBar.java Wed
Aug 18 13:21:16 2010
+++ /trunk/user/test/com/google/gwt/valuestore/server/SimpleBar.java Thu
Aug 19 17:13:42 2010
@@ -80,6 +80,12 @@
public void persist() {
setId(nextId++);
+ singleton.setUserName(userName);
+ }
+
+ public SimpleBar persistAndReturnSelf() {
+ persist();
+ return this;
}
public void setId(Long id) {
=======================================
--- /trunk/user/test/com/google/gwt/valuestore/server/SimpleFoo.java Thu
Aug 19 13:24:10 2010
+++ /trunk/user/test/com/google/gwt/valuestore/server/SimpleFoo.java Thu
Aug 19 17:13:42 2010
@@ -142,6 +142,11 @@
public void persist() {
setId(nextId++);
}
+
+ public SimpleFoo persistAndReturnSelf() {
+ persist();
+ return this;
+ }
public void setBarField(SimpleBar barField) {
this.barField = barField;
=======================================
--- /trunk/user/test/com/google/gwt/valuestore/shared/SimpleBarRequest.java
Wed Aug 18 13:21:16 2010
+++ /trunk/user/test/com/google/gwt/valuestore/shared/SimpleBarRequest.java
Thu Aug 19 17:13:42 2010
@@ -16,6 +16,7 @@
package com.google.gwt.valuestore.shared;
import com.google.gwt.requestfactory.shared.Instance;
+import com.google.gwt.requestfactory.shared.RecordRequest;
import com.google.gwt.requestfactory.shared.RequestObject;
import com.google.gwt.requestfactory.shared.Service;
@@ -27,4 +28,7 @@
@Instance
RequestObject<Void> persist(SimpleBarRecord record);
-}
+
+ @Instance
+ RecordRequest<SimpleBarRecord> persistAndReturnSelf(SimpleBarRecord
record);
+}
=======================================
--- /trunk/user/test/com/google/gwt/valuestore/shared/SimpleFooRequest.java
Thu Aug 19 13:24:10 2010
+++ /trunk/user/test/com/google/gwt/valuestore/shared/SimpleFooRequest.java
Thu Aug 19 17:13:42 2010
@@ -39,6 +39,9 @@
@Instance
RequestObject<Void> persist(SimpleFooRecord record);
+
+ @Instance
+ RecordRequest<SimpleFooRecord> persistAndReturnSelf(SimpleFooRecord
record);
@Instance
RequestObject<String> hello(SimpleFooRecord instance, SimpleBarRecord
record);
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors