diff options
Diffstat (limited to 'ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt')
-rw-r--r-- | ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt index 25abcd30b..ebe682611 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt @@ -113,7 +113,7 @@ fun <T : Any?> T.asJsonPrimitive(): JsonNode { is Double -> this.asJsonPrimitive() else -> - throw BlueprintException("$this type is not supported") + throw BluePrintException("$this type is not supported") } } } @@ -121,11 +121,11 @@ fun <T : Any?> T.asJsonPrimitive(): JsonNode { /** Based on Blueprint DataType Convert string value to JsonNode Type **/ fun String.asJsonType(bpDataType: String): JsonNode { return when (bpDataType.toLowerCase()) { - BlueprintConstants.DATA_TYPE_STRING -> this.asJsonPrimitive() - BlueprintConstants.DATA_TYPE_BOOLEAN -> this.toBoolean().asJsonPrimitive() - BlueprintConstants.DATA_TYPE_INTEGER -> this.toInt().asJsonPrimitive() - BlueprintConstants.DATA_TYPE_FLOAT -> this.toFloat().asJsonPrimitive() - BlueprintConstants.DATA_TYPE_DOUBLE -> this.toDouble().asJsonPrimitive() + BluePrintConstants.DATA_TYPE_STRING -> this.asJsonPrimitive() + BluePrintConstants.DATA_TYPE_BOOLEAN -> this.toBoolean().asJsonPrimitive() + BluePrintConstants.DATA_TYPE_INTEGER -> this.toInt().asJsonPrimitive() + BluePrintConstants.DATA_TYPE_FLOAT -> this.toFloat().asJsonPrimitive() + BluePrintConstants.DATA_TYPE_DOUBLE -> this.toDouble().asJsonPrimitive() // For List, Map and Complex Types. else -> this.jsonAsJsonType() } @@ -182,7 +182,7 @@ fun <T : Any> Map<String, *>.castValue(key: String, valueType: KClass<T>): T { if (containsKey(key)) { return get(key) as T } else { - throw BlueprintException("couldn't find the key $key") + throw BluePrintException("couldn't find the key $key") } } @@ -197,7 +197,7 @@ fun JsonNode.asByteArray(): ByteArray { fun <T> JsonNode.asType(clazzType: Class<T>): T { return JacksonUtils.readValue(this, clazzType) - ?: throw BlueprintException("couldn't convert JsonNode of type $clazzType") + ?: throw BluePrintException("couldn't convert JsonNode of type $clazzType") } fun JsonNode.asListOfString(): List<String> { @@ -226,7 +226,7 @@ fun JsonNode.rootFieldsToMap(): MutableMap<String, JsonNode> { } return propertyMap } else { - throw BlueprintException("json node should be Object Node Type") + throw BluePrintException("json node should be Object Node Type") } } @@ -248,19 +248,19 @@ fun MutableMap<String, JsonNode>.putJsonElement(key: String, value: Any) { } fun Map<String, JsonNode>.getAsString(key: String): String { - return this[key]?.asText() ?: throw BlueprintException("couldn't find value for key($key)") + return this[key]?.asText() ?: throw BluePrintException("couldn't find value for key($key)") } fun Map<String, JsonNode>.getAsBoolean(key: String): Boolean { - return this[key]?.asBoolean() ?: throw BlueprintException("couldn't find value for key($key)") + return this[key]?.asBoolean() ?: throw BluePrintException("couldn't find value for key($key)") } fun Map<String, JsonNode>.getAsInt(key: String): Int { - return this[key]?.asInt() ?: throw BlueprintException("couldn't find value for key($key)") + return this[key]?.asInt() ?: throw BluePrintException("couldn't find value for key($key)") } fun Map<String, JsonNode>.getAsDouble(key: String): Double { - return this[key]?.asDouble() ?: throw BlueprintException("couldn't find value for key($key)") + return this[key]?.asDouble() ?: throw BluePrintException("couldn't find value for key($key)") } fun Map<String, JsonNode>.getOptionalAsString(key: String): String? { @@ -285,7 +285,7 @@ inline fun checkEquals(value1: String?, value2: String?, lazyMessage: () -> Any) if (value1.equals(value2, ignoreCase = true)) { return true } else { - throw BlueprintException(lazyMessage().toString()) + throw BluePrintException(lazyMessage().toString()) } } |