Changes for Checkstyle 8.32
[policy/models.git] / models-tosca / src / main / java / org / onap / policy / models / tosca / simple / concepts / JpaToscaConstraintLogical.java
index 632f84a..cd62164 100644 (file)
 package org.onap.policy.models.tosca.simple.concepts;
 
 import javax.persistence.Column;
-
 import lombok.EqualsAndHashCode;
 import lombok.Getter;
 import lombok.NonNull;
 import lombok.ToString;
-
 import org.apache.commons.lang3.ObjectUtils;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaConstraint;
 
@@ -65,6 +63,7 @@ public class JpaToscaConstraintLogical extends JpaToscaConstraint {
      *
      * @param authorativeConcept the authorative concept to copy from
      */
+    @SuppressWarnings("java:S2637")
     public JpaToscaConstraintLogical(final ToscaConstraint authorativeConcept) {
         super(authorativeConcept);
     }
@@ -111,20 +110,16 @@ public class JpaToscaConstraintLogical extends JpaToscaConstraint {
         if (toscaConstraint.getEqual() != null) {
             operation = JpaToscaConstraintOperation.EQ;
             compareTo = toscaConstraint.getEqual();
-        }
-        else if (toscaConstraint.getGreaterThan() != null) {
+        } else  if (toscaConstraint.getGreaterThan() != null) {
             operation = JpaToscaConstraintOperation.GT;
             compareTo = toscaConstraint.getGreaterThan();
-        }
-        else if (toscaConstraint.getGreaterOrEqual() != null) {
+        } else  if (toscaConstraint.getGreaterOrEqual() != null) {
             operation = JpaToscaConstraintOperation.GE;
             compareTo = toscaConstraint.getGreaterOrEqual();
-        }
-        else if (toscaConstraint.getLessThan() != null) {
+        } else  if (toscaConstraint.getLessThan() != null) {
             operation = JpaToscaConstraintOperation.LT;
             compareTo = toscaConstraint.getLessThan();
-        }
-        else if (toscaConstraint.getLessOrEqual() != null) {
+        } else  if (toscaConstraint.getLessOrEqual() != null) {
             operation = JpaToscaConstraintOperation.LE;
             compareTo = toscaConstraint.getLessOrEqual();
         }
@@ -140,7 +135,7 @@ public class JpaToscaConstraintLogical extends JpaToscaConstraint {
             return 0;
         }
         if (getClass() != otherConstraint.getClass()) {
-            return this.hashCode() - otherConstraint.hashCode();
+            return getClass().getName().compareTo(otherConstraint.getClass().getName());
         }
 
         final JpaToscaConstraintLogical other = (JpaToscaConstraintLogical) otherConstraint;