← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18690: Analytics, impl support for explicit approval level parameter

 

------------------------------------------------------------
revno: 18690
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-03-26 15:25:02 +0100
message:
  Analytics, impl support for explicit approval level parameter
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataapproval/DataApprovalLevelService.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsService.java
  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
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/MockAnalyticsService.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/security/DefaultAnalyticsSecurityManager.java
  dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsServiceTest.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AnalyticsController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/GeoFeatureController.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/dataapproval/DataApprovalLevelService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataapproval/DataApprovalLevelService.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataapproval/DataApprovalLevelService.java	2015-03-26 14:25:02 +0000
@@ -59,6 +59,14 @@
     DataApprovalLevel getDataApprovalLevel( int id );
 
     /**
+     * Gets the data approval level with the given uid.
+     *
+     * @param uid the uid.
+     * @return a data approval level.
+     */
+    DataApprovalLevel getDataApprovalLevel( String uid );
+
+    /**
      * Gets the data approval level with the given name.
      *
      * @param name the name.
@@ -233,4 +241,6 @@
      *         the minimum data approval level within that subhierarchy.
      */
     Map<OrganisationUnit, Integer> getUserReadApprovalLevels();
+    
+    Map<OrganisationUnit, Integer> getUserReadApprovalLevels( DataApprovalLevel approvalLevel );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsService.java	2015-03-07 16:26:59 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsService.java	2015-03-26 14:25:02 +0000
@@ -152,20 +152,24 @@
      * @param aggregationType the aggregation type.
      * @param measureCriteria the measure criteria.
      * @param skipMeta whether to skip the meta data part of the response.
-     * @param skipRounding whether to skip rounding and provide full precision for values.
-     * @param hierarchyMeta whether to include meta data about the org units 
-     *        in the hierarchy.
+     * @param skipRounding whether to skip rounding and provide full precision 
+     *        for values.
+     * @param hierarchyMeta whether to include meta data about the organisation 
+     *        units in the hierarchy.
      * @param ignoreLimit whether to ignore the max number of cells limit.
-     * @param hideEmptyRows whether to hide rows without data values, applies to table layout.
-     * @param showHierarchy whether to show the org unit hierarchy together with the name.
+     * @param hideEmptyRows whether to hide rows without data values, applies to
+     *        table layout.
+     * @param showHierarchy whether to show the organisation unit hierarchy 
+     *        together with the name.
      * @param displayProperty the property to display for meta-data.
      * @param outputIdScheme the identifier scheme to use in the query response.
+     * @param approvalLevel the approval level identifier.
      * @param format the i18n format.
      * @return a data query parameter object created based on the given URL info.
      */
     DataQueryParams getFromUrl( Set<String> dimensionParams, Set<String> filterParams, AggregationType aggregationType, String measureCriteria, 
         boolean skipMeta, boolean skipRounding, boolean hierarchyMeta, boolean ignoreLimit, boolean hideEmptyRows, boolean showHierarchy, 
-        DisplayProperty displayProperty, IdentifiableProperty outputIdScheme, I18nFormat format );
+        DisplayProperty displayProperty, IdentifiableProperty outputIdScheme, String approvalLevel, I18nFormat format );
     
     /**
      * Creates a data query parameter object from the given BaseAnalyticalObject.

=== 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	2015-03-24 11:45:27 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java	2015-03-26 14:25:02 +0000
@@ -160,6 +160,11 @@
      */
     protected IdentifiableProperty outputIdScheme;
     
+    /**
+     * The required approval level identifier for data to be included in query response.
+     */
+    protected String approvalLevel;
+    
     // -------------------------------------------------------------------------
     // Transient properties
     // -------------------------------------------------------------------------
@@ -218,6 +223,7 @@
         params.showHierarchy = this.showHierarchy;
         params.displayProperty = this.displayProperty;
         params.outputIdScheme = this.outputIdScheme;
+        params.approvalLevel = this.approvalLevel;
         
         params.partitions = new Partitions( this.partitions );
         params.dataType = this.dataType;
@@ -515,7 +521,7 @@
         
         return ( dimOpts != null && !dimOpts.isEmpty() ) || ( filterOpts != null && !filterOpts.isEmpty() );
     }
-        
+    
     /**
      * Returns the period type of the first period specified as filter, or
      * null if there is no period filter.
@@ -936,6 +942,15 @@
     }
     
     /**
+     * Indicates whether this params specifies a approval level.
+     * @return
+     */
+    public boolean hasApprovalLevel()
+    {
+        return approvalLevel != null;
+    }
+    
+    /**
      * Ignore data approval constraints for this query.
      */
     public void ignoreDataApproval()
@@ -1209,6 +1224,16 @@
         this.outputIdScheme = outputIdScheme;
     }
 
+    public String getApprovalLevel()
+    {
+        return approvalLevel;
+    }
+
+    public void setApprovalLevel( String approvalLevel )
+    {
+        this.approvalLevel = approvalLevel;
+    }
+
     // -------------------------------------------------------------------------
     // Get and set methods for transient properties
     // -------------------------------------------------------------------------

=== 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	2015-03-26 08:36:46 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java	2015-03-26 14:25:02 +0000
@@ -811,7 +811,7 @@
     @Override
     public DataQueryParams getFromUrl( Set<String> dimensionParams, Set<String> filterParams, AggregationType aggregationType,
         String measureCriteria, boolean skipMeta, boolean skipRounding, boolean hierarchyMeta, boolean ignoreLimit,
-        boolean hideEmptyRows, boolean showHierarchy, DisplayProperty displayProperty, IdentifiableProperty outputIdScheme, I18nFormat format )
+        boolean hideEmptyRows, boolean showHierarchy, DisplayProperty displayProperty, IdentifiableProperty outputIdScheme, String approvalLevel, I18nFormat format )
     {
         DataQueryParams params = new DataQueryParams();
 
@@ -840,6 +840,7 @@
         params.setShowHierarchy( showHierarchy );
         params.setDisplayProperty( displayProperty );
         params.setOutputIdScheme( outputIdScheme );
+        params.setApprovalLevel( approvalLevel );
 
         return params;
     }

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/MockAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/MockAnalyticsService.java	2015-03-07 16:16:41 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/MockAnalyticsService.java	2015-03-26 14:25:02 +0000
@@ -84,7 +84,7 @@
     @Override
     public DataQueryParams getFromUrl( Set<String> dimensionParams, Set<String> filterParams, AggregationType aggregationType, 
         String measureCriteria, boolean skipMeta, boolean skipRounding, boolean hierarchyMeta, boolean ignoreLimit, boolean hideEmptyRows, 
-        boolean showHierarchy, DisplayProperty displayProperty, IdentifiableProperty idScheme, I18nFormat format )
+        boolean showHierarchy, DisplayProperty displayProperty, IdentifiableProperty idScheme, String approvalLevel, I18nFormat format )
     {
         throw new NotImplementedException("");
     }

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/security/DefaultAnalyticsSecurityManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/security/DefaultAnalyticsSecurityManager.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/security/DefaultAnalyticsSecurityManager.java	2015-03-26 14:25:02 +0000
@@ -43,6 +43,8 @@
 import org.hisp.dhis.common.DimensionalObject;
 import org.hisp.dhis.common.IllegalQueryException;
 import org.hisp.dhis.common.NameableObject;
+import org.hisp.dhis.dataapproval.DataApproval;
+import org.hisp.dhis.dataapproval.DataApprovalLevel;
 import org.hisp.dhis.dataapproval.DataApprovalLevelService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
@@ -110,13 +112,35 @@
     @Override
     public void applyDataApprovalConstraints( DataQueryParams params )
     {
-        boolean approval = (Boolean) systemSettingManager.getSystemSetting( SystemSettingManager.KEY_HIDE_UNAPPROVED_DATA_IN_ANALYTICS, false );
+        User user = currentUserService.getCurrentUser();
 
-        User user = currentUserService.getCurrentUser();
-        
-        if ( approval && user != null )
+        boolean hideUnapprovedData = (Boolean) systemSettingManager.getSystemSetting( SystemSettingManager.KEY_HIDE_UNAPPROVED_DATA_IN_ANALYTICS, false );
+        
+        boolean canViewUnapproveData = user.getUserCredentials().isAuthorized( DataApproval.AUTH_VIEW_UNAPPROVED_DATA );
+        
+        Map<OrganisationUnit, Integer> approvalLevels = null;
+        
+        if ( hideUnapprovedData && user != null )
         {
-            Map<OrganisationUnit, Integer> approvalLevels = approvalLevelService.getUserReadApprovalLevels();
+            if ( params.hasApprovalLevel() ) 
+            {
+                // Set approval level from query
+                
+                DataApprovalLevel approvalLevel = approvalLevelService.getDataApprovalLevel( params.getApprovalLevel() );
+                
+                if ( approvalLevel == null )
+                {
+                    throw new IllegalQueryException( "Approval level does not exist:" + params.getApprovalLevel() );
+                }
+                
+                approvalLevels = approvalLevelService.getUserReadApprovalLevels( approvalLevel );
+            }
+            else if ( !canViewUnapproveData )
+            {
+                // Set approval level from user level
+                
+                approvalLevels = approvalLevelService.getUserReadApprovalLevels();
+            }
             
             if ( approvalLevels != null && !approvalLevels.isEmpty() )
             {
@@ -126,7 +150,7 @@
                 }
                 
                 params.setDataApprovalLevels( approvalLevels );
-            
+                
                 log.info( "User: " + user.getUsername() + " constrained by data approval levels: " + approvalLevels.values() );
             }
         }

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsServiceTest.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsServiceTest.java	2015-03-07 16:16:41 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsServiceTest.java	2015-03-26 14:25:02 +0000
@@ -168,7 +168,7 @@
         Set<String> filterParams = new HashSet<>();
         filterParams.add( "ou:" + ouA.getUid() + ";" + ouB.getUid() + ";" + ouC.getUid() + ";" + ouD.getUid() + ";" + ouE.getUid() );
         
-        DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, false, false, false, false, false, false, null, null, null );
+        DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, false, false, false, false, false, false, null, null, null, null );
         
         assertEquals( 4, params.getDataElements().size() );
         assertEquals( 3, params.getPeriods().size() );
@@ -185,7 +185,7 @@
         Set<String> filterParams = new HashSet<>();
         filterParams.add( "ou:" + ouA.getUid() );
         
-        DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, false, false, false, false, false, false, null, null, null );
+        DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, false, false, false, false, false, false, null, null, null, null );
         
         assertEquals( 4, params.getDataElements().size() );
         assertEquals( 1, params.getFilterOrganisationUnits().size() );
@@ -202,7 +202,7 @@
         Set<String> filterParams = new HashSet<>();
         filterParams.add( "ou:" + ouA.getUid() + ";" + ouB.getUid() + ";" + ouC.getUid() );
         
-        DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, false, false, false, false, false, false, null, null, null );
+        DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, false, false, false, false, false, false, null, null, null, null );
         
         assertEquals( 3, params.getDataElements().size() );
         assertEquals( 2, params.getPeriods().size() );
@@ -220,7 +220,7 @@
         Set<String> filterParams = new HashSet<>();
         filterParams.add( "ou:" + ouA.getUid() + ";" + ouB.getUid() );
 
-        DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, false, false, false, false, false, false, null, null, null );
+        DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, false, false, false, false, false, false, null, null, null, null );
         
         assertEquals( 4, params.getDataElements().size() );
         assertEquals( 12, params.getPeriods().size() );
@@ -235,7 +235,7 @@
         dimensionParams.add( "dx:" + deA.getUid() + ";" + deB.getUid() );
         dimensionParams.add( "pe:2011;2012" );
         
-        DataQueryParams params = analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null, null );
+        DataQueryParams params = analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null, null, null );
         
         assertEquals( 1, params.getOrganisationUnits().size() );  
         assertEquals( 2, params.getDataElements().size() );
@@ -250,7 +250,7 @@
         dimensionParams.add( "dx:" + deA.getUid() + ";" + deB.getUid() );
         dimensionParams.add( "pe:2011;2012" );
         
-        DataQueryParams params = analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null, null );
+        DataQueryParams params = analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null, null, null );
         
         assertEquals( 3, params.getOrganisationUnits().size() );  
         assertEquals( 2, params.getDataElements().size() );
@@ -265,7 +265,7 @@
         dimensionParams.add( "dx:" + deA.getUid() + ";" + deB.getUid() );
         dimensionParams.add( "pe:2011;2012" );
         
-        DataQueryParams params = analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null, null );
+        DataQueryParams params = analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null, null, null );
         
         assertEquals( 2, params.getOrganisationUnits().size() );  
         assertEquals( 2, params.getDataElements().size() );
@@ -279,7 +279,7 @@
         dimensionParams.add( "dx" );
         dimensionParams.add( "pe:2012,2012S1,2012S2" );
         
-        analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null, null );        
+        analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null, null, null );        
     }
     
     @Test( expected = IllegalQueryException.class )
@@ -289,7 +289,7 @@
         dimensionParams.add( "dx:" + BASE_UID + "A;" + BASE_UID + "B;" + BASE_UID + "C;" + BASE_UID + "D" );
         dimensionParams.add( "pe" );
 
-        analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null, null );        
+        analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null, null, null );        
     }
 
     @Test( expected = IllegalQueryException.class )
@@ -299,7 +299,7 @@
         dimensionParams.add( "dx:" + BASE_UID + "A;" + BASE_UID + "B;" + BASE_UID + "C;" + BASE_UID + "D" );
         dimensionParams.add( "ou" );
         
-        analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null, null );        
+        analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null, null, null );        
     }
 
     @Test( expected = IllegalQueryException.class )
@@ -309,7 +309,7 @@
         dimensionParams.add( "dx:" + BASE_UID + "A;" + BASE_UID + "B;" + BASE_UID + "C;" + BASE_UID + "D" );
         dimensionParams.add( "yebo:2012,2012S1,2012S2" );
         
-        analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null, null );        
+        analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null, null, null );        
     }
     
     @Test

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java	2015-03-19 19:17:43 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java	2015-03-26 14:25:02 +0000
@@ -123,6 +123,12 @@
     }
 
     @Override
+    public DataApprovalLevel getDataApprovalLevel( String uid )
+    {
+        return dataApprovalLevelStore.getByUid( uid );
+    }
+
+    @Override
     public DataApprovalLevel getDataApprovalLevelByName( String name )
     {
         return dataApprovalLevelStore.getByName( name );
@@ -514,6 +520,10 @@
 
         User user = currentUserService.getCurrentUser();
 
+        // ---------------------------------------------------------------------
+        // Add user organisation units if authorized to approve at lower levels
+        // ---------------------------------------------------------------------
+
         if ( user.getUserCredentials().isAuthorized( DataApproval.AUTH_APPROVE_LOWER_LEVELS ) )
         {
             for ( OrganisationUnit orgUnit : user.getOrganisationUnits() )
@@ -529,6 +539,10 @@
             }
         }
 
+        // ---------------------------------------------------------------------
+        // Add data view organisation units with approval levels
+        // ---------------------------------------------------------------------
+
         Collection<OrganisationUnit> dataViewOrgUnits = user.getDataViewOrganisationUnits();
 
         if ( dataViewOrgUnits == null || dataViewOrgUnits.isEmpty() )
@@ -546,6 +560,28 @@
 
         return map;
     }
+    
+    @Override
+    public Map<OrganisationUnit, Integer> getUserReadApprovalLevels( DataApprovalLevel approvalLevel )
+    {
+        Map<OrganisationUnit, Integer> map = new HashMap<>();
+        
+        User user = currentUserService.getCurrentUser();
+
+        Collection<OrganisationUnit> dataViewOrgUnits = user.getDataViewOrganisationUnits();
+
+        if ( dataViewOrgUnits == null || dataViewOrgUnits.isEmpty() )
+        {
+            dataViewOrgUnits = organisationUnitService.getRootOrganisationUnits();
+        }
+
+        for ( OrganisationUnit orgUnit : dataViewOrgUnits )
+        {
+            map.put( orgUnit, approvalLevel.getLevel() );
+        }
+
+        return map;
+    }
 
     // -------------------------------------------------------------------------
     // Supportive methods
@@ -637,7 +673,7 @@
 
     /**
      * Get the approval level for an organisation unit that is required
-     * in order for the user to see the data -- if user is limited to seeing
+     * in order for the user to see the data, assuming user is limited to seeing
      * approved data only from lower approval levels.
      *
      * @param orgUnit organisation unit to test.

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AnalyticsController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AnalyticsController.java	2015-03-07 16:26:59 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AnalyticsController.java	2015-03-26 14:25:02 +0000
@@ -89,13 +89,14 @@
         @RequestParam( required = false ) boolean showHierarchy,
         @RequestParam( required = false ) DisplayProperty displayProperty,
         @RequestParam( required = false ) IdentifiableProperty outputIdScheme,
+        @RequestParam( required = false ) String approvalLevel,
         @RequestParam( required = false ) String columns,
         @RequestParam( required = false ) String rows,
         Model model,
         HttpServletResponse response ) throws Exception
     {
-        DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria,
-            skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, i18nManager.getI18nFormat() );
+        DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipRounding, 
+            hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, i18nManager.getI18nFormat() );
 
         contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_JSON, CacheStrategy.RESPECT_SYSTEM_SETTING );
         Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getDimensionsFromParam( columns ), getDimensionsFromParam( rows ) );
@@ -119,13 +120,14 @@
         @RequestParam( required = false ) boolean showHierarchy,
         @RequestParam( required = false ) DisplayProperty displayProperty,
         @RequestParam( required = false ) IdentifiableProperty outputIdScheme,
+        @RequestParam( required = false ) String approvalLevel,
         @RequestParam( required = false ) String columns,
         @RequestParam( required = false ) String rows,
         Model model,
         HttpServletResponse response ) throws Exception
     {
-        DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria,
-            skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, i18nManager.getI18nFormat() );
+        DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipRounding, 
+            hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, i18nManager.getI18nFormat() );
 
         contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_XML, CacheStrategy.RESPECT_SYSTEM_SETTING );
         Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getDimensionsFromParam( columns ), getDimensionsFromParam( rows ) );
@@ -147,13 +149,14 @@
         @RequestParam( required = false ) boolean showHierarchy,
         @RequestParam( required = false ) DisplayProperty displayProperty,
         @RequestParam( required = false ) IdentifiableProperty outputIdScheme,
+        @RequestParam( required = false ) String approvalLevel,
         @RequestParam( required = false ) String columns,
         @RequestParam( required = false ) String rows,
         Model model,
         HttpServletResponse response ) throws Exception
     {
-        DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria,
-            skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, i18nManager.getI18nFormat() );
+        DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipRounding, 
+            hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, i18nManager.getI18nFormat() );
 
         contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, CacheStrategy.RESPECT_SYSTEM_SETTING );
         Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getDimensionsFromParam( columns ), getDimensionsFromParam( rows ) );
@@ -175,13 +178,14 @@
         @RequestParam( required = false ) boolean showHierarchy,
         @RequestParam( required = false ) DisplayProperty displayProperty,
         @RequestParam( required = false ) IdentifiableProperty outputIdScheme,
+        @RequestParam( required = false ) String approvalLevel,
         @RequestParam( required = false ) String columns,
         @RequestParam( required = false ) String rows,
         Model model,
         HttpServletResponse response ) throws Exception
     {
-        DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria,
-            skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, i18nManager.getI18nFormat() );
+        DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipRounding, 
+            hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, i18nManager.getI18nFormat() );
 
         contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, CacheStrategy.RESPECT_SYSTEM_SETTING );
         Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getDimensionsFromParam( columns ), getDimensionsFromParam( rows ) );
@@ -203,13 +207,14 @@
         @RequestParam( required = false ) boolean showHierarchy,
         @RequestParam( required = false ) DisplayProperty displayProperty,
         @RequestParam( required = false ) IdentifiableProperty outputIdScheme,
+        @RequestParam( required = false ) String approvalLevel,
         @RequestParam( required = false ) String columns,
         @RequestParam( required = false ) String rows,
         Model model,
         HttpServletResponse response ) throws Exception
     {
-        DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria,
-            skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, i18nManager.getI18nFormat() );
+        DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipRounding, 
+            hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, i18nManager.getI18nFormat() );
 
         contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_CSV, CacheStrategy.RESPECT_SYSTEM_SETTING, "data.csv", true );
         Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getDimensionsFromParam( columns ), getDimensionsFromParam( rows ) );
@@ -231,13 +236,14 @@
         @RequestParam( required = false ) boolean showHierarchy,
         @RequestParam( required = false ) DisplayProperty displayProperty,
         @RequestParam( required = false ) IdentifiableProperty outputIdScheme,
+        @RequestParam( required = false ) String approvalLevel,
         @RequestParam( required = false ) String columns,
         @RequestParam( required = false ) String rows,
         Model model,
         HttpServletResponse response ) throws Exception
     {
-        DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria,
-            skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, i18nManager.getI18nFormat() );
+        DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipRounding, 
+            hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, i18nManager.getI18nFormat() );
 
         contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_EXCEL, CacheStrategy.RESPECT_SYSTEM_SETTING, "data.xls", true );
         Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getDimensionsFromParam( columns ), getDimensionsFromParam( rows ) );
@@ -259,13 +265,14 @@
         @RequestParam( required = false ) boolean showHierarchy,
         @RequestParam( required = false ) DisplayProperty displayProperty,
         @RequestParam( required = false ) IdentifiableProperty outputIdScheme,
+        @RequestParam( required = false ) Integer approvalLevel,
         @RequestParam( required = false ) String columns,
         @RequestParam( required = false ) String rows,
         Model model,
         HttpServletResponse response ) throws Exception
     {
         DataQueryParams params = analyticsService.getFromUrl( dimension, filter, null, null,
-            true, false, false, false, false, false, null, null, i18nManager.getI18nFormat() );
+            true, false, false, false, false, false, null, null, null, i18nManager.getI18nFormat() );
 
         contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_XML, CacheStrategy.RESPECT_SYSTEM_SETTING, "data.jrxml", false );
         Grid grid = analyticsService.getAggregatedDataValues( params );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/GeoFeatureController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/GeoFeatureController.java	2015-03-07 16:16:41 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/GeoFeatureController.java	2015-03-26 14:25:02 +0000
@@ -137,7 +137,8 @@
         Set<String> set = new HashSet<>();
         set.add( ou );
 
-        DataQueryParams params = analyticsService.getFromUrl( set, null, AggregationType.SUM, null, false, false, false, false, false, false, displayProperty, null, null );
+        DataQueryParams params = analyticsService.getFromUrl( set, null, AggregationType.SUM, null, 
+            false, false, false, false, false, false, displayProperty, null, null, null );
 
         DimensionalObject dim = params.getDimension( DimensionalObject.ORGUNIT_DIM_ID );