summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/src/main/java')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java2
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java14
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaNodeTemplate.java1
3 files changed, 16 insertions, 1 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java
index ca4002f26a..2f712e1e7b 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java
@@ -1263,6 +1263,8 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic {
oldComponentInstance.setModificationTime(System.currentTimeMillis());
oldComponentInstance.setCustomizationUUID(UUID.randomUUID().toString());
oldComponentInstance.setDirectives(newComponentInstance.getDirectives());
+ oldComponentInstance.setMaxOccurrences(newComponentInstance.getMaxOccurrences());
+ oldComponentInstance.setMinOccurrences(newComponentInstance.getMinOccurrences());
if (oldComponentInstance.getGroupInstances() != null) {
oldComponentInstance.getGroupInstances().forEach(group -> group.setName(getNewGroupName(oldComponentInstance.getNormalizedName(),
ValidationUtils.normalizeComponentInstanceName(newComponentInstance.getName()), group.getName())));
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 ef63a86d39..5c30d0977c 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
@@ -46,6 +46,7 @@ import java.util.Optional;
import java.util.Set;
import java.util.function.Supplier;
import java.util.stream.Collectors;
+import com.google.common.primitives.Ints;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.io.FilenameUtils;
@@ -912,6 +913,12 @@ public class ToscaExportHandler {
if (MapUtils.isNotEmpty(componentInstance.getToscaArtifacts())) {
nodeTemplate.setArtifacts(convertToNodeTemplateArtifacts(componentInstance.getToscaArtifacts()));
}
+ if (componentInstance.getMinOccurrences() != null && componentInstance.getMaxOccurrences()!= null){
+ List<Object> occur = new ArrayList<Object>();
+ occur.add(parseToIntIfPossible(componentInstance.getMinOccurrences()));
+ occur.add(parseToIntIfPossible(componentInstance.getMaxOccurrences()));
+ nodeTemplate.setOccurrences(occur);
+ }
nodeTemplate.setType(componentInstance.getToscaComponentName());
nodeTemplate.setDirectives(componentInstance.getDirectives());
nodeTemplate.setNode_filter(convertToNodeTemplateNodeFilterComponent(componentInstance.getNodeFilter()));
@@ -1015,7 +1022,12 @@ public class ToscaExportHandler {
log.debug("finish convert topology template for {} for type {}", component.getUniqueId(), component.getComponentType());
return convertNodeTemplatesRes;
}
-
+
+ private Object parseToIntIfPossible(final String value) {
+ final Integer intValue = Ints.tryParse(value);
+ return intValue == null ? value : intValue;
+ }
+
private void handleInstanceInterfaces(
Map<String, List<ComponentInstanceInterface>> componentInstanceInterfaces,
ComponentInstance componentInstance, Map<String, DataTypeDefinition> dataTypes, ToscaNodeTemplate nodeTemplate,
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaNodeTemplate.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaNodeTemplate.java
index f909a9c7b1..0a75870502 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaNodeTemplate.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaNodeTemplate.java
@@ -34,6 +34,7 @@ import org.apache.commons.collections.MapUtils;
public class ToscaNodeTemplate {
private String type;
+ private List<Object> occurrences;
private List<String> directives;
private Map<String, String> metadata;
private String description;