webMethods, OneData, and Terracotta  10.2 | Managing Master Data with webMethods OneData | Developing for webMethods OneData | REST Web Services | XSD Samples by Object Type | Network Recursive Objects
 
Network Recursive Objects
Network Recursive Hierarchy Inserts and Updates
The following scenario shows XML that inserts data into the network recursive conceptual object NR_EMPLOYEE using a REST service.
<?xml version='1.0' encoding='utf-8'?>
<NR_EMPLOYEE>
<datarow>
   <EMPNAME>Manager</EMPNAME>
</datarow>
<datarow>
<EMPNAME>John Doe</EMPNAME>
  <NR_EMPLOYEE_REL>
 <datarow>
   <RelatedManager>Manager</RelatedManager>
   <RelatedEmployee> John Doe </RelatedEmployee>
 </datarow>
</NR_EMPLOYEE_REL>
 </datarow>
</NR_EMPLOYEE>
If the primary key values are sequences, include alternateKey in the RESTful web service link as a request parameter. For more information about the request parameters, see REST URL Parameters.
alternateKey= NR_EMPLOYEE = FNM; NR_EMPLOYEE_REL=EMP_ID,MGNR_ID
Network Recursive Hierarchy Delete, Restore, and Purge
The following scenario shows XML that deletes data from the network recursive conceptual object NR_EMPLOYEE using a REST service.
Construct XML for the root node alone according to the XSD. Because the delete operation deletes 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'?>
<NR_EMPLOYEE>
<datarow>
<EMPNAME>Manager</EMPNAME>
</datarow>
<datarow>
<EMPNAME>John Doe</EMPNAME>
</datarow></NR_EMPLOYEE>
If the primary key values are sequences, include alternateKey in the RESTful web service link as a request parameter. For more information about the request parameters, see REST URL Parameters.
alternateKey= NR_EMPLOYEE = FNM;
Set the processingMode parameter in the REST web service as delete. This deletes all records from the MANAGER conceptual object under the specified hierarchy. You can set this parameter as either purge or restore to delete all records from the NR_EMPLOYEE network recursive conceptual object under the specified hierarchy.
Network Recursive Object Restore and Purge Root Nodes
To restore/purge the root nodes (nodes without any parent) in a network recursive object, you must restore/purge all the child nodes first.
Note: When deleting or purging a root object, if you do not want to specify the relational table data, delete or purge the child nodes before the root object.
This is a two-step process with child nodes in one XML and ONLY root nodes in the second XML.
Step 1: Restore / Purge child nodes
<?xml version='1.0' encoding='utf-8'?>
<EMPLOYEE_SR> <datarow>  <FirstName>John</FirstName> </datarow>
</EMPLOYEE_SR>
Step 2: Restore / Purge root nodes
<?xml version='1.0' encoding='utf-8'?>

<EMPLOYEE_SR> <datarow>
  <FirstName>Manager</FirstName>
 </datarow></EMPLOYEE_SR>

Copyright © 2011-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Innovation Release