XMLWordPrintable

      Implement the functionality to support multiple nodes replacement using data fragment with list-node as a root element.

      replacing one or more list elements that already may exists (same-key). Al old element that are not in the new payload will be deleted

      Data JSON example:

      // references test-tree.yang (see cps-service test)
      {
        "branch": [
          { "name": "one"},
          { "name": "two"}
        ]
      }
      

      A/C

      REST layer (incl. openapi update)

      • uri:
        • (CPS) PATCH /dataspaces/{dataspaceName}/anchor/{anchorName}/list-node
        •  (NCMP) PATCH /cm-handle/{cmHandle}/list-node
          • (NCMP REST interface not final might change later)
      • parameters:
        • xpath - parent node xpath (mandatory)
        • JSON data fragment via request body
      • response 200 on success
      • if empty list provided treat as validation exception

      Service layer

      • parse JSON string into collection of DataNode objects

      Persistence layer

      • extract list-node xpath identifier from data nodes provided
      • find parent node by parent node xpath (throw not found exception if absent)
      • remove all children matching (starting with) list-node xpath identifier
      • add all provided elements to parent node
      • persist

      out of scope

      • system will replace even if all content is identical

            rkashapov rkashapov
            rkashapov rkashapov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: