← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10998: Analytics, performance improvement, nullpointer checks

 

------------------------------------------------------------
revno: 10998
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2013-05-25 14:22:29 +0200
message:
  Analytics, performance improvement, nullpointer checks
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.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/organisationunit/OrganisationUnit.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java	2013-05-24 11:48:35 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java	2013-05-25 12:22:29 +0000
@@ -543,6 +543,8 @@
             thisParent = thisParent.getParent();
         }
 
+        this.level = currentLevel;
+        
         return currentLevel;
     }
 

=== 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-05-24 12:13:28 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java	2013-05-25 12:22:29 +0000
@@ -501,12 +501,12 @@
         
         List<Future<Map<String, Double>>> futures = new ArrayList<Future<Map<String, Double>>>();
         
-        Map<String, Double> map = new HashMap<String, Double>();
-        
         for ( DataQueryParams query : queries )
         {
             futures.add( analyticsManager.getAggregatedDataValues( query ) );
         }
+
+        Map<String, Double> map = new HashMap<String, Double>();
         
         for ( Future<Map<String, Double>> future : futures )
         {

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java	2013-05-15 15:00:45 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java	2013-05-25 12:22:29 +0000
@@ -235,13 +235,23 @@
         dimensionService.mergeAnalyticalObject( chart );
         
         chart.getFilterDimensions().clear();
-                
-        chart.setSeries( toDimension( chart.getColumns().get( 0 ).getDimension() ) );
-        chart.setCategory( toDimension( chart.getRows().get( 0 ).getDimension() ) );
-        
-        for ( DimensionalObject dimension : chart.getFilters() )
-        {
-            chart.getFilterDimensions().add( toDimension( dimension.getDimension() ) );
+        
+        if ( chart.getColumns() != null )
+        {
+            chart.setSeries( toDimension( chart.getColumns().get( 0 ).getDimension() ) );
+        }
+        
+        if ( chart.getRows() != null )
+        {
+            chart.setCategory( toDimension( chart.getRows().get( 0 ).getDimension() ) );
+        }
+        
+        if ( chart.getFilters() != null )
+        {
+            for ( DimensionalObject dimension : chart.getFilters() )
+            {
+                chart.getFilterDimensions().add( toDimension( dimension.getDimension() ) );
+            }
         }
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java	2013-05-20 06:10:29 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java	2013-05-25 12:22:29 +0000
@@ -302,19 +302,28 @@
         reportTable.getRowDimensions().clear();
         reportTable.getFilterDimensions().clear();
         
-        for ( DimensionalObject column : reportTable.getColumns() )
-        {
-            reportTable.getColumnDimensions().add( toDimension( column.getDimension() ) );
-        }
-        
-        for ( DimensionalObject row : reportTable.getRows() )
-        {
-            reportTable.getRowDimensions().add( toDimension( row.getDimension() ) );
-        }
-        
-        for ( DimensionalObject filter : reportTable.getFilters() )
-        {
-            reportTable.getFilterDimensions().add( toDimension( filter.getDimension() ) );
+        if ( reportTable.getColumns() != null )
+        {
+            for ( DimensionalObject column : reportTable.getColumns() )
+            {
+                reportTable.getColumnDimensions().add( toDimension( column.getDimension() ) );
+            }
+        }
+        
+        if ( reportTable.getRows() != null )
+        {
+            for ( DimensionalObject row : reportTable.getRows() )
+            {
+                reportTable.getRowDimensions().add( toDimension( row.getDimension() ) );
+            }
+        }
+        
+        if ( reportTable.getFilters() != null )
+        {
+            for ( DimensionalObject filter : reportTable.getFilters() )
+            {
+                reportTable.getFilterDimensions().add( toDimension( filter.getDimension() ) );
+            }
         }
     }
 }