Bug 787534 - REST Interface - Unable to create WorkingTranslatedSnapshotData
Summary: REST Interface - Unable to create WorkingTranslatedSnapshotData
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: PressGang CCMS
Classification: Community
Component: REST-API
Version: 1.x
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Matthew Casperson
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-02-06 01:55 UTC by Lee Newson
Modified: 2014-08-04 22:26 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-02-06 23:23:04 UTC


Attachments (Terms of Use)
Server Error Log (428.58 KB, text/x-log)
2012-02-06 01:55 UTC, Lee Newson
no flags Details
Test Case (1.94 KB, text/x-java)
2012-02-06 02:28 UTC, Lee Newson
no flags Details
An example of creating a "One" entity with a collection of "Many" entities in one REST call (1.93 KB, application/octet-stream)
2012-02-06 08:56 UTC, Matthew Casperson
no flags Details

Description Lee Newson 2012-02-06 01:55:29 UTC
Atm it is impossible to create a WorkingTranslatedSnapshotData entity due to a recursion error. When you attempt to update a SnapshotTopic to include the Working Translation Data you get a massive error log (see attached). This is caused by the JSON mapper attempting to first marshal the SnapshotTopic into JSON, then the WorkingTranslatedSnapshotData which includes the SnapshotTopic object. As such it then attempts to marshal the SnapshotTopic again in an infinite loop until an exception is eventually thrown.

Comment 1 Lee Newson 2012-02-06 01:55:56 UTC
Created attachment 559530 [details]
Server Error Log

Comment 2 Lee Newson 2012-02-06 02:28:25 UTC
Created attachment 559532 [details]
Test Case

Adding a Test Case to display the problem.

Comment 3 Matthew Casperson 2012-02-06 08:55:29 UTC
With the way the classes are set up I can't stop recursive references like this in the client code. But the "explicit" methods for setting the "One" property of the "Many" entity in the One-To-Many relationships (like the WorkingSnapshotTranslatedDataV1.setSnapshotTopicExplicit() method) have been removed.

When creating new "Many" entities the REST interface will set the appropriate "One" properties.

It is also now possible to create the "One" entity and populate the "Many" entities collection in one call to the create REST function. See the attached test case for an example.

Comment 4 Matthew Casperson 2012-02-06 08:56:13 UTC
Created attachment 559571 [details]
An example of creating a "One" entity with a collection of "Many" entities in one REST call


Note You need to log in before you can comment on or make changes to this bug.