Currently within CPS it is possible to delete child list-nodes on a given anchor and xpath, or deleting the anchor which subsequently deletes all related list-nodes under that anchor.
There is no functionality right now to delete the data-node at the highest level, and subsequently the list-nodes for this data-node.
CPS should provide the functionality to delete data-nodes as part available within the CPS-REST API, and the NCMP-REST API.
Implementation Proposal
Implement an endpoint which provides functionality to support data-node removal using the data-node xpath.
REST layer
- URI
- (CPS-Core) DELETE dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes
REST layer (DataRestController.java)
- Implement method to delete data-nodes with anchor, dataspace and xpath as string parameters.
- Call cpsDataService.
- return 204.
REST layer (cpsData.yml)
- Add delete operation to endpoint functionality within CPS-Core
REST layer (DataRestControllerSpec.groovy)
- Ensure appropriate response in tests on invocation.
Service layer (CPSDataService.java)
- Reuse current abstract method to deleteListNodeData(). Rename this method.
Service layer (CpsDataServiceImpl.java)
- validate xpath of the data-node
- call cpsDataPersistence.deleteListDataNodes(rename method)
- notificationService.processDataUpdatedEvent(dataspaceName, anchorName)
Service layer (CPSDataServiceImplSpec.groovy)
- delete data-node under xpath.
Persistence layer (CpsDataPeristenceService.java)
- Use current abstract method deleteListDataNodes(). This method will probably have to be renamed
Persistence layer(CpsDataPersistenceServiceImpl.java)
- Use method getFragmentByXpath() to the get the parentEntity of the data-node.
- Call removeListNodeDescendants()
Persistence layer (CpsDataPersistenceServiceSpec.groovy)
- Verify data-node is deleted successfully.
- Error thrown when the xpath does not exist.
- CPS-313Getting issue details... STATUS
Issues & Decisions
# | Issue | Notes | Decision |
---|---|---|---|
1 | Empty Anchors | If top level data-node is removed, it could potentially leave an empty anchor. | Check with stakeholders (Peter and Kieran) |