From 359e2a243b5586c2d844b5053279c4569343c5fe Mon Sep 17 00:00:00 2001 From: Oleg Mitsura Date: Thu, 22 Aug 2019 15:05:01 -0400 Subject: allow null type for primitives (to be consistent with validPrimitiveTypes() in BluePrintTypes) TODO: refactor that as well. This should fix the issue with missing values in output-type-mapping breaking execution. Issue-Id: CCSDK-1614 Signed-off-by: Oleg Mitsura Change-Id: Ia209a3bfcdc5fc2ef1179bd46669be2d57426749 --- .../ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'ms/controllerblueprints/modules') diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt index 73dff9379..1f1345327 100644 --- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt +++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt @@ -243,7 +243,8 @@ class JacksonUtils { BluePrintConstants.DATA_TYPE_FLOAT, BluePrintConstants.DATA_TYPE_DOUBLE, BluePrintConstants.DATA_TYPE_TIMESTAMP, - BluePrintConstants.DATA_TYPE_STRING -> + BluePrintConstants.DATA_TYPE_STRING, + BluePrintConstants.DATA_TYPE_NULL -> objectNode.set(key, value) else -> throw BluePrintException("populatePrimitiveValues expected only primitive values! Received: ($value)") } @@ -256,7 +257,9 @@ class JacksonUtils { BluePrintConstants.DATA_TYPE_FLOAT, BluePrintConstants.DATA_TYPE_DOUBLE, BluePrintConstants.DATA_TYPE_TIMESTAMP, - BluePrintConstants.DATA_TYPE_STRING -> arrayNode.add(value) + BluePrintConstants.DATA_TYPE_STRING, + BluePrintConstants.DATA_TYPE_NULL -> + arrayNode.add(value) else -> throw BluePrintException("populatePrimitiveValues expected only primitive values! Received: ($value)") } } @@ -284,7 +287,7 @@ class JacksonUtils { } } - fun populateJsonNodeValues(key: String, nodeValue: JsonNode, type: String, objectNode: ObjectNode) { + fun populateJsonNodeValues(key: String, nodeValue: JsonNode?, type: String, objectNode: ObjectNode) { if (nodeValue == null || nodeValue is NullNode) { objectNode.set(key, nodeValue) } else if (BluePrintTypes.validPrimitiveTypes().contains(type)) { -- cgit 1.2.3-korg