package org.onap.ccsdk.cds.controllerblueprints.core.dsl
import com.fasterxml.jackson.databind.JsonNode
-import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
/**
* @author Brinda Santh
*/
-class DSLBlueprintBuilder(
+class DSLBluePrintBuilder(
private val name: String,
private val version: String,
private val author: String,
private val tags: String
) {
- private var dslBlueprint = DSLBlueprint()
+ private var dslBluePrint = DSLBluePrint()
private var metadata: MutableMap<String, String> = hashMapOf()
var properties: MutableMap<String, JsonNode>? = null
var dataTypes: MutableMap<String, DataType> = hashMapOf()
var workflows: MutableMap<String, DSLWorkflow> = hashMapOf()
private fun initMetaData() {
- metadata[BlueprintConstants.METADATA_TEMPLATE_NAME] = name
- metadata[BlueprintConstants.METADATA_TEMPLATE_VERSION] = version
- metadata[BlueprintConstants.METADATA_TEMPLATE_AUTHOR] = author
- metadata[BlueprintConstants.METADATA_TEMPLATE_TAGS] = tags
+ metadata[BluePrintConstants.METADATA_TEMPLATE_NAME] = name
+ metadata[BluePrintConstants.METADATA_TEMPLATE_VERSION] = version
+ metadata[BluePrintConstants.METADATA_TEMPLATE_AUTHOR] = author
+ metadata[BluePrintConstants.METADATA_TEMPLATE_TAGS] = tags
}
fun metadata(id: String, value: String) {
workflows[id] = DSLWorkflowBuilder(id, description).apply(block).build()
}
- fun build(): DSLBlueprint {
+ fun build(): DSLBluePrint {
initMetaData()
- dslBlueprint.metadata = metadata
- dslBlueprint.properties = properties
- dslBlueprint.dataTypes = dataTypes
- dslBlueprint.artifactTypes = artifactTypes
- dslBlueprint.components = components
- dslBlueprint.registryComponents = registryComponents
- dslBlueprint.workflows = workflows
- return dslBlueprint
+ dslBluePrint.metadata = metadata
+ dslBluePrint.properties = properties
+ dslBluePrint.dataTypes = dataTypes
+ dslBluePrint.artifactTypes = artifactTypes
+ dslBluePrint.components = components
+ dslBluePrint.registryComponents = registryComponents
+ dslBluePrint.workflows = workflows
+ return dslBluePrint
}
}
properties!![id] = property
}
- fun implementation(timeout: Int, operationHost: String? = BlueprintConstants.PROPERTY_SELF) {
+ fun implementation(timeout: Int, operationHost: String? = BluePrintConstants.PROPERTY_SELF) {
implementation = Implementation().apply {
this.operationHost = operationHost!!
this.timeout = timeout
properties!![id] = expression.asJsonType()
}
- fun implementation(timeout: Int, operationHost: String? = BlueprintConstants.PROPERTY_SELF) {
+ fun implementation(timeout: Int, operationHost: String? = BluePrintConstants.PROPERTY_SELF) {
implementation = Implementation().apply {
this.operationHost = operationHost!!
this.timeout = timeout
class DSLAttributeDefinitionBuilder(
private val id: String,
- private val type: String? = BlueprintConstants.DATA_TYPE_STRING,
+ private val type: String? = BluePrintConstants.DATA_TYPE_STRING,
private val required: Boolean? = false,
private val expression: JsonNode,
private val description: String? = ""
class DSLPropertyDefinitionBuilder(
private val id: String,
- private val type: String? = BlueprintConstants.DATA_TYPE_STRING,
+ private val type: String? = BluePrintConstants.DATA_TYPE_STRING,
private val required: Boolean? = false,
private val expression: JsonNode,
private val description: String? = ""