Re: ERRest skipping my NSDictionary
Re: ERRest skipping my NSDictionary
- Subject: Re: ERRest skipping my NSDictionary
- From: Riccardo De Menna <email@hidden>
- Date: Sat, 11 Oct 2014 00:22:02 +0200
Hi Philippe,
The filters seem ok to me… I’ve stepped through the ERRest code and it does match them. (BTW in this particular case the filter explicitly includes that property).
The thing is that after matching it, it looks for a relationship property or a primitive one.
Since the dictionary is neither, it discards the value.
Let me post some code…
I have a “location” property that holds geographic data (very similar to iOS’s CLPlacemark and CLLocation).
I need to move this data back and forth between server and client, where it will be “rebuilt” into a CLLocation object.
Since the “location” property is not primitive, I’ve excluded that one from the filter and instead included a custom “locationDictionary”.
Something like the following…
public NSDictionary<String,Object> locationDictionary() {
return location() != null ? location().toPlistDictionary() : null;
}
public void setLocationDictionary(NSDictionary<String,Object> dictionary) {
setLocation(TLocation.fromPlistDictionary(dictionary));
}
When I try to update the record on the server posting from the client, the location remains null.
I was hoping that ERRest would detect that there is NO “locationDictionary” relationship and simply KVC post it to my EO.
Maybe I’m just assuming something wrong… but what’s the best way to move dictionary attributes then?
Thank you all in advance,
Riccardo
On 10/ott/2014, at 23:59, Philippe Rabier <email@hidden> wrote:
> Hi Riccardo
>
> Did you think to create an alias and use it in your filter? And didn't you forget to add a filter that includes all the keys when you built your write filter?
>
> Otherwise all map content is excluded if you just add the key/alias of your "map" attribute without using the method which takes a key and a filter as parameters.
>
> Philippe Rabier
> ---------------------
> http://twitter.com/prabier
>
> Sent from my iPhone
> Philippe Rabier
> ---------------------
> http://twitter.com/prabier
>
> Sent from my iPhone
>
>
>> Anyone on this?
>>
>> On 09/ott/2014, at 15:52, Riccardo De Menna <email@hidden> wrote:
>>
>>> Hi all,
>>>
>>> This is an ERRest specific question.
>>>
>>> I have an iOS -> WebObjects/ERRest setup regularly working.
>>> One of the entities on both sides has an attribute that returns an NSDictionary.
>>> The problem is that when I try to update this attribute from the iOS side into the WO side, it is silently skipped and left empty.
>>>
>>> The iOS side JSON-serializes everything before posting the Rest requests… as a result, the dictionary attribute shows in the JSON output, very similar to a relationship child node.
>>>
>>> I could be saying something stupid here so please don’t be too harsh…
>>>
>>> The thing is, together with any primitive type, I was assuming that the Map/Dictionary kind was among the things I could “obviously” send.
>>> Now I’m not so sure… could anybody shed some light on this, since I could be banging my head under the wrong tree?
>>>
>>> In other words… Can I send a Map/Dictionary type object inside my JSON request and hope that WO/ERRest will catch that it is NOT a relationship to other nodes, but simply a plain old dictionary and call my entity setter or am I simply confusing ERRest?
>>>
>>> BTW, not sure if it means anything, but the attribute is actually a class method and not a real model attribute since the dictionary needs to be processed. Could that be the issue?
>>>
>>> Please help,
>>> Riccardo De Menna
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden
>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden