aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor
diff options
context:
space:
mode:
authorshaaban Altanany <shaaban.eltanany.ext@orange.com>2019-12-17 15:45:51 +0200
committerKAPIL SINGAL <ks220y@att.com>2019-12-24 14:53:21 +0000
commit033e544e10e6c35b9f38c91972eccb7906ecc6c4 (patch)
tree97267bc6d28ba55bca237102837769a15a3e0080 /ms/blueprintsprocessor
parent8fd7adbb9428bc0c14f5f08a321eabd582fbaf48 (diff)
add group notation to resource dictionary
-including changes to (starter-dictionary,test-dictionary)json files -add column in resource dictionary table in database -expose api for getting unique group from resource dictionary table Issue-ID: CCSDK-2004 Signed-off-by: shaaban Altanany <shaaban.eltanany.ext@orange.com> Change-Id: I0998709af2e692717b9b1b4937943c323144594a
Diffstat (limited to 'ms/blueprintsprocessor')
-rw-r--r--ms/blueprintsprocessor/application/src/main/resources/sql/schema.sql1
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt3
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryController.kt6
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt5
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandler.kt6
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepository.kt9
6 files changed, 30 insertions, 0 deletions
diff --git a/ms/blueprintsprocessor/application/src/main/resources/sql/schema.sql b/ms/blueprintsprocessor/application/src/main/resources/sql/schema.sql
index 8bf39eed2..6dcd2af89 100644
--- a/ms/blueprintsprocessor/application/src/main/resources/sql/schema.sql
+++ b/ms/blueprintsprocessor/application/src/main/resources/sql/schema.sql
@@ -69,6 +69,7 @@ CREATE TABLE IF NOT EXISTS configurator.RESOURCE_DICTIONARY (
data_type VARCHAR(100) NOT NULL,
entry_schema VARCHAR(100) NULL DEFAULT NULL,
definition LONGTEXT NOT NULL,
+ resource_dictionary_group VARCHAR(10) NOT NULL,
description LONGTEXT NOT NULL,
tags LONGTEXT NOT NULL,
creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
diff --git a/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt
index 10930ffab..a746abac5 100644
--- a/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt
@@ -34,6 +34,9 @@ open class ResourceDefinition {
var tags: String? = null
+ @JsonProperty(value = "group")
+ lateinit var group: String
+
@JsonProperty(value = "updated-by")
lateinit var updatedBy: String
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryController.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryController.kt
index 562932e23..390207995 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryController.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryController.kt
@@ -71,4 +71,10 @@ open class ResourceDictionaryController(private val resourceDictionaryHandler: R
fun getResourceSourceMapping(): ResourceSourceMapping = runBlocking {
resourceDictionaryHandler.getResourceSourceMapping()
}
+
+ @GetMapping(path = ["/resource_dictionary_group"], produces = [MediaType.APPLICATION_JSON_VALUE])
+ @ResponseBody
+ fun getResourceDictionaryDistinct(): List<String> = runBlocking {
+ resourceDictionaryHandler.getResourceDictionaryDistinct()
+ }
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt
index 209e2bbe8..e91d9e136 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt
@@ -56,6 +56,10 @@ class ResourceDictionary : Serializable {
@Column(name = "entry_schema")
var entrySchema: String? = null
+ @Column(name = "resource_dictionary_group")
+ @ApiModelProperty(required = true)
+ var resourceDictionaryGroup: String? = null
+
@Lob
@Convert(converter = JpaResourceDefinitionConverter::class)
@Column(name = "definition", nullable = false)
@@ -86,6 +90,7 @@ class ResourceDictionary : Serializable {
return "[" + ", name = " + name +
", dataType = " + dataType +
", entrySchema = " + entrySchema +
+ ", resourceDictionaryGroup = " + resourceDictionaryGroup +
", definition =" + definition +
", description = " + description +
", updatedBy = " + updatedBy +
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandler.kt
index af40f56ed..d7563e821 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandler.kt
@@ -89,6 +89,7 @@ class ResourceDictionaryHandler(private val resourceDictionaryRepository: Resour
resourceDictionary.tags = resourceDefinition.tags!!
resourceDefinition.updatedBy = resourceDictionary.updatedBy
+ resourceDictionary.resourceDictionaryGroup = resourceDefinition.group
// Set the Property Definitions
val propertyDefinition = resourceDefinition.property
resourceDictionary.description = propertyDefinition.description!!
@@ -107,6 +108,7 @@ class ResourceDictionaryHandler(private val resourceDictionaryRepository: Resour
dbResourceDictionary.definition = resourceDictionary.definition
dbResourceDictionary.description = resourceDictionary.description
dbResourceDictionary.tags = resourceDictionary.tags
+ dbResourceDictionary.resourceDictionaryGroup = resourceDictionary.resourceDictionaryGroup
dbResourceDictionary.updatedBy = resourceDictionary.updatedBy
dbResourceDictionary.dataType = resourceDictionary.dataType
dbResourceDictionary.entrySchema = resourceDictionary.entrySchema
@@ -143,4 +145,8 @@ class ResourceDictionaryHandler(private val resourceDictionaryRepository: Resour
checkNotEmpty(resourceDictionary.updatedBy) { "DataDictionary Definition updatedBy is missing." }
return true
}
+
+ fun getResourceDictionaryDistinct(): List<String> {
+ return resourceDictionaryRepository.findDistinctByResourceDictionaryGroup()
+ }
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepository.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepository.kt
index da7893861..fea01992b 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepository.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepository.kt
@@ -18,6 +18,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ResourceDictionary
import org.springframework.data.jpa.repository.JpaRepository
+import org.springframework.data.jpa.repository.Query
import org.springframework.stereotype.Repository
/**
@@ -59,4 +60,12 @@ interface ResourceDictionaryRepository : JpaRepository<ResourceDictionary, Strin
* @param name name
*/
fun deleteByName(name: String)
+
+ /**
+ *this method for getting resource dictionary group distinct
+ * (Dictionary library instances)
+ *
+ * */
+ @Query("SELECT distinct resourceDictionary.resourceDictionaryGroup FROM ResourceDictionary resourceDictionary")
+ fun findDistinctByResourceDictionaryGroup(): List<String>
}