Bug 787534

Summary: REST Interface - Unable to create WorkingTranslatedSnapshotData
Product: [Community] PressGang CCMS Reporter: Lee Newson <lnewson>
Component: REST-APIAssignee: Matthew Casperson <mcaspers>
Status: CLOSED WORKSFORME QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 1.xCC: cbredesen, topic-tool-list
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-06 23:23:04 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Server Error Log
none
Test Case
none
An example of creating a "One" entity with a collection of "Many" entities in one REST call none

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