diff options
author | Jozsef Csongvai <jozsef.csongvai@bell.ca> | 2020-12-09 19:49:48 -0500 |
---|---|---|
committer | Jozsef Csongvai <jozsef.csongvai@bell.ca> | 2021-03-17 22:31:31 -0400 |
commit | b96b44d6d7ca11dbbc3ad4bd2194df31fba5efb6 (patch) | |
tree | c10077ebb496410271ca3d07ca8896048c817bd9 /ms/blueprintsprocessor/modules/inbounds/selfservice-api | |
parent | ae588292c67e20c5cae8cb3c899957aac79a676d (diff) |
Refactoring to enable on_failure for imperative workflow
BlueprintError needs to associate errors with the steps in which they occurred
in order for imperative workflow to handle on_failure properly.
Made stepName more accessible and corrected places where stepName was assigned to nodeTemplateName.
Issue-ID: CCSDK-3219
Change-Id: I7e5805745c63558cff6be533e1b99c32ad06c3db
Signed-off-by: Jozsef Csongvai <jozsef.csongvai@bell.ca>
Diffstat (limited to 'ms/blueprintsprocessor/modules/inbounds/selfservice-api')
2 files changed, 3 insertions, 7 deletions
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt index 3d8cc04ef..8c958c4b4 100644 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt @@ -42,7 +42,6 @@ import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintDependencyS import org.onap.ccsdk.cds.controllerblueprints.core.utils.BlueprintMetadataUtils import org.slf4j.LoggerFactory import org.springframework.stereotype.Service -import java.util.stream.Collectors @Service class ExecutionServiceHandler( @@ -119,10 +118,9 @@ class ExecutionServiceHandler( executionServiceInput, hashMapOf() ) - val errors = blueprintRuntimeService.getBlueprintError().errors + val errors = blueprintRuntimeService.getBlueprintError().allErrors() if (errors.isNotEmpty()) { - val errorMessage = errors.stream().map { it.toString() }.collect(Collectors.joining(", ")) - setErrorStatus(errorMessage, executionServiceOutput.status) + setErrorStatus(errors.joinToString(", "), executionServiceOutput.status) } } } catch (e: Exception) { diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/KafkaPublishAuditService.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/KafkaPublishAuditService.kt index 8be43cc94..46befee8a 100644 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/KafkaPublishAuditService.kt +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/KafkaPublishAuditService.kt @@ -169,9 +169,7 @@ class KafkaPublishAuditService( val blueprintRuntimeService = BlueprintMetadataUtils.getBlueprintRuntime(requestId, basePath.toString()) val blueprintContext = blueprintRuntimeService.bluePrintContext() - val workflowSteps = blueprintContext.workflowByName(workflowName).steps - checkNotNull(workflowSteps) { "Failed to get step(s) for workflow($workflowName)" } - workflowSteps.forEach { step -> + blueprintContext.workflowSteps(workflowName).forEach { step -> val nodeTemplateName = step.value.target checkNotNull(nodeTemplateName) { "Failed to get node template target for workflow($workflowName), step($step)" } val nodeTemplate = blueprintContext.nodeTemplateByName(nodeTemplateName) |