Error creating in_range constraint for non integer properties 29/132929/5
authorJvD_Ericsson <jeff.van.dam@est.tech>
Tue, 17 Jan 2023 11:13:45 +0000 (11:13 +0000)
committerMichael Morris <michael.morris@est.tech>
Tue, 24 Jan 2023 10:05:41 +0000 (10:05 +0000)
Issue-ID: SDC-4334
Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech>
Change-Id: I5474eb29e1a8100aeb85bd96b5f6752331aa11f2

catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java

index f6bcf1b..d5f7ccb 100644 (file)
@@ -2197,8 +2197,8 @@ public class PropertyOperation extends AbstractOperation implements IPropertyOpe
                                         Object minValue = rangeArray.get(0);
                                         Object maxValue = rangeArray.get(1);
                                         InRangeConstraint rangeConstraint = new InRangeConstraint(Lists.newArrayList(minValue, maxValue));
-                                        rangeConstraint.setMin(convertToComparable(ToscaType.RANGE, String.valueOf(minValue)));
-                                        rangeConstraint.setMax(convertToComparable(ToscaType.RANGE, String.valueOf(maxValue)));
+                                        rangeConstraint.setMin(String.valueOf(minValue));
+                                        rangeConstraint.setMax(String.valueOf(maxValue));
                                         propertyConstraint = rangeConstraint;
                                     }
                                 } else {
@@ -2318,9 +2318,6 @@ public class PropertyOperation extends AbstractOperation implements IPropertyOpe
             if (je.isBoolean()) {
                 return je.getAsBoolean();
             }
-            if (je.isString()) {
-                return je.getAsString();
-            }
             if (je.isNumber()) {
                 double number = je.getAsNumber().floatValue();
                 if ((number % 1) == 0) {
@@ -2328,6 +2325,9 @@ public class PropertyOperation extends AbstractOperation implements IPropertyOpe
                 }
                 return number;
             }
+            if (je.isString()) {
+                return je.getAsString();
+            }
             return null;
         }
     }
@@ -2442,8 +2442,8 @@ public class PropertyOperation extends AbstractOperation implements IPropertyOpe
                     String minValue = rangeArray.get(0).asText();
                     String maxValue = rangeArray.get(1).asText();
                     InRangeConstraint rangeConstraint = new InRangeConstraint(Lists.newArrayList(minValue, maxValue));
-                    rangeConstraint.setMin(convertToComparable(ToscaType.RANGE, minValue));
-                    rangeConstraint.setMax(convertToComparable(ToscaType.RANGE, maxValue));
+                    rangeConstraint.setMin(minValue);
+                    rangeConstraint.setMax(maxValue);
                     return rangeConstraint;
                 }
             }