summaryrefslogtreecommitdiffstats
path: root/catalog-be/src
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/src')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java48
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;
}
}
}