- val uncompleteIdentifierWithSchemaNode = identifier.resolveInstanceIdentifier
- var schemaNode = (uncompleteIdentifierWithSchemaNode.schemaNode as DataNodeContainer).getSchemaChildNode(payload)
- if (schemaNode === null) {
- schemaNode = payload.findModule(uncompleteIdentifierWithSchemaNode.instanceIdentifier)?.getSchemaChildNode(payload)
- }
- val value = normalizeNode(payload, schemaNode, uncompleteIdentifierWithSchemaNode.instanceIdentifier)
- val completeIdentifierWithSchemaNode = uncompleteIdentifierWithSchemaNode.addLastIdentifierFromData(value, schemaNode)
- val status = broker.commitConfigurationDataPost(completeIdentifierWithSchemaNode.instanceIdentifier, value)?.get();
+ if (payload.namespace === null) {
+ throw new ResponseException(BAD_REQUEST,
+ "Data has bad format. Root element node must have namespace (XML format) or module name(JSON format)");
+ }
+ val uncompleteInstIdWithData = identifier.toInstanceIdentifier
+ val schemaNode = uncompleteInstIdWithData.mountPoint.findModule(payload)?.getSchemaChildNode(payload)
+ val value = normalizeNode(payload, schemaNode, uncompleteInstIdWithData.mountPoint)
+ val completeInstIdWithData = uncompleteInstIdWithData.addLastIdentifierFromData(value, schemaNode)
+ var RpcResult<TransactionStatus> status = null
+ if (completeInstIdWithData.mountPoint !== null) {
+ status = broker.commitConfigurationDataPostBehindMountPoint(completeInstIdWithData.mountPoint,
+ completeInstIdWithData.instanceIdentifier, value)?.get();
+ } else {
+ status = broker.commitConfigurationDataPost(completeInstIdWithData.instanceIdentifier, value)?.get();
+ }