aboutsummaryrefslogtreecommitdiffstats
path: root/ms
diff options
context:
space:
mode:
authorSerge Simard <serge@agilitae.com>2019-09-05 14:42:43 -0400
committerSerge Simard <serge@agilitae.com>2019-09-05 22:52:03 -0400
commit50a9d5df3bb42d204248c7ffc025b4c58d0c6ccb (patch)
treef46f7fa89537a60638430c5596cd1caad5afd623 /ms
parent23edb472bde9cf4fc119bc538dc51f5e16c9865f (diff)
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 <serge@agilitae.com> Change-Id: I3a601ebabfcd42c439a515d3fe44ff4fc00b2314 Signed-off-by: Serge Simard <serge@agilitae.com>
Diffstat (limited to 'ms')
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt9
1 files changed, 7 insertions, 2 deletions
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)