← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5724: Charts, current user org unit function now working properly

 

------------------------------------------------------------
revno: 5724
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-01-13 10:55:59 +0100
message:
  Charts, current user org unit function now working properly
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.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/chart/Chart.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java	2012-01-13 09:55:59 +0000
@@ -153,16 +153,6 @@
         this.name = name;
     }
 
-    public void init()
-    {
-        allOrganisationUnits.addAll( organisationUnits );
-
-        if ( organisationUnit != null )
-        {
-            allOrganisationUnits.add( organisationUnit );
-        }
-    }
-
     // -------------------------------------------------------------------------
     // Logic
     // -------------------------------------------------------------------------
@@ -211,8 +201,14 @@
         }
         else if ( DIMENSION_ORGANISATIONUNIT.equals( dimension ) )
         {
-            list.addAll( organisationUnits );
-            list.addAll( organisationUnit != null ? Arrays.asList( organisationUnit ) : new ArrayList<NameableObject>() );
+            if ( organisationUnit != null )
+            {
+                list.addAll( Arrays.asList( organisationUnit ) );
+            }
+            else
+            {
+                list.addAll( organisationUnits );
+            }
         }
         
         return list;
@@ -227,39 +223,6 @@
         }
     }
     
-    /**
-     * TODO This method is a temporary hack while we phase out the old chart UI.
-     */
-    public String getDimension()
-    {
-        if ( DIMENSION_DATA.equals( series ) && DIMENSION_PERIOD.equals( category ) && !indicators.isEmpty() )
-        {
-            return DIMENSION_PERIOD_INDICATOR;
-        }
-        else if ( DIMENSION_DATA.equals( series ) && DIMENSION_ORGANISATIONUNIT.equals( category ) && !indicators.isEmpty() )
-        {
-            return DIMENSION_ORGANISATIONUNIT_INDICATOR;
-        }
-        else if ( DIMENSION_PERIOD.equals( series ) && DIMENSION_DATA.equals( category ) && !indicators.isEmpty() )
-        {
-            return DIMENSION_INDICATOR_PERIOD;
-        }
-        else if ( DIMENSION_DATA.equals( series ) && DIMENSION_PERIOD.equals( category ) )
-        {
-            return DIMENSION_PERIOD_DATAELEMENT;
-        }
-        else if ( DIMENSION_DATA.equals( series ) && DIMENSION_ORGANISATIONUNIT.equals( category ) )
-        {
-            return DIMENSION_ORGANISATIONUNIT_DATAELEMENT;
-        }
-        else if ( DIMENSION_PERIOD.equals( series ) && DIMENSION_DATA.equals( category ) )
-        {
-            return DIMENSION_DATAELEMENT_PERIOD;
-        }
-        
-        return null;
-    }
-    
     // -------------------------------------------------------------------------
     // hashCode, equals, toString
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java	2012-01-09 20:22:01 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java	2012-01-13 09:55:59 +0000
@@ -213,7 +213,6 @@
         }
 
         chart.setFormat( format );
-        chart.init();
 
         return getJFreeChart( chart, !chart.isHideSubtitle() );
     }
@@ -238,8 +237,6 @@
         chart.setOrganisationUnit( unit );
         chart.setFormat( format );
 
-        chart.init();
-
         return getJFreeChart( chart, title );
     }
 
@@ -264,8 +261,6 @@
         chart.setOrganisationUnits( parent.getSortedChildren() );
         chart.setFormat( format );
 
-        chart.init();
-
         return getJFreeChart( chart, title );
     }
 
@@ -287,8 +282,6 @@
         chart.setFormat( format );
         chart.setName( chart.getTitle() );
 
-        chart.init();
-
         return getJFreeChart( chart, false );
     }