diff options
author | andre.schmid <andre.schmid@est.tech> | 2021-09-17 18:57:23 +0100 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2021-09-20 07:28:42 +0000 |
commit | 0ef5f83fbe6f68cbde5530b5d58d96cac285cfa7 (patch) | |
tree | 7dbe40191ff174b5cfad39fa205a80555f733984 /catalog-dao/src/main | |
parent | d6b83fce723703f4dea0bce3675ecbf6996aaf9a (diff) |
Fix update VSP missing VSP version id
Fills the gaps of persisting and loading the VSP version id
Change-Id: I4d6c63bd2309777fdfb337cf98c1a0f9daaa434b
Issue-ID: SDC-3731
Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'catalog-dao/src/main')
3 files changed, 25 insertions, 18 deletions
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionary.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionary.java index 03016f793f..145bcbdbc0 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionary.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionary.java @@ -65,6 +65,7 @@ public enum GraphPropertiesDictionary { ENTRY_SCHEMA ("entry_schema", String.class, false, false), CSAR_UUID ("csarUuid", String.class, false, true), CSAR_VERSION ("csarVersion", String.class, false, true), + CSAR_VERSION_ID ("csarUuid", String.class, false, true), IMPORTED_TOSCA_CHECKSUM ("importedToscaChecksum", String.class, false, true), GENERATED ("generated", Boolean.class, false, false), // User diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionaryExtractor.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionaryExtractor.java index ed1dc29942..3b11743050 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionaryExtractor.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionaryExtractor.java @@ -120,6 +120,10 @@ public class GraphPropertiesDictionaryExtractor { return (String) properties.get(GraphPropertiesDictionary.CSAR_VERSION.getProperty()); } + public String getCsarVersionId() { + return (String) properties.get(GraphPropertiesDictionary.CSAR_VERSION_ID.getProperty()); + } + public String getImportedToscaChecksum() { return (String) properties.get(GraphPropertiesDictionary.IMPORTED_TOSCA_CHECKSUM.getProperty()); } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ResourceMetadataData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ResourceMetadataData.java index 5163b00df4..1b5f948c1c 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ResourceMetadataData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ResourceMetadataData.java @@ -36,29 +36,31 @@ public class ResourceMetadataData extends ComponentMetadataData { super(NodeTypeEnum.Resource, metadataDataDefinition); } - public ResourceMetadataData(GraphPropertiesDictionaryExtractor extractor) { + public ResourceMetadataData(final GraphPropertiesDictionaryExtractor extractor) { super(NodeTypeEnum.Resource, new ResourceMetadataDataDefinition(), extractor); - ((ResourceMetadataDataDefinition) metadataDataDefinition).setVendorName(extractor.getVendorName()); - ((ResourceMetadataDataDefinition) metadataDataDefinition).setVendorRelease(extractor.getVendorRelease()); - ((ResourceMetadataDataDefinition) metadataDataDefinition).setResourceType(extractor.getResourceType()); - ((ResourceMetadataDataDefinition) metadataDataDefinition).setAbstract(extractor.isAbstract()); - ((ResourceMetadataDataDefinition) metadataDataDefinition).setCost(extractor.getCost()); - ((ResourceMetadataDataDefinition) metadataDataDefinition).setLicenseType(extractor.getLicenseType()); - ((ResourceMetadataDataDefinition) metadataDataDefinition).setToscaResourceName(extractor.getToscaResourceName()); + final var resourceMetadataDataDefinition = (ResourceMetadataDataDefinition) metadataDataDefinition; + resourceMetadataDataDefinition.setVendorName(extractor.getVendorName()); + resourceMetadataDataDefinition.setVendorRelease(extractor.getVendorRelease()); + resourceMetadataDataDefinition.setResourceType(extractor.getResourceType()); + resourceMetadataDataDefinition.setAbstract(extractor.isAbstract()); + resourceMetadataDataDefinition.setCost(extractor.getCost()); + resourceMetadataDataDefinition.setLicenseType(extractor.getLicenseType()); + resourceMetadataDataDefinition.setToscaResourceName(extractor.getToscaResourceName()); + resourceMetadataDataDefinition.setCsarVersionId(extractor.getCsarVersionId()); } @Override public Map<String, Object> toGraphMap() { - Map<String, Object> graphMap = super.toGraphMap(); - addIfExists(graphMap, GraphPropertiesDictionary.VENDOR_NAME, ((ResourceMetadataDataDefinition) metadataDataDefinition).getVendorName()); - addIfExists(graphMap, GraphPropertiesDictionary.VENDOR_RELEASE, ((ResourceMetadataDataDefinition) metadataDataDefinition).getVendorRelease()); - addIfExists(graphMap, GraphPropertiesDictionary.RESOURCE_TYPE, - ((ResourceMetadataDataDefinition) metadataDataDefinition).getResourceType().name()); - addIfExists(graphMap, GraphPropertiesDictionary.IS_ABSTRACT, ((ResourceMetadataDataDefinition) metadataDataDefinition).isAbstract()); - addIfExists(graphMap, GraphPropertiesDictionary.COST, ((ResourceMetadataDataDefinition) metadataDataDefinition).getCost()); - addIfExists(graphMap, GraphPropertiesDictionary.LICENSE_TYPE, ((ResourceMetadataDataDefinition) metadataDataDefinition).getLicenseType()); - addIfExists(graphMap, GraphPropertiesDictionary.TOSCA_RESOURCE_NAME, - ((ResourceMetadataDataDefinition) metadataDataDefinition).getToscaResourceName()); + final Map<String, Object> graphMap = super.toGraphMap(); + final ResourceMetadataDataDefinition resourceMetadataDataDefinition = (ResourceMetadataDataDefinition) metadataDataDefinition; + addIfExists(graphMap, GraphPropertiesDictionary.VENDOR_NAME, resourceMetadataDataDefinition.getVendorName()); + addIfExists(graphMap, GraphPropertiesDictionary.VENDOR_RELEASE, resourceMetadataDataDefinition.getVendorRelease()); + addIfExists(graphMap, GraphPropertiesDictionary.RESOURCE_TYPE, resourceMetadataDataDefinition.getResourceType().name()); + addIfExists(graphMap, GraphPropertiesDictionary.IS_ABSTRACT, resourceMetadataDataDefinition.isAbstract()); + addIfExists(graphMap, GraphPropertiesDictionary.COST, resourceMetadataDataDefinition.getCost()); + addIfExists(graphMap, GraphPropertiesDictionary.LICENSE_TYPE, resourceMetadataDataDefinition.getLicenseType()); + addIfExists(graphMap, GraphPropertiesDictionary.TOSCA_RESOURCE_NAME, resourceMetadataDataDefinition.getToscaResourceName()); + addIfExists(graphMap, GraphPropertiesDictionary.CSAR_VERSION_ID, resourceMetadataDataDefinition.getCsarVersionId()); return graphMap; } } |