aboutsummaryrefslogtreecommitdiffstats
path: root/models/src/main/java
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2023-10-03 16:14:05 +0100
committerFrancesco Fiora <francesco.fiora@est.tech>2023-10-03 15:29:30 +0000
commitae980791d1996041592fd45a56cfdce7801cecfa (patch)
treea6dde540ff0e7c0d122eab83310787434d92dcb5 /models/src/main/java
parentbb8c570ba261dedbfc9972bfb08efccd41d130d2 (diff)
Fix minor Sonar Issues for clamp/acm
Issue-ID: POLICY-4834 Change-Id: I17efea9b14bb39d7abbafa4f3b695b0451a08c68 Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'models/src/main/java')
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/document/base/ToscaServiceTemplateValidation.java11
-rwxr-xr-xmodels/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProvider.java4
-rwxr-xr-xmodels/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ProviderUtils.java3
3 files changed, 9 insertions, 9 deletions
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/document/base/ToscaServiceTemplateValidation.java b/models/src/main/java/org/onap/policy/clamp/models/acm/document/base/ToscaServiceTemplateValidation.java
index ff580c7c2..0053ca0ca 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/document/base/ToscaServiceTemplateValidation.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/document/base/ToscaServiceTemplateValidation.java
@@ -38,6 +38,7 @@ import org.onap.policy.models.base.Validated;
public final class ToscaServiceTemplateValidation {
private static final String ROOT_KEY_NAME_SUFFIX = ".Root";
+ private static final String TOPOLOGY_TEMPLATE = "TopologyTemplate";
/**
* validate a serviceTemplate.
@@ -91,9 +92,9 @@ public final class ToscaServiceTemplateValidation {
/**
* Validate ToscaTopologyTemplate.
*
- * @param result
- *
+ * @param result the BeanValidationResult
* @param topologyTemplate the ToscaServiceTemplate
+ * @param toscaCompositionName the name of the ToscaComposition
*/
public static void validateToscaTopologyTemplate(BeanValidationResult result,
DocToscaTopologyTemplate topologyTemplate, String toscaCompositionName) {
@@ -106,14 +107,14 @@ public final class ToscaServiceTemplateValidation {
nodeTemplate -> toscaCompositionName.equals(nodeTemplate.getType()))
.count();
if (acNumber == 0) {
- result.addResult("TopologyTemplate", nodeTemplates, ValidationStatus.INVALID, acNodeTypeNotPresent);
+ result.addResult(TOPOLOGY_TEMPLATE, nodeTemplates, ValidationStatus.INVALID, acNodeTypeNotPresent);
}
if (acNumber > 1) {
- result.addResult("TopologyTemplate", nodeTemplates, ValidationStatus.INVALID, "NodeTemplate with type "
+ result.addResult(TOPOLOGY_TEMPLATE, nodeTemplates, ValidationStatus.INVALID, "NodeTemplate with type "
+ toscaCompositionName + " not allowed to be more than one!");
}
} else {
- result.addResult("TopologyTemplate", topologyTemplate, ValidationStatus.INVALID, acNodeTypeNotPresent);
+ result.addResult(TOPOLOGY_TEMPLATE, topologyTemplate, ValidationStatus.INVALID, acNodeTypeNotPresent);
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProvider.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProvider.java
index a518c4908..a9b9a0cfd 100755
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProvider.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProvider.java
@@ -72,8 +72,8 @@ public class AcDefinitionProvider {
}
acmDefinition.setElementStateMap(AcmUtils.createElementStateMap(acElements, AcTypeState.COMMISSIONED));
var jpaAcmDefinition = ProviderUtils.getJpaAndValidate(acmDefinition, JpaAutomationCompositionDefinition::new,
- "AutomationCompositionDefinition");
- var validationResult = new BeanValidationResult("AutomationCompositionDefinition", acmDefinition);
+ acmDefinition.getClass().getSimpleName());
+ var validationResult = new BeanValidationResult(acmDefinition.getClass().getSimpleName(), acmDefinition);
ToscaServiceTemplateValidation.validate(validationResult, jpaAcmDefinition.getServiceTemplate(),
toscaCompositionName);
if (! validationResult.isValid()) {
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ProviderUtils.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ProviderUtils.java
index 4d4b25b77..6ba6ac016 100755
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ProviderUtils.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ProviderUtils.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation.
+ * Copyright (C) 2021-2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,6 @@ import jakarta.ws.rs.core.Response;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;
-import java.util.stream.Collectors;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.onap.policy.common.parameters.BeanValidationResult;