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 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'ms/blueprintsprocessor/modules/blueprints/blueprint-core/src') 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)") } -- cgit 1.2.3-korg