← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1890: Sorting of integrity violations

 

------------------------------------------------------------
revno: 1890
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Thu 2010-05-20 11:54:45 +0200
message:
  Sorting of integrity violations
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataintegrity/DataIntegrityService.java
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataintegrity/DefaultDataIntegrityService.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/dataintegrity/DataIntegrityService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataintegrity/DataIntegrityService.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataintegrity/DataIntegrityService.java	2010-05-20 09:54:45 +0000
@@ -28,7 +28,7 @@
  */
 
 import java.util.Collection;
-import java.util.Map;
+import java.util.SortedMap;
 
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataset.DataSet;
@@ -67,7 +67,7 @@
      * Returns all data elements which are members of data sets with different
      * period types.
      */
-    Map<DataElement, Collection<DataSet>> getDataElementsAssignedToDataSetsWithDifferentPeriodTypes();
+    SortedMap<DataElement, Collection<DataSet>> getDataElementsAssignedToDataSetsWithDifferentPeriodTypes();
 
     // -------------------------------------------------------------------------
     // DataSet
@@ -95,12 +95,12 @@
     /**
      * Gets all indicators with invalid indicator numerators.
      */
-    Map<Indicator, String> getInvalidIndicatorNumerators();
+    SortedMap<Indicator, String> getInvalidIndicatorNumerators();
 
     /**
      * Gets all indicators with invalid indicator denominators.
      */
-    Map<Indicator, String> getInvalidIndicatorDenominators();
+    SortedMap<Indicator, String> getInvalidIndicatorDenominators();
     
     // -------------------------------------------------------------------------
     // OrganisationUnit
@@ -154,10 +154,10 @@
     /**
      * Gets all ValidationRules with invalid left side expressions.
      */
-    Map<ValidationRule, String> getInvalidValidationRuleLeftSideExpressions();
+    SortedMap<ValidationRule, String> getInvalidValidationRuleLeftSideExpressions();
     
     /**
      * Gets all ValidationRules with invalid right side expressions.
      */
-    Map<ValidationRule, String> getInvalidValidationRuleRightSideExpressions();
+    SortedMap<ValidationRule, String> getInvalidValidationRuleRightSideExpressions();
 }

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataintegrity/DefaultDataIntegrityService.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataintegrity/DefaultDataIntegrityService.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataintegrity/DefaultDataIntegrityService.java	2010-05-20 09:54:45 +0000
@@ -31,19 +31,21 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Hashtable;
-import java.util.Map;
 import java.util.Set;
+import java.util.SortedMap;
+import java.util.TreeMap;
 
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataelement.comparator.DataElementNameComparator;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.expression.ExpressionService;
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.indicator.IndicatorService;
+import org.hisp.dhis.indicator.comparator.IndicatorNameComparator;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
@@ -56,6 +58,7 @@
 import org.hisp.dhis.system.util.FilterUtils;
 import org.hisp.dhis.validation.ValidationRule;
 import org.hisp.dhis.validation.ValidationRuleService;
+import org.hisp.dhis.validation.comparator.ValidationRuleNameComparator;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
@@ -141,13 +144,13 @@
         return dataElementService.getDataElementsWithoutGroups();
     }
 
-    public Map<DataElement, Collection<DataSet>> getDataElementsAssignedToDataSetsWithDifferentPeriodTypes()
+    public SortedMap<DataElement, Collection<DataSet>> getDataElementsAssignedToDataSetsWithDifferentPeriodTypes()
     {
         Collection<DataElement> dataElements = dataElementService.getAllDataElements();
 
         Collection<DataSet> dataSets = dataSetService.getAllDataSets();
 
-        Map<DataElement, Collection<DataSet>> targets = new HashMap<DataElement, Collection<DataSet>>();
+        SortedMap<DataElement, Collection<DataSet>> targets = new TreeMap<DataElement, Collection<DataSet>>( new DataElementNameComparator() );
 
         for ( DataElement element : dataElements )
         {
@@ -236,9 +239,9 @@
         return indicatorService.getIndicatorsWithoutGroups();
     }
 
-    public Map<Indicator, String> getInvalidIndicatorNumerators()
+    public SortedMap<Indicator, String> getInvalidIndicatorNumerators()
     {
-        Map<Indicator, String> invalids = new HashMap<Indicator, String>();
+        SortedMap<Indicator, String> invalids = new TreeMap<Indicator, String>( new IndicatorNameComparator() );
 
         for ( Indicator indicator : indicatorService.getAllIndicators() )
         {
@@ -253,9 +256,9 @@
         return invalids;
     }
 
-    public Map<Indicator, String> getInvalidIndicatorDenominators()
+    public SortedMap<Indicator, String> getInvalidIndicatorDenominators()
     {
-        Map<Indicator, String> invalids = new HashMap<Indicator, String>();
+        SortedMap<Indicator, String> invalids = new TreeMap<Indicator, String>( new IndicatorNameComparator() );
 
         for ( Indicator indicator : indicatorService.getAllIndicators() )
         {
@@ -395,9 +398,9 @@
         } );
     }
 
-    public Map<ValidationRule, String> getInvalidValidationRuleLeftSideExpressions()
+    public SortedMap<ValidationRule, String> getInvalidValidationRuleLeftSideExpressions()
     {
-        Map<ValidationRule, String> invalids = new HashMap<ValidationRule, String>();
+        SortedMap<ValidationRule, String> invalids = new TreeMap<ValidationRule, String>( new ValidationRuleNameComparator() );
 
         for ( ValidationRule rule : validationRuleService.getAllValidationRules() )
         {
@@ -412,9 +415,9 @@
         return invalids;
     }
 
-    public Map<ValidationRule, String> getInvalidValidationRuleRightSideExpressions()
+    public SortedMap<ValidationRule, String> getInvalidValidationRuleRightSideExpressions()
     {
-        Map<ValidationRule, String> invalids = new HashMap<ValidationRule, String>();
+        SortedMap<ValidationRule, String> invalids = new TreeMap<ValidationRule, String>( new ValidationRuleNameComparator() );
 
         for ( ValidationRule rule : validationRuleService.getAllValidationRules() )
         {