aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-model/src/main/java/org
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 /catalog-model/src/main/java/org
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>
Diffstat (limited to 'catalog-model/src/main/java/org')
-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
4 files changed, 9 insertions, 3 deletions
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();
}
}