[Building Sakai] EntityBroker problem: updateEntity won't work

Aaron Zeckoski azeckoski at unicon.net
Tue Apr 27 01:02:00 PDT 2010


Sorry about that. I meant to paste this one (InputTranslatable):
http://source.sakaiproject.org/release/2.6.2/apidocs/index.html?org/sakaiproject/entitybroker/entityprovider/capabilities/InputTranslatable.html

The RequestStorable one allows you place data into or access data that
is in the request but that is probably not what you need here.

-AZ


On Tue, Apr 27, 2010 at 2:12 AM, Dunstall, Christopher
<cdunstall at csu.edu.au> wrote:
> Hi Aaron,
>
> Did you mean to paste the same link twice?
>
> Were you referring to the RequestStorable capability?
>
> Thanks,
>
> Chris Dunstall | Service Support - Applications
> Technology Integration/OLE Virtual Team
> Division of Information Technology | Charles Sturt University | Bathurst, NSW
>
> Ph: 02 63384818 | Fax: 02 63384181
>
> -----Original Message-----
> From: azeckoski at gmail.com [mailto:azeckoski at gmail.com] On Behalf Of Aaron Zeckoski
> Sent: Friday, 23 April 2010 6:16 PM
> To: Dunstall, Christopher
> Cc: sakai-dev
> Subject: Re: [Building Sakai] EntityBroker problem: updateEntity won't work
>
> The javadocs will help:
> http://source.sakaiproject.org/release/2.6.2/apidocs/index.html?org/sakaiproject/entitybroker/entityprovider/capabilities/package-summary.html
>
> In this case I think you want this one:
> http://source.sakaiproject.org/release/2.6.2/apidocs/index.html?org/sakaiproject/entitybroker/entityprovider/capabilities/package-summary.html
>
> Confluence only has the basics. The detailed docs are in the javadocs
> themselves.
> Hope this helps
> -AZ
>
>
> On Fri, Apr 23, 2010 at 1:19 AM, Dunstall, Christopher
> <cdunstall at csu.edu.au> wrote:
>> Hi Aaron,
>>
>> Thanks for the reply!
>>
>> "You can get to all the incoming data and handle it yourself if you
>> have a more advanced use case and you can even handle the encoding for
>> certain instances and then allow the EB automatic stuff to run for the
>> others if you like. Take a look at the capabilities related to
>> encoding and let me know if you have further questions."
>>
>> This sounds like it could do the trick.  I'm trawling through confluence, but I can't seem to find anything on how to access the incoming data myself. Could you please point me in the right direction?
>>
>> Thanks,
>>
>> Chris Dunstall | Service Support - Applications
>> Technology Integration/OLE Virtual Team
>> Division of Information Technology | Charles Sturt University | Bathurst, NSW
>>
>> Ph: 02 63384818 | Fax: 02 63384181
>>
>>
>> -----Original Message-----
>> From: azeckoski at gmail.com [mailto:azeckoski at gmail.com] On Behalf Of Aaron Zeckoski
>> Sent: Thursday, 22 April 2010 6:22 PM
>> To: Dunstall, Christopher
>> Cc: sakai-dev
>> Subject: Re: [Building Sakai] EntityBroker problem: updateEntity won't work
>>
>> Basically the system calls your getEntity method to obtain the current
>> version of the object. It then goes through a series of decoding steps
>> where it checks to see if you have any methods to handle the decoding
>> yourself and checks the formats of the input data. If it does not find
>> anything it will use the export format as the base and then decode the
>> data according to that (i.e. whatever was sent out for your entity
>> when you sent out JSON data). This initially causes the data to be
>> decoded into a series of fields with names like "someField",
>> "someThing.nestedField", etc. Then it uses reflection to place this
>> data into the object that was provided by your getEntity method.
>>
>> This is the automatic method which will not work for every object type
>> and specifically has trouble with collections as it generally cannot
>> determine the type of a collection and certainly cannot determine the
>> types of objects within it.
>>
>> You can get to all the incoming data and handle it yourself if you
>> have a more advanced use case and you can even handle the encoding for
>> certain instances and then allow the EB automatic stuff to run for the
>> others if you like. Take a look at the capabilities related to
>> encoding and let me know if you have further questions.
>>
>> Hope that helps!
>> -AZ
>>
>>
>> On Thu, Apr 22, 2010 at 6:27 AM, Dunstall, Christopher
>> <cdunstall at csu.edu.au> wrote:
>>> Hi all,
>>>
>>>
>>>
>>> I’m hoping an EntityBroker guru can help me out.
>>>
>>>
>>>
>>> I’m attempting to save, via a POST an object through EntityBroker that has
>>> nested objects inside it.
>>>
>>> For instance, consider the following json:
>>>
>>>
>>>
>>> {
>>>
>>>                 "autotextId": 0,
>>>
>>>                 "canBeNull": "N",
>>>
>>>                 "children": [
>>>
>>>                 {
>>>
>>>                                 "autotextId": 0,
>>>
>>>                                 "canBeNull": "N",
>>>
>>>                                 "children": [],
>>>
>>>                                 "displayHeader": "N",
>>>
>>>                                 "editable": "Y",
>>>
>>>                                 "formatType": "Rich Text",
>>>
>>>                                 "helpText": "Blah",
>>>
>>>                                 "outlineSpecific": "N",
>>>
>>>                                 "parentId": 274,
>>>
>>>                                 "parentSectionId": 274,
>>>
>>>                                 "requiresQa": "Y",
>>>
>>>                                 "sectionId": 275,
>>>
>>>                                 "sectionSectionId": 281,
>>>
>>>                                 "sectionSeqNumber": 1,
>>>
>>>                                 "sectionSourceUrl": null,
>>>
>>>                                 "templateId": 101
>>>
>>>                 }
>>>
>>>                 ],
>>>
>>>                 "displayHeader": "Y",
>>>
>>>                 "editable": "N",
>>>
>>>                 "formatType": "Text",
>>>
>>>                 "helpText": null,
>>>
>>>                 "outlineSpecific": "N",
>>>
>>>                 "parentId": 200,
>>>
>>>                 "parentSectionId": 200,
>>>
>>>                 "requiresQa": "N",
>>>
>>>                 "sectionId": 274,
>>>
>>>                 "sectionSectionId": 280,
>>>
>>>                 "sectionSeqNumber": 8,
>>>
>>>                 "sectionSourceUrl": "Header",
>>>
>>>                 "templateId": 101
>>>
>>> }
>>>
>>>
>>>
>>> This is a ‘template’ object, but it also has child ‘template’ objects.
>>>
>>>
>>>
>>> My updateEntity method is called but when I debug the entity that is passed
>>> to the method, it’s got the data from the database (obtained from calling
>>> getEntity) and not the data I submitted in the post.
>>>
>>>
>>>
>>> I have double checked my java object and the entity broker entity class and
>>> all members are read/write. I’m confused as to how the update method works.
>>>
>>>
>>>
>>> Can someone explain to me how the submitted object from the post makes it to
>>> my entitybroker class and cast some light on why it’s not doing so?
>>>
>>>
>>>
>>> Thanks,
>>>
>>>
>>>
>>> Chris Dunstall | Service Support - Applications
>>>
>>> Technology Integration/OLE Virtual Team
>>>
>>> Division of Information Technology | Charles Sturt University | Bathurst,
>>> NSW
>>>
>>>
>>>
>>> Ph: 02 63384818 | Fax: 02 63384181
>>>
>>>
>>>
>>> _______________________________________________
>>> sakai-dev mailing list
>>> sakai-dev at collab.sakaiproject.org
>>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>>>
>>> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org
>>> with a subject of "unsubscribe"
>>>
>>
>>
>>
>> --
>> Aaron Zeckoski - Software Engineer - http://tinyurl.com/azprofile
>>
>
>
>
> --
> Aaron Zeckoski - Software Engineer - http://tinyurl.com/azprofile
>



-- 
Aaron Zeckoski - Software Engineer - http://tinyurl.com/azprofile


More information about the sakai-dev mailing list