if (oldResource.getCsarUUID() != null) {
newResource.setCsarUUID(oldResource.getCsarUUID());
}
+ if (oldResource.getCsarVersionId() != null) {
+ newResource.setCsarVersionId(oldResource.getCsarVersionId());
+ }
if (oldResource.getImportedToscaChecksum() != null) {
newResource.setImportedToscaChecksum(oldResource.getImportedToscaChecksum());
}
if (oldResource.getCsarUUID() != null) {
newResource.setCsarUUID(oldResource.getCsarUUID());
}
+ if (oldResource.getCsarVersionId() != null) {
+ newResource.setCsarVersionId(oldResource.getCsarVersionId());
+ }
if (oldResource.getImportedToscaChecksum() != null) {
newResource.setImportedToscaChecksum(oldResource.getImportedToscaChecksum());
}
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
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());
}
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;
}
}
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;
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!!!!!
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);
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);
}
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);
this.toscaResourceName = metadata.getToscaResourceName();
this.derivedFrom = derivedFrom;
this.categorySpecificMetadata = metadata.getCategorySpecificMetadata();
+ this.csarVersionId = metadata.getCsarVersionId();
}
}
resourceType: string;
csarUUID: string;
csarVersion: string;
+ csarVersionId: string;
derivedList: string[];
vendorName: string;
vendorRelease: string;
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;
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),