From 50a9d5df3bb42d204248c7ffc025b4c58d0c6ccb Mon Sep 17 00:00:00 2001 From: Serge Simard Date: Thu, 5 Sep 2019 14:42:43 -0400 Subject: Resource resolution fix + improvement. Fix: Fix for list typed data resolution retrieved from database table. Improvement: exposing occurrence property to template engine; useful, when doing multi-occurrence template generation, to index list data resolved previously. Issue-ID: CCSDK-1693 Signed-off-by: Serge Simard Change-Id: I3a601ebabfcd42c439a515d3fe44ff4fc00b2314 Signed-off-by: Serge Simard --- .../functions/resource/resolution/ResourceResolutionService.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'ms/blueprintsprocessor/functions/resource-resolution') diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt index 641175ca2..51170a9b2 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt @@ -28,6 +28,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.proc import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceDefinitionUtils.createResourceAssignments import org.onap.ccsdk.cds.controllerblueprints.core.* +import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintTemplateService import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils @@ -151,7 +152,9 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica ResourceAssignmentUtils.generateResourceDataForAssignments(resourceAssignments.toList()) resolvedContent = blueprintTemplateService.generateContent(bluePrintRuntimeService, nodeTemplateName, - artifactTemplate, resolvedParamJsonContent) + artifactTemplate, resolvedParamJsonContent, false, + mutableMapOf(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE to + properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE].asJsonPrimitive())) if (isToStore(properties)) { templateResolutionDBService.write(properties, resolvedContent, bluePrintRuntimeService, artifactPrefix) @@ -330,7 +333,9 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica resourceAssignmentList.forEach { if (compareOne(resourceResolution, it)) { log.info("Resource ({}) already resolve: value=({})", it.name, resourceResolution.value) - val value = resourceResolution.value!!.asJsonPrimitive() + + // Make sure to recreate value as per the defined type. + val value = resourceResolution.value!!.asJsonType(it.property!!.type) it.property!!.value = value it.status = resourceResolution.status ResourceAssignmentUtils.setResourceDataValue(it, raRuntimeService, value) -- cgit 1.2.3-korg