Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


We are bringing support for persisting of top level list nodes. Here mainly it covers two issues, they are

  1. Persisting list elements as a top level node creates multiple list nodes for every entry rather than a singular list node with the entries
  2. Persisting a list element to a parent list 

...

https://jira.onap.org/browse/CPS-1586https://jira.onap.org/browse/CPS-358

Add support for persisting of top level list nodes

Issues & Decisions

#

ISSUES

ISSUE

NOTES

Description

DECISIONS

Persisting list elements as a top level node creates multiple list nodes (dec-0)

 

 

Persisting a list element to a parent list (dec-1)

The DataNodeBuilder currently assumes the incoming data always describes single data node. As result the single DataNode object is always created even if input data contains multiple entries

Endpoint 

 POST 'http://localhost:8080/cps/api/v2/dataspaces/{dataspace-name}/anchor/{anchor-name}/nodes

 POST 'http://localhost:8080/cps/api/v2/dataspaces/{dataspace-name}/anchor/{anchor-name}/list-nodes

Required code Changes

CpsDataServiceImpl.java –  buildDataNodes

...

1
Adding a list element to a root list node does not 
add element in parent list but in child list element
(Add list element API).
By using add list element(s) API, when added an element 
to root level list node,data node is added to child node
not to parent list node.

Jira
serverONAP Jira
columnIdsissuekey,summary,issuetype,created,updated,duedate,assignee,reporter,priority,status,resolution
columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
serverId425b2b0a-557c-3c0c-b515-579789cceedb
keyCPS-1586

For top level list nodes when new elements are added to root list nodes, 
first element in the root list nodes treated as parent node. so we need to
change logic to store list nodes. 

REST Layer
  • DataRestController.java
    • Add a check in addListElements to see if the parent xpath is a root path ("/"). 
      If root node, create passed list element as top node. Else add passed list element
      to parent xpath node.
  • DataRestControllerSpec.groovy
    • Add test for scenario above
Service Layer
  • CpsDataService.java
    • Overload saveListElements method with implementation for no parentNodeXpath
  • CpsDataServiceImpl.java
    • Overload saveListElements method with implementation for no parentNodeXpath
    • buildDataNodes and call new method storeListElements in Persistence Layer
Persistence Layer
  • CpsDataPersistenceService.java
    • new method storeListElements
  • CpsDataPersistenceServiceImpl.java
    • new method storeListElements, converts datanodes to fragment repository and 
      saves it.
Integration Tests
  • CpsDataServiceIntegrationSpec.groovy
    • Add and Delete top-level list (element) data nodes with root node