From 15f3f0bb8e0cec965a9714e3681fbdee4b19b3c4 Mon Sep 17 00:00:00 2001 From: MichaelMorris Date: Mon, 28 Nov 2022 15:23:52 +0000 Subject: Fix empty interfaces and operations Signed-off-by: MichaelMorris Issue-ID: SDC-4281 Change-Id: I53bd54fea0aca3540dafebc9360fd305dd56128d --- .../sdc/be/tosca/InterfacesOperationsConverter.java | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverter.java index 54e61da41a..3650422afc 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverter.java @@ -273,12 +273,16 @@ public class InterfacesOperationsConverter { final Map operations = interfaceDefinition.getOperations(); final Map toscaOperationMap = new HashMap<>(); for (final Entry operationEntry : operations.entrySet()) { - final ToscaLifecycleOperationDefinition toscaLifecycleOperationDefinition = new ToscaLifecycleOperationDefinition(); - handleInterfaceOperationImplementation(component, componentInstance, isAssociatedComponent, operationEntry.getValue(), - toscaLifecycleOperationDefinition, dataTypes); - toscaLifecycleOperationDefinition.setDescription(operationEntry.getValue().getDescription()); - fillToscaOperationInputs(operationEntry.getValue(), dataTypes, toscaLifecycleOperationDefinition); - toscaOperationMap.put(operationEntry.getValue().getName(), toscaLifecycleOperationDefinition); + if (operationHasAnImplementation(operationEntry.getValue())) { + final ToscaLifecycleOperationDefinition toscaLifecycleOperationDefinition = new ToscaLifecycleOperationDefinition(); + handleInterfaceOperationImplementation(component, componentInstance, isAssociatedComponent, operationEntry.getValue(), + toscaLifecycleOperationDefinition, dataTypes); + if (StringUtils.isNotEmpty(operationEntry.getValue().getDescription())) { + toscaLifecycleOperationDefinition.setDescription(operationEntry.getValue().getDescription()); + } + fillToscaOperationInputs(operationEntry.getValue(), dataTypes, toscaLifecycleOperationDefinition); + toscaOperationMap.put(operationEntry.getValue().getName(), toscaLifecycleOperationDefinition); + } } toscaInterfaceDefinition.setOperations(toscaOperationMap); final Map interfaceInputMap = createInterfaceInputMap(interfaceDefinition, dataTypes); @@ -294,6 +298,10 @@ public class InterfacesOperationsConverter { interfaceDefinitionAsMap.putAll(operationsMap); toscaInterfaceDefinitions.put(getLastPartOfName(interfaceType), interfaceDefinitionAsMap); } + + private boolean operationHasAnImplementation(OperationDataDefinition operation) { + return operation.getImplementation() != null && StringUtils.isNotEmpty(operation.getImplementation().getArtifactName()) && !operation.getImplementation().getArtifactName().equals("''"); + } private void handleInterfaceOperationImplementation(final Component component, final ComponentInstance componentInstance, final boolean isAssociatedComponent, -- cgit 1.2.3-korg