aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main
diff options
context:
space:
mode:
authorJvD_Ericsson <jeff.van.dam@est.tech>2022-05-11 10:18:18 +0100
committerMichael Morris <michael.morris@est.tech>2022-05-17 08:27:02 +0000
commit23b75f1807cce5418320d0a25aced64f2c2394ed (patch)
tree5d8288c335e3c7ba53c0d30fc6f7a6a043fc1440 /catalog-be/src/main
parentca30916132c62fa6488b8f891776d262c3eac529 (diff)
Fix interface panel is blank when switched to a different version of a VFC
Issue-ID: SDC-3997 Change-Id: Ibedd863fee39766cdf42edd32bdad7a67f9331cb Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech>
Diffstat (limited to 'catalog-be/src/main')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java10
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMerge.java25
2 files changed, 28 insertions, 7 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 8d12751c07..ef55381974 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
@@ -2853,6 +2853,16 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic {
} else {
origComponent = getOriginComponentFromComponentInstance(newComponentInstance);
newComponentInstance.setName(resResourceInfo.getName());
+ final Either<Component, StorageOperationStatus> getComponentRes = toscaOperationFacade
+ .getToscaFullElement(newComponentInstance.getComponentUid());
+ if (getComponentRes.isRight()) {
+ throw new ByActionStatusComponentException(componentsUtils.convertFromStorageResponse(getComponentRes.right().value()));
+ }
+ final Component component = getComponentRes.left().value();
+ final Map<String, InterfaceDefinition> componentInterfaces = component.getInterfaces();
+ if (MapUtils.isNotEmpty(componentInterfaces)) {
+ componentInterfaces.forEach(newComponentInstance::addInterface);
+ }
}
newComponentInstance.setInvariantName(resResourceInfo.getInvariantName());
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMerge.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMerge.java
index 2d49eaeffe..43da6181cd 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMerge.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMerge.java
@@ -74,18 +74,29 @@ public class ComponentInstanceInterfacesMerge implements ComponentInstanceMergeI
newOperationDef -> prevInstanceInterfaces.stream().filter(in -> in.getUniqueId().equals(newInterfaceDef.getUniqueId())).forEach(
prevInterfaceDef -> prevInterfaceDef.getOperationsMap().values().stream()
.filter(in1 -> in1.getUniqueId().equals(newOperationDef.getUniqueId()))
- .forEach(oldOperationDef -> mergeOperationInputDefinitions(oldOperationDef.getInputs(), newOperationDef.getInputs())))));
+ .forEach(oldOperationDef -> {
+ if(oldOperationDef.getInputs() != null) {
+ if(newOperationDef.getInputs() == null) {
+ newOperationDef.setInputs(new ListDataDefinition<>());
+ }
+ mergeOperationInputDefinitions(oldOperationDef.getInputs(), newOperationDef.getInputs());
+ }
+ }))));
StorageOperationStatus updateStatus = toscaOperationFacade.updateComponentInstanceInterfaces(currentComponent, instanceId);
return componentsUtils.convertFromStorageResponse(updateStatus);
}
private void mergeOperationInputDefinitions(ListDataDefinition<OperationInputDefinition> origInputs,
ListDataDefinition<OperationInputDefinition> newInputs) {
- newInputs.getListToscaDataDefinition()
- .forEach(inp -> origInputs.getListToscaDataDefinition().stream().filter(in -> in.getInputId().equals(inp.getInputId())).forEach(in -> {
- inp.setSourceProperty(in.getSourceProperty());
- inp.setSource(in.getSource());
- inp.setValue(in.getValue());
- }));
+ newInputs.getListToscaDataDefinition().
+ forEach(inp -> origInputs.getListToscaDataDefinition().stream().filter(in -> in.getInputId().equals(inp.getInputId())).
+ forEach(in -> {
+ inp.setSourceProperty(in.getSourceProperty());
+ inp.setSource(in.getSource());
+ inp.setValue(in.getValue());
+ }));
+ origInputs.getListToscaDataDefinition().stream().
+ filter(inp -> newInputs.getListToscaDataDefinition().stream().noneMatch(in -> in.getInputId().equals(inp.getInputId()))).
+ forEach(inp -> newInputs.getListToscaDataDefinition().add(inp));
}
}