← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2824: Minor simplifcation in report table

 

Merge authors:
  Lars Helge Øverland (larshelge)
------------------------------------------------------------
revno: 2824 [merge]
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-02-08 11:51:13 +0100
message:
  Minor simplifcation in report table
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.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/reporttable/ReportTable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2011-02-07 08:43:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2011-02-08 09:53:28 +0000
@@ -424,6 +424,7 @@
     {
         verify( nonEmptyLists( dataElements, indicators, dataSets ) == 1, "One of dataelements, indicators, and datasets size must be larger than 0" );
         verify( !( doIndicators && doPeriods && doUnits ), "Cannot crosstab on all dimensions" );
+        verify( i18nFormat != null, "I18n format must be set" );
         
         // ---------------------------------------------------------------------
         // Init tableName, allPeriods and allUnits
@@ -443,9 +444,9 @@
 
         for ( Period period : allPeriods )
         {
-            if ( period.getName() == null && i18nFormat != null )
+            if ( period.getName() == null ) // Crosstabulated relative periods
             {
-                period.setName( i18nFormat.formatPeriod( period ) );
+                period.setName( i18nFormat.formatPeriod( period ) ); // Static periods + indexed relative periods
             }
         }
         
@@ -598,25 +599,6 @@
     // -------------------------------------------------------------------------
     // Public methods
     // -------------------------------------------------------------------------
-
-    /**
-     * Tests whether this report table has report parameters for dimensions which
-     * are on columns.
-     */
-    public boolean hasDynamicColumns()
-    {
-        if ( doUnits && reportParams != null && ( reportParams.isParamOrganisationUnit() || reportParams.isParamParentOrganisationUnit() ) )
-        {
-            return true;
-        }
-        
-        if ( doPeriods && reportParams != null && reportParams.isParamReportingMonth() )
-        {
-            return true;
-        }
-        
-        return false;
-    }
     
     /**
      * Returns a list of names of all columns for this ReportTable.
@@ -780,9 +762,7 @@
         }
         if ( period != null )
         {
-            String periodName = format == null ? period.getName() : format.formatPeriod( period );
-            
-            buffer.append( periodName + SPACE );
+            buffer.append( format.formatPeriod( period ) + SPACE );
         }
         if ( unit != null )
         {