summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoremaclee <lee.anjella.macabuhay@est.tech>2024-03-27 14:54:50 +0000
committerLee Anjella Macabuhay <lee.anjella.macabuhay@est.tech>2024-03-27 16:09:08 +0000
commitfd02245bd3aae4c2d57da8f5b5c5428d98ce8551 (patch)
treeebe308515c28d17087a5d98428cf467821f8d438
parentbdc3fae4230ea23accfae66f250526d51f3b3210 (diff)
Fix code smell
- change string to formatted Issue-ID: CPS-475 Change-Id: I59271c63f244c4d6684b145b1afe2356668e6fd8 Signed-off-by: emaclee <lee.anjella.macabuhay@est.tech>
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/service/CmNotificationSubscriptionPersistenceServiceImpl.java11
1 files changed, 2 insertions, 9 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/service/CmNotificationSubscriptionPersistenceServiceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/service/CmNotificationSubscriptionPersistenceServiceImpl.java
index 5eca5e8c57..2efd321b8d 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/service/CmNotificationSubscriptionPersistenceServiceImpl.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/service/CmNotificationSubscriptionPersistenceServiceImpl.java
@@ -20,7 +20,6 @@
package org.onap.cps.ncmp.api.impl.events.cmsubscription.service;
-import static org.onap.cps.ncmp.api.impl.operations.DatastoreType.PASSTHROUGH_RUNNING;
import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS;
import java.io.Serializable;
@@ -109,14 +108,8 @@ public class CmNotificationSubscriptionPersistenceServiceImpl implements CmNotif
private void addNewSubscriptionViaDatastore(final DatastoreType datastoreType, final String cmHandleId,
final String xpath, final String newSubscriptionId) {
- final String parentXpathFormat = "/datastores/datastore[@name='%s']/cm-handles";
- String parentXpath = "";
- if (datastoreType == PASSTHROUGH_RUNNING) {
- parentXpath = parentXpathFormat.formatted("ncmp-datastore:passthrough-running");
- } else {
- parentXpath = parentXpathFormat.formatted("ncmp-datastore:passthrough-operational");
- }
-
+ final String parentXpath = "/datastores/datastore[@name='%s']/cm-handles"
+ .formatted(datastoreType.getDatastoreName());
final String updatedJson = String.format("{\"cm-handle\":[{\"id\":\"%s\",\"filters\":{\"filter\":"
+ "[{\"xpath\":\"%s\",\"subscriptionIds\":[\"%s\"]}]}}]}", cmHandleId, xpath, newSubscriptionId);
cpsDataService.saveData(NCMP_DATASPACE_NAME, SUBSCRIPTION_ANCHOR_NAME, parentXpath, updatedJson,