From 86a67360c6cd076c91954892b5c0c49b4cbc1dfa Mon Sep 17 00:00:00 2001 From: "Singal, Kapil (ks220y)" Date: Wed, 5 Feb 2020 14:27:36 -0500 Subject: Refactoring Resource Resolution Service Removing Node Template dependency Issue-ID: CCSDK-2078 Signed-off-by: Singal, Kapil (ks220y) Change-Id: I24f3e003c64f3ee40eee4699366cfadfc1d7147e --- .../cds/controllerblueprints/core/service/BluePrintContext.kt | 10 ++++++---- .../services/workflow/ImperativeWorkflowExecutionService.kt | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'ms/blueprintsprocessor/modules') diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt index a112b6e6c..7c0970202 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt @@ -231,15 +231,17 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) { return nodeTemplateByName(nodeTemplateName).artifacts } - fun nodeTemplateArtifact(nodeTemplateName: String, artifactName: String): ArtifactDefinition { + fun checkNodeTemplateArtifact(nodeTemplateName: String, artifactName: String): ArtifactDefinition? { return nodeTemplateArtifacts(nodeTemplateName)?.get(artifactName) + } + + fun nodeTemplateArtifact(nodeTemplateName: String, artifactName: String): ArtifactDefinition { + return checkNodeTemplateArtifact(nodeTemplateName, artifactName) ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s ArtifactDefinition($artifactName)") } fun nodeTemplateArtifactForArtifactType(nodeTemplateName: String, artifactType: String): ArtifactDefinition { - return nodeTemplateArtifacts(nodeTemplateName)?.filter { it.value.type == artifactType }?.map { it.value }?.get( - 0 - ) + return nodeTemplateArtifacts(nodeTemplateName)?.filter { it.value.type == artifactType }?.map { it.value }?.get(0) ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s Artifact Type($artifactType)") } diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt index ebd9d553d..06100f1fc 100644 --- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt +++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt @@ -144,7 +144,7 @@ open class ImperativeBluePrintWorkflowService(private val nodeTemplateExecutionS nodeInput: ExecutionServiceInput, nodeOutput: ExecutionServiceOutput ): EdgeLabel { - log.info("Executing workflow($workflowName[${this.workflowId}])'s step($${node.id})") + log.info("Executing workflow($workflowName[${this.workflowId}])'s step(${node.id})") val step = bluePrintRuntimeService.bluePrintContext().workflowStepByName(this.workflowName, node.id) checkNotEmpty(step.target) { "couldn't get step target for workflow(${this.workflowName})'s step(${node.id})" } val nodeTemplateName = step.target!! -- cgit 1.2.3-korg