← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9682: Minor

 

------------------------------------------------------------
revno: 9682
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-02-01 13:13:47 +0200
message:
  Minor
modified:
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.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-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java	2013-01-31 10:59:22 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java	2013-02-01 11:13:47 +0000
@@ -647,6 +647,16 @@
         this.organisationUnitLevel = organisationUnitLevel;
     }
 
+    public PeriodType getDataPeriodType()
+    {
+        return dataPeriodType;
+    }
+
+    public void setDataPeriodType( PeriodType dataPeriodType )
+    {
+        this.dataPeriodType = dataPeriodType;
+    }
+    
     // -------------------------------------------------------------------------
     // Get and set helpers for dimensions or filter
     // -------------------------------------------------------------------------
@@ -780,18 +790,4 @@
     {
         setFilterOptions( ORGUNIT_DIM_ID, DimensionType.ORGANISATIONUNIT, organisationUnits );
     }
-
-    // -------------------------------------------------------------------------
-    // Get and set methods for transient properties
-    // -------------------------------------------------------------------------
-
-    public PeriodType getDataPeriodType()
-    {
-        return dataPeriodType;
-    }
-
-    public void setDataPeriodType( PeriodType dataPeriodType )
-    {
-        this.dataPeriodType = dataPeriodType;
-    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java	2013-01-31 10:59:22 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java	2013-02-01 11:13:47 +0000
@@ -45,6 +45,7 @@
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -83,6 +84,7 @@
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.period.RelativePeriodEnum;
 import org.hisp.dhis.period.RelativePeriods;
+import org.hisp.dhis.period.comparator.PeriodComparator;
 import org.hisp.dhis.system.grid.ListGrid;
 import org.hisp.dhis.system.util.MathUtils;
 import org.hisp.dhis.system.util.SystemUtils;
@@ -373,7 +375,7 @@
                 DataElement de = dataElementService.getDataElement( uid );
                 
                 if ( de != null )
-                {
+                {       
                     dataElements.add( de );
                     continue options;
                 }
@@ -431,7 +433,7 @@
         
         if ( PERIOD_DIM_ID.equals( dimension ) )
         {
-            List<IdentifiableObject> periods = new ArrayList<IdentifiableObject>();
+            List<Period> periods = new ArrayList<Period>();
             
             periods : for ( String isoPeriod : options )
             {
@@ -456,8 +458,11 @@
             {
                 throw new IllegalQueryException( "Dimension pe is present in query without any valid dimension options" );
             }
+
+            List<Period> periodList = new ArrayList<Period>( periods );
+            Collections.sort( periodList, PeriodComparator.INSTANCE );
             
-            return Arrays.asList( new Dimension( dimension, DimensionType.PERIOD, periods ) );
+            return Arrays.asList( new Dimension( dimension, DimensionType.PERIOD, asList( periodList ) ) );
         }
         
         OrganisationUnitGroupSet orgUnitGroupSet = organisationUnitGroupService.getOrganisationUnitGroupSet( dimension );