aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorJozsef Csongvai <jozsef.csongvai@bell.ca>2022-04-07 13:36:27 -0400
committerJozsef Csongvai <jozsef.csongvai@bell.ca>2022-04-11 02:52:42 +0000
commit3477cf29e64eab2edf16c1ba3d589519765ada39 (patch)
treedf8ffb947b7d92f799d63a2a32388f64b923e3c9 /bpmn
parentd64070d39ee8608c514e6b1e45f1e1e25480c076 (diff)
Enable complex data types in service instanceParams
Issue-ID: SO-3923 Signed-off-by: Jozsef Csongvai <jozsef.csongvai@bell.ca> Change-Id: Ibf371c4ffbedd6548a8e9630a9baeb5e2c43d7f4
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForService.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsUtil.java8
2 files changed, 10 insertions, 2 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForService.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForService.java
index e8c88e00d7..4148a60433 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForService.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForService.java
@@ -20,7 +20,7 @@
package org.onap.so.client.cds;
-import static org.onap.so.client.cds.ConfigureInstanceParamsUtil.applyParamsToObject;
+import static org.onap.so.client.cds.ConfigureInstanceParamsUtil.applyJsonParamsToObject;
import com.google.gson.JsonObject;
import java.util.List;
import java.util.Map;
@@ -49,7 +49,7 @@ public class ConfigureInstanceParamsForService {
Optional<Service> service =
extractServiceFromUserParameters.getServiceFromRequestUserParams(userParamsFromRequest);
- service.map(Service::getInstanceParams).ifPresent(p -> applyParamsToObject(p, jsonObject));
+ service.map(Service::getInstanceParams).ifPresent(p -> applyJsonParamsToObject(p, jsonObject));
} catch (Exception e) {
throw new PayloadGenerationException("Failed to resolve instance parameters", e);
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsUtil.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsUtil.java
index 117fd74498..7e9c885496 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsUtil.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsUtil.java
@@ -20,15 +20,23 @@
package org.onap.so.client.cds;
+import com.google.gson.Gson;
import com.google.gson.JsonObject;
import java.util.List;
import java.util.Map;
public final class ConfigureInstanceParamsUtil {
+ private static final Gson gson = new Gson();
+
public static void applyParamsToObject(List<Map<String, String>> instanceParamsList, JsonObject jsonObject) {
instanceParamsList.stream().flatMap(instanceParamsMap -> instanceParamsMap.entrySet().stream())
.forEachOrdered(entry -> jsonObject.addProperty(entry.getKey(), entry.getValue()));
}
+ public static void applyJsonParamsToObject(List<Map<String, Object>> instanceParamsList, JsonObject jsonObject) {
+ instanceParamsList.stream().flatMap(instanceParamsMap -> instanceParamsMap.entrySet().stream())
+ .forEachOrdered(entry -> jsonObject.add(entry.getKey(), gson.toJsonTree(entry.getValue())));
+ }
+
}