import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
+import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintRuntimeService
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import org.slf4j.LoggerFactory
private val log = LoggerFactory.getLogger(ResourceResolutionDBService::class.toString())
suspend fun findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKeyAndOccurrence(
- bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ bluePrintRuntimeService: BlueprintRuntimeService<*>,
key: String,
occurrence: Int,
artifactPrefix: String
return try {
val metadata = bluePrintRuntimeService.bluePrintContext().metadata!!
- val blueprintVersion = metadata[BluePrintConstants.METADATA_TEMPLATE_VERSION]!!
- val blueprintName = metadata[BluePrintConstants.METADATA_TEMPLATE_NAME]!!
+ val blueprintVersion = metadata[BlueprintConstants.METADATA_TEMPLATE_VERSION]!!
+ val blueprintName = metadata[BlueprintConstants.METADATA_TEMPLATE_NAME]!!
resourceResolutionRepository.findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKeyAndOccurrence(
blueprintName,
}
suspend fun findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResourceIdAndResourceTypeAndOccurrence(
- bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ bluePrintRuntimeService: BlueprintRuntimeService<*>,
resourceId: String,
resourceType: String,
occurrence: Int,
val metadata = bluePrintRuntimeService.bluePrintContext().metadata!!
- val blueprintVersion = metadata[BluePrintConstants.METADATA_TEMPLATE_VERSION]!!
- val blueprintName = metadata[BluePrintConstants.METADATA_TEMPLATE_NAME]!!
+ val blueprintVersion = metadata[BlueprintConstants.METADATA_TEMPLATE_VERSION]!!
+ val blueprintName = metadata[BlueprintConstants.METADATA_TEMPLATE_NAME]!!
resourceResolutionRepository.findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResourceIdAndResourceTypeAndOccurrence(
blueprintName,
suspend fun write(
properties: Map<String, Any>,
- bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ bluePrintRuntimeService: BlueprintRuntimeService<*>,
artifactPrefix: String,
resourceAssignment: ResourceAssignment
): ResourceResolution = withContext(Dispatchers.IO) {
val metadata = bluePrintRuntimeService.bluePrintContext().metadata!!
- val blueprintVersion = metadata[BluePrintConstants.METADATA_TEMPLATE_VERSION]!!
- val blueprintName = metadata[BluePrintConstants.METADATA_TEMPLATE_NAME]!!
+ val blueprintVersion = metadata[BlueprintConstants.METADATA_TEMPLATE_VERSION]!!
+ val blueprintName = metadata[BlueprintConstants.METADATA_TEMPLATE_NAME]!!
val resolutionKey = properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOLUTION_KEY] as String
val resourceId = properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_ID] as String
resourceResolution.resourceType = resourceType
resourceResolution.resourceId = resourceId
resourceResolution.value = resourceAssignment.property?.value?.let {
- if (BluePrintConstants.STATUS_SUCCESS == resourceAssignment.status)
+ if (BlueprintConstants.STATUS_SUCCESS == resourceAssignment.status)
JacksonUtils.getValue(it).toString()
else ""
} ?: ""
resourceResolution.dictionaryName = resourceAssignment.dictionaryName
resourceResolution.dictionaryVersion = resourceAssignment.version
resourceResolution.dictionarySource = resourceAssignment.dictionarySource
- resourceResolution.status = resourceAssignment.status ?: BluePrintConstants.STATUS_FAILURE
+ resourceResolution.status = resourceAssignment.status ?: BlueprintConstants.STATUS_FAILURE
try {
resourceResolutionRepository.saveAndFlush(resourceResolution)
} catch (ex: Exception) {
- throw BluePrintException("Failed to store resource resolution result.", ex)
+ throw BlueprintException("Failed to store resource resolution result.", ex)
}
}