aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor
diff options
context:
space:
mode:
authorkuldip Rai <kuldip.rai@bell.ca>2020-10-20 16:37:42 -0400
committerkuldipr <kuldip.rai@amdocs.com>2020-10-28 11:25:22 -0400
commite4eb1fc26edd78b62e9e05d00dc5fec44b2be534 (patch)
treedaa79bb5c85bb9786b5b5372fb582184bdc21559 /ms/blueprintsprocessor
parent3cf2196942c6a5378bb8b2483d7bdd9c0e76ab10 (diff)
Enable retrieving ResourceResolution objects from database in kotlin scripts
Issue-ID: CCSDK-2949 Change-Id: I9605d8cdb2a61cba45c56f3dcc12740d4da0b5c8 Signed-off-by: kuldipr <kuldip.rai@amdocs.com>
Diffstat (limited to 'ms/blueprintsprocessor')
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionExtensions.kt19
1 files changed, 19 insertions, 0 deletions
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionExtensions.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionExtensions.kt
index 6451b8fc8..4774ad57a 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionExtensions.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionExtensions.kt
@@ -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]
*/