Revert "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 / BluePrintExtensionFunctions.kt
@@ -18,9 +18,9 @@ package org.onap.ccsdk.cds.controllerblueprints.core
 
 import org.onap.ccsdk.cds.controllerblueprints.core.annotations.ArtifactExpression
 import org.onap.ccsdk.cds.controllerblueprints.core.annotations.AttributeExpression
-import org.onap.ccsdk.cds.controllerblueprints.core.annotations.BlueprintsConstrain
-import org.onap.ccsdk.cds.controllerblueprints.core.annotations.BlueprintsDataType
-import org.onap.ccsdk.cds.controllerblueprints.core.annotations.BlueprintsProperty
+import org.onap.ccsdk.cds.controllerblueprints.core.annotations.BluePrintsConstrain
+import org.onap.ccsdk.cds.controllerblueprints.core.annotations.BluePrintsDataType
+import org.onap.ccsdk.cds.controllerblueprints.core.annotations.BluePrintsProperty
 import org.onap.ccsdk.cds.controllerblueprints.core.annotations.DSLExpression
 import org.onap.ccsdk.cds.controllerblueprints.core.annotations.InputExpression
 import org.onap.ccsdk.cds.controllerblueprints.core.annotations.OperationOutputExpression
@@ -41,9 +41,9 @@ import kotlin.reflect.KProperty1
 import kotlin.reflect.KType
 import kotlin.reflect.full.declaredMemberProperties
 
-fun <T : KClass<*>> T.asBlueprintsDataTypes(): DataType {
-    val annotation = this.annotations.filter { it is BlueprintsDataType }.single() as BlueprintsDataType
-    checkNotNull(annotation) { "BlueprintsDataType annotation definition not found" }
+fun <T : KClass<*>> T.asBluePrintsDataTypes(): DataType {
+    val annotation = this.annotations.filter { it is BluePrintsDataType }.single() as BluePrintsDataType
+    checkNotNull(annotation) { "BluePrintsDataType annotation definition not found" }
     val dataType = DataType().apply {
         id = annotation.name
         version = annotation.version
@@ -67,20 +67,20 @@ fun <T> KProperty1<T, *>.asPropertyDefinition(): PropertyDefinition {
     property.id = this.name
     val getter = this.getter
     property.required = !this.returnType.isMarkedNullable
-    property.type = this.returnType.asBlueprintsDataType(this.name)
+    property.type = this.returnType.asBluePrintsDataType(this.name)
     if (this.returnType.arguments.isNotEmpty()) {
         property.entrySchema = this.returnType.entitySchema()
     }
     this.annotations.forEach { fieldAnnotation ->
         // println("Field : ${this.name} : Annotation : $fieldAnnotation")
         when (fieldAnnotation) {
-            is BlueprintsProperty ->
+            is BluePrintsProperty ->
                 property.description = fieldAnnotation.description
             is PropertyDefaultValue ->
                 property.value = fieldAnnotation.value.asJsonType(property.type)
-            is BlueprintsConstrain -> {
+            is BluePrintsConstrain -> {
                 if (property.constraints == null) property.constraints = arrayListOf()
-                property.constraints!!.add(fieldAnnotation.asBlueprintConstraintClause())
+                property.constraints!!.add(fieldAnnotation.asBluePrintConstraintClause())
             }
             is InputExpression -> {
                 property.value = getInput(fieldAnnotation.propertyName)
@@ -117,32 +117,32 @@ fun <T> KProperty1<T, *>.asPropertyDefinition(): PropertyDefinition {
     return property
 }
 
-internal fun BlueprintsConstrain.asBlueprintConstraintClause(): ConstraintClause {
+internal fun BluePrintsConstrain.asBluePrintConstraintClause(): ConstraintClause {
     TODO()
 }
 
 internal fun <T : KType> T.entitySchema(): EntrySchema {
     val entrySchema = EntrySchema()
     if (this.arguments.size == 1) {
-        entrySchema.type = this.arguments[0].type!!.asBlueprintsDataType("")
+        entrySchema.type = this.arguments[0].type!!.asBluePrintsDataType("")
     } else if (this.arguments.size == 2) {
-        entrySchema.type = this.arguments[1].type!!.asBlueprintsDataType("")
+        entrySchema.type = this.arguments[1].type!!.asBluePrintsDataType("")
     }
     return entrySchema
 }
 
-internal fun <T : KType> T.asBlueprintsDataType(propertyName: String): String {
+internal fun <T : KType> T.asBluePrintsDataType(propertyName: String): String {
     val simpleName = (this.classifier as? KClass<*>)?.java?.simpleName
-        ?: throw BlueprintException("filed to get simple name.")
+        ?: throw BluePrintException("filed to get simple name.")
     return when (simpleName) {
-        "String", "Date" -> BlueprintConstants.DATA_TYPE_STRING
-        "int" -> BlueprintConstants.DATA_TYPE_INTEGER
-        "Boolean" -> BlueprintConstants.DATA_TYPE_BOOLEAN
-        "Float" -> BlueprintConstants.DATA_TYPE_FLOAT
-        "Double" -> BlueprintConstants.DATA_TYPE_DOUBLE
-        "List" -> BlueprintConstants.DATA_TYPE_LIST
-        "Map" -> BlueprintConstants.DATA_TYPE_MAP
-        "Object", "JsonNode", "ObjectNode", "ArrayNode" -> BlueprintConstants.DATA_TYPE_JSON
+        "String", "Date" -> BluePrintConstants.DATA_TYPE_STRING
+        "int" -> BluePrintConstants.DATA_TYPE_INTEGER
+        "Boolean" -> BluePrintConstants.DATA_TYPE_BOOLEAN
+        "Float" -> BluePrintConstants.DATA_TYPE_FLOAT
+        "Double" -> BluePrintConstants.DATA_TYPE_DOUBLE
+        "List" -> BluePrintConstants.DATA_TYPE_LIST
+        "Map" -> BluePrintConstants.DATA_TYPE_MAP
+        "Object", "JsonNode", "ObjectNode", "ArrayNode" -> BluePrintConstants.DATA_TYPE_JSON
         else -> simpleName
     }
 }