From 3477cf29e64eab2edf16c1ba3d589519765ada39 Mon Sep 17 00:00:00 2001 From: Jozsef Csongvai Date: Thu, 7 Apr 2022 13:36:27 -0400 Subject: Enable complex data types in service instanceParams Issue-ID: SO-3923 Signed-off-by: Jozsef Csongvai Change-Id: Ibf371c4ffbedd6548a8e9630a9baeb5e2c43d7f4 --- .../java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'mso-api-handlers/mso-api-handler-infra/src') diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java index cddb1ada31..531d87c229 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java @@ -33,7 +33,10 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; @@ -841,7 +844,11 @@ public class RequestHandlerUtils extends AbstractRestHandler { if (params.containsKey("service")) { Service service = serviceMapper(params); - addUserParams(userParams, service.getInstanceParams()); + // Filter out non-string params for backward compatibility + Map svcStrParams = service.getInstanceParams().stream().map(Map::entrySet) + .flatMap(Set::stream).filter(e -> e.getValue() instanceof String) + .collect(Collectors.toMap(Entry::getKey, e -> (String) e.getValue())); + userParams.putAll(svcStrParams); for (Networks network : service.getResources().getNetworks()) { addUserParams(userParams, network.getInstanceParams()); -- cgit 1.2.3-korg