diff options
author | vasraz <vasyl.razinkov@est.tech> | 2021-02-17 12:45:11 +0000 |
---|---|---|
committer | Christophe Closset <christophe.closset@intl.att.com> | 2021-02-25 13:09:03 +0000 |
commit | cb44534e601539dbe1b882da257f9defad57f5f3 (patch) | |
tree | 4b3cee80d749468c09291a6576b5594ef87012f2 /catalog-be/src | |
parent | 0aa493c70aebd63244beeddf0ef22147196c5489 (diff) |
Fix 'not deleting Outputs'
Change-Id: I1a5ab1dec4ab7ec381df157e9c12dc8fa00e82c4
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Issue-ID: SDC-3448
Diffstat (limited to 'catalog-be/src')
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java | 48 |
1 files changed, 29 insertions, 19 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 5729d246cf..a18d8dc8e4 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 @@ -93,6 +93,7 @@ import org.openecomp.sdc.be.model.GroupDefinition; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.InterfaceDefinition; import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.OutputDefinition; import org.openecomp.sdc.be.model.PolicyDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.RelationshipInfo; @@ -1559,6 +1560,17 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } } } + if (CollectionUtils.isNotEmpty(containerComponent.getOutputs())) { + final List<OutputDefinition> outputsToDelete = containerComponent.getOutputs().stream().filter(i -> i.getInstanceUniqueId() != null && i.getInstanceUniqueId().equals(componentInstanceId)).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(outputsToDelete)) { + final StorageOperationStatus deleteOutputsRes = toscaOperationFacade.deleteComponentInstanceOutputsFromTopologyTemplate(containerComponent, outputsToDelete); + if (deleteOutputsRes != StorageOperationStatus.OK) { + log.debug("Failed to delete outputs of the component instance {} from container component. ", componentInstanceId); + throw new ByActionStatusComponentException( + componentsUtils.convertFromStorageResponse(deleteOutputsRes, containerComponentType), componentInstanceId); + } + } + } return deletedInstance; } @@ -3342,25 +3354,23 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { String sourceAttributeName = sourceAttribute.getName(); for (ComponentInstanceAttribute destAttribute : destAttributeList) { if (sourceAttributeName.equals(destAttribute.getName())) { -// if (sourceAttribute.getValue() != null && !sourceAttribute.getValue().isEmpty()) { - log.debug("Start to copy the attribute exists {}", sourceAttributeName); - - sourceAttribute.setUniqueId( - UniqueIdBuilder.buildResourceInstanceUniuqeId( - "attribute" , destComponentInstanceId.split("\\.")[1] , sourceAttributeName)); - - Either<ComponentInstanceAttribute, ResponseFormat> updateAttributeValueEither = - createOrUpdateAttributeValueForCopyPaste(ComponentTypeEnum.SERVICE, - destComponent.getUniqueId(), destComponentInstanceId, sourceAttribute, - userId); - if (updateAttributeValueEither.isRight()) { - log.error("Failed to copy the attribute"); - return Either.right(componentsUtils - .getResponseFormat(ActionStatus.INVALID_CONTENT_PARAM, - "Failed to paste component instance to the canvas, attribute copy")); - } - break; -// } + log.debug("Start to copy the attribute exists {}", sourceAttributeName); + + sourceAttribute.setUniqueId( + UniqueIdBuilder.buildResourceInstanceUniuqeId( + "attribute", destComponentInstanceId.split("\\.")[1], sourceAttributeName)); + + Either<ComponentInstanceAttribute, ResponseFormat> updateAttributeValueEither = + createOrUpdateAttributeValueForCopyPaste(ComponentTypeEnum.SERVICE, + destComponent.getUniqueId(), destComponentInstanceId, sourceAttribute, + userId); + if (updateAttributeValueEither.isRight()) { + log.error("Failed to copy the attribute"); + return Either.right(componentsUtils + .getResponseFormat(ActionStatus.INVALID_CONTENT_PARAM, + "Failed to paste component instance to the canvas, attribute copy")); + } + break; } } } |