diff options
author | imamSidero <imam.hussain@est.tech> | 2022-07-21 17:17:38 +0100 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2022-08-02 18:31:02 +0000 |
commit | a9d0bcd206b7a677b82e5e9b497a8b52b38e3a43 (patch) | |
tree | c114c9b85e841609af62a89204fa14576f75b3be /catalog-model/src | |
parent | 4eb2c0d521f2b16b920f27f738cb8ba146c23fdd (diff) |
Enabled configuration of instance name
The given name for the instance dragged and dropped is changed to <type
name>_<instance count>
Signed-off-by: Imam hussain <imam.hussain@est.tech>
Issue-ID: SDC-4109
Change-Id: Ibce6f911480841df496f0e7bb17a6d7cd533e803
Diffstat (limited to 'catalog-model/src')
2 files changed, 8 insertions, 4 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java index 0e7b9f0193..910b9e3afa 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java @@ -1559,7 +1559,11 @@ public class NodeTemplateOperation extends BaseOperation { } private String buildComponentInstanceName(String instanceSuffixNumber, String instanceName) { - return instanceName + " " + (instanceSuffixNumber == null ? 0 : instanceSuffixNumber); + String delimiter = ConfigurationManager.getConfigurationManager().getConfiguration().getComponentInstanceCounterDelimiter(); + if(delimiter == null){ + delimiter = " "; + } + return instanceName + delimiter + (instanceSuffixNumber == null ? 0 : instanceSuffixNumber); } public Either<RequirementCapabilityRelDef, StorageOperationStatus> associateResourceInstances(Component component, String componentId, diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java index 7c34da89f0..02fda3c51b 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java @@ -1323,10 +1323,10 @@ public class ToscaOperationFacade { private Integer getMaxCounterFromNamesAndIds(Component containerComponent, String normalizedName) { List<String> countersInNames = containerComponent.getComponentInstances().stream() .filter(ci -> ci.getNormalizedName() != null && ci.getNormalizedName().startsWith(normalizedName)) - .map(ci -> ci.getNormalizedName().split(normalizedName)[1]).collect(Collectors.toList()); + .map(ci -> ci.getNormalizedName().split(normalizedName)[1].replaceAll("\\D", "")).collect(Collectors.toList()); List<String> countersInIds = containerComponent.getComponentInstances().stream() - .filter(ci -> ci.getUniqueId() != null && ci.getUniqueId().contains(normalizedName)).map(ci -> ci.getUniqueId().split(normalizedName)[1]) - .collect(Collectors.toList()); + .filter(ci -> ci.getUniqueId() != null && ci.getUniqueId().contains(normalizedName)) + .map(ci -> ci.getUniqueId().split(normalizedName)[1].replaceAll("\\D", "")).collect(Collectors.toList()); List<String> namesAndIdsList = new ArrayList<>(countersInNames); namesAndIdsList.addAll(countersInIds); return getMaxInteger(namesAndIdsList); |