aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions/resource-resolution
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor/functions/resource-resolution')
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt6
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt2
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt2
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt54
4 files changed, 32 insertions, 32 deletions
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt
index 8d21e9a70..2120449ab 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt
@@ -135,7 +135,9 @@ open class DatabaseResourceAssignmentProcessor(
logger.trace("Reference dictionary key (${it.key}) resulted in value ($expressionValue)")
namedParameters[it.key] = expressionValue
}
- logger.info("Parameter information : ($namedParameters)")
+ if (namedParameters.isNotEmpty()) {
+ logger.info("Parameter information : ($namedParameters)")
+ }
return namedParameters
}
@@ -152,7 +154,7 @@ open class DatabaseResourceAssignmentProcessor(
val outputKeyMapping = checkNotNull(sourceProperties.outputKeyMapping) {
"failed to get output-key-mappings for $dName under $dSource properties"
}
- logger.info("Response processing type($type)")
+ logger.info("Response processing type ($type)")
val responseNode = checkNotNull(JacksonUtils.getJsonNode(rows)) {
"Failed to get database query result into Json node."
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt
index af89bcef6..c4c308efb 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt
@@ -51,7 +51,7 @@ abstract class ResourceAssignmentProcessor : BlueprintFunctionNode<ResourceAssig
open fun setFromInput(resourceAssignment: ResourceAssignment): Boolean {
try {
val value = raRuntimeService.getInputValue(resourceAssignment.name)
- if (value.returnNullIfMissing() != null) {
+ if (!value.isNullOrMissing()) {
ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, value)
return true
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt
index dab6ff79f..70da462c4 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt
@@ -133,7 +133,7 @@ open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyS
val outputKeyMapping = checkNotNull(sourceProperties.outputKeyMapping) {
"failed to get output-key-mappings for $dName under $dSource properties"
}
- logger.info("Response processing type($type)")
+ logger.info("Response processing type ($type)")
val responseNode = checkNotNull(JacksonUtils.jsonNode(restResponse).at(path)) {
"Failed to find path ($path) in response ($restResponse)"
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt
index 05e7b6941..688713469 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt
@@ -124,9 +124,7 @@ class ResourceAssignmentUtils {
val resourceProp = checkNotNull(resourceAssignment.property) {
"Failed to populate mandatory resource resource mapping $resourceAssignment"
}
- if (resourceProp.required != null && resourceProp.required!!
- && (resourceProp.value == null || resourceProp.value!!.returnNullIfMissing() == null)
- ) {
+ if (resourceProp.required != null && resourceProp.required!! && resourceProp.value.isNullOrMissing()) {
logger.error("failed to populate mandatory resource mapping ($resourceAssignment)")
throw BluePrintProcessorException("failed to populate mandatory resource mapping ($resourceAssignment)")
}
@@ -244,9 +242,10 @@ class ResourceAssignmentUtils {
val type = resourceAssignment.property!!.type
val valueToPrint = getValueToLog(metadata, responseNode)
- logger.info("For template key (${resourceAssignment.name}) setting value as ($valueToPrint)")
+ logger.info("For template key (${resourceAssignment.name}) trying to get value from responseNode ($valueToPrint)")
return when (type) {
in BluePrintTypes.validPrimitiveTypes() -> {
+ // Primitive Types
parseResponseNodeForPrimitiveTypes(responseNode, outputKeyMapping)
}
in BluePrintTypes.validCollectionTypes() -> {
@@ -268,34 +267,33 @@ class ResourceAssignmentUtils {
responseNode: JsonNode,
outputKeyMapping: MutableMap<String, String>
): JsonNode {
- if (responseNode.isComplexType()) {
- val outputKey = outputKeyMapping.keys.firstOrNull()
- var returnNode = if (responseNode is ArrayNode) {
- val arrayNode = responseNode.toList()
- if (outputKey.isNullOrEmpty()) {
- arrayNode.first()
- } else {
- arrayNode.firstOrNull { element ->
- element.isComplexType() && element.has(outputKeyMapping[outputKey])
- }
- }
- } else {
- responseNode
- }
+ // Return responseNode if is not a Complex Type
+ if (!responseNode.isComplexType()) {
+ return responseNode
+ }
- if (returnNode.isNull() || returnNode!!.isComplexType() && !returnNode.has(outputKeyMapping[outputKey])) {
- throw BluePrintProcessorException("Fail to find output key mapping ($outputKey) in the responseNode.")
- }
- return if (returnNode.isComplexType()) {
- returnNode[outputKeyMapping[outputKey]]
+ val outputKey = outputKeyMapping.keys.firstOrNull()
+ var returnNode = if (responseNode is ArrayNode) {
+ val arrayNode = responseNode.toList()
+ if (outputKey.isNullOrEmpty()) {
+ arrayNode.first()
} else {
- returnNode
+ arrayNode.firstOrNull { element ->
+ element.isComplexType() && element.has(outputKeyMapping[outputKey])
+ }
}
+ } else {
+ responseNode
}
- if (outputKeyMapping.isNotEmpty()) {
- throw BluePrintProcessorException("Fail to find key-value in response node to map output-key-mapping.")
+
+ if (returnNode.isNullOrMissing() || returnNode!!.isComplexType() && !returnNode.has(outputKeyMapping[outputKey])) {
+ throw BluePrintProcessorException("Fail to find output key mapping ($outputKey) in the responseNode.")
+ }
+ return if (returnNode.isComplexType()) {
+ returnNode[outputKeyMapping[outputKey]]
+ } else {
+ returnNode
}
- return responseNode
}
private fun parseResponseNodeForCollection(
@@ -566,7 +564,7 @@ class ResourceAssignmentUtils {
fun getValueToLog(metadata: MutableMap<String, String>?, value: Any): Any {
return if (checkIfLogIsProtected(metadata)) {
- "*************"
+ "******REDACTED******"
} else {
value
}