From 7247588ed2ac6b9fb0bd615525ae9347145b66b0 Mon Sep 17 00:00:00 2001 From: jananib Date: Thu, 16 Apr 2020 03:52:31 +0530 Subject: Workflow-spec returning error response Fix workflow-spec query Change-Id: Ic66e2249b73c113cd25bd99c9cf33984520e31df Issue-ID: CCSDK-2181 Signed-off-by: jananib --- .../designer/api/handler/BluePrintModelHandler.kt | 27 +++++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'ms/blueprintsprocessor/modules') diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt index f55fee04b..48ca912da 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt @@ -42,6 +42,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile import org.onap.ccsdk.cds.controllerblueprints.core.deleteNBDir import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType +import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintEnhancerService import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintCompileCache @@ -121,17 +122,29 @@ open class BluePrintModelHandler( workFlowData.inputs = workFlow.inputs workFlowData.outputs = workFlow.outputs - for ((k, v) in workFlow.inputs!!) { - addDataType(v.type, blueprintContext, wfRes) + if (workFlow.inputs != null) { + for ((k, v) in workFlow.inputs!!) { + addPropertyInfo(v, blueprintContext, wfRes) + } } - for ((k, v) in workFlow.outputs!!) { - addDataType(v.type, blueprintContext, wfRes) + if (workFlow.outputs != null) { + for ((k, v) in workFlow.outputs!!) { + addPropertyInfo(v, blueprintContext, wfRes) + } } + wfRes.workFlowData = workFlowData return wfRes } + private fun addPropertyInfo(prop: PropertyDefinition, ctx: BluePrintContext, res: WorkFlowSpecResponse) { + addDataType(prop.type, ctx, res) + if (prop.entrySchema != null && prop.entrySchema!!.type != null) { + addDataType(prop.entrySchema!!.type, ctx, res) + } + } + private fun addDataType(name: String, ctx: BluePrintContext, res: WorkFlowSpecResponse) { var data = ctx.dataTypeByName(name) if (data != null) { @@ -141,8 +154,10 @@ open class BluePrintModelHandler( } private fun addParentDataType(data: DataType, ctx: BluePrintContext, res: WorkFlowSpecResponse) { - for ((k, v) in data.properties!!) { - addDataType(v.type, ctx, res) + if (data.properties != null) { + for ((k, v) in data.properties!!) { + addPropertyInfo(v, ctx, res) + } } } -- cgit 1.2.3-korg