aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2019-06-18 15:16:39 +0000
committerGerrit Code Review <gerrit@onap.org>2019-06-18 15:16:39 +0000
commitda79303b367ed5d4f12a279a401dee379f38147e (patch)
treeae1b052132c498f14c1f668ebcc83fa2d7dc7cf3 /ms/blueprintsprocessor/functions
parent013df49f02fc67ed196072881d703ff8013c3903 (diff)
parentd1e26003105404f974f9fa45d542f658706ad3cb (diff)
Merge "Create REST API layer for resource resolution stored configlet"
Diffstat (limited to 'ms/blueprintsprocessor/functions')
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionResultService.kt32
1 files changed, 22 insertions, 10 deletions
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionResultService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionResultService.kt
index cbc68bbc9..3cb9dec63 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionResultService.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionResultService.kt
@@ -29,6 +29,21 @@ import java.util.*
@Service
class ResourceResolutionResultService(private val resourceResolutionRepository: ResourceResolutionRepository) {
+ suspend fun read(bluePrintRuntimeService: BluePrintRuntimeService<*>, artifactPrefix: String,
+ resolutionKey: String): String = withContext(Dispatchers.IO) {
+
+ val metadata = bluePrintRuntimeService.bluePrintContext().metadata!!
+
+ val blueprintVersion = metadata[BluePrintConstants.METADATA_TEMPLATE_VERSION]
+ val blueprintName = metadata[BluePrintConstants.METADATA_TEMPLATE_NAME]
+
+ resourceResolutionRepository.findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactName(
+ resolutionKey,
+ blueprintName,
+ blueprintVersion,
+ artifactPrefix).result!!
+ }
+
suspend fun write(properties: Map<String, Any>, result: String, bluePrintRuntimeService: BluePrintRuntimeService<*>,
artifactPrefix: String) = withContext(Dispatchers.IO) {
@@ -50,18 +65,15 @@ class ResourceResolutionResultService(private val resourceResolutionRepository:
}
}
- suspend fun read(bluePrintRuntimeService: BluePrintRuntimeService<*>, artifactPrefix: String,
- resolutionKey: String): String = withContext(Dispatchers.IO) {
+ suspend fun readByKey(resolutionResultId: String): String = withContext(Dispatchers.IO) {
- val metadata = bluePrintRuntimeService.bluePrintContext().metadata!!
+ resourceResolutionRepository.getOne(resolutionResultId).result!!
+ }
- val blueprintVersion = metadata[BluePrintConstants.METADATA_TEMPLATE_VERSION]
- val blueprintName = metadata[BluePrintConstants.METADATA_TEMPLATE_NAME]
+ suspend fun deleteByKey(resolutionResultId: String): Unit = withContext(Dispatchers.IO) {
- resourceResolutionRepository.findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactName(
- resolutionKey,
- blueprintName,
- blueprintVersion,
- artifactPrefix).result!!
+ val row = resourceResolutionRepository.getOne(resolutionResultId)
+ resourceResolutionRepository.delete(row)
+ resourceResolutionRepository.flush()
}
} \ No newline at end of file