Jira Legacy | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
...
For the JSON output of Get DataNode we need to alter the DataMapUtils class. The function toDataMap translates a datanode object to a JSON output. We only want this to occur on the top node and as such we can create a new method which is called before toDataMap:
public static Map<String, Object> toDataMapTopNode(final DataNode dataNode) {
final String nodeName = dataNode.getXpath().substring(dataNode.getXpath().lastIndexOf('/') + 1)
.replaceAll("\\[.*?\\]", "");
return ImmutableMap.<String, Object>builder().put(nodeName,
toDataMap(dataNode)
).build();
}
We only want the container name on the top level of the JSON output and as such have to distinguish between a top level node and non top level node. We create an outer map to wrap the inner map which creates the appropriate levels in the JSON output.
...
Queries which use toDataMap:
Query/Service | Class | Notes | Response now | Response After | ||
---|---|---|---|---|---|---|
Notification Service | CpsDataUpdatedEventFactory,java | Notification Service response should be the same as CPS Core for consistency | Query data nodes | Query DataNodes will produce a datanode within an array with the container ID and then the relevant data:. CPS Temporal | cpsDataUpdatedEvent Object content.data.additionalProperties.toString(): [[bookstore-name:Chapters]] | cpsDataUpdatedEvent Object content.data.additionalProperties.toString(): [bookstore:[bookstore-name:Chapters]] |
Query data nodes | QueryRestController.java | Query DataNodes will produce a datanode within an array with the container ID and then the relevant data: Do with node instead of list | [ { "code": "01", | [ "categories": { "code": "01", | ||
get Node by CMHandle and Xpath (NCMP) | DataRestController.java | get Node should follow the get Node which CPS Core produces for consistency |
...