← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6237: Fixed flaw in hashcode/equals for aggregateddata/indicatorvalue

 

------------------------------------------------------------
revno: 6237
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-03-09 18:10:14 +0100
message:
  Fixed flaw in hashcode/equals for aggregateddata/indicatorvalue
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValue.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedIndicatorValue.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValue.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValue.java	2012-02-13 17:18:22 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValue.java	2012-03-09 17:10:14 +0000
@@ -167,7 +167,7 @@
     @Override
     public int hashCode()
     {
-        return dataElementId * periodId * organisationUnitId * 17;
+        return dataElementId * periodId * organisationUnitId * organisationUnitGroupId * 17;
     }
     
     @Override
@@ -186,8 +186,9 @@
         AggregatedDataValue that = (AggregatedDataValue) object;
         
         return this.dataElementId == that.getDataElementId() &&
-            this.categoryOptionComboId == that.categoryOptionComboId &&
+            this.categoryOptionComboId == that.getCategoryOptionComboId() &&
     	    this.periodId == that.getPeriodId() &&
-    	    this.organisationUnitId == that.getOrganisationUnitId();
+    	    this.organisationUnitId == that.getOrganisationUnitId() &&
+    	    this.organisationUnitGroupId == that.getOrganisationUnitGroupId();
     }
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedIndicatorValue.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedIndicatorValue.java	2012-02-13 17:18:22 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedIndicatorValue.java	2012-03-09 17:10:14 +0000
@@ -224,7 +224,7 @@
     @Override
     public int hashCode()
     {
-        return indicatorId * periodId * organisationUnitId * 17;
+        return indicatorId * periodId * organisationUnitId * organisationUnitGroupId * 17;
     }
 
     @Override
@@ -244,6 +244,7 @@
         
         return this.indicatorId == that.getIndicatorId() && 
             this.periodId == that.getPeriodId() && 
-            this.organisationUnitId == that.getOrganisationUnitId(); 
+            this.organisationUnitId == that.getOrganisationUnitId() &&
+            this.organisationUnitGroupId == that.getOrganisationUnitGroupId();
     }
 }