summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/src/main')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverter.java12
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java4
2 files changed, 12 insertions, 4 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverter.java
index 8cc5868341..bf42af8322 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverter.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverter.java
@@ -322,7 +322,7 @@ public class CapabilityRequirementConverter {
(StringUtils.isEmpty(r.getExternalName()) ?
addEntry(componentsCache, toscaRequirements, component, new SubstitutionEntry(r.getName(), r.getParentName(), ""),
r.getPreviousName(), r.getOwnerId(), r.getPath()):
- addEntry(componentsCache, toscaRequirements, component, new SubstitutionEntry(r.getExternalName(), r.getName(), ""),
+ addEntry(componentsCache, toscaRequirements, component, new SubstitutionEntry(r.getExternalName(), r.getPreviousName() == null ? r.getName(): r.getPreviousName(), ""),
r.getPreviousName(), r.getOwnerId(), r.getPath(), false))
).findAny();
}
@@ -667,7 +667,15 @@ public class CapabilityRequirementConverter {
* @return
*/
public Either<String, Boolean> buildSubstitutedName(Map<String, Component> componentsCache, Component originComponent, List<String> path,
- String name, String previousName) {
+ String name, String previousName) {
+ return buildSubstitutedName(componentsCache, originComponent, path, name, previousName, null);
+ }
+
+ public Either<String, Boolean> buildSubstitutedName(Map<String, Component> componentsCache, Component originComponent, List<String> path,
+ String name, String previousName, String externalName) {
+ if (StringUtils.isNotEmpty(externalName)) {
+ return Either.left(externalName);
+ }
if (StringUtils.isNotEmpty(previousName)) {
return Either.left(name);
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java
index 1b27857869..6a1ba4ef63 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java
@@ -1379,7 +1379,7 @@ public class ToscaExportHandler {
}
final RelationshipInfo relationshipInfo = capabilityRequirementRelationship.getRelation();
final Either<String, Boolean> capabilityNameEither = capabilityRequirementConverter.buildSubstitutedName(componentCache,
- toOriginComponent, reducedPath, relationshipInfo.getCapability(), capability.getPreviousName());
+ toOriginComponent, reducedPath, relationshipInfo.getCapability(), capability.getPreviousName(), capability.getExternalName());
if (capabilityNameEither.isRight()) {
final String errorMsg = String.format(
"Failed to build a substituted capability name for the capability with name %s on a component with uniqueId %s",
@@ -1390,7 +1390,7 @@ public class ToscaExportHandler {
}
final Either<String, Boolean> requirementNameEither = capabilityRequirementConverter
.buildSubstitutedName(componentCache, fromOriginComponent,
- requirement.getPath(), relationshipInfo.getRequirement(), requirement.getPreviousName());
+ requirement.getPath(), relationshipInfo.getRequirement(), requirement.getPreviousName(), requirement.getExternalName());
if (requirementNameEither.isRight()) {
final String errorMsg = String.format("Failed to build a substituted requirement name for the requirement "
+ "with name %s on a component with uniqueId %s",