aboutsummaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/modules/blueprint-core
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh <brindasanth@in.ibm.com>2019-03-15 17:07:19 -0400
committerMuthuramalingam, Brinda Santh <brindasanth@in.ibm.com>2019-03-15 17:07:19 -0400
commit356b84dca647aab26f560ce01dfd20fb4bc3e1a2 (patch)
tree800b447b73717ffe43a7a7f97ee1a23012ef3942 /ms/controllerblueprints/modules/blueprint-core
parent593e3233ffff0b82a8bdf687ca051666688296a7 (diff)
Add workflow node template enrichment
Change-Id: I15c2db6ab81bae2176d1606157f13416c1fac660 Issue-ID: CCSDK-1168 Signed-off-by: Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/controllerblueprints/modules/blueprint-core')
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt38
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt2
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt2
3 files changed, 21 insertions, 21 deletions
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt
index e2211f7e..ca86c964 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt
@@ -44,15 +44,15 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
*/
var entryDefinition = ""
- val imports: List<ImportDefinition>? = serviceTemplate.imports
+ fun imports(): List<ImportDefinition>? = serviceTemplate.imports
- val dslDefinitions = serviceTemplate.dslDefinitions
+ fun dslDefinitions() = serviceTemplate.dslDefinitions
val metadata: MutableMap<String, String>? = serviceTemplate.metadata
- val dataTypes: MutableMap<String, DataType>? = serviceTemplate.dataTypes
+ fun dataTypes(): MutableMap<String, DataType>? = serviceTemplate.dataTypes
- val inputs: MutableMap<String, PropertyDefinition>? = serviceTemplate.topologyTemplate?.inputs
+ fun inputs(): MutableMap<String, PropertyDefinition>? = serviceTemplate.topologyTemplate?.inputs
fun blueprintJson(pretty: Boolean = false): String = print("json", pretty)
@@ -70,9 +70,9 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
?: throw BluePrintException("could't get template author from meta data")
// Workflow
- val workflows: MutableMap<String, Workflow>? = serviceTemplate.topologyTemplate?.workflows
+ fun workflows(): MutableMap<String, Workflow>? = serviceTemplate.topologyTemplate?.workflows
- fun workflowByName(workFlowName: String): Workflow = workflows?.get(workFlowName)
+ fun workflowByName(workFlowName: String): Workflow = workflows()?.get(workFlowName)
?: throw BluePrintException("could't get workflow($workFlowName)")
fun workflowInputs(workFlowName: String) = workflowByName(workFlowName).inputs
@@ -99,27 +99,27 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
}
// DSL
- fun dslPropertiesByName(name: String): JsonNode = dslDefinitions?.get(name)
+ fun dslPropertiesByName(name: String): JsonNode = dslDefinitions()?.get(name)
?: throw BluePrintException("could't get policy type for the dsl($name)")
// Data Type
- fun dataTypeByName(name: String): DataType? = dataTypes?.get(name)
+ fun dataTypeByName(name: String): DataType? = dataTypes()?.get(name)
// Artifact Type
- val artifactTypes: MutableMap<String, ArtifactType>? = serviceTemplate.artifactTypes
+ fun artifactTypes(): MutableMap<String, ArtifactType>? = serviceTemplate.artifactTypes
// Policy Types
- val policyTypes: MutableMap<String, PolicyType>? = serviceTemplate.policyTypes
+ fun policyTypes(): MutableMap<String, PolicyType>? = serviceTemplate.policyTypes
- fun policyTypeByName(policyName: String) = policyTypes?.get(policyName)
+ fun policyTypeByName(policyName: String) = policyTypes()?.get(policyName)
?: throw BluePrintException("could't get policy type for the name($policyName)")
fun policyTypesDerivedFrom(name: String): MutableMap<String, PolicyType>? {
- return policyTypes?.filterValues { policyType -> policyType.derivedFrom == name }?.toMutableMap()
+ return policyTypes()?.filterValues { policyType -> policyType.derivedFrom == name }?.toMutableMap()
}
fun policyTypesTarget(target: String): MutableMap<String, PolicyType>? {
- return policyTypes?.filterValues { it.targets.contains(target) }?.toMutableMap()
+ return policyTypes()?.filterValues { it.targets.contains(target) }?.toMutableMap()
}
fun policyTypesTargetNDerivedFrom(target: String, derivedFrom: String): MutableMap<String, PolicyType>? {
@@ -129,14 +129,14 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
}
// Node Type Methods
- val nodeTypes: MutableMap<String, NodeType>? = serviceTemplate.nodeTypes
+ fun nodeTypes(): MutableMap<String, NodeType>? = serviceTemplate.nodeTypes
fun nodeTypeByName(name: String): NodeType =
- nodeTypes?.get(name)
+ nodeTypes()?.get(name)
?: throw BluePrintException("could't get node type for the name($name)")
fun nodeTypeDerivedFrom(name: String): MutableMap<String, NodeType>? {
- return nodeTypes?.filterValues { nodeType -> nodeType.derivedFrom == name }?.toMutableMap()
+ return nodeTypes()?.filterValues { nodeType -> nodeType.derivedFrom == name }?.toMutableMap()
}
fun nodeTypeInterface(nodeTypeName: String, interfaceName: String): InterfaceDefinition {
@@ -163,13 +163,13 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
}
// Node Template Methods
- val nodeTemplates: MutableMap<String, NodeTemplate>? = serviceTemplate.topologyTemplate?.nodeTemplates
+ fun nodeTemplates(): MutableMap<String, NodeTemplate>? = serviceTemplate.topologyTemplate?.nodeTemplates
fun nodeTemplateByName(name: String): NodeTemplate =
- nodeTemplates?.get(name) ?: throw BluePrintException("could't get node template for the name($name)")
+ nodeTemplates()?.get(name) ?: throw BluePrintException("could't get node template for the name($name)")
fun nodeTemplateForNodeType(name: String): MutableMap<String, NodeTemplate>? {
- return nodeTemplates?.filterValues { nodeTemplate -> nodeTemplate.type == name }?.toMutableMap()
+ return nodeTemplates()?.filterValues { nodeTemplate -> nodeTemplate.type == name }?.toMutableMap()
}
fun nodeTemplateNodeType(nodeTemplateName: String): NodeType {
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
index c5828073..c16d1ecc 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
@@ -488,7 +488,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
override fun assignInputs(jsonNode: JsonNode) {
log.info("assignInputs from input JSON ({})", jsonNode.toString())
- bluePrintContext.inputs?.forEach { propertyName, property ->
+ bluePrintContext.inputs()?.forEach { propertyName, property ->
val valueNode: JsonNode = jsonNode.at(BluePrintConstants.PATH_DIVIDER + propertyName)
?: NullNode.getInstance()
setInputValue(propertyName, property, valueNode)
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt
index c37d8eea..d20fc553 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt
@@ -49,7 +49,7 @@ object BluePrintRuntimeUtils {
fun assignInputs(bluePrintContext: BluePrintContext, jsonNode: JsonNode, context: MutableMap<String, JsonNode>) {
log.info("assignInputs from input JSON ({})", jsonNode.toString())
- bluePrintContext.inputs?.forEach { propertyName, _ ->
+ bluePrintContext.inputs()?.forEach { propertyName, _ ->
val valueNode: JsonNode = jsonNode.at("/".plus(propertyName)) ?: NullNode.getInstance()
val path = BluePrintConstants.PATH_INPUTS.plus(BluePrintConstants.PATH_DIVIDER).plus(propertyName)