/*
- * ============LICENSE_START=======================================================
+ * ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation
- * Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2020-2021 Bell Canada.
* Modifications Copyright (C) 2021 Pantheon.tech
- * Modifications Copyright (C) 2021 Bell Canada.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
notificationService.processDataUpdatedEvent(dataspaceName, anchorName);
}
+ @Override
+ public void updateNodeLeavesAndExistingDescendantLeaves(final String dataspaceName, final String anchorName,
+ final String parentNodeXpath,
+ final String dataNodeUpdatesAsJson) {
+ final Collection<DataNode> dataNodeUpdates =
+ buildDataNodeCollectionFromJson(dataspaceName, anchorName, parentNodeXpath, dataNodeUpdatesAsJson);
+ for (final DataNode dataNodeUpdate : dataNodeUpdates) {
+ processDataNodeUpdate(dataspaceName, anchorName, dataNodeUpdate);
+ }
+ notificationService.processDataUpdatedEvent(dataspaceName, anchorName);
+ }
+
@Override
public void replaceNodeTree(final String dataspaceName, final String anchorName, final String parentNodeXpath,
final String jsonData) {
notificationService.processDataUpdatedEvent(dataspaceName, anchorName);
}
+ @Override
+ public void deleteListNodeData(final String dataspaceName, final String anchorName, final String listNodeXpath) {
+ cpsDataPersistenceService.deleteListDataNodes(dataspaceName, anchorName, listNodeXpath);
+ notificationService.processDataUpdatedEvent(dataspaceName, anchorName);
+ }
+
+
private DataNode buildDataNodeFromJson(final String dataspaceName, final String anchorName,
final String parentNodeXpath, final String jsonData) {
private SchemaContext getSchemaContext(final String dataspaceName, final String schemaSetName) {
return yangTextSchemaSourceSetCache.get(dataspaceName, schemaSetName).getSchemaContext();
}
-}
\ No newline at end of file
+
+ private void processDataNodeUpdate(final String dataspaceName, final String anchorName,
+ final DataNode dataNodeUpdate) {
+ if (dataNodeUpdate == null) {
+ return;
+ }
+ cpsDataPersistenceService.updateDataLeaves(dataspaceName, anchorName, dataNodeUpdate.getXpath(),
+ dataNodeUpdate.getLeaves());
+ final Collection<DataNode> childDataNodeUpdates = dataNodeUpdate.getChildDataNodes();
+ for (final DataNode childDataNodeUpdate : childDataNodeUpdates) {
+ processDataNodeUpdate(dataspaceName, anchorName, childDataNodeUpdate);
+ }
+ }
+}