From 83808703f4c1379c331f71d670b5610e2ca395b0 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Fri, 7 Sep 2018 19:20:59 +0000 Subject: Controller Blueprints Microservice Remove Resource Dictionary resource_type, resource_path, sample_values and valid_values parameters. Change-Id: I7ec899e30aaef64130f35eb754a79f9dfc54f71f Issue-ID: CCSDK-488 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../service/DataBaseInitService.java | 34 +++++++-------- .../service/ResourceDictionaryService.java | 4 -- .../service/domain/ResourceDictionary.java | 51 ---------------------- .../validator/ResourceDictionaryValidator.java | 4 -- .../src/main/resources/sql/schema-local.sql | 4 -- .../service/src/main/resources/sql/schema.sql | 4 -- 6 files changed, 16 insertions(+), 85 deletions(-) (limited to 'ms/controllerblueprints/modules/service/src/main') diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java index c6d80cfb..cfcf93d2 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java @@ -157,30 +157,28 @@ public class DataBaseInitService { fileName = file.getFilename(); log.trace("Loading : {}", fileName); String definitionContent = getResourceContent(file); - ResourceDefinition dictionaryDefinition = + ResourceDefinition resourceDefinition = JacksonUtils.readValue(definitionContent, ResourceDefinition.class); - if (dictionaryDefinition != null) { - Preconditions.checkNotNull(dictionaryDefinition.getProperty(), "Failed to get Property Definition"); + if (resourceDefinition != null) { + Preconditions.checkNotNull(resourceDefinition.getProperty(), "Failed to get Property Definition"); ResourceDictionary resourceDictionary = new ResourceDictionary(); - resourceDictionary.setResourcePath(dictionaryDefinition.getResourcePath()); - resourceDictionary.setName(dictionaryDefinition.getName()); - resourceDictionary.setDefinition(dictionaryDefinition); - - resourceDictionary.setResourceType(dictionaryDefinition.getResourceType()); - resourceDictionary.setDescription(dictionaryDefinition.getProperty().getDescription()); - resourceDictionary.setDataType(dictionaryDefinition.getProperty().getType()); - if(dictionaryDefinition.getProperty().getEntrySchema() != null){ - resourceDictionary.setEntrySchema(dictionaryDefinition.getProperty().getEntrySchema().getType()); + resourceDictionary.setName(resourceDefinition.getName()); + resourceDictionary.setDefinition(resourceDefinition); + + Preconditions.checkNotNull(resourceDefinition.getProperty(), "Property field is missing"); + resourceDictionary.setDescription(resourceDefinition.getProperty().getDescription()); + resourceDictionary.setDataType(resourceDefinition.getProperty().getType()); + if(resourceDefinition.getProperty().getEntrySchema() != null){ + resourceDictionary.setEntrySchema(resourceDefinition.getProperty().getEntrySchema().getType()); } - resourceDictionary.setUpdatedBy(dictionaryDefinition.getUpdatedBy()); - if (StringUtils.isBlank(dictionaryDefinition.getTags())) { + resourceDictionary.setUpdatedBy(resourceDefinition.getUpdatedBy()); + if (StringUtils.isBlank(resourceDefinition.getTags())) { resourceDictionary.setTags( - dictionaryDefinition.getName() + ", " + dictionaryDefinition.getUpdatedBy() - + ", " + dictionaryDefinition.getResourceType() + ", " - + dictionaryDefinition.getUpdatedBy()); + resourceDefinition.getName() + ", " + resourceDefinition.getUpdatedBy() + + ", " + resourceDefinition.getUpdatedBy()); } else { - resourceDictionary.setTags(dictionaryDefinition.getTags()); + resourceDictionary.setTags(resourceDefinition.getTags()); } resourceDictionaryService.saveResourceDictionary(resourceDictionary); diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java index 70e43d69..62aa0e29 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java @@ -112,8 +112,6 @@ public class ResourceDictionaryService { // Validate the Resource Definitions resourceDictionaryValidationService.validate(resourceDefinition); - resourceDictionary.setResourceType(resourceDefinition.getResourceType()); - resourceDictionary.setResourcePath(resourceDefinition.getResourcePath()); resourceDictionary.setTags(resourceDefinition.getTags()); resourceDefinition.setUpdatedBy(resourceDictionary.getUpdatedBy()); // Set the Property Definitions @@ -134,8 +132,6 @@ public class ResourceDictionaryService { dbResourceDictionary.setName(resourceDictionary.getName()); dbResourceDictionary.setDefinition(resourceDictionary.getDefinition()); dbResourceDictionary.setDescription(resourceDictionary.getDescription()); - dbResourceDictionary.setResourceType(resourceDictionary.getResourceType()); - dbResourceDictionary.setResourcePath(resourceDictionary.getResourcePath()); dbResourceDictionary.setTags(resourceDictionary.getTags()); dbResourceDictionary.setUpdatedBy(resourceDictionary.getUpdatedBy()); dbResourceDictionary.setDataType(resourceDictionary.getDataType()); diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java index 7af9972a..42c8e83b 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java @@ -43,14 +43,6 @@ public class ResourceDictionary implements Serializable { @ApiModelProperty(required=true) private String name; - @Column(name = "resource_path", nullable = false) - @ApiModelProperty(required=true) - private String resourcePath; - - @Column(name = "resource_type", nullable = false) - @ApiModelProperty(required=true) - private String resourceType; - @Column(name = "data_type", nullable = false) @ApiModelProperty(required=true) private String dataType; @@ -58,14 +50,6 @@ public class ResourceDictionary implements Serializable { @Column(name = "entry_schema") private String entrySchema; - @Lob - @Column(name = "valid_values") - private String validValues; - - @Lob - @Column(name = "sample_value") - private String sampleValue; - @Lob @Convert(converter = JpaResourceDefinitionConverter.class) @Column(name = "definition", nullable = false) @@ -95,11 +79,8 @@ public class ResourceDictionary implements Serializable { @Override public String toString() { String buffer = "[" + ", name = " + name + - ", resourcePath = " + resourcePath + - ", resourceType = " + resourceType + ", dataType = " + dataType + ", entrySchema = " + entrySchema + - ", validValues = " + validValues + ", definition =" + definition + ", description = " + description + ", updatedBy = " + updatedBy + @@ -109,14 +90,6 @@ public class ResourceDictionary implements Serializable { return buffer; } - public String getResourcePath() { - return resourcePath; - } - - public void setResourcePath(String resourcePath) { - this.resourcePath = resourcePath; - } - public String getName() { return name; } @@ -125,14 +98,6 @@ public class ResourceDictionary implements Serializable { this.name = name; } - public String getResourceType() { - return resourceType; - } - - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - public String getDataType() { return dataType; } @@ -149,22 +114,6 @@ public class ResourceDictionary implements Serializable { this.entrySchema = entrySchema; } - public String getValidValues() { - return validValues; - } - - public void setValidValues(String validValues) { - this.validValues = validValues; - } - - public String getSampleValue() { - return sampleValue; - } - - public void setSampleValue(String sampleValue) { - this.sampleValue = sampleValue; - } - public ResourceDefinition getDefinition() { return definition; } diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ResourceDictionaryValidator.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ResourceDictionaryValidator.java index 1c2a7337..57330d90 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ResourceDictionaryValidator.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ResourceDictionaryValidator.java @@ -45,10 +45,6 @@ public class ResourceDictionaryValidator { Preconditions.checkArgument( StringUtils.isNotBlank(resourceDictionary.getName()), "DataDictionary Alias Name Information is missing."); - Preconditions.checkArgument( StringUtils.isNotBlank(resourceDictionary.getResourcePath()), - "DataDictionary Resource Name Information is missing."); - Preconditions.checkArgument( StringUtils.isNotBlank(resourceDictionary.getResourceType()), - "DataDictionary Resource Type Information is missing."); Preconditions.checkNotNull( resourceDictionary.getDefinition(), "DataDictionary Definition Information is missing."); Preconditions.checkArgument( StringUtils.isNotBlank(resourceDictionary.getDescription()), diff --git a/ms/controllerblueprints/modules/service/src/main/resources/sql/schema-local.sql b/ms/controllerblueprints/modules/service/src/main/resources/sql/schema-local.sql index 1ba9c365..47e0cce7 100644 --- a/ms/controllerblueprints/modules/service/src/main/resources/sql/schema-local.sql +++ b/ms/controllerblueprints/modules/service/src/main/resources/sql/schema-local.sql @@ -71,12 +71,8 @@ CREATE TABLE IF NOT EXISTS sdnctl.MODEL_TYPE ( -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS sdnctl.RESOURCE_DICTIONARY ( name VARCHAR(100) NOT NULL, - resource_path VARCHAR(500) NOT NULL, - resource_type VARCHAR(100) NOT NULL, data_type VARCHAR(100) NOT NULL, entry_schema VARCHAR(100) NULL DEFAULT NULL, - valid_values LONGTEXT NULL DEFAULT NULL, - sample_value LONGTEXT NULL DEFAULT NULL, definition LONGTEXT NOT NULL, description LONGTEXT NOT NULL, tags LONGTEXT NOT NULL, diff --git a/ms/controllerblueprints/modules/service/src/main/resources/sql/schema.sql b/ms/controllerblueprints/modules/service/src/main/resources/sql/schema.sql index b884cf34..9c38bec0 100644 --- a/ms/controllerblueprints/modules/service/src/main/resources/sql/schema.sql +++ b/ms/controllerblueprints/modules/service/src/main/resources/sql/schema.sql @@ -66,12 +66,8 @@ CREATE TABLE IF NOT EXISTS configurator.MODEL_TYPE ( -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS configurator.RESOURCE_DICTIONARY ( name VARCHAR(100) NOT NULL, - resource_path VARCHAR(500) NOT NULL, - resource_type VARCHAR(100) NOT NULL, data_type VARCHAR(100) NOT NULL, entry_schema VARCHAR(100) NULL DEFAULT NULL, - valid_values LONGTEXT NULL DEFAULT NULL, - sample_value LONGTEXT NULL DEFAULT NULL, definition LONGTEXT NOT NULL, description LONGTEXT NOT NULL, tags LONGTEXT NOT NULL, -- cgit 1.2.3-korg