summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/main/java/org
diff options
context:
space:
mode:
authorkissand <andras.zoltan.kiss@est.tech>2022-06-13 10:55:49 +0200
committerkissand <andras.zoltan.kiss@est.tech>2022-06-13 10:55:49 +0200
commitf696068ae5cced10c0fdf6a1686c4eadbdfdfff0 (patch)
treeaa43df1511e2635e0f7f3041a83a29ed21ff27a3 /cps-ncmp-service/src/main/java/org
parent708d2b566a8b8cdf48e1dfe337369c946cec0e02 (diff)
Fix sonar code smells
- https://sonarcloud.io/project/issues?resolved=false&types=CODE_SMELL&id=onap_cps&open=AYFC3OguDZ5Vb3SQMOU1 Issue-ID: CPS-1016 Change-Id: Ic8fdae78337da1ff2c239ae2dfae67e23e88a4bb Signed-off-by: kissand <andras.zoltan.kiss@est.tech>
Diffstat (limited to 'cps-ncmp-service/src/main/java/org')
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NetworkCmProxyCmHandlerQueryService.java6
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandlerQueryServiceImpl.java22
-rwxr-xr-xcps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java10
3 files changed, 19 insertions, 19 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NetworkCmProxyCmHandlerQueryService.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NetworkCmProxyCmHandlerQueryService.java
index f8d51feba8..92b1e82c3e 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NetworkCmProxyCmHandlerQueryService.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NetworkCmProxyCmHandlerQueryService.java
@@ -21,15 +21,15 @@
package org.onap.cps.ncmp.api;
import java.util.Collection;
-import org.onap.cps.spi.model.CmHandleQueryParameters;
+import org.onap.cps.spi.model.CmHandleQueryServiceParameters;
import org.onap.cps.spi.model.DataNode;
public interface NetworkCmProxyCmHandlerQueryService {
/**
* Query and return cm handles that match the given query parameters.
*
- * @param cmHandleQueryParameters the cm handle query parameters
+ * @param cmHandleQueryServiceParameters the cm handle query parameters
* @return collection of cm handles
*/
- Collection<DataNode> queryCmHandles(CmHandleQueryParameters cmHandleQueryParameters);
+ Collection<DataNode> queryCmHandles(CmHandleQueryServiceParameters cmHandleQueryServiceParameters);
}
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandlerQueryServiceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandlerQueryServiceImpl.java
index ef6e953e2f..00cbe69f54 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandlerQueryServiceImpl.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandlerQueryServiceImpl.java
@@ -37,7 +37,7 @@ import org.onap.cps.ncmp.api.NetworkCmProxyCmHandlerQueryService;
import org.onap.cps.spi.CpsAdminPersistenceService;
import org.onap.cps.spi.CpsDataPersistenceService;
import org.onap.cps.spi.model.Anchor;
-import org.onap.cps.spi.model.CmHandleQueryParameters;
+import org.onap.cps.spi.model.CmHandleQueryServiceParameters;
import org.onap.cps.spi.model.ConditionProperties;
import org.onap.cps.spi.model.DataNode;
import org.onap.cps.spi.model.DataNodeIdentifier;
@@ -58,23 +58,23 @@ public class NetworkCmProxyCmHandlerQueryServiceImpl implements NetworkCmProxyCm
/**
* Query and return cm handles that match the given query parameters.
*
- * @param cmHandleQueryParameters the cm handle query parameters
+ * @param cmHandleQueryServiceParameters the cm handle query parameters
* @return collection of cm handles
*/
@Override
- public Collection<DataNode> queryCmHandles(final CmHandleQueryParameters cmHandleQueryParameters) {
+ public Collection<DataNode> queryCmHandles(final CmHandleQueryServiceParameters cmHandleQueryServiceParameters) {
- if (cmHandleQueryParameters.getCmHandleQueryParameters().isEmpty()) {
+ if (cmHandleQueryServiceParameters.getCmHandleQueryParameters().isEmpty()) {
return getAllCmHandles();
}
final Collection<DataNodeIdentifier> amalgamatedQueryResultIdentifiers = new ArrayList<>();
final Map<DataNodeIdentifier, DataNode> amalgamatedQueryResults = new HashMap<>();
- final boolean firstQuery = moduleNameQuery(cmHandleQueryParameters,
+ final boolean firstQuery = moduleNameQuery(cmHandleQueryServiceParameters,
amalgamatedQueryResultIdentifiers, amalgamatedQueryResults);
- publicPropertyQuery(cmHandleQueryParameters, amalgamatedQueryResultIdentifiers,
+ publicPropertyQuery(cmHandleQueryServiceParameters, amalgamatedQueryResultIdentifiers,
amalgamatedQueryResults, firstQuery);
final Collection<DataNode> filteredDataNodes = new ArrayList<>();
@@ -85,12 +85,12 @@ public class NetworkCmProxyCmHandlerQueryServiceImpl implements NetworkCmProxyCm
return filteredDataNodes;
}
- private void publicPropertyQuery(final CmHandleQueryParameters cmHandleQueryParameters,
+ private void publicPropertyQuery(final CmHandleQueryServiceParameters cmHandleQueryServiceParameters,
final Collection<DataNodeIdentifier> amalgamatedQueryResultIdentifiers,
final Map<DataNodeIdentifier, DataNode> amalgamatedQueryResults,
boolean firstQuery) {
for (final Map.Entry<String, String> entry :
- getPublicPropertyPairs(cmHandleQueryParameters.getCmHandleQueryParameters()).entrySet()) {
+ getPublicPropertyPairs(cmHandleQueryServiceParameters.getCmHandleQueryParameters()).entrySet()) {
final String cmHandlePath = "//public-properties[@name='" + entry.getKey() + "' " + "and @value='"
+ entry.getValue() + "']" + "/ancestor::cm-handles";
@@ -121,13 +121,13 @@ public class NetworkCmProxyCmHandlerQueryServiceImpl implements NetworkCmProxyCm
}
}
- private boolean moduleNameQuery(final CmHandleQueryParameters cmHandleQueryParameters,
+ private boolean moduleNameQuery(final CmHandleQueryServiceParameters cmHandleQueryServiceParameters,
final Collection<DataNodeIdentifier> amalgamatedQueryResultIdentifiers,
final Map<DataNodeIdentifier, DataNode> amalgamatedQueryResults) {
boolean firstQuery = true;
- if (!getModuleNames(cmHandleQueryParameters.getCmHandleQueryParameters()).isEmpty()) {
+ if (!getModuleNames(cmHandleQueryServiceParameters.getCmHandleQueryParameters()).isEmpty()) {
final Collection<Anchor> anchors = cpsAdminPersistenceService.queryAnchors("NFP-Operational",
- getModuleNames(cmHandleQueryParameters.getCmHandleQueryParameters()));
+ getModuleNames(cmHandleQueryServiceParameters.getCmHandleQueryParameters()));
anchors.forEach(anchor -> {
final List<DataNode> dataNodes = getDataNodes("//cm-handles[@id='" + anchor.getName() + "']");
dataNodes.parallelStream().forEach(dataNode -> {
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 d1f72a5ef4..f8cab4f1ca 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
@@ -63,7 +63,7 @@ import org.onap.cps.spi.exceptions.AlreadyDefinedException;
import org.onap.cps.spi.exceptions.DataNodeNotFoundException;
import org.onap.cps.spi.exceptions.DataValidationException;
import org.onap.cps.spi.exceptions.SchemaSetNotFoundException;
-import org.onap.cps.spi.model.CmHandleQueryParameters;
+import org.onap.cps.spi.model.CmHandleQueryServiceParameters;
import org.onap.cps.spi.model.ModuleReference;
import org.onap.cps.utils.CpsValidator;
import org.onap.cps.utils.JsonObjectMapper;
@@ -167,12 +167,12 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService
@Override
public Set<NcmpServiceCmHandle> executeCmHandleSearch(final CmHandleQueryApiParameters cmHandleQueryApiParameters) {
- final CmHandleQueryParameters cmHandleQueryParameters = jsonObjectMapper.convertToValueType(
- cmHandleQueryApiParameters, CmHandleQueryParameters.class);
+ final CmHandleQueryServiceParameters cmHandleQueryServiceParameters = jsonObjectMapper.convertToValueType(
+ cmHandleQueryApiParameters, CmHandleQueryServiceParameters.class);
- validateCmHandleQueryParameters(cmHandleQueryParameters);
+ validateCmHandleQueryParameters(cmHandleQueryServiceParameters);
- return networkCmProxyCmHandlerQueryService.queryCmHandles(cmHandleQueryParameters).stream()
+ return networkCmProxyCmHandlerQueryService.queryCmHandles(cmHandleQueryServiceParameters).stream()
.map(dataNode -> YangDataConverter
.convertCmHandleToYangModel(dataNode, dataNode.getLeaves().get("id").toString()))
.map(YangDataConverter::convertYangModelCmHandleToNcmpServiceCmHandle).collect(Collectors.toSet());