From 19ef02e9ad1d5b4550f0663cef2a9a9866266ec0 Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Thu, 28 Feb 2019 09:00:18 -0500 Subject: Use protobuf JsonFormat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of manually parsing Struct to ObjectNode, uses JsonFormat Change-Id: I5a457f10e3d106f189f9636fbcc166b12e3915fd Issue-ID: CCSDK-947 Signed-off-by: Alexis de Talhouët --- .../resource/resolution/utils/ResourceAssignmentUtils.kt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'ms/blueprintsprocessor/functions/resource-resolution/src') diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt index 93b93fecb..1c9a905fd 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt @@ -23,7 +23,13 @@ import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.node.NullNode import com.fasterxml.jackson.databind.node.ObjectNode import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.ResourceAssignmentRuntimeService -import org.onap.ccsdk.apps.controllerblueprints.core.* +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes +import org.onap.ccsdk.apps.controllerblueprints.core.checkNotEmpty +import org.onap.ccsdk.apps.controllerblueprints.core.checkNotEmptyOrThrow +import org.onap.ccsdk.apps.controllerblueprints.core.nullToEmpty +import org.onap.ccsdk.apps.controllerblueprints.core.returnNotEmptyOrThrow import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment @@ -41,13 +47,13 @@ class ResourceAssignmentUtils { val resourceProp = checkNotNull(resourceAssignment.property) { "Failed in setting resource value for resource mapping $resourceAssignment" } checkNotEmptyOrThrow(resourceAssignment.name, "Failed in setting resource value for resource mapping $resourceAssignment") - if (checkNotEmpty(resourceAssignment.dictionaryName)) { + if (resourceAssignment.dictionaryName.isNullOrEmpty()) { resourceAssignment.dictionaryName = resourceAssignment.name logger.warn("Missing dictionary key, setting with template key (${resourceAssignment.name}) as dictionary key (${resourceAssignment.dictionaryName})") } try { - if (checkNotEmpty(resourceProp.type)) { + if (resourceProp.type.isNotEmpty()) { val convertedValue = convertResourceValue(resourceProp.type, value) logger.info("Setting Resource Value ($convertedValue) for Resource Name (${resourceAssignment.dictionaryName}) of type (${resourceProp.type})") setResourceValue(resourceAssignment, raRuntimeService, convertedValue) -- cgit 1.2.3-korg