Revert "Renaming Files having BluePrint to have Blueprint"
[ccsdk/cds.git] / ms / blueprintsprocessor / functions / resource-resolution / src / main / kotlin / org / onap / ccsdk / cds / blueprintsprocessor / functions / resource / resolution / ResourceResolutionExtensions.kt
index 6451b8f..4774ad5 100644 (file)
@@ -17,6 +17,8 @@
 package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution
 
 import kotlinx.coroutines.runBlocking
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db.ResourceResolution
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db.ResourceResolutionDBService
 import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction
 import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService
 
@@ -26,6 +28,9 @@ import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyS
 fun BluePrintDependencyService.resourceResolutionService(): ResourceResolutionService =
     instance(ResourceResolutionConstants.SERVICE_RESOURCE_RESOLUTION)
 
+fun BluePrintDependencyService.resourceResolutionDBService(): ResourceResolutionDBService =
+    instance(ResourceResolutionDBService::class.java)
+
 suspend fun AbstractComponentFunction.storedContentFromResolvedArtifactNB(
     resolutionKey: String,
     artifactName: String
@@ -34,6 +39,20 @@ suspend fun AbstractComponentFunction.storedContentFromResolvedArtifactNB(
         .resolveFromDatabase(bluePrintRuntimeService, artifactName, resolutionKey)
 }
 
+suspend fun AbstractComponentFunction.storedResourceResolutionsNB(
+    resolutionKey: String,
+    artifactName: String,
+    occurrence: Int = 1
+): List<ResourceResolution> {
+    return BluePrintDependencyService.resourceResolutionDBService()
+        .findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKeyAndOccurrence(
+            bluePrintRuntimeService,
+            resolutionKey,
+            occurrence,
+            artifactName
+        )
+}
+
 /**
  * Return resolved and mashed artifact content for artifact prefix [artifactPrefix]
  */