From aa92493c97b43075c18696d79f7d1bf62aa4805a Mon Sep 17 00:00:00 2001 From: JvD_Ericsson Date: Tue, 6 Dec 2022 11:40:17 +0000 Subject: Fix resource property constraint values mutable in Service design Issue-ID: SDC-4290 Signed-off-by: JvD_Ericsson Change-Id: Ica942b7a8bb1f03cbf6baec709135287e31def06 --- .../org/openecomp/sdc/be/model/tosca/constraints/EqualConstraint.java | 3 +++ .../sdc/be/model/tosca/constraints/GreaterOrEqualConstraint.java | 2 ++ .../sdc/be/model/tosca/constraints/GreaterThanConstraint.java | 2 ++ .../openecomp/sdc/be/model/tosca/constraints/InRangeConstraint.java | 3 +++ .../openecomp/sdc/be/model/tosca/constraints/LengthConstraint.java | 2 ++ .../sdc/be/model/tosca/constraints/LessOrEqualConstraint.java | 2 ++ .../openecomp/sdc/be/model/tosca/constraints/LessThanConstraint.java | 2 ++ .../openecomp/sdc/be/model/tosca/constraints/MaxLengthConstraint.java | 2 ++ .../openecomp/sdc/be/model/tosca/constraints/MinLengthConstraint.java | 2 ++ .../openecomp/sdc/be/model/tosca/constraints/PatternConstraint.java | 3 +++ .../sdc/be/model/tosca/constraints/ValidValuesConstraint.java | 4 +++- 11 files changed, 26 insertions(+), 1 deletion(-) (limited to 'catalog-model/src') diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/EqualConstraint.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/EqualConstraint.java index e1c55ac829..7462a7276a 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/EqualConstraint.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/EqualConstraint.java @@ -20,6 +20,7 @@ package org.openecomp.sdc.be.model.tosca.constraints; import javax.validation.constraints.NotNull; +import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; import org.openecomp.sdc.be.datatypes.enums.ConstraintType; @@ -31,11 +32,13 @@ import org.openecomp.sdc.be.model.tosca.constraints.exception.ConstraintViolatio import org.openecomp.sdc.be.model.tosca.constraints.exception.PropertyConstraintException; @SuppressWarnings("serial") +@EqualsAndHashCode(onlyExplicitlyIncluded = true) public class EqualConstraint extends AbstractComparablePropertyConstraint { @Getter @Setter @NotNull + @EqualsAndHashCode.Include private Object equal; private Object typed; diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/GreaterOrEqualConstraint.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/GreaterOrEqualConstraint.java index e90f1c0bf2..35f036b9c6 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/GreaterOrEqualConstraint.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/GreaterOrEqualConstraint.java @@ -21,6 +21,7 @@ package org.openecomp.sdc.be.model.tosca.constraints; import javax.validation.constraints.NotNull; import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; import org.openecomp.sdc.be.datatypes.enums.ConstraintType; @@ -34,6 +35,7 @@ import org.openecomp.sdc.be.model.tosca.constraints.exception.PropertyConstraint @Getter @Setter @AllArgsConstructor +@EqualsAndHashCode public class GreaterOrEqualConstraint extends AbstractComparablePropertyConstraint { @NotNull diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/GreaterThanConstraint.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/GreaterThanConstraint.java index e1293d1bb1..7ecec8aad3 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/GreaterThanConstraint.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/GreaterThanConstraint.java @@ -21,6 +21,7 @@ package org.openecomp.sdc.be.model.tosca.constraints; import javax.validation.constraints.NotNull; import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; import org.openecomp.sdc.be.datatypes.enums.ConstraintType; @@ -34,6 +35,7 @@ import org.openecomp.sdc.be.model.tosca.constraints.exception.PropertyConstraint @Getter @Setter @AllArgsConstructor +@EqualsAndHashCode public class GreaterThanConstraint extends AbstractComparablePropertyConstraint { @NotNull diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/InRangeConstraint.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/InRangeConstraint.java index 26d75bd134..19e215364c 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/InRangeConstraint.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/InRangeConstraint.java @@ -21,6 +21,7 @@ package org.openecomp.sdc.be.model.tosca.constraints; import com.fasterxml.jackson.annotation.JsonIgnore; import java.util.List; +import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.NonNull; @@ -36,9 +37,11 @@ import org.openecomp.sdc.be.model.tosca.constraints.exception.PropertyConstraint @NoArgsConstructor @Getter @Setter +@EqualsAndHashCode(onlyExplicitlyIncluded = true) public class InRangeConstraint extends AbstractPropertyConstraint { @NonNull + @EqualsAndHashCode.Include private List inRange; @JsonIgnore private Comparable min; diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/LengthConstraint.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/LengthConstraint.java index 3ed6e7fc50..f7952fa3a1 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/LengthConstraint.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/LengthConstraint.java @@ -22,6 +22,7 @@ package org.openecomp.sdc.be.model.tosca.constraints; import java.util.List; import java.util.Map; import javax.validation.constraints.NotNull; +import lombok.EqualsAndHashCode; import org.openecomp.sdc.be.datatypes.enums.ConstraintType; import org.openecomp.sdc.be.model.PropertyConstraint; import org.openecomp.sdc.be.model.tosca.ToscaType; @@ -33,6 +34,7 @@ import lombok.NoArgsConstructor; @AllArgsConstructor @NoArgsConstructor +@EqualsAndHashCode public class LengthConstraint extends AbstractPropertyConstraint { @NotNull diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/LessOrEqualConstraint.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/LessOrEqualConstraint.java index 3830ddf811..ece5e403ee 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/LessOrEqualConstraint.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/LessOrEqualConstraint.java @@ -21,6 +21,7 @@ package org.openecomp.sdc.be.model.tosca.constraints; import javax.validation.constraints.NotNull; import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; import org.openecomp.sdc.be.datatypes.enums.ConstraintType; @@ -34,6 +35,7 @@ import org.openecomp.sdc.be.model.tosca.constraints.exception.PropertyConstraint @Getter @Setter @AllArgsConstructor +@EqualsAndHashCode public class LessOrEqualConstraint extends AbstractComparablePropertyConstraint { @NotNull diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/LessThanConstraint.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/LessThanConstraint.java index f3e283c98e..d071dbaa07 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/LessThanConstraint.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/LessThanConstraint.java @@ -21,6 +21,7 @@ package org.openecomp.sdc.be.model.tosca.constraints; import javax.validation.constraints.NotNull; import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; import org.openecomp.sdc.be.datatypes.enums.ConstraintType; @@ -34,6 +35,7 @@ import org.openecomp.sdc.be.model.tosca.constraints.exception.PropertyConstraint @Getter @Setter @AllArgsConstructor +@EqualsAndHashCode public class LessThanConstraint extends AbstractComparablePropertyConstraint { @NotNull diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/MaxLengthConstraint.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/MaxLengthConstraint.java index 388eb059e6..dfc0d9bf2c 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/MaxLengthConstraint.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/MaxLengthConstraint.java @@ -22,6 +22,7 @@ package org.openecomp.sdc.be.model.tosca.constraints; import java.util.List; import java.util.Map; import javax.validation.constraints.NotNull; +import lombok.EqualsAndHashCode; import org.openecomp.sdc.be.datatypes.enums.ConstraintType; import org.openecomp.sdc.be.model.PropertyConstraint; import org.openecomp.sdc.be.model.tosca.ToscaType; @@ -29,6 +30,7 @@ import org.openecomp.sdc.be.model.tosca.constraints.exception.ConstraintFunction import org.openecomp.sdc.be.model.tosca.constraints.exception.ConstraintViolationException; import org.openecomp.sdc.be.model.tosca.constraints.exception.PropertyConstraintException; +@EqualsAndHashCode public class MaxLengthConstraint extends AbstractPropertyConstraint { @NotNull diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/MinLengthConstraint.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/MinLengthConstraint.java index a2ff95512a..fbced6bdda 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/MinLengthConstraint.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/MinLengthConstraint.java @@ -22,6 +22,7 @@ package org.openecomp.sdc.be.model.tosca.constraints; import java.util.List; import java.util.Map; import javax.validation.constraints.NotNull; +import lombok.EqualsAndHashCode; import org.openecomp.sdc.be.datatypes.enums.ConstraintType; import org.openecomp.sdc.be.model.PropertyConstraint; import org.openecomp.sdc.be.model.tosca.ToscaType; @@ -29,6 +30,7 @@ import org.openecomp.sdc.be.model.tosca.constraints.exception.ConstraintFunction import org.openecomp.sdc.be.model.tosca.constraints.exception.ConstraintViolationException; import org.openecomp.sdc.be.model.tosca.constraints.exception.PropertyConstraintException; +@EqualsAndHashCode public class MinLengthConstraint extends AbstractPropertyConstraint { @NotNull diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/PatternConstraint.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/PatternConstraint.java index 6ff9524169..6d67847272 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/PatternConstraint.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/PatternConstraint.java @@ -21,6 +21,7 @@ package org.openecomp.sdc.be.model.tosca.constraints; import java.util.regex.Pattern; import javax.validation.constraints.NotNull; +import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NoArgsConstructor; import org.openecomp.sdc.be.datatypes.enums.ConstraintType; @@ -30,11 +31,13 @@ import org.openecomp.sdc.be.model.tosca.constraints.exception.ConstraintFunction import org.openecomp.sdc.be.model.tosca.constraints.exception.ConstraintViolationException; import org.openecomp.sdc.be.model.tosca.constraints.exception.PropertyConstraintException; +@EqualsAndHashCode(onlyExplicitlyIncluded = true) @NoArgsConstructor public class PatternConstraint extends AbstractStringPropertyConstraint { @NotNull @Getter + @EqualsAndHashCode.Include private String pattern; private Pattern compiledPattern; diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/ValidValuesConstraint.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/ValidValuesConstraint.java index f6bc589521..bf979feea1 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/ValidValuesConstraint.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/ValidValuesConstraint.java @@ -25,9 +25,9 @@ import com.google.common.collect.Sets; import java.util.List; import java.util.Set; import javax.validation.constraints.NotNull; +import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NoArgsConstructor; -import lombok.RequiredArgsConstructor; import lombok.Setter; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.ConstraintType; @@ -39,12 +39,14 @@ import org.openecomp.sdc.be.model.tosca.constraints.exception.ConstraintViolatio import org.openecomp.sdc.be.model.tosca.constraints.exception.PropertyConstraintException; @NoArgsConstructor +@EqualsAndHashCode(onlyExplicitlyIncluded = true) public class ValidValuesConstraint extends AbstractPropertyConstraint { private static final String PROPERTY_TYPE_IS = "> property type is <"; @Getter @Setter @NotNull + @EqualsAndHashCode.Include private List validValues; private Set validValuesTyped; -- cgit 1.2.3-korg