What if the request were simpler, say something like:

{
   "dataSource":"isc_FlashCardsGWTClient_1_0",
   "operationType":"update",
   "componentId":"isc_ListGrid_0",
   "data":{
      "id":1,
      "frontSideResource.content":"word1xxx"
   },
   "oldValues":{...}
}

Could I do it without any complex Parser/Writer?  Just Filter and Mapping (from 
the value for the single "data" structure)?  Does this sound right:

ERXRestRequestNode dataNode = requestNode().childNamed( "data" );
dataNode.updateObjectWithFilter(card, updateFilter(), restContext());

So far I THINK it is working, but now I have the problem that 
"frontSideResource.content" is really a flattened relationship:

myEO.frontSideResource.content is what I want updated, but the data structure 
didn't say 

   "data":{
      "id":1,
      "frontSideResource":{content:"word1xxx"}
   }

Can I map the "frontsideResource.content" key to the actual keypath off the EO 
being updated?  Of course I could look into the client end and try to figure 
out how to maintain the content value in the structure correctly.

= Robert =

On Oct 14, 2012, at 5:42 PM, Pascal Robert <[email protected]> wrote:

> I never wrote a new format, but check the existing formats (ERXJSONRestParser 
> / ERXJSONRestWriter would be a good start). I think ERXSproutCoreRestWriter 
> was for a case like yours, e.g. SproutCore needs to add elements to a 
> response. 
> 
>> Could u kindly point me to an example of implementing a new erxformat?
>> 
>> On Oct 14, 2012, at 3:58 PM, [email protected] wrote:
>> 
>>> Maybe it should be done as a new ErxFormat.
>>> 
>>> Envoyé de mon iPhone
>>> 
>>> Le 2012-10-14 à 16:51, "Robert Hanviriyapunt" <[email protected]> a écrit :
>>> 
>>>> SmartGWT is a strange animal.
>>>> 
>>>> I like it's idea of various DataSource classes, specifically 
>>>> RestDataSource.  And I love WebObjects and am looking to employ ERRest.  I 
>>>> have GET and PUT being called for indexAction and updateAction.  I have 
>>>> indexAction returning my EOs in an container Dictionary to provide other 
>>>> data required by SmartGWT.  But now I'm trying to handle the PUT request 
>>>> by SmartGWT to my Controller.updateAction method and have the following 
>>>> JSON structure to deal with:
>>>> 
>>>>  { 
>>>>      transaction: { 
>>>>          operations: [{
>>>>              dataSource:"countryDS", 
>>>>              operationType:"update", 
>>>>              data: {
>>>>                  pk: 1
>>>>                  countryName: "Edited Value",
>>>>                  capital: "Edited Value",
>>>>                  continent: "Edited Value"
>>>>              }
>>>>          }, {
>>>>              dataSource:"countryDS", 
>>>>              operationType:"update", 
>>>>              data: {
>>>>                  pk: 2,
>>>>                  capital: "Edited Value",
>>>>                  popuilation: 123456
>>>>              }
>>>>          }]
>>>>      }
>>>>  }
>>>> 
>>>> 
>>>> My updated fields are in the values for the keys named "data".  Is there 
>>>> an example of handling this data in the REST update request?  Or anyone 
>>>> done this before that hasn't posted about it that can offer any advice?
>>>> 
>>>> = Robert =
>>>> _______________________________________________
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Webobjects-dev mailing list      ([email protected])
>>>> Help/Unsubscribe/Update your Subscription:
>>>> https://lists.apple.com/mailman/options/webobjects-dev/probert%40macti.ca
>>>> 
>>>> This email sent to [email protected]
> 

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to