aboutsummaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/main
diff options
context:
space:
mode:
authormpriyank <priyank.maheshwari@est.tech>2022-08-26 13:26:01 +0100
committermpriyank <priyank.maheshwari@est.tech>2022-08-29 15:15:54 +0100
commit91d66108379d7cd397aedc30da4801d20643ee68 (patch)
tree63c73329d3478b641b479d56fb31e8d2e10c31be /cps-ncmp-service/src/main
parentbf1fdbdeed0ba6f0e8420d15ab33d6c88a5ee4d5 (diff)
Performance Improvement:save cmhandles capability
- add saveCmHandleBatch in InventoryPersistence - add saveListElementsBatch in CpsDataService - have addListElementsBatch in CpsDataPersistenceService - Test scenarios for the same Issue-ID: CPS-1229 Issue-ID: CPS-1126 Change-Id: I0a1401818da5a4e523d7d0751cac6a526d1611b2 Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
Diffstat (limited to 'cps-ncmp-service/src/main')
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/InventoryPersistence.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/InventoryPersistence.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/InventoryPersistence.java
index c059ece0d3..7a7ef66668 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/InventoryPersistence.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/InventoryPersistence.java
@@ -27,8 +27,10 @@ import static org.onap.cps.spi.CascadeDeleteAllowed.CASCADE_DELETE_ALLOWED;
import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS;
import java.time.OffsetDateTime;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -157,6 +159,19 @@ public class InventoryPersistence {
}
/**
+ * Method to save batch of cm handles.
+ *
+ * @param yangModelCmHandles cm handle represented as Yang Models
+ */
+ public void saveCmHandleBatch(final Collection<YangModelCmHandle> yangModelCmHandles) {
+ final List<String> cmHandlesJsonData = new ArrayList<>();
+ yangModelCmHandles.forEach(yangModelCmHandle -> cmHandlesJsonData.add(
+ String.format("{\"cm-handles\":[%s]}", jsonObjectMapper.asJsonString(yangModelCmHandle))));
+ cpsDataService.saveListElementsBatch(NCMP_DATASPACE_NAME, NCMP_DMI_REGISTRY_ANCHOR,
+ NCMP_DMI_REGISTRY_PARENT, cmHandlesJsonData, NO_TIMESTAMP);
+ }
+
+ /**
* Method to delete a list or a list element.
*
* @param listElementXpath list element xPath