summaryrefslogtreecommitdiffstats
path: root/catalog-be
diff options
context:
space:
mode:
authorJvD_Ericsson <jeff.van.dam@est.tech>2022-06-02 10:46:40 +0100
committerMichael Morris <michael.morris@est.tech>2022-06-24 13:17:23 +0000
commit363d9a6fea48bf6f34e4f1d4ecb37d33812c7626 (patch)
tree6d5023023b0f93346ed40e62f6cf3f4bc23792b9 /catalog-be
parent2dcfb0996a8345de5c8be73a5600ee995309664a (diff)
Service Import - Read metadata from csar
Also exports metadata to the tosca template and fixes service metadata not being set when the create button is clicked Issue-ID: SDC-4044 Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech> Change-Id: I6f8428d9ed385335c05e7b994e622229ea00342b
Diffstat (limited to 'catalog-be')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java3
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportManager.java10
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java1
3 files changed, 10 insertions, 4 deletions
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 9a8c181377..dd55ae8612 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
@@ -210,9 +210,6 @@ public class ServiceImportBusinessLogic {
service.setVersion(INITIAL_VERSION);
service.setConformanceLevel(ConfigurationManager.getConfigurationManager().getConfiguration().getToscaConformanceLevel());
service.setDistributionStatus(DistributionStatusEnum.DISTRIBUTION_NOT_APPROVED);
- service.setInstantiationType("A-la-carte");
- service.setEnvironmentContext("General_Revenue-Bearing");
- service.setEcompGeneratedNaming(true);
try {
serviceBusinessLogic.validateServiceBeforeCreate(service, user, auditingAction);
log.debug("enter createService,validateServiceBeforeCreate success");
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportManager.java
index 7958efa3de..6f10aaea9c 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportManager.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportManager.java
@@ -71,7 +71,15 @@ public class ServiceImportManager {
ServiceMetadataDataDefinition serviceMetadataDataDefinition = (ServiceMetadataDataDefinition) service.getComponentMetadataDefinition()
.getMetadataDataDefinition();
serviceMetadataDataDefinition.getServiceVendorModelNumber();
- service.setServiceType("");
+ service.setServiceType(serviceMetaData.getServiceType());
+ service.setServiceRole(serviceMetaData.getServiceRole());
+ service.setNamingPolicy(serviceMetaData.getNamingPolicy());
+ boolean ecompGeneratedNaming = serviceMetaData.getEcompGeneratedNaming() == null
+ || serviceMetaData.getEcompGeneratedNaming().equals("true");
+ service.setEcompGeneratedNaming(ecompGeneratedNaming);
+ service.setServiceFunction(serviceMetaData.getServiceFunction());
+ service.setInstantiationType(serviceMetaData.getInstantiationType());
+ service.setEnvironmentContext(serviceMetaData.getEnvironmentContext());
service.setProjectCode(serviceMetaData.getProjectCode());
service.setModel(serviceMetaData.getModel());
if (serviceMetaData.getVendorName() != null) {
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java
index 586b9f66b9..91d2bd5336 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java
@@ -510,6 +510,7 @@ public class ToscaExportHandler {
toscaMetadata.put(JsonPresentationFields.DESCRIPTION.getPresentation(), component.getDescription());
List<CategoryDefinition> categories = component.getCategories();
CategoryDefinition categoryDefinition = categories.get(0);
+ toscaMetadata.put(JsonPresentationFields.MODEL.getPresentation(), component.getModel());
toscaMetadata.put(JsonPresentationFields.CATEGORY.getPresentation(), categoryDefinition.getName());
if (isInstance) {
toscaMetadata.put(JsonPresentationFields.VERSION.getPresentation(), component.getVersion());