From 2a473f639dd543d78d1f2c6ca439722dccebefd1 Mon Sep 17 00:00:00 2001 From: JvD_Ericsson Date: Fri, 26 May 2023 13:23:14 +0100 Subject: Fix not possible to edit property with custom tosca function Issue-ID: SDC-4511 Signed-off-by: JvD_Ericsson Change-Id: I2303f1690de3f04ccb478a227534f00d3db72e64 --- .../openecomp/sdc/be/components/impl/ImportUtils.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'catalog-be/src/main') diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ImportUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ImportUtils.java index 62b345c499..a57a6b7f86 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ImportUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ImportUtils.java @@ -17,6 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.components.impl; import static org.apache.commons.collections.CollectionUtils.isEmpty; @@ -278,7 +279,8 @@ public final class ImportUtils { } } - private static List getPropertyConstraints(final Map propertyValue, final String propertyType, final SchemaDefinition schema) { + private static List getPropertyConstraints(final Map propertyValue, final String propertyType, + final SchemaDefinition schema) { final List propertyFieldConstraints = findCurrentLevelConstraintsElement(propertyValue); if (CollectionUtils.isEmpty(propertyFieldConstraints)) { return Collections.emptyList(); @@ -288,7 +290,8 @@ public final class ImportUtils { }.getType(); final Gson gson = new GsonBuilder().registerTypeAdapter(constraintType, new PropertyConstraintDeserialiser()).create(); for (final Object constraintJson : propertyFieldConstraints) { - final PropertyConstraint propertyConstraint = validateAndGetPropertyConstraint(propertyType, constraintType, gson, constraintJson, schema); + final PropertyConstraint propertyConstraint = + validateAndGetPropertyConstraint(propertyType, constraintType, gson, constraintJson, schema); if (propertyConstraint != null) { constraintList.add(propertyConstraint); } @@ -309,7 +312,8 @@ public final class ImportUtils { return constraints; } - private static PropertyConstraint validateAndGetPropertyConstraint(String propertyType, Type constraintType, Gson gson, Object constraintJson, SchemaDefinition schema) { + private static PropertyConstraint validateAndGetPropertyConstraint(String propertyType, Type constraintType, Gson gson, Object constraintJson, + SchemaDefinition schema) { PropertyConstraint propertyConstraint; try { propertyConstraint = gson.fromJson(gson.toJson(constraintJson), constraintType); @@ -704,8 +708,8 @@ public final class ImportUtils { public static boolean containsGetInput(Object propValue) { String value = getPropertyJsonStringValue(propValue, ToscaPropertyType.MAP.getType()); - return value != null && value.contains(TypeUtils.ToscaTagNamesEnum.GET_INPUT.getElementName()) && !value.contains( - TypeUtils.ToscaTagNamesEnum.CONCAT.getElementName()); + return value != null && value.contains(TypeUtils.ToscaTagNamesEnum.GET_INPUT.getElementName()) && + !value.contains(TypeUtils.ToscaTagNamesEnum.CONCAT.getElementName()) && !value.contains("$"); } public static String getPropertyJsonStringValue(Object value, String type) { @@ -743,7 +747,8 @@ public final class ImportUtils { } public enum ResultStatusEnum { - ELEMENT_NOT_FOUND, GENERAL_ERROR, OK, INVALID_PROPERTY_DEFAULT_VALUE, INVALID_PROPERTY_TYPE, INVALID_PROPERTY_VALUE, MISSING_ENTRY_SCHEMA_TYPE, INVALID_PROPERTY_NAME, INVALID_ATTRIBUTE_NAME + ELEMENT_NOT_FOUND, GENERAL_ERROR, OK, INVALID_PROPERTY_DEFAULT_VALUE, INVALID_PROPERTY_TYPE, INVALID_PROPERTY_VALUE, + MISSING_ENTRY_SCHEMA_TYPE, INVALID_PROPERTY_NAME, INVALID_ATTRIBUTE_NAME } public enum ToscaElementTypeEnum { -- cgit 1.2.3-korg