From afcd99e9dc0d765758be1d91ab862afa54d244dd Mon Sep 17 00:00:00 2001 From: Brinda Santh Date: Mon, 5 Aug 2019 12:24:33 -0400 Subject: Add class model for workflow and resource data type. Change-Id: Ia42f56541bef0418dddb797c019ecda3afa6983b Issue-ID: CCSDK-1380 Signed-off-by: Brinda Santh --- .../functions/resource/resolution/ResourceDefinitionDSL.kt | 5 +++++ .../functions/resource/resolution/ResourceSourceDSL.kt | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'ms/blueprintsprocessor/functions/resource-resolution/src') diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSL.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSL.kt index 1b02ebe70..141bad619 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSL.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSL.kt @@ -18,6 +18,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate +import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition import org.onap.ccsdk.cds.controllerblueprints.core.dsl.PropertyDefinitionBuilder import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition @@ -73,6 +74,10 @@ class ResourceDefinitionBuilder(private val name: String, private val descriptio resourceDefinition.tags = tags } + fun property(property: PropertyDefinition) { + resourceDefinition.property = property + } + fun property(type: String, required: Boolean) { resourceDefinition.property = PropertyDefinitionBuilder(name, type, required, description).build() } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt index b1d694859..182f3a178 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt @@ -24,6 +24,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType import org.onap.ccsdk.cds.controllerblueprints.core.dsl.AbstractNodeTemplatePropertyImplBuilder import org.onap.ccsdk.cds.controllerblueprints.core.dsl.PropertiesAssignmentBuilder import org.onap.ccsdk.cds.controllerblueprints.core.dsl.nodeType +import kotlin.reflect.KClass fun BluePrintTypes.nodeTypeSourceInput(): NodeType { return nodeType(id = "source-input", version = BluePrintConstants.DEFAULT_VERSION_NUMBER, @@ -311,6 +312,10 @@ class SourceCapabilityNodeTemplateBuilder(id: String, description: String) : property(ComponentScriptExecutor.INPUT_SCRIPT_TYPE, type) } + fun scriptClassReference(scriptClassReference: KClass<*>) { + scriptClassReference(scriptClassReference.qualifiedName!!) + } + fun scriptClassReference(scriptClassReference: String) = scriptClassReference(scriptClassReference.asJsonPrimitive()) fun scriptClassReference(scriptClassReference: JsonNode) { -- cgit 1.2.3-korg