diff options
author | JvD_Ericsson <jeff.van.dam@est.tech> | 2023-05-26 13:23:14 +0100 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2023-05-29 14:26:04 +0000 |
commit | 2a473f639dd543d78d1f2c6ca439722dccebefd1 (patch) | |
tree | b0c037c0bfbaf0de7d4a5019b7bfc8e635e7652a /catalog-be | |
parent | 01cde8e3cd095919ba74ac1d5e750e4b6842ae64 (diff) |
Fix not possible to edit property with custom tosca function
Issue-ID: SDC-4511
Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech>
Change-Id: I2303f1690de3f04ccb478a227534f00d3db72e64
Diffstat (limited to 'catalog-be')
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ImportUtils.java | 17 |
1 files changed, 11 insertions, 6 deletions
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<PropertyConstraint> getPropertyConstraints(final Map<String, Object> propertyValue, final String propertyType, final SchemaDefinition schema) { + private static List<PropertyConstraint> getPropertyConstraints(final Map<String, Object> propertyValue, final String propertyType, + final SchemaDefinition schema) { final List<Object> 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 { |