diff options
author | 2019-03-25 13:12:24 -0400 | |
---|---|---|
committer | 2019-03-25 14:31:38 -0400 | |
commit | b26a869c146e58a014cc3c936f8716b90cd0b84a (patch) | |
tree | 6de2b38a5e12311e6e7124cb2638c63f1eb6c7af /ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org | |
parent | 40e79084751b4ef3b6d69189f1edf947fb6af011 (diff) |
Add workflow output processing
Change-Id: Ie1ff465e7fba07bc5280166275a9109fbdded379
Issue-ID: CCSDK-1175
Signed-off-by: Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org')
3 files changed, 14 insertions, 11 deletions
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt index fbd9f4c8b..d8aefe904 100644 --- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt +++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt @@ -20,8 +20,10 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInpu import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.asObjectNode import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintWorkflowExecutionService import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.slf4j.LoggerFactory import org.springframework.stereotype.Service @@ -41,6 +43,10 @@ open class BluePrintWorkflowExecutionServiceImpl( val workflowName = executionServiceInput.actionIdentifiers.actionName + // Assign Workflow inputs + val input = executionServiceInput.payload.get("$workflowName-request") + bluePrintRuntimeService.assignWorkflowInputs(workflowName, input) + // Get the DG Node Template val nodeTemplateName = bluePrintContext.workflowFirstStepNodeTemplate(workflowName) @@ -65,7 +71,12 @@ open class BluePrintWorkflowExecutionServiceImpl( executionServiceOutput.commonHeader = executionServiceInput.commonHeader executionServiceOutput.actionIdentifiers = executionServiceInput.actionIdentifiers - // TODO("Populate Response Payload and status") + // Resolve Workflow Outputs + val workflowOutputs = bluePrintRuntimeService.resolveWorkflowOutputs(workflowName) + + // Set the Response Payload + executionServiceOutput.payload = JacksonUtils.objectMapper.createObjectNode() + executionServiceOutput.payload.set("$workflowName-response", workflowOutputs.asObjectNode()) return executionServiceOutput } diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt index 3b2fc3368..ee6c35397 100644 --- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt +++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt @@ -38,10 +38,6 @@ open class ComponentWorkflowExecutionService(private val nodeTemplateExecutionSe // Get the DG Node Template val nodeTemplateName = bluePrintContext.workflowFirstStepNodeTemplate(workflowName) - // Assign Workflow inputs - val input = executionServiceInput.payload.get("$workflowName-request") - bluePrintRuntimeService.assignWorkflowInputs(workflowName, input) - return nodeTemplateExecutionService.executeNodeTemplate(bluePrintRuntimeService, nodeTemplateName, executionServiceInput) } diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt index 571b6c7c0..80aa1030d 100644 --- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt +++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt @@ -21,10 +21,10 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInpu import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput import org.onap.ccsdk.cds.blueprintsprocessor.services.workflow.utils.SvcGraphUtils import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintWorkflowExecutionService +import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService import org.slf4j.LoggerFactory import org.springframework.stereotype.Service -import java.io.File @Service("dgWorkflowExecutionService") @@ -51,17 +51,13 @@ open class DGWorkflowExecutionService(private val blueprintSvcLogicService: Blue WorkflowServiceConstants.ARTIFACT_TYPE_DIRECTED_GRAPH) // Populate the DG Path - val dgFilePath = bluePrintContext.rootPath.plus(File.separator).plus(artifactDefinition.file) + val dgFilePath = normalizedPathName(bluePrintContext.rootPath, artifactDefinition.file) log.info("Executing directed graph ($dgFilePath)") // Create DG instance val graph = SvcGraphUtils.getSvcGraphFromFile(dgFilePath) - // Assign Workflow inputs - val input = executionServiceInput.payload.get("$workflowName-request") - bluePrintRuntimeService.assignWorkflowInputs(workflowName, input) - // Execute the DG return blueprintSvcLogicService.execute(graph, bluePrintRuntimeService, executionServiceInput) as ExecutionServiceOutput |