aboutsummaryrefslogtreecommitdiffstats
path: root/participant/participant-impl/participant-impl-http/src/main
diff options
context:
space:
mode:
authorRamesh Murugan Iyer <ramesh.murugan.iyer@est.tech>2024-06-17 13:35:35 +0000
committerGerrit Code Review <gerrit@onap.org>2024-06-17 13:35:35 +0000
commit94328f3eb1b573193eb3d201368efee0b9fbb0b6 (patch)
tree154f20a158682d53b2a0051a0ed5187b922fd11c /participant/participant-impl/participant-impl-http/src/main
parent8c76c17a2d589d4e94571f4b6dce40261c0bb62d (diff)
parentca2ee94054c580827fcfc7f07c9db641301d6b9a (diff)
Merge "Remove restarting implementation from participants"
Diffstat (limited to 'participant/participant-impl/participant-impl-http/src/main')
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java17
1 files changed, 8 insertions, 9 deletions
diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java
index 752b8d938..161cf9278 100644
--- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java
+++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java
@@ -36,7 +36,6 @@ import org.onap.policy.clamp.models.acm.concepts.StateChangeResult;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
-import org.onap.policy.models.base.PfModelException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
@@ -76,11 +75,9 @@ public class AutomationCompositionElementHandler extends AcElementListenerV1 {
* @param automationCompositionId the automationComposition Id
* @param element the information on the automation composition element
* @param properties properties Map
- * @throws PfModelException in case of a exception
*/
@Override
- public void deploy(UUID automationCompositionId, AcElementDeploy element, Map<String, Object> properties)
- throws PfModelException {
+ public void deploy(UUID automationCompositionId, AcElementDeploy element, Map<String, Object> properties) {
try {
var configRequest = getConfigRequest(properties);
var restResponseMap = acHttpClient.run(configRequest);
@@ -104,11 +101,13 @@ public class AutomationCompositionElementHandler extends AcElementListenerV1 {
private ConfigRequest getConfigRequest(Map<String, Object> properties) throws AutomationCompositionException {
try {
var configRequest = CODER.convert(properties, ConfigRequest.class);
- var violations = Validation.buildDefaultValidatorFactory().getValidator().validate(configRequest);
- if (!violations.isEmpty()) {
- LOGGER.error("Violations found in the config request parameters: {}", violations);
- throw new AutomationCompositionException(Status.BAD_REQUEST,
- "Constraint violations in the config request");
+ try (var validatorFactory = Validation.buildDefaultValidatorFactory()) {
+ var violations = validatorFactory.getValidator().validate(configRequest);
+ if (!violations.isEmpty()) {
+ LOGGER.error("Violations found in the config request parameters: {}", violations);
+ throw new AutomationCompositionException(Status.BAD_REQUEST,
+ "Constraint violations in the config request");
+ }
}
return configRequest;
} catch (CoderException e) {