diff options
author | imamSidero <imam.hussain@est.tech> | 2023-03-23 11:25:23 +0000 |
---|---|---|
committer | Imam hussain <imam.hussain@est.tech> | 2023-04-03 11:13:18 +0000 |
commit | 7565f810f9fa50c8140843b2f81e8fb428815154 (patch) | |
tree | 5ff3ef43bd7434db7c0bd462db295a2726052c61 /catalog-be/src/main | |
parent | 3dff1c221e58de6a81cf6bbdfb84fdf97665e484 (diff) |
Provide tosca function capability to all nested levels
Tosca function capability is provided to all nested levels of list, map and custom types
Issue-ID: SDC-4445
Signed-off-by: Imam hussain <imam.hussain@est.tech>
Change-Id: I29907bdac83d3cadf90aa0a2ed538002132b4789
Diffstat (limited to 'catalog-be/src/main')
2 files changed, 10 insertions, 7 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java index 96366194d3..f43f7de860 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java @@ -2077,7 +2077,7 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { if (jsonObject.has(path.get(0))) { objectForPath = jsonObject.get(path.get(0)); } else { - if (StringUtils.isNumeric(path.get(0))) { + if (path.size() > 1 && StringUtils.isNumeric(path.get(1))) { objectForPath = new JSONArray(); } else { objectForPath = new JSONObject(); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/PropertyValueConstraintValidationUtil.java b/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/PropertyValueConstraintValidationUtil.java index 247fff9bc6..ef7363a1a3 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/PropertyValueConstraintValidationUtil.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/PropertyValueConstraintValidationUtil.java @@ -61,6 +61,9 @@ public class PropertyValueConstraintValidationUtil { private static final String IGNORE_PROPERTY_VALUE_START_WITH_INPUT = "{\"get_input\":"; private static final String IGNORE_PROPERTY_VALUE_START_WITH_PROPERTY = "{\"get_property\":"; private static final String IGNORE_PROPERTY_VALUE_START_WITH_ATTRIBUTE = "{\"get_attribute\":"; + private static final String IGNORE_PROPERTY_VALUE_INPUT = "{get_input="; + private static final String IGNORE_PROPERTY_VALUE_PROPERTY = "{get_property="; + private static final String IGNORE_PROPERTY_VALUE_ATTRIBUTE = "{get_attribute="; private Map<String, DataTypeDefinition> dataTypeDefinitionCache; private final ObjectMapper objectMapper = new ObjectMapper(); private final List<String> errorMessages = new ArrayList<>(); @@ -159,8 +162,10 @@ public class PropertyValueConstraintValidationUtil { } private boolean isValueAToscaFunction(PropertyDefinition propertyDefinition) { - return propertyDefinition.getToscaFunction() != null || propertyDefinition.getValue() != null && (propertyDefinition.getValue().startsWith(IGNORE_PROPERTY_VALUE_START_WITH_INPUT) || propertyDefinition.getValue().startsWith(IGNORE_PROPERTY_VALUE_START_WITH_PROPERTY) - || propertyDefinition.getValue().startsWith(IGNORE_PROPERTY_VALUE_START_WITH_ATTRIBUTE)); + return (propertyDefinition.getToscaFunction() != null) || (propertyDefinition.getValue() != null + && ((propertyDefinition.getValue().startsWith(IGNORE_PROPERTY_VALUE_START_WITH_INPUT) || propertyDefinition.getValue().startsWith(IGNORE_PROPERTY_VALUE_START_WITH_PROPERTY) + || propertyDefinition.getValue().startsWith(IGNORE_PROPERTY_VALUE_START_WITH_ATTRIBUTE) || propertyDefinition.getValue().startsWith(IGNORE_PROPERTY_VALUE_ATTRIBUTE) + || propertyDefinition.getValue().startsWith(IGNORE_PROPERTY_VALUE_PROPERTY) || propertyDefinition.getValue().startsWith(IGNORE_PROPERTY_VALUE_INPUT)))); } private void checkAndEvaluatePrimitiveProperty(PropertyDefinition propertyDefinition, DataTypeDefinition dataTypeDefinition) { @@ -197,10 +202,8 @@ public class PropertyValueConstraintValidationUtil { if (propertyDefinition.getSubPropertyToscaFunctions() != null) { for (SubPropertyToscaFunction subPropertyToscaFunction : propertyDefinition.getSubPropertyToscaFunctions()) { final List<String> path = subPropertyToscaFunction.getSubPropertyPath(); - if (path.size() == 1) { - if (path.get(0).equals(prop.getName())) { - return; - } + if (path.size() == 1 && path.get(0).equals(prop.getName())) { + return; } if (path.size() > 1) { if (path.get(0).equals(propertyDefinition.getToscaSubPath()) && path.get(1).equals(prop.getName())) { |