Self Recursive Objects
Self Recursive Hierarchy Inserts and Updates
The scenario explained here shows XML that inserts data into the self recursive conceptual object MANAGER using REST.
<?xml version='1.0' encoding='utf-8'?>
<EMPLOYEE_SR>
<datarow>
<FirstName>Manager</FirstName>
<LastName>last name</LastName>
</datarow>
<datarow>
<FirstName>John</FirstName>
<LastName>Doe</LastName>
<RelatedManager>Manager</RelatedManager>
</datarow>
</EMPLOYEE_SR>
If the primary key values are sequences, include
alternateKey in the RESTful web service URL as a request parameter. For more information about the request parameters, see
REST URL Parameters.
alternateKey=EMPLOYEE_SR=FNM
Self Recursive Hierarchy Deletes, Restores, and Purges
The scenario explained here shows XML to delete data from the self recursive conceptual object MANAGER using REST.
Construct XML for the root node alone according to the XSD. Because the delete operation will delete the hierarchy, you do not need to provide data for the complete hierarchy. XML is required to contain the primary key information only.
<?xml version='1.0' encoding='utf-8'?>
<EMPLOYEE_SR>
<datarow>
<FirstName>Manager</FirstName>
</datarow>
<datarow>
<FirstName>John</FirstName>
</datarow>
</EMPLOYEE_SR>
If the primary key values are sequences, include alternateKey in the RESTful web service link as a request parameter.
alternateKey= NR_EMPLOYEE = FNM;
Set the
processingMode parameter in the RESTful web service URL as delete. This deletes all records from the MANAGER conceptual object under the specified hierarchy. You can pass this parameter as either purge or restore. For more information about the request parameters, see
REST URL Parameters.
Self Recursive Conceptual Object Restore Root Nodes
To purge the root nodes (nodes without any parent) in a self recursive object, you must purge all the child nodes first. This is a two-step process with child nodes in one XML and only root nodes in the second XML.
Step 1: Purge child nodes
<?xml version='1.0' encoding='utf-8'?>
<EMPLOYEE_SR>
<datarow>
<FirstName>John</FirstName>
</datarow></EMPLOYEE_SR>
Step 2: Purge root nodes
<?xml version='1.0' encoding='utf-8'?><EMPLOYEE_SR>
<datarow>
<FirstName>Manager</FirstName>
</datarow>
</EMPLOYEE_SR>
Self Recursive Conceptual Objects Restore Root Nodes
The ability to restore a self recursive conceptual object is not currently supported, but you can perform this operation as a two-step process. This process must be invoked on the RESTful URL of the corresponding data objects.
Step 1: Restore root nodes
<?xml version='1.0' encoding='utf-8'?>
<EMPLOYEE_SR>
<datarow>
<FirstName>Manager</FirstName>
</datarow>
</EMPLOYEE_SR>
Step 2: Restore child nodes
<?xml version='1.0' encoding='utf-8'?>
<EMPLOYEE_SR>
<datarow>
<FirstName>John</FirstName>
</datarow></EMPLOYEE_SR>