diff options
author | Shashikanth VH <shashikanth.vh@huawei.com> | 2022-04-11 12:24:24 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2022-04-11 12:24:24 +0000 |
commit | 131fd74f717f76bc23af1ef935f6e96654f703d6 (patch) | |
tree | e5ce2c096ce3112f96e8f0d5c8226099355387cd /mso-api-handlers/mso-api-handler-infra/src/main/java | |
parent | 9a6d09acbd38c70329377e2ead31900efe773b27 (diff) | |
parent | 3477cf29e64eab2edf16c1ba3d589519765ada39 (diff) |
Merge "Enable complex data types in service instanceParams"
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main/java')
-rw-r--r-- | mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java | 9 |
1 files changed, 8 insertions, 1 deletions
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<String, String> 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()); |