- final YangInstanceIdentifier path;
- if(payload instanceof MapEntryNode) {
- path = parentPath.node(payload.getNodeType()).node(payload.getIdentifier());
+ if(payload instanceof MapNode) {
+ final YangInstanceIdentifier mapPath = parentPath.node(payload.getIdentifier());
+ final NormalizedNode<?, ?> emptySubtree = ImmutableNodes.fromInstanceId(schemaContext, mapPath);
+ rWTransaction.merge(datastore, YangInstanceIdentifier.create(emptySubtree.getIdentifier()), emptySubtree);
+ ensureParentsByMerge(datastore, mapPath, rWTransaction, schemaContext);
+ for(final MapEntryNode child : ((MapNode) payload).getValue()) {
+ final YangInstanceIdentifier childPath = mapPath.node(child.getIdentifier());
+ checkItemDoesNotExists(rWTransaction, datastore, childPath);
+ rWTransaction.put(datastore, childPath, child);
+ }