← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19713: Analytics, fixed minor issue with restoring favorites with org unit groups/levels

 

------------------------------------------------------------
revno: 19713
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-08-04 17:11:23 +0200
message:
  Analytics, fixed minor issue with restoring favorites with org unit groups/levels
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseAnalyticalObject.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-08-04 13:40:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseAnalyticalObject.java	2015-08-04 15:11:23 +0000
@@ -209,6 +209,11 @@
     {
         return relatives != null && !relatives.isEmpty();
     }
+    
+    public boolean hasOrganisationUnits()
+    {
+        return organisationUnits != null && !organisationUnits.isEmpty();
+    }
 
     public boolean hasOrganisationUnitLevels()
     {
@@ -219,6 +224,11 @@
     {
         return itemOrganisationUnitGroups != null && !itemOrganisationUnitGroups.isEmpty();
     }
+    
+    public boolean hasAnyOrganisationUnits()
+    {
+        return hasOrganisationUnits() || hasOrganisationUnitLevels() || hasItemOrganisationUnitGroups() || hasUserOrgUnit();
+    }
 
     public boolean hasSortOrder()
     {
@@ -535,7 +545,7 @@
         {
             objects.add( new BaseDimensionalObject( dimension, DimensionType.DATA_X, getDataDimensionNameableObjects() ) );
         }
-        else if ( PERIOD_DIM_ID.equals( dimension ) && (!periods.isEmpty() || hasRelativePeriods()) )
+        else if ( PERIOD_DIM_ID.equals( dimension ) && ( !periods.isEmpty() || hasRelativePeriods() ) )
         {
             List<Period> periodList = new ArrayList<>( periods );
 
@@ -553,7 +563,7 @@
 
             objects.add( new BaseDimensionalObject( dimension, DimensionType.PERIOD, periodList ) );
         }
-        else if ( ORGUNIT_DIM_ID.equals( dimension ) && (!organisationUnits.isEmpty() || !transientOrganisationUnits.isEmpty() || hasUserOrgUnit()) )
+        else if ( ORGUNIT_DIM_ID.equals( dimension ) && ( hasAnyOrganisationUnits() || !transientOrganisationUnits.isEmpty() ) )
         {
             List<NameableObject> ouList = new ArrayList<>();
             ouList.addAll( organisationUnits );