summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorimamSidero <imam.hussain@est.tech>2023-09-19 14:50:51 +0100
committerMichael Morris <michael.morris@est.tech>2023-09-20 08:55:16 +0000
commit32dfc8645ec005aad8d89717e03d525ed97dd614 (patch)
treed3886533c41f976043a7e7a43f68593021142798
parent7bffcb811876bb4f0b3e5b5df27cc0aa6bd96541 (diff)
Bug fix for userspecified output name in import
Fixed the userspecified name to be provided on importing service Issue-ID: SDC-4630 Signed-off-by: Imam hussain <imam.hussain@est.tech> Change-Id: I1191fb4de5566928d356d44eebedd66a51acae07
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/OutputsBusinessLogic.java9
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstanceAttribOutput.java4
2 files changed, 9 insertions, 4 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/OutputsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/OutputsBusinessLogic.java
index ecab6402c6..603270ec0a 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/OutputsBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/OutputsBusinessLogic.java
@@ -300,7 +300,7 @@ public class OutputsBusinessLogic extends BaseBusinessLogic {
final var optionalComponentInstance = component.getComponentInstanceByName(getAttribute.get(0));
if (optionalComponentInstance.isPresent()) {
final var createdOutputs
- = createOutputs(component.getUniqueId(), userId, getAttribute.get(1), optionalComponentInstance.get());
+ = createOutputs(component.getUniqueId(), userId, getAttribute.get(1), optionalComponentInstance.get(),outputDefinitionValue.getName());
if (createdOutputs.isRight()) {
return Either.right((createdOutputs.right().value()));
}
@@ -318,7 +318,8 @@ public class OutputsBusinessLogic extends BaseBusinessLogic {
private Either<List<OutputDefinition>, ResponseFormat> createOutputs(final String componentUniqueId, final String userId,
final String attributeName,
- final ComponentInstance componentInstance) {
+ final ComponentInstance componentInstance,
+ final String outputName) {
// From Instance
final var componentInstanceAttributes = componentInstance.getAttributes();
if (CollectionUtils.isNotEmpty(componentInstanceAttributes)) {
@@ -327,7 +328,7 @@ public class OutputsBusinessLogic extends BaseBusinessLogic {
if (componentInstanceAttributeOptional.isPresent()) {
final var componentInstOutputsMap = new ComponentInstOutputsMap();
componentInstOutputsMap.setComponentInstanceAttributes(Collections.singletonMap(componentInstance.getUniqueId(),
- Collections.singletonList(new ComponentInstanceAttribOutput(componentInstanceAttributeOptional.get()))));
+ Collections.singletonList(new ComponentInstanceAttribOutput(componentInstanceAttributeOptional.get(),outputName))));
return createMultipleOutputs(userId, componentUniqueId, ComponentTypeEnum.SERVICE,
componentInstOutputsMap, true, false);
}
@@ -341,7 +342,7 @@ public class OutputsBusinessLogic extends BaseBusinessLogic {
final ComponentInstOutputsMap componentInstOutputsMap = new ComponentInstOutputsMap();
ComponentInstanceAttribOutput attribute = getComponentInstanceAttribOutput(propertyDefinition);
componentInstOutputsMap.setComponentInstanceAttributes(Collections.singletonMap(componentInstance.getUniqueId(),
- Collections.singletonList(new ComponentInstanceAttribOutput(attribute))));
+ Collections.singletonList(new ComponentInstanceAttribOutput(attribute,outputName))));
return createMultipleOutputs(userId, componentUniqueId, ComponentTypeEnum.SERVICE, componentInstOutputsMap, true, false);
}
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstanceAttribOutput.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstanceAttribOutput.java
index 42ff192ac7..c59a91891a 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstanceAttribOutput.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstanceAttribOutput.java
@@ -37,6 +37,10 @@ public class ComponentInstanceAttribOutput extends ComponentInstanceAttribute {
public ComponentInstanceAttribOutput(ComponentInstanceAttribute p) {
super(p);
}
+ public ComponentInstanceAttribOutput(ComponentInstanceAttribute p,String outputName) {
+ super(p);
+ this.outputName = outputName;
+ }
public String[] getParsedAttribNames() {
String[] tokens = null;