summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenry.Sun <henry.a.sun@est.tech>2019-08-07 03:41:50 +0000
committerHenry.Sun <henry.a.sun@est.tech>2019-08-07 03:41:50 +0000
commitb7909b8e74c0bc5920f5d0397a4371988df9e8b2 (patch)
tree3307c4c2c260c0ea975aceb6c5a5eedbb6aa5230
parent52d2377853af5eb2acba40381e61de17f3fe0d29 (diff)
replace hashCode function with compareTo
Issue-ID: POLICY-1600 Change-Id: If660cbe84424e492b6db3ab11ef97b37f046b3aa Signed-off-by: Henry.Sun <henry.a.sun@est.tech>
-rw-r--r--models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java2
-rw-r--r--models-base/src/main/java/org/onap/policy/models/base/PfConceptKey.java2
-rw-r--r--models-base/src/main/java/org/onap/policy/models/base/PfKeyUse.java2
-rw-r--r--models-base/src/main/java/org/onap/policy/models/base/PfModel.java2
-rw-r--r--models-base/src/main/java/org/onap/policy/models/base/PfReferenceKey.java2
-rw-r--r--models-base/src/test/java/org/onap/policy/models/base/PfKeyTest.java2
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java2
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogical.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintValidValues.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataType.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntityType.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilter.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModel.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeInterval.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTrigger.java2
21 files changed, 21 insertions, 21 deletions
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java b/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java
index 99b5f9710..63ab14ee5 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java
@@ -261,7 +261,7 @@ public class PfConceptContainer<C extends PfConcept, A extends PfNameVersion> ex
return 0;
}
if (getClass() != otherConcept.getClass()) {
- return this.hashCode() - otherConcept.hashCode();
+ return getClass().getName().compareTo(otherConcept.getClass().getName());
}
@SuppressWarnings("unchecked")
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfConceptKey.java b/models-base/src/main/java/org/onap/policy/models/base/PfConceptKey.java
index dfc356060..17fda7cfe 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfConceptKey.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfConceptKey.java
@@ -310,7 +310,7 @@ public class PfConceptKey extends PfKey {
return 0;
}
if (getClass() != otherObj.getClass()) {
- return this.hashCode() - otherObj.hashCode();
+ return getClass().getName().compareTo(otherObj.getClass().getName());
}
final PfConceptKey other = (PfConceptKey) otherObj;
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfKeyUse.java b/models-base/src/main/java/org/onap/policy/models/base/PfKeyUse.java
index 836707ef2..d56b0dbab 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfKeyUse.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfKeyUse.java
@@ -152,7 +152,7 @@ public class PfKeyUse extends PfKey {
return 0;
}
if (getClass() != otherObj.getClass()) {
- return this.hashCode() - otherObj.hashCode();
+ return getClass().getName().compareTo(otherObj.getClass().getName());
}
final PfKeyUse other = (PfKeyUse) otherObj;
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfModel.java b/models-base/src/main/java/org/onap/policy/models/base/PfModel.java
index 3dc233b02..07ec3af04 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfModel.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfModel.java
@@ -274,7 +274,7 @@ public abstract class PfModel extends PfConcept {
return 0;
}
if (getClass() != otherObj.getClass()) {
- return this.hashCode() - otherObj.hashCode();
+ return getClass().getName().compareTo(otherObj.getClass().getName());
}
final PfModel other = (PfModel) otherObj;
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfReferenceKey.java b/models-base/src/main/java/org/onap/policy/models/base/PfReferenceKey.java
index bda5aed12..bdf16dcdf 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfReferenceKey.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfReferenceKey.java
@@ -405,7 +405,7 @@ public class PfReferenceKey extends PfKey {
return 0;
}
if (getClass() != otherObj.getClass()) {
- return this.hashCode() - otherObj.hashCode();
+ return getClass().getName().compareTo(otherObj.getClass().getName());
}
final PfReferenceKey other = (PfReferenceKey) otherObj;
diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfKeyTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfKeyTest.java
index 9ef1aeb75..fca73b0d6 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/PfKeyTest.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/PfKeyTest.java
@@ -136,7 +136,7 @@ public class PfKeyTest {
.hasMessage("otherObj is marked @NonNull but is null");
assertEquals(0, someKey0.compareTo(someKey0));
- assertEquals(266127751, someKey0.compareTo(new DummyPfKey()));
+ assertEquals(-36, someKey0.compareTo(new DummyPfKey()));
assertFalse(someKey0.equals(null));
assertTrue(someKey0.equals(someKey0));
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java
index 528d6fbe7..7d90c03b1 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java
@@ -210,7 +210,7 @@ public class JpaPdp extends PfConcept implements PfAuthorative<Pdp>, Serializabl
return 0;
}
if (getClass() != otherConcept.getClass()) {
- return this.hashCode() - otherConcept.hashCode();
+ return getClass().getName().compareTo(otherConcept.getClass().getName());
}
final JpaPdp other = (JpaPdp) otherConcept;
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java
index f0ff4a6c2..723d427de 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java
@@ -360,7 +360,7 @@ public class JpaPdpSubGroup extends PfConcept implements PfAuthorative<PdpSubGro
return 0;
}
if (getClass() != otherConcept.getClass()) {
- return this.hashCode() - otherConcept.hashCode();
+ return getClass().getName().compareTo(otherConcept.getClass().getName());
}
final JpaPdpSubGroup other = (JpaPdpSubGroup) otherConcept;
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogical.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogical.java
index 632f84add..41cd1c274 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogical.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogical.java
@@ -140,7 +140,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;
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintValidValues.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintValidValues.java
index 248ca496c..2a121573c 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintValidValues.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintValidValues.java
@@ -92,7 +92,7 @@ public class JpaToscaConstraintValidValues extends JpaToscaConstraint {
return 0;
}
if (getClass() != otherConstraint.getClass()) {
- return this.hashCode() - otherConstraint.hashCode();
+ return getClass().getName().compareTo(otherConstraint.getClass().getName());
}
final JpaToscaConstraintValidValues other = (JpaToscaConstraintValidValues) otherConstraint;
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataType.java
index cf1150af8..7e2b641a2 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataType.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataType.java
@@ -244,7 +244,7 @@ public class JpaToscaDataType extends JpaToscaEntityType<ToscaDataType> implemen
return 0;
}
if (getClass() != otherConcept.getClass()) {
- return this.hashCode() - otherConcept.hashCode();
+ return getClass().getName().compareTo(otherConcept.getClass().getName());
}
final JpaToscaDataType other = (JpaToscaDataType) otherConcept;
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntityType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntityType.java
index a39515b49..bade7a227 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntityType.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntityType.java
@@ -248,7 +248,7 @@ public class JpaToscaEntityType<T extends ToscaEntity> extends PfConcept impleme
return 0;
}
if (getClass() != otherConcept.getClass()) {
- return this.hashCode() - otherConcept.hashCode();
+ return getClass().getName().compareTo(otherConcept.getClass().getName());
}
@SuppressWarnings("unchecked")
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilter.java
index 3907a1b0c..40727c9c0 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilter.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilter.java
@@ -161,7 +161,7 @@ public class JpaToscaEventFilter extends PfConcept {
return 0;
}
if (getClass() != otherConcept.getClass()) {
- return this.hashCode() - otherConcept.hashCode();
+ return getClass().getName().compareTo(otherConcept.getClass().getName());
}
final JpaToscaEventFilter other = (JpaToscaEventFilter) otherConcept;
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModel.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModel.java
index 204ef5b9d..5e4bd4f5c 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModel.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModel.java
@@ -137,7 +137,7 @@ public class JpaToscaModel extends PfModel {
}
if (getClass() != otherConcept.getClass()) {
- return this.hashCode() - otherConcept.hashCode();
+ return getClass().getName().compareTo(otherConcept.getClass().getName());
}
final JpaToscaModel other = (JpaToscaModel) otherConcept;
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java
index 30ad2b246..7b4ffd164 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java
@@ -331,7 +331,7 @@ public class JpaToscaPolicy extends JpaToscaEntityType<ToscaPolicy> implements P
}
if (getClass() != otherConcept.getClass()) {
- return this.hashCode() - otherConcept.hashCode();
+ return getClass().getName().compareTo(otherConcept.getClass().getName());
}
final JpaToscaPolicy other = (JpaToscaPolicy) otherConcept;
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java
index a6bc835b4..d7560c46e 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java
@@ -280,7 +280,7 @@ public class JpaToscaPolicyType extends JpaToscaEntityType<ToscaPolicyType> impl
return 0;
}
if (getClass() != otherConcept.getClass()) {
- return this.hashCode() - otherConcept.hashCode();
+ return getClass().getName().compareTo(otherConcept.getClass().getName());
}
final JpaToscaPolicyType other = (JpaToscaPolicyType) otherConcept;
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java
index e2b6e6f93..10e8b5d04 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java
@@ -286,7 +286,7 @@ public class JpaToscaProperty extends PfConcept implements PfAuthorative<ToscaPr
return 0;
}
if (getClass() != otherConcept.getClass()) {
- return this.hashCode() - otherConcept.hashCode();
+ return getClass().getName().compareTo(otherConcept.getClass().getName());
}
final JpaToscaProperty other = (JpaToscaProperty) otherConcept;
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java
index f9e388b04..904db849c 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java
@@ -250,7 +250,7 @@ public class JpaToscaServiceTemplate extends JpaToscaEntityType<ToscaServiceTemp
return 0;
}
if (getClass() != otherConcept.getClass()) {
- return this.hashCode() - otherConcept.hashCode();
+ return getClass().getName().compareTo(otherConcept.getClass().getName());
}
final JpaToscaServiceTemplate other = (JpaToscaServiceTemplate) otherConcept;
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeInterval.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeInterval.java
index 369aa03c1..a62affddd 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeInterval.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeInterval.java
@@ -157,7 +157,7 @@ public class JpaToscaTimeInterval extends PfConcept {
return 0;
}
if (getClass() != otherConcept.getClass()) {
- return this.hashCode() - otherConcept.hashCode();
+ return getClass().getName().compareTo(otherConcept.getClass().getName());
}
final JpaToscaTimeInterval other = (JpaToscaTimeInterval) otherConcept;
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.java
index b1c3f209d..bafcb847c 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.java
@@ -185,7 +185,7 @@ public class JpaToscaTopologyTemplate extends PfConcept implements PfAuthorative
return 0;
}
if (getClass() != otherConcept.getClass()) {
- return this.hashCode() - otherConcept.hashCode();
+ return getClass().getName().compareTo(otherConcept.getClass().getName());
}
final JpaToscaTopologyTemplate other = (JpaToscaTopologyTemplate) otherConcept;
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTrigger.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTrigger.java
index 551dbe5bf..f46d43a93 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTrigger.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTrigger.java
@@ -234,7 +234,7 @@ public class JpaToscaTrigger extends PfConcept {
return 0;
}
if (getClass() != otherConcept.getClass()) {
- return this.hashCode() - otherConcept.hashCode();
+ return getClass().getName().compareTo(otherConcept.getClass().getName());
}
final JpaToscaTrigger other = (JpaToscaTrigger) otherConcept;