aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions/resource-resolution
diff options
context:
space:
mode:
authorkuldipr <kuldip.rai@amdocs.com>2022-06-17 12:18:35 -0400
committerJozsef Csongvai <jozsef.csongvai@bell.ca>2022-07-12 12:35:22 +0000
commitb6d9f6ed76bfd7db84ee121b63d3e0898b4ea79d (patch)
treef5d76d19315e4624cf9314786c8f612e7c816127 /ms/blueprintsprocessor/functions/resource-resolution
parent5c658a23e4f8d739ef879f7efa708d89fbdf3d29 (diff)
Change template query to return a result when duplicate rows exists
Issue-ID: CCSDK-3714 Change-Id: I516efc75d5d789903883437b6f3b50874bcfc79a Signed-off-by: kuldipr <kuldip.rai@amdocs.com>
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/db/TemplateResolutionRepository.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/db/TemplateResolutionRepository.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionRepository.kt
index 38d61e78d..0d8946ece 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionRepository.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionRepository.kt
@@ -24,6 +24,16 @@ import javax.transaction.Transactional
@Repository
interface TemplateResolutionRepository : JpaRepository<TemplateResolution, String> {
+ @Query(
+ value = """
+ SELECT * FROM TEMPLATE_RESOLUTION
+ WHERE resource_type = :resourceType AND resource_id = :resourceId
+ AND blueprint_name = :blueprintName AND blueprint_version = :blueprintVersion
+ AND artifact_name = :artifactName AND occurrence = :occurrence
+ ORDER BY creation_date DESC LIMIT 1
+ """,
+ nativeQuery = true
+ )
fun findByResourceIdAndResourceTypeAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
resourceId: String,
resourceType: String,
@@ -33,6 +43,15 @@ interface TemplateResolutionRepository : JpaRepository<TemplateResolution, Strin
occurrence: Int
): TemplateResolution?
+ @Query(
+ value = """
+ SELECT * FROM TEMPLATE_RESOLUTION WHERE resolution_key = :key
+ AND blueprint_name = :blueprintName AND blueprint_version = :blueprintVersion
+ AND artifact_name = :artifactName AND occurrence = :occurrence
+ ORDER BY creation_date DESC LIMIT 1
+ """,
+ nativeQuery = true
+ )
fun findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
key: String,
blueprintName: String?,