From 4571ab67d1b3d24d5f046a38055bcf34910cc785 Mon Sep 17 00:00:00 2001 From: lukegleeson Date: Mon, 16 Aug 2021 12:30:26 +0100 Subject: Fix Sonar Qube Violations Issue-ID: CPS-475 Signed-off-by: lukegleeson Change-Id: I9673fe8ff5373a1ea50df148ac2a3d8af235e508 --- .../cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java | 12 +++++------- .../src/main/java/org/onap/cps/ncmp/api/models/CmHandle.java | 4 +++- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'cps-ncmp-service/src/main/java') diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java index f97ea029db..d6d1ec75ce 100755 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java @@ -51,8 +51,6 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService private static final String NCMP_ANCHOR_NAME = "ncmp-dmi-registry"; - private static final String NCMP_DATA_TOP_PATH = "/dmi-registry"; - private CpsDataService cpsDataService; private ObjectMapper objectMapper; @@ -118,16 +116,16 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService final List persistenceCmHandles = new ArrayList<>(); for (final CmHandle cmHandle: dmiPluginRegistration.getCreatedCmHandles()) { - final PersistenceCmHandle persistenceCmHandle = new PersistenceCmHandle(); + final var persistenceCmHandle = new PersistenceCmHandle(); persistenceCmHandle.setDmiServiceName(dmiPluginRegistration.getDmiPlugin()); - persistenceCmHandle.setId(cmHandle.getCmHandle()); + persistenceCmHandle.setId(cmHandle.getCmHandleID()); persistenceCmHandle.setAdditionalProperties(cmHandle.getCmHandleProperties()); persistenceCmHandles.add(persistenceCmHandle); } - final PersistenceCmHandlesList persistenceCmHandlesList = new PersistenceCmHandlesList(); + final var persistenceCmHandlesList = new PersistenceCmHandlesList(); persistenceCmHandlesList.setCmHandles(persistenceCmHandles); - final String cmHandleJsonData = objectMapper.writeValueAsString(persistenceCmHandlesList); - cpsDataService.saveListNodeData(NCMP_DATASPACE_NAME, NCMP_ANCHOR_NAME, NCMP_DATA_TOP_PATH, + final var cmHandleJsonData = objectMapper.writeValueAsString(persistenceCmHandlesList); + cpsDataService.saveListNodeData(NCMP_DATASPACE_NAME, NCMP_ANCHOR_NAME, "/dmi-registry", cmHandleJsonData); } catch (final JsonProcessingException e) { throw new DataValidationException( diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/CmHandle.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/CmHandle.java index 0d1c7693a6..84227ed6b3 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/CmHandle.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/CmHandle.java @@ -20,6 +20,7 @@ package org.onap.cps.ncmp.api.models; +import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; import lombok.Getter; import lombok.Setter; @@ -33,7 +34,8 @@ import org.springframework.validation.annotation.Validated; @Setter public class CmHandle { - private String cmHandle; + @JsonProperty("cmHandle") + private String cmHandleID; private Map cmHandleProperties; -- cgit 1.2.3-korg