aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJvD_Ericsson <jeff.van.dam@est.tech>2023-02-28 16:19:36 +0000
committerJeff van Dam <jeff.van.dam@est.tech>2023-03-01 08:51:45 +0000
commita63ba175e7dfe7744f4ae36036f53bdd21d25fa4 (patch)
tree40d20fa3823dad6d5bf77d4a144af777b8f39667
parente546c7283de4abf182545cea1aa07a8de0233d3b (diff)
Operation implementation name not formatting correctly
Issue-ID: SDC-4421 Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech> Change-Id: I6699029dff4e78760163d01691b6a1964aacbc0e
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInterfaceOperationBusinessLogic.java20
1 files changed, 17 insertions, 3 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInterfaceOperationBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInterfaceOperationBusinessLogic.java
index 8a2ab8924e..3ac8ce3562 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInterfaceOperationBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInterfaceOperationBusinessLogic.java
@@ -18,8 +18,11 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
+
package org.openecomp.sdc.be.components.impl;
+import static org.openecomp.sdc.be.components.impl.ImportUtils.Constants.QUOTE;
+
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -64,6 +67,7 @@ import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation;
import org.openecomp.sdc.be.model.operations.impl.PropertyOperation;
import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
+import org.openecomp.sdc.be.tosca.utils.OperationArtifactUtil;
import org.openecomp.sdc.be.user.Role;
import org.openecomp.sdc.common.datastructure.Wrapper;
import org.openecomp.sdc.exception.ResponseFormat;
@@ -204,14 +208,14 @@ public class ComponentInterfaceOperationBusinessLogic extends BaseBusinessLogic
return componentInstanceOptional;
}
- private Either<Boolean, ResponseFormat> validateOperationInputConstraints (
+ private Either<Boolean, ResponseFormat> validateOperationInputConstraints(
OperationDataDefinition operationDataDefinition, PropertyValueConstraintValidationUtil constraintValidatorUtil, String model) {
return constraintValidatorUtil
.validatePropertyConstraints(convertOperationInputsToPropertyDefinitions(operationDataDefinition), applicationDataTypeCache,
model);
}
- private Either<Boolean, ResponseFormat> validateOperationArtifactPropertyConstraints (
+ private Either<Boolean, ResponseFormat> validateOperationArtifactPropertyConstraints(
OperationDataDefinition operationDataDefinition, PropertyValueConstraintValidationUtil constraintValidatorUtil, String model) {
return constraintValidatorUtil
.validatePropertyConstraints(convertOperationArtifactPropsToPropertyDefinitions(operationDataDefinition, model), applicationDataTypeCache,
@@ -330,6 +334,8 @@ public class ComponentInterfaceOperationBusinessLogic extends BaseBusinessLogic
final OperationDataDefinition updatedOperationDataDefinition = optionalOperationDataDefinition.get();
updatedOperationDataDefinition.setUniqueId(UUID.randomUUID().toString());
+ updatedOperationDataDefinition.getImplementation()
+ .setArtifactName(generateArtifactName(updatedOperationDataDefinition.getImplementation().getArtifactName()));
final InterfaceDefinition interfaceDefinitionFound = componentInterfaceMap.get(componentInterfaceUpdatedKey);
if (interfaceDefinitionFound != null) {
@@ -381,6 +387,14 @@ public class ComponentInterfaceOperationBusinessLogic extends BaseBusinessLogic
return Optional.of(component);
}
+ private String generateArtifactName(final String name) {
+ if (OperationArtifactUtil.artifactNameIsALiteralValue(name)) {
+ return name;
+ } else {
+ return QUOTE + name + QUOTE;
+ }
+ }
+
public User validateUser(final String userId) {
final User user = userValidations.validateUserExists(userId);
userValidations.validateUserRole(user, Arrays.asList(Role.DESIGNER, Role.ADMIN));
@@ -418,7 +432,7 @@ public class ComponentInterfaceOperationBusinessLogic extends BaseBusinessLogic
}
private List<PropertyDefinition> convertOperationArtifactPropsToPropertyDefinitions(final OperationDataDefinition operationDataDefinition,
- final String model) {
+ final String model) {
List<PropertyDefinition> artifactPropertiesToValidateCollection = new ArrayList<>();
final ArtifactDataDefinition artifactDataDefinition = operationDataDefinition.getImplementation();
if (null != artifactDataDefinition) {