← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18685: Analytics. Using user org unit instead of user data view org unit as basis for user orgunit pivot...

 

------------------------------------------------------------
revno: 18685
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-03-26 09:36:46 +0100
message:
  Analytics. Using user org unit instead of user data view org unit as basis for user orgunit pivots and charts
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseAnalyticalObject.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/event/data/DefaultEventAnalyticsService.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/common/BaseAnalyticalObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseAnalyticalObject.java	2015-03-23 20:38:30 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseAnalyticalObject.java	2015-03-26 08:36:46 +0000
@@ -273,19 +273,19 @@
             items.addAll( organisationUnits );
             items.addAll( transientOrganisationUnits );
 
-            if ( userOrganisationUnit && user != null && user.hasDataViewOrganisationUnitWithFallback() )
-            {
-                items.add( user.getDataViewOrganisationUnitWithFallback() );
-            }
-
-            if ( userOrganisationUnitChildren && user != null && user.hasDataViewOrganisationUnitWithFallback() )
-            {
-                items.addAll( user.getDataViewOrganisationUnitWithFallback().getSortedChildren() );
-            }
-
-            if ( userOrganisationUnitGrandChildren && user != null && user.hasDataViewOrganisationUnitWithFallback() )
-            {
-                items.addAll( user.getDataViewOrganisationUnitWithFallback().getSortedGrandChildren() );
+            if ( userOrganisationUnit && user != null && user.hasOrganisationUnit() )
+            {
+                items.add( user.getOrganisationUnit() );
+            }
+
+            if ( userOrganisationUnitChildren && user != null && user.hasOrganisationUnit() )
+            {
+                items.addAll( user.getOrganisationUnit().getSortedChildren() );
+            }
+
+            if ( userOrganisationUnitGrandChildren && user != null && user.hasOrganisationUnit() )
+            {
+                items.addAll( user.getOrganisationUnit().getSortedGrandChildren() );
             }
 
             if ( organisationUnitLevels != null && !organisationUnitLevels.isEmpty() && organisationUnitsAtLevel != null )

=== 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-24 11:45:27 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java	2015-03-26 08:36:46 +0000
@@ -504,7 +504,7 @@
             User user = currentUserService.getCurrentUser();
             
             List<OrganisationUnit> organisationUnits = asTypedList( params.getDimensionOrFilter( ORGUNIT_DIM_ID ), OrganisationUnit.class );
-            Collection<OrganisationUnit> roots = user != null ? user.getDataViewOrganisationUnits() : null;
+            Collection<OrganisationUnit> roots = user != null ? user.getOrganisationUnits() : null;
             
             if ( params.isHierarchyMeta() )
             {
@@ -1068,17 +1068,17 @@
 
             for ( String ou : items )
             {
-                if ( KEY_USER_ORGUNIT.equals( ou ) && user != null && user.hasDataViewOrganisationUnitWithFallback() )
-                {
-                    ous.add( user.getDataViewOrganisationUnitWithFallback() );
-                }
-                else if ( KEY_USER_ORGUNIT_CHILDREN.equals( ou ) && user != null && user.hasDataViewOrganisationUnitWithFallback() )
-                {
-                    ous.addAll( user.getDataViewOrganisationUnitWithFallback().getSortedChildren() );
-                }
-                else if ( KEY_USER_ORGUNIT_GRANDCHILDREN.equals( ou ) && user != null && user.hasDataViewOrganisationUnitWithFallback() )
-                {
-                    ous.addAll( user.getDataViewOrganisationUnitWithFallback().getSortedGrandChildren() );
+                if ( KEY_USER_ORGUNIT.equals( ou ) && user != null && user.hasOrganisationUnit() )
+                {
+                    ous.add( user.getOrganisationUnit() );
+                }
+                else if ( KEY_USER_ORGUNIT_CHILDREN.equals( ou ) && user != null && user.hasOrganisationUnit() )
+                {
+                    ous.addAll( user.getOrganisationUnit().getSortedChildren() );
+                }
+                else if ( KEY_USER_ORGUNIT_GRANDCHILDREN.equals( ou ) && user != null && user.hasOrganisationUnit() )
+                {
+                    ous.addAll( user.getOrganisationUnit().getSortedGrandChildren() );
                 }
                 else if ( ou != null && ou.startsWith( KEY_LEVEL ) )
                 {

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java	2015-03-24 08:43:31 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java	2015-03-26 08:36:46 +0000
@@ -249,7 +249,7 @@
 
             User user = currentUserService.getCurrentUser();
             
-            Collection<OrganisationUnit> roots = user != null ? user.getDataViewOrganisationUnits() : null;
+            Collection<OrganisationUnit> roots = user != null ? user.getOrganisationUnits() : null;
             
             if ( params.isHierarchyMeta() )
             {
@@ -340,7 +340,7 @@
 
         User user = currentUserService.getCurrentUser();
 
-        Collection<OrganisationUnit> roots = user != null ? user.getDataViewOrganisationUnits() : null;
+        Collection<OrganisationUnit> roots = user != null ? user.getOrganisationUnits() : null;
         
         if ( params.isHierarchyMeta() )
         {