aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandre.schmid <andre.schmid@est.tech>2021-09-17 18:57:23 +0100
committerMichael Morris <michael.morris@est.tech>2021-09-20 07:28:42 +0000
commit0ef5f83fbe6f68cbde5530b5d58d96cac285cfa7 (patch)
tree7dbe40191ff174b5cfad39fa205a80555f733984
parentd6b83fce723703f4dea0bce3675ecbf6996aaf9a (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>
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java3
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java3
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionary.java1
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionaryExtractor.java4
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ResourceMetadataData.java38
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java6
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiResourceMetadata.java2
-rw-r--r--catalog-ui/src/app/models/component-metadata.ts2
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java1
11 files changed, 43 insertions, 21 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
index 018deca3ac..9ba20f46a1 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
@@ -3599,6 +3599,9 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
if (oldResource.getCsarUUID() != null) {
newResource.setCsarUUID(oldResource.getCsarUUID());
}
+ if (oldResource.getCsarVersionId() != null) {
+ newResource.setCsarVersionId(oldResource.getCsarVersionId());
+ }
if (oldResource.getImportedToscaChecksum() != null) {
newResource.setImportedToscaChecksum(oldResource.getImportedToscaChecksum());
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java
index 6bb7fdadb9..0c5accad09 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java
@@ -2419,6 +2419,9 @@ public class ServiceImportBusinessLogic {
if (oldResource.getCsarUUID() != null) {
newResource.setCsarUUID(oldResource.getCsarUUID());
}
+ if (oldResource.getCsarVersionId() != null) {
+ newResource.setCsarVersionId(oldResource.getCsarVersionId());
+ }
if (oldResource.getImportedToscaChecksum() != null) {
newResource.setImportedToscaChecksum(oldResource.getImportedToscaChecksum());
}
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;
}
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java
index 78aa4c7cf1..61b11b3168 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java
@@ -590,6 +590,8 @@ public class TopologyTemplateOperation extends ToscaElementOperation {
nodeTypeVertex.setJson(topologyTemplate.getCompositions());
}
nodeTypeVertex.addMetadataProperty(GraphPropertyEnum.CSAR_UUID, topologyTemplate.getMetadataValue(JsonPresentationFields.CSAR_UUID));
+ nodeTypeVertex.addMetadataProperty(GraphPropertyEnum.CSAR_VERSION_UUID,
+ topologyTemplate.getMetadataValue(JsonPresentationFields.CSAR_VERSION_ID));
nodeTypeVertex.addMetadataProperty(GraphPropertyEnum.DISTRIBUTION_STATUS,
topologyTemplate.getMetadataValue(JsonPresentationFields.DISTRIBUTION_STATUS));
return nodeTypeVertex;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java
index b2ccb6d0ac..1c753a5e84 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java
@@ -2432,10 +2432,10 @@ public class ToscaOperationFacade {
log.debug("getLatestResourceByCsarOrName - getByCriteria(by system name) returned 2 latest CERTIFIED versions");
return Either.right(StorageOperationStatus.GENERAL_ERROR);
}
- if (resourceMetadataData.getJsonMetadataField(JsonPresentationFields.CSAR_UUID) != null && !((String) resourceMetadataData
- .getJsonMetadataField(JsonPresentationFields.CSAR_UUID)).equals(csarUUID)) {
+ final Object csarUuid = resourceMetadataData.getJsonMetadataField(JsonPresentationFields.CSAR_UUID);
+ if (csarUuid != null && !csarUuid.equals(csarUUID)) {
log.debug("getLatestResourceByCsarOrName - same system name {} but different csarUUID. exist {} and new {} ", systemName,
- resourceMetadataData.getJsonMetadataField(JsonPresentationFields.CSAR_UUID), csarUUID);
+ csarUuid, csarUUID);
// correct error will be returned from create flow. with all
// correct audit records!!!!!
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java
index 079f5a41fd..9efef3b606 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java
@@ -253,6 +253,7 @@ public class ModelConverter {
TopologyTemplate topologyTemplate = (TopologyTemplate) toscaElement;
if (resource.getResourceType() == ResourceTypeEnum.VF || resource.getResourceType() == ResourceTypeEnum.PNF) {
resource.setCsarUUID((String) topologyTemplate.getMetadataValue(JsonPresentationFields.CSAR_UUID));
+ resource.setCsarVersionId((String) topologyTemplate.getMetadataValue(JsonPresentationFields.CSAR_VERSION_ID));
resource.setCsarVersion((String) topologyTemplate.getMetadataValue(JsonPresentationFields.CSAR_VERSION));
resource.setImportedToscaChecksum((String) topologyTemplate.getMetadataValue(JsonPresentationFields.IMPORTED_TOSCA_CHECKSUM));
convertInterfaces(topologyTemplate, resource);
@@ -1112,6 +1113,7 @@ public class ModelConverter {
topologyTemplate.setResourceType(resource.getResourceType());
topologyTemplate.setMetadataValue(JsonPresentationFields.CSAR_UUID, resource.getCsarUUID());
topologyTemplate.setMetadataValue(JsonPresentationFields.CSAR_VERSION, resource.getCsarVersion());
+ topologyTemplate.setMetadataValue(JsonPresentationFields.CSAR_VERSION_ID, resource.getCsarVersionId());
topologyTemplate.setMetadataValue(JsonPresentationFields.IMPORTED_TOSCA_CHECKSUM, resource.getImportedToscaChecksum());
convertTopologyTemplateInterfaces(resource, topologyTemplate);
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiResourceMetadata.java b/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiResourceMetadata.java
index b8fcc40158..9cc5294f5b 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiResourceMetadata.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiResourceMetadata.java
@@ -43,6 +43,7 @@ public class UiResourceMetadata extends UiComponentMetadata {
private String toscaResourceName;
private List<String> derivedFrom;
private Map<String, String> categorySpecificMetadata;
+ private String csarVersionId;
public UiResourceMetadata(List<CategoryDefinition> categories, List<String> derivedFrom, ResourceMetadataDataDefinition metadata) {
super(categories, metadata);
@@ -55,5 +56,6 @@ public class UiResourceMetadata extends UiComponentMetadata {
this.toscaResourceName = metadata.getToscaResourceName();
this.derivedFrom = derivedFrom;
this.categorySpecificMetadata = metadata.getCategorySpecificMetadata();
+ this.csarVersionId = metadata.getCsarVersionId();
}
}
diff --git a/catalog-ui/src/app/models/component-metadata.ts b/catalog-ui/src/app/models/component-metadata.ts
index 351ae4a79b..2aae97744d 100644
--- a/catalog-ui/src/app/models/component-metadata.ts
+++ b/catalog-ui/src/app/models/component-metadata.ts
@@ -60,6 +60,7 @@ export interface IComponentMetadata {
resourceType: string;
csarUUID: string;
csarVersion: string;
+ csarVersionId: string;
derivedList: string[];
vendorName: string;
vendorRelease: string;
@@ -187,6 +188,7 @@ export class ComponentMetadata implements IComponentMetadata {
this.resourceType = response.resourceType;
this.csarUUID = response.csarUUID;
this.csarVersion = response.csarVersion;
+ this.csarVersionId = response.csarVersionId;
this.state = response.state;
this.ecompGeneratedNaming = response.ecompGeneratedNaming;
this.namingPolicy = response.namingPolicy;
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java
index 1d65d1d70a..ab3a05e560 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java
@@ -44,6 +44,7 @@ public enum GraphPropertyEnum {
IS_ABSTRACT("abstract", Boolean.class, false, true),
INVARIANT_UUID("invariantUuid", String.class, false, true),
CSAR_UUID("csarUuid", String.class, false, true),
+ CSAR_VERSION_UUID("csarVersionUuid", String.class, false, true),
//used for user (old format, no json for users)
USERID("userId", String.class, true, true),
ROLE("role", String.class, false, false),