diff options
author | vasraz <vasyl.razinkov@est.tech> | 2022-12-07 17:05:26 +0000 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2022-12-12 13:50:50 +0000 |
commit | 468b3dcbd9e2eabeaddf8c5081b28cfa6493721d (patch) | |
tree | ed8b98dfb6276e66456a60a2926874dcdb2756f6 /catalog-model/src/main | |
parent | 16a6ce043bc95c3db4634ebbc955f8a5ea92056d (diff) |
Add support for comparable type constraints for strings
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Change-Id: I3b52c720968ab8333fa2ec81b13c3d0e7b2f4316
Issue-ID: SDC-4299
Diffstat (limited to 'catalog-model/src/main')
2 files changed, 4 insertions, 11 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/AbstractComparablePropertyConstraint.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/AbstractComparablePropertyConstraint.java index e7730bd612..d7eb6e69c6 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/AbstractComparablePropertyConstraint.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/AbstractComparablePropertyConstraint.java @@ -33,9 +33,7 @@ public abstract class AbstractComparablePropertyConstraint extends AbstractPrope } protected void initialize(String rawTextValue, ToscaType propertyType) throws ConstraintValueDoNotMatchPropertyTypeException { - // Perform verification that the property type is supported for - - // comparison + // Perform verification that the property type is supported for comparison ConstraintUtil.checkComparableType(propertyType); // Check if the text value is valid for the property type if (propertyType.isValidValue(rawTextValue)) { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/ConstraintUtil.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/ConstraintUtil.java index 74a9359f2a..1b9b94eb61 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/ConstraintUtil.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/ConstraintUtil.java @@ -60,20 +60,15 @@ public final class ConstraintUtil { * @throws ConstraintValueDoNotMatchPropertyTypeException if the property type cannot be compared */ public static void checkComparableType(ToscaType propertyType) throws ConstraintValueDoNotMatchPropertyTypeException { - // The validity of the value is already assured by us with our - - // ToscaType.convert() method - - // here we just want to check that the constraint is not used on - - // unsupported type as boolean + // The validity of the value is already assured by us with our ToscaType.convert() method + // here we just want to check that the constraint is not used on unsupported type as boolean switch (propertyType) { case FLOAT: case INTEGER: case TIMESTAMP: case VERSION: - break; case STRING: + break; case BOOLEAN: throw new ConstraintValueDoNotMatchPropertyTypeException("Constraint is invalid for property type <" + propertyType.toString() + ">"); default: |