summaryrefslogtreecommitdiffstats
path: root/catalog-model/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-model/src/main')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/UploadComponentInstanceInfo.java2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/UploadReqInfo.java23
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java1
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java47
4 files changed, 58 insertions, 15 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/UploadComponentInstanceInfo.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/UploadComponentInstanceInfo.java
index 57652ee162..ef9f1f17e8 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/UploadComponentInstanceInfo.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/UploadComponentInstanceInfo.java
@@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import lombok.Getter;
import lombok.Setter;
+import org.openecomp.sdc.be.ui.model.OperationUi;
@Getter
@Setter
@@ -40,4 +41,5 @@ public class UploadComponentInstanceInfo {
private Map<String, String> requirementsNamesToUpdate;
private Collection<String> directives;
private UploadNodeFilterInfo uploadNodeFilterInfo;
+ private Map<String, List<OperationUi>> operations;
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/UploadReqInfo.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/UploadReqInfo.java
index a3f927925f..b18a8e47a5 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/UploadReqInfo.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/UploadReqInfo.java
@@ -19,6 +19,13 @@
*/
package org.openecomp.sdc.be.model;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@Getter
+@Setter
+@NoArgsConstructor
public class UploadReqInfo extends UploadInfo {
/**
@@ -26,20 +33,6 @@ public class UploadReqInfo extends UploadInfo {
*/
private String capabilityName;
private String node;
+ private String relationshipTemplate;
- public String getCapabilityName() {
- return capabilityName;
- }
-
- public void setCapabilityName(String capabilityName) {
- this.capabilityName = capabilityName;
- }
-
- public String getNode() {
- return node;
- }
-
- public void setNode(String node) {
- this.node = node;
- }
}
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 02fda3c51b..8c08a3d040 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
@@ -2082,6 +2082,7 @@ public class ToscaOperationFacade {
Component updatedComponent = componentEither.left().value();
component.setCapabilities(updatedComponent.getCapabilities());
component.setRequirements(updatedComponent.getRequirements());
+ component.setComponentInstancesRelations(updatedComponent.getComponentInstancesRelations());
component.setComponentInstances(updatedComponent.getComponentInstances());
}
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 6dfaebc947..cfc58671e4 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
@@ -32,6 +32,7 @@ import java.util.Map.Entry;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
+import java.util.UUID;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
@@ -118,6 +119,7 @@ import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum;
import org.openecomp.sdc.be.model.jsonjanusgraph.enums.JsonConstantKeysEnum;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTemplateOperation;
import org.openecomp.sdc.be.model.operations.StorageException;
import org.openecomp.sdc.be.resources.data.ComponentMetadataData;
import org.openecomp.sdc.be.resources.data.ProductMetadataData;
@@ -481,11 +483,56 @@ public class ModelConverter {
requirementCapabilityRelDef.setType(p.getRelation().getRelationship().getType());
requirementCapabilityRelDef.setCapability(p.getRelation().getCapability());
requirementCapabilityRelDef.setOriginUI(relation.isOriginUI());
+ createRelationshipInterfaces(p.getOperations()).ifPresent(requirementCapabilityRelDef::setInterfaces);
relationsList.add(requirementCapabilityRelDef);
});
return relationsList;
}
+ private static Optional<ListDataDefinition<InterfaceDataDefinition>> createRelationshipInterfaces(final List<OperationUi> operationList) {
+ if (CollectionUtils.isEmpty(operationList)) {
+ return Optional.empty();
+ }
+ final ListDataDefinition<InterfaceDataDefinition> interfaceList = new ListDataDefinition<>();
+ final Map<String, List<OperationUi>> operationByInterfaceType = operationList.stream()
+ .collect(Collectors.groupingBy(OperationUi::getInterfaceType));
+ for (final Entry<String, List<OperationUi>> interfaceEntry : operationByInterfaceType.entrySet()) {
+ interfaceList.add(createInterface(interfaceEntry.getKey(), interfaceEntry.getValue()));
+ }
+ return Optional.of(interfaceList);
+ }
+
+ private static InterfaceDataDefinition createInterface(final String interfaceType, final List<OperationUi> operationList) {
+ final InterfaceDataDefinition interfaceDataDefinition = new InterfaceDataDefinition();
+ interfaceDataDefinition.setType(interfaceType);
+ if (CollectionUtils.isNotEmpty(operationList)) {
+ final Map<String, OperationDataDefinition> operationMap = operationList.stream()
+ .collect(Collectors.toMap(OperationUi::getOperationType, ModelConverter::createOperation));
+ interfaceDataDefinition.setOperations(operationMap);
+ }
+ return interfaceDataDefinition;
+ }
+
+ private static OperationDataDefinition createOperation(final OperationUi operation) {
+ final OperationDataDefinition operationDataDefinition = new OperationDataDefinition();
+ operationDataDefinition.setName(operation.getOperationType());
+ operationDataDefinition.setUniqueId(UUID.randomUUID().toString());
+ final ArtifactDataDefinition artifactDataDefinition = (ArtifactDataDefinition) operation.getImplementation();
+ operationDataDefinition.setImplementation(artifactDataDefinition);
+ if (CollectionUtils.isNotEmpty(operation.getInputs())) {
+ final ListDataDefinition<OperationInputDefinition> inputs = new ListDataDefinition<>();
+ operation.getInputs().forEach(input -> {
+ final OperationInputDefinition operationInputDefinition = new OperationInputDefinition();
+ operationInputDefinition.setLabel(input.getName());
+ operationInputDefinition.setType(input.getType());
+ operationInputDefinition.setValue(input.getValue());
+ inputs.add(operationInputDefinition);
+ });
+ operationDataDefinition.setInputs(inputs);
+ }
+ return operationDataDefinition;
+ }
+
private static void convertCapabilities(Component component, TopologyTemplate topologyTemplate) {
convertTopologyTemplateCapabilities(component, topologyTemplate);
if (componentInstancesCapabilitiesExist(component) || groupsCapabilitiesExist(component)) {