Renaming Files having BluePrint to have Blueprint
[ccsdk/cds.git] / ms / blueprintsprocessor / modules / blueprints / blueprint-core / src / main / kotlin / org / onap / ccsdk / cds / controllerblueprints / core / service / BlueprintContext.kt
@@ -19,8 +19,8 @@
 package org.onap.ccsdk.cds.controllerblueprints.core.service
 
 import com.fasterxml.jackson.databind.JsonNode
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException
 import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
 import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
 import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityAssignment
@@ -49,7 +49,7 @@ import org.slf4j.LoggerFactory
  *
  * @author Brinda Santh
  */
-class BluePrintContext(val serviceTemplate: ServiceTemplate) {
+class BlueprintContext(val serviceTemplate: ServiceTemplate) {
 
     private val log = LoggerFactory.getLogger(this::class.toString())
 
@@ -86,36 +86,36 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
         return JacksonUtils.getJson(serviceTemplate, pretty)
     }
 
-    fun name(): String = metadata?.get(BluePrintConstants.METADATA_TEMPLATE_NAME)
-        ?: throw BluePrintException("could't get template name from meta data")
+    fun name(): String = metadata?.get(BlueprintConstants.METADATA_TEMPLATE_NAME)
+        ?: throw BlueprintException("could't get template name from meta data")
 
-    fun version(): String = metadata?.get(BluePrintConstants.METADATA_TEMPLATE_VERSION)
-        ?: throw BluePrintException("could't get template version from meta data")
+    fun version(): String = metadata?.get(BlueprintConstants.METADATA_TEMPLATE_VERSION)
+        ?: throw BlueprintException("could't get template version from meta data")
 
-    fun author(): String = metadata?.get(BluePrintConstants.METADATA_TEMPLATE_AUTHOR)
-        ?: throw BluePrintException("could't get template author from meta data")
+    fun author(): String = metadata?.get(BlueprintConstants.METADATA_TEMPLATE_AUTHOR)
+        ?: throw BlueprintException("could't get template author from meta data")
 
     // Workflow
     fun workflows(): MutableMap<String, Workflow>? = serviceTemplate.topologyTemplate?.workflows
 
     fun workflowByName(workFlowName: String): Workflow = workflows()?.get(workFlowName)
-        ?: throw BluePrintException("could't get workflow($workFlowName)")
+        ?: throw BlueprintException("could't get workflow($workFlowName)")
 
     fun workflowInputs(workFlowName: String) = workflowByName(workFlowName).inputs
 
     fun workflowStepByName(workFlowName: String, stepName: String): Step {
         return workflowByName(workFlowName).steps?.get(stepName)
-            ?: throw BluePrintException("could't get step($stepName) for workflow($workFlowName)")
+            ?: throw BlueprintException("could't get step($stepName) for workflow($workFlowName)")
     }
 
     fun workflowStepNodeTemplate(workFlowName: String, stepName: String): String {
         return workflowStepByName(workFlowName, stepName).target
-            ?: throw BluePrintException("could't get node template name for workflow($workFlowName)'s step($stepName)")
+            ?: throw BlueprintException("could't get node template name for workflow($workFlowName)'s step($stepName)")
     }
 
     fun workflowFirstStepNodeTemplate(workFlowName: String): String {
         val firstStepName = workflowByName(workFlowName).steps?.keys?.first()
-            ?: throw BluePrintException("could't get first step for workflow($workFlowName)")
+            ?: throw BlueprintException("could't get first step for workflow($workFlowName)")
         return workflowStepNodeTemplate(workFlowName, firstStepName)
     }
 
@@ -124,12 +124,12 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
             workFlowName,
             stepName
         ).activities?.filter { it.callOperation != null }?.single()?.callOperation
-            ?: throw BluePrintException("couldn't get first callOperation for WorkFlow($workFlowName) ")
+            ?: throw BlueprintException("couldn't get first callOperation for WorkFlow($workFlowName) ")
     }
 
     // DSL
     fun dslPropertiesByName(name: String): JsonNode = dslDefinitions()?.get(name)
-        ?: throw BluePrintException("couldn't get policy type for the dsl($name)")
+        ?: throw BlueprintException("couldn't get policy type for the dsl($name)")
 
     // Data Type
     fun dataTypeByName(name: String): DataType? = dataTypes()?.get(name)
@@ -141,7 +141,7 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
     fun policyTypes(): MutableMap<String, PolicyType>? = serviceTemplate.policyTypes
 
     fun policyTypeByName(policyName: String) = policyTypes()?.get(policyName)
-        ?: throw BluePrintException("could't get policy type for the name($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()
@@ -162,7 +162,7 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
 
     fun nodeTypeByName(name: String): NodeType =
         nodeTypes()?.get(name)
-            ?: throw BluePrintException("could't get node type for the name($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()
@@ -170,7 +170,7 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
 
     fun nodeTypeInterface(nodeTypeName: String, interfaceName: String): InterfaceDefinition {
         return nodeTypeByName(nodeTypeName).interfaces?.get(interfaceName)
-            ?: throw BluePrintException("could't get node type($nodeTypeName)'s interface definition($interfaceName)")
+            ?: throw BlueprintException("could't get node type($nodeTypeName)'s interface definition($interfaceName)")
     }
 
     fun nodeTypeInterfaceOperation(
@@ -179,12 +179,12 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
         operationName: String
     ): OperationDefinition {
         return nodeTypeInterface(nodeTypeName, interfaceName).operations?.get(operationName)
-            ?: throw BluePrintException("could't get node type($nodeTypeName)'s interface definition($interfaceName) operation definition($operationName)")
+            ?: throw BlueprintException("could't get node type($nodeTypeName)'s interface definition($interfaceName) operation definition($operationName)")
     }
 
     fun interfaceNameForNodeType(nodeTypeName: String): String {
         return nodeTypeByName(nodeTypeName).interfaces?.keys?.first()
-            ?: throw BluePrintException("could't get NodeType($nodeTypeName)'s first InterfaceDefinition name")
+            ?: throw BlueprintException("could't get NodeType($nodeTypeName)'s first InterfaceDefinition name")
     }
 
     fun nodeTypeInterfaceOperationInputs(
@@ -207,13 +207,13 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
     fun relationshipTypes(): MutableMap<String, RelationshipType>? = serviceTemplate.relationshipTypes
 
     fun relationshipTypeByName(name: String): RelationshipType = relationshipTypes()?.get(name)
-        ?: throw BluePrintException("could't get relationship type for the name($name)")
+        ?: throw BlueprintException("could't get relationship type for the name($name)")
 
     // Node Template Methods
     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()
@@ -238,27 +238,27 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
 
     fun nodeTemplateArtifact(nodeTemplateName: String, artifactName: String): ArtifactDefinition {
         return checkNodeTemplateArtifact(nodeTemplateName, artifactName)
-            ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s ArtifactDefinition($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)
-            ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s Artifact Type($artifactType)")
+            ?: throw BlueprintException("could't get NodeTemplate($nodeTemplateName)'s Artifact Type($artifactType)")
     }
 
     fun nodeTemplateFirstInterface(nodeTemplateName: String): InterfaceAssignment {
         return nodeTemplateByName(nodeTemplateName).interfaces?.values?.first()
-            ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment")
+            ?: throw BlueprintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment")
     }
 
     fun nodeTemplateFirstInterfaceName(nodeTemplateName: String): String {
         return nodeTemplateByName(nodeTemplateName).interfaces?.keys?.first()
-            ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment name")
+            ?: throw BlueprintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment name")
     }
 
     fun nodeTemplateFirstInterfaceFirstOperationName(nodeTemplateName: String): String {
         return nodeTemplateFirstInterface(nodeTemplateName).operations?.keys?.first()
-            ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment's first OperationAssignment name")
+            ?: throw BlueprintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment's first OperationAssignment name")
     }
 
     fun nodeTemplateOperationImplementation(nodeTemplateName: String, interfaceName: String, operationName: String):
@@ -284,7 +284,7 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
 
     fun nodeTemplateInterface(nodeTemplateName: String, interfaceName: String): InterfaceAssignment {
         return nodeTemplateByName(nodeTemplateName).interfaces?.get(interfaceName)
-            ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s InterfaceAssignment($interfaceName)")
+            ?: throw BlueprintException("could't get NodeTemplate($nodeTemplateName)'s InterfaceAssignment($interfaceName)")
     }
 
     fun nodeTemplateInterfaceOperation(
@@ -293,23 +293,23 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
         operationName: String
     ): OperationAssignment {
         return nodeTemplateInterface(nodeTemplateName, interfaceName).operations?.get(operationName)
-            ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s InterfaceAssignment($interfaceName) OperationAssignment($operationName)")
+            ?: throw BlueprintException("could't get NodeTemplate($nodeTemplateName)'s InterfaceAssignment($interfaceName) OperationAssignment($operationName)")
     }
 
     fun nodeTemplateCapability(nodeTemplateName: String, capabilityName: String): CapabilityAssignment {
         return nodeTemplateByName(nodeTemplateName).capabilities?.get(capabilityName)
-            ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s CapabilityAssignment($capabilityName)")
+            ?: throw BlueprintException("could't get NodeTemplate($nodeTemplateName)'s CapabilityAssignment($capabilityName)")
     }
 
     fun nodeTemplateRequirement(nodeTemplateName: String, requirementName: String): RequirementAssignment {
         return nodeTemplateByName(nodeTemplateName).requirements?.get(requirementName)
-            ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first RequirementAssignment($requirementName)")
+            ?: throw BlueprintException("could't get NodeTemplate($nodeTemplateName)'s first RequirementAssignment($requirementName)")
     }
 
     fun nodeTemplateRequirementNode(nodeTemplateName: String, requirementName: String): NodeTemplate {
         val filteredNodeTemplateName: String =
             nodeTemplateByName(nodeTemplateName).requirements?.get(requirementName)?.node
-                ?: throw BluePrintException("could't NodeTemplate for NodeTemplate's($nodeTemplateName) requirement's ($requirementName) ")
+                ?: throw BlueprintException("could't NodeTemplate for NodeTemplate's($nodeTemplateName) requirement's ($requirementName) ")
         return nodeTemplateByName(filteredNodeTemplateName)
     }
 
@@ -322,7 +322,7 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
         serviceTemplate.topologyTemplate?.relationshipTemplates
 
     fun relationshipTemplateByName(name: String): RelationshipTemplate = relationshipTemplates()?.get(name)
-        ?: throw BluePrintException("could't get relationship template for the name($name)")
+        ?: throw BlueprintException("could't get relationship template for the name($name)")
 
     fun relationshipTemplateProperty(relationshipTemplateName: String, propertyName: String): Any? {
         return nodeTemplateByName(relationshipTemplateName).properties?.get(propertyName)
@@ -341,10 +341,10 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
     // Chained Functions
 
     fun nodeTypeChained(nodeTypeName: String): NodeType {
-        return BluePrintChainedService(this).nodeTypeChained(nodeTypeName)
+        return BlueprintChainedService(this).nodeTypeChained(nodeTypeName)
     }
 
     fun nodeTypeChainedProperties(nodeTypeName: String): MutableMap<String, PropertyDefinition>? {
-        return BluePrintChainedService(this).nodeTypeChainedProperties(nodeTypeName)
+        return BlueprintChainedService(this).nodeTypeChainedProperties(nodeTypeName)
     }
 }