diff options
author | Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com> | 2019-03-25 13:12:24 -0400 |
---|---|---|
committer | Alexis de Talhouƫt <adetalhouet89@gmail.com> | 2019-03-25 14:31:38 -0400 |
commit | b26a869c146e58a014cc3c936f8716b90cd0b84a (patch) | |
tree | 6de2b38a5e12311e6e7124cb2638c63f1eb6c7af /ms/blueprintsprocessor/modules/services/execution-service | |
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/execution-service')
-rw-r--r-- | ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt index d6c1a7c21..35fef96fd 100644 --- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt +++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt @@ -19,7 +19,6 @@ package org.onap.ccsdk.cds.blueprintsprocessor.services.execution import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.node.JsonNodeFactory import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.Status @@ -30,6 +29,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.asObjectNode import org.onap.ccsdk.cds.controllerblueprints.core.getAsString import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintFunctionNode import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.slf4j.LoggerFactory /** @@ -70,10 +70,10 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic log.info("preparing request id($processId) for workflow($workflowName) step($stepName)") - val operationInputs = bluePrintRuntimeService.get("$stepName-step-inputs") - ?: JsonNodeFactory.instance.objectNode() + val stepInputs = bluePrintRuntimeService.get("$stepName-step-inputs") + ?: JacksonUtils.objectMapper.createObjectNode() - operationInputs.fields().forEach { + stepInputs.fields().forEach { this.operationInputs[it.key] = it.value } @@ -98,23 +98,20 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic log.info("Preparing Response...") executionServiceOutput.commonHeader = executionServiceInput.commonHeader executionServiceOutput.actionIdentifiers = executionServiceInput.actionIdentifiers - - // Resolve the Output Expression - val stepOutputs = bluePrintRuntimeService - .resolveNodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName) - - // FIXME("Not the right place to populate the response payload") - executionServiceOutput.payload = stepOutputs.asObjectNode() - - bluePrintRuntimeService.put("$stepName-step-outputs", executionServiceOutput.payload) - - // FIXME("Not the right place to populate the status") - // Populate Status - val status = Status() - status.eventType = EventType.EVENT_COMPONENT_EXECUTED.name - status.code = 200 - status.message = BluePrintConstants.STATUS_SUCCESS - executionServiceOutput.status = status + var status: Status? + try { + // Resolve the Output Expression + val stepOutputs = bluePrintRuntimeService + .resolveNodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName) + + bluePrintRuntimeService.put("$stepName-step-outputs", stepOutputs.asObjectNode()) + // Set the Default Step Status + status = Status() + } catch (e: Exception) { + status = Status() + status.message = BluePrintConstants.STATUS_FAILURE + } + executionServiceOutput.status = status!! return this.executionServiceOutput } |