Versions Compared

Key

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

...

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

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

Add support for persisting of top level list nodes

Issues & Decisions

#

ISSUES

Description

DECISIONS

1

Persisting list elements as a top level node creates multiple list nodes .

 

 

creating top level node with multiple list nodes are not persisted appropriately. For example, below is request payload with actual and expected responses. 

Code Block
titlerequest payload
collapsetrue
{
  "bookstores":[
    {
      "bookstore-name": "Books"
    },
    {
      "bookstore-name": "Stories"
    }
  ]
}
Code Block
titleactual datanode
collapsetrue
[
  {
    "book-store:bookstores": {
      "bookstore-name": "Books"
    }
  },
  {
    "book-store:bookstores": {
      "bookstore-name": "Stories"
    }
  }
]
Code Block
titleexpected data node
collapsetrue
"book-store:bookstores": [
    {"bookstore-name":"Books"},
    {"bookstore-name":"Stores"}
]

list is not a container and hence top-level list nodes are stored as collection of data node. it is same behavior for leaf list data node. 

2Adding a list element to a root list node does not add element in parent list but in child list element (Add list element API). 
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.
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. details are provided 

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