← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4894: Impl new relative period last 5 years

 

------------------------------------------------------------
revno: 4894
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-10-11 13:27:38 +0200
message:
  Impl new relative period last 5 years
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/RelativePeriods.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/YearlyPeriodType.java
  dhis-2/dhis-api/src/test/java/org/hisp/dhis/period/RelativePeriodTest.java
  dhis-2/dhis-api/src/test/java/org/hisp/dhis/period/YearlyPeriodTypeTest.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartExportStoreTest.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataMartTask.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataSetCompletenessTask.java
  dhis-2/dhis-web/dhis-web-datamart/src/main/java/org/hisp/dhis/datamart/action/SaveDataMartExportAction.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/SaveChartAction.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/SaveTableAction.java
  dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedDataValuesAction.java
  dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedIndicatorValuesAction.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/period/RelativePeriods.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/RelativePeriods.java	2011-09-29 13:48:07 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/RelativePeriods.java	2011-10-11 11:27:38 +0000
@@ -92,6 +92,13 @@
         "quarter2_last_year",
         "quarter3_last_year",
         "quarter4_last_year" };
+    
+    public static final String[] LAST_5_YEARS = {
+        "year_minus_4",
+        "year_minus_3",
+        "year_minus_2",
+        "year_minus_1",
+        "year_this" };
 
     private static final int MONTHS_IN_YEAR = 12;
     
@@ -112,6 +119,8 @@
     private Boolean quartersLastYear = false;
     
     private Boolean lastYear = false;
+
+    private Boolean last5Years = false;
     
     // -------------------------------------------------------------------------
     // Constructors
@@ -131,10 +140,11 @@
      * @param monthsLastYear months last year
      * @param quartersLastYear quarters last year
      * @param lastYear last year
+     * @param last5Years last 5 years
      */
     public RelativePeriods( boolean reportingMonth, boolean reportingBimonth, boolean reportingQuarter,
         boolean monthsThisYear, boolean quartersThisYear, boolean thisYear,
-        boolean monthsLastYear, boolean quartersLastYear, boolean lastYear )
+        boolean monthsLastYear, boolean quartersLastYear, boolean lastYear, boolean last5Years )
     {
         this.reportingMonth = reportingMonth;
         this.reportingBimonth = reportingBimonth;
@@ -145,6 +155,7 @@
         this.monthsLastYear = monthsLastYear;
         this.quartersLastYear = quartersLastYear;
         this.lastYear = lastYear;
+        this.last5Years = last5Years;
     }
 
     // -------------------------------------------------------------------------
@@ -162,6 +173,7 @@
         this.monthsLastYear = false;
         this.quartersLastYear = false;
         this.lastYear = false;
+        this.last5Years = false;
         return this;
     }
     
@@ -241,6 +253,11 @@
         {
             periods.add( getRelativePeriod( new YearlyPeriodType(), THIS_YEAR, current, dynamicNames, format ) );
         }
+
+        if ( isLast5Years() )
+        {
+            periods.addAll( getRelativePeriodList( new YearlyPeriodType().generateLast5Years( current ), LAST_5_YEARS, dynamicNames, format ) );
+        }
         
         current = getDate( MONTHS_IN_YEAR, current );
         
@@ -275,16 +292,28 @@
      */
     private List<Period> getRelativePeriodList( CalendarPeriodType periodType, String[] periodNames, Date current, boolean dynamicNames, I18nFormat format )
     {
-        List<Period> relatives = periodType.generatePeriods( current );
+        return getRelativePeriodList( periodType.generatePeriods( current ), periodNames, dynamicNames, format );
+    }
+
+    /**
+     * Returns a list of relative periods. The name will be dynamic depending on
+     * the dynamicNames argument. The short name will always be dynamic.
+     * 
+     * @param relatives the list of periods.
+     * @param periodNames the array of period names.
+     * @param dynamicNames indication of whether dynamic names should be used.
+     * @param format the I18nFormat.
+     * @return a list of periods.
+     */
+    private List<Period> getRelativePeriodList( List<Period> relatives, String[] periodNames, boolean dynamicNames, I18nFormat format )
+    {
         List<Period> periods = new ArrayList<Period>();
         
         int c = 0;
         
         for ( Period period : relatives )
         {
-            period.setName( dynamicNames && format != null ? format.formatPeriod( period ) : periodNames[c++] );
-            period.setShortName( format != null ? format.formatPeriod( period ) : null );
-            periods.add( period );
+            periods.add( setName( period, periodNames[c++], dynamicNames, format ) );
         }
         
         return periods;
@@ -303,10 +332,22 @@
      */
     private Period getRelativePeriod( CalendarPeriodType periodType, String periodName, Date current, boolean dynamicNames, I18nFormat format )
     {
-        Period period = periodType.createPeriod( current );
+        return setName( periodType.createPeriod( current ), periodName, dynamicNames, format );
+    }
+    
+    /**
+     * Sets the name and short name of the given Period.
+     * 
+     * @param period the period.
+     * @param periodName the period name.
+     * @param dynamicNames indication of whether dynamic names should be used.
+     * @param format the I18nFormat.
+     * @return a period.
+     */
+    private Period setName( Period period, String periodName, boolean dynamicNames, I18nFormat format )
+    {
         period.setName( dynamicNames && format != null ? format.formatPeriod( period ) : periodName );
-        period.setShortName( format != null ? format.formatPeriod( period ) : null );
-        
+        period.setShortName( format != null ? format.formatPeriod( period ) : null );        
         return period;
     }
     
@@ -375,6 +416,11 @@
     {
         return lastYear != null && lastYear;
     }
+    
+    public boolean isLast5Years()
+    {
+        return last5Years != null && last5Years;
+    }
         
     // -------------------------------------------------------------------------
     // Getters & setters
@@ -470,6 +516,16 @@
         this.lastYear = lastYear;
     }
 
+    public Boolean getLast5Years()
+    {
+        return last5Years;
+    }
+
+    public void setLast5Years( Boolean last5Years )
+    {
+        this.last5Years = last5Years;
+    }
+
     // -------------------------------------------------------------------------
     // Equals, hashCode, and toString
     // -------------------------------------------------------------------------
@@ -490,6 +546,7 @@
         result = prime * result + ( ( monthsLastYear == null ) ? 0 : monthsLastYear.hashCode() );
         result = prime * result + ( ( quartersLastYear == null ) ? 0 : quartersLastYear.hashCode() );
         result = prime * result + ( ( lastYear == null ) ? 0 : lastYear.hashCode() );
+        result = prime * result + ( ( last5Years == null ) ? 0 : last5Years.hashCode() );
         
         return result;
     }
@@ -621,7 +678,19 @@
         {
             return false;
         }
-                
+
+        if ( last5Years == null )
+        {
+            if ( other.last5Years != null )
+            {
+                return false;
+            }
+        }
+        else if ( !last5Years.equals( other.last5Years ) )
+        {
+            return false;
+        }
+        
         return true;
     }
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/YearlyPeriodType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/YearlyPeriodType.java	2011-05-05 21:14:56 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/YearlyPeriodType.java	2011-10-11 11:27:38 +0000
@@ -132,6 +132,26 @@
         return periods;
     }
 
+    /**
+     * Generates YearlyPeriods for the last 5 years including the current.
+     */
+    public List<Period> generateLast5Years( Date date )
+    {
+        Calendar cal = createCalendarInstance( date );
+        cal.add( Calendar.YEAR, -4 );
+        cal.set( Calendar.DAY_OF_YEAR, 1 );
+
+        ArrayList<Period> periods = new ArrayList<Period>();
+
+        for ( int i = 0; i < 5; ++i )
+        {
+            periods.add( createPeriod( cal ) );
+            cal.add( Calendar.YEAR, 1 );
+        }
+
+        return periods;
+    }
+
     @Override
     public String getIsoDate( Period period )
     {

=== modified file 'dhis-2/dhis-api/src/test/java/org/hisp/dhis/period/RelativePeriodTest.java'
--- dhis-2/dhis-api/src/test/java/org/hisp/dhis/period/RelativePeriodTest.java	2011-09-16 09:29:21 +0000
+++ dhis-2/dhis-api/src/test/java/org/hisp/dhis/period/RelativePeriodTest.java	2011-10-11 11:27:38 +0000
@@ -58,7 +58,7 @@
     @Test
     public void getRelativePeriodsA()
     {        
-        RelativePeriods periods = new RelativePeriods( true, true, true, true, true, true, true, true, true );
+        RelativePeriods periods = new RelativePeriods( true, true, true, true, true, true, true, true, true, true );
         
         Collection<Period> relatives = periods.getRelativePeriods( 1, getDate( 2002, 1, 1 ), i18nFormat, false );
         
@@ -101,7 +101,13 @@
         assertTrue( relatives.contains( new Period( new QuarterlyPeriodType(), getDate( 2000, 10, 1 ), getDate( 2000, 12, 31 ) ) ) );
 
         assertTrue( relatives.contains( new Period( new YearlyPeriodType(), getDate( 2000, 1, 1 ), getDate( 2000, 12, 31 ) ) ) );
+
+        assertTrue( relatives.contains( new Period( new YearlyPeriodType(), getDate( 1997, 1, 1 ), getDate( 1997, 12, 31 ) ) ) );
+        assertTrue( relatives.contains( new Period( new YearlyPeriodType(), getDate( 1998, 1, 1 ), getDate( 1998, 12, 31 ) ) ) );
+        assertTrue( relatives.contains( new Period( new YearlyPeriodType(), getDate( 1999, 1, 1 ), getDate( 1999, 12, 31 ) ) ) );
+        assertTrue( relatives.contains( new Period( new YearlyPeriodType(), getDate( 2000, 1, 1 ), getDate( 2000, 12, 31 ) ) ) );
+        assertTrue( relatives.contains( new Period( new YearlyPeriodType(), getDate( 2001, 1, 1 ), getDate( 2001, 12, 31 ) ) ) );
         
-        assertEquals( 37, relatives.size() );
+        assertEquals( 42, relatives.size() );
     }
 }

=== modified file 'dhis-2/dhis-api/src/test/java/org/hisp/dhis/period/YearlyPeriodTypeTest.java'
--- dhis-2/dhis-api/src/test/java/org/hisp/dhis/period/YearlyPeriodTypeTest.java	2011-02-24 21:01:47 +0000
+++ dhis-2/dhis-api/src/test/java/org/hisp/dhis/period/YearlyPeriodTypeTest.java	2011-10-11 11:27:38 +0000
@@ -127,4 +127,19 @@
         assertEquals( periodType.createPeriod( new Cal( 2013, 1, 1 ).time() ), periods.get( 9 ) );
         assertEquals( periodType.createPeriod( new Cal( 2014, 1, 1 ).time() ), periods.get( 10 ) );
     }
+    
+    @Test
+    public void testGenerateLast5Years()
+    {
+        testCal.set( 2009, 8, 15 );
+        
+        List<Period> periods = new YearlyPeriodType().generateLast5Years( testCal.time() );
+
+        assertEquals( 5, periods.size() );
+        assertEquals( periodType.createPeriod( new Cal( 2005, 1, 1 ).time() ), periods.get( 0 ) );
+        assertEquals( periodType.createPeriod( new Cal( 2006, 1, 1 ).time() ), periods.get( 1 ) );
+        assertEquals( periodType.createPeriod( new Cal( 2007, 1, 1 ).time() ), periods.get( 2 ) );
+        assertEquals( periodType.createPeriod( new Cal( 2008, 1, 1 ).time() ), periods.get( 3 ) );
+        assertEquals( periodType.createPeriod( new Cal( 2009, 1, 1 ).time() ), periods.get( 4 ) );        
+    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartExportStoreTest.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartExportStoreTest.java	2011-09-16 09:29:21 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartExportStoreTest.java	2011-10-11 11:27:38 +0000
@@ -134,7 +134,7 @@
         periods.add( periodA );
         periods.add( periodB );
         
-        relatives = new RelativePeriods( true, true, true, true, true, true, false, false, false );
+        relatives = new RelativePeriods( true, true, true, true, true, true, false, false, false, false );
         
         exportA = new DataMartExport( "ExportA", dataElements, indicators, organisationUnits, periods, relatives );
         exportB = new DataMartExport( "ExportB", dataElements, indicators, organisationUnits, periods, relatives );

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataMartTask.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataMartTask.java	2011-09-16 09:29:21 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataMartTask.java	2011-10-11 11:27:38 +0000
@@ -70,7 +70,7 @@
         Collection<Integer> indicatorIds = ConversionUtils.getIdentifiers( Indicator.class, indicatorService.getAllIndicators() );
         Collection<Integer> organisationUnitIds = ConversionUtils.getIdentifiers( OrganisationUnit.class, organisationUnitService.getAllOrganisationUnits() );
         
-        RelativePeriods relatives = new RelativePeriods( false, false, false, true, true, true, false, false, false );
+        RelativePeriods relatives = new RelativePeriods( false, false, false, true, true, true, false, false, false, false );
         
         dataMartService.export( dataElementIds, indicatorIds, new HashSet<Integer>(), organisationUnitIds, relatives, true );
     }

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataSetCompletenessTask.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataSetCompletenessTask.java	2011-09-16 09:29:21 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataSetCompletenessTask.java	2011-10-11 11:27:38 +0000
@@ -63,7 +63,7 @@
         Collection<Integer> dataSetIds = ConversionUtils.getIdentifiers( DataSet.class, dataSetService.getAllDataSets() );
         Collection<Integer> organisationUnitIds = ConversionUtils.getIdentifiers( OrganisationUnit.class, organisationUnitService.getAllOrganisationUnits() );
 
-        RelativePeriods relatives = new RelativePeriods( false, false, false, true, true, true, false, false, false );
+        RelativePeriods relatives = new RelativePeriods( false, false, false, true, true, true, false, false, false, false );
         
         completenessService.exportDataSetCompleteness( dataSetIds, relatives, organisationUnitIds );        
     }

=== modified file 'dhis-2/dhis-web/dhis-web-datamart/src/main/java/org/hisp/dhis/datamart/action/SaveDataMartExportAction.java'
--- dhis-2/dhis-web/dhis-web-datamart/src/main/java/org/hisp/dhis/datamart/action/SaveDataMartExportAction.java	2011-09-16 09:29:21 +0000
+++ dhis-2/dhis-web/dhis-web-datamart/src/main/java/org/hisp/dhis/datamart/action/SaveDataMartExportAction.java	2011-10-11 11:27:38 +0000
@@ -208,7 +208,7 @@
 
         RelativePeriods relatives = new RelativePeriods( reportingMonth, reportingBimonth, reportingQuarter,
             monthsThisYear, quartersThisYear, thisYear, 
-            monthsLastYear, quartersLastYear, lastYear );
+            monthsLastYear, quartersLastYear, lastYear, false );
           
         export.setName( name );            
         export.setDataElements( getSet( dataElementService.getDataElements( getIntegerCollection( selectedDataElements ) ) ) );

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/SaveChartAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/SaveChartAction.java	2011-09-16 09:29:21 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/SaveChartAction.java	2011-10-11 11:27:38 +0000
@@ -353,7 +353,7 @@
 
         RelativePeriods relatives = new RelativePeriods( reportingMonth, reportingBimonth, reportingQuarter,
             monthsThisYear, quartersThisYear, thisYear,
-            monthsLastYear, quartersLastYear, lastYear );
+            monthsLastYear, quartersLastYear, lastYear, false );
 
         chart.setRelatives( relatives );
 

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/SaveTableAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/SaveTableAction.java	2011-09-16 09:29:21 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/SaveTableAction.java	2011-10-11 11:27:38 +0000
@@ -364,7 +364,7 @@
         
         RelativePeriods relatives = new RelativePeriods( reportingMonth, reportingBimonth, reportingQuarter,
             monthsThisYear, quartersThisYear, thisYear, 
-            monthsLastYear, quartersLastYear, lastYear );
+            monthsLastYear, quartersLastYear, lastYear, false );
         
         ReportParams reportParams = new ReportParams();
         

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedDataValuesAction.java'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedDataValuesAction.java	2011-09-28 15:21:59 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedDataValuesAction.java	2011-10-11 11:27:38 +0000
@@ -41,7 +41,6 @@
 
 /**
  * @author Jan Henrik Overland
- * @version $Id$
  */
 public class GetAggregatedDataValuesAction
     implements Action
@@ -82,6 +81,13 @@
         this.dataElementIds = dataElementIds;
     }
 
+    private Collection<Integer> organisationUnitIds;
+
+    public void setOrganisationUnitIds( Collection<Integer> organisationUnitIds )
+    {
+        this.organisationUnitIds = organisationUnitIds;
+    }
+
     private boolean lastMonth;
 
     public void setLastMonth( boolean lastMonth )
@@ -89,6 +95,13 @@
         this.lastMonth = lastMonth;
     }
 
+    private boolean lastQuarter;
+
+    public void setLastQuarter( boolean lastQuarter )
+    {
+        this.lastQuarter = lastQuarter;
+    }
+
     private boolean monthsThisYear;
 
     public void setMonthsThisYear( boolean monthsThisYear )
@@ -96,6 +109,20 @@
         this.monthsThisYear = monthsThisYear;
     }
 
+    private boolean quartersThisYear;
+
+    public void setQuartersThisYear( boolean quartersThisYear )
+    {
+        this.quartersThisYear = quartersThisYear;
+    }
+
+    private boolean thisYear;
+
+    public void setThisYear( boolean thisYear )
+    {
+        this.thisYear = thisYear;
+    }
+
     private boolean monthsLastYear;
 
     public void setMonthsLastYear( boolean monthsLastYear )
@@ -103,20 +130,6 @@
         this.monthsLastYear = monthsLastYear;
     }
 
-    private boolean lastQuarter;
-
-    public void setLastQuarter( boolean lastQuarter )
-    {
-        this.lastQuarter = lastQuarter;
-    }
-
-    private boolean quartersThisYear;
-
-    public void setQuartersThisYear( boolean quartersThisYear )
-    {
-        this.quartersThisYear = quartersThisYear;
-    }
-
     private boolean quartersLastYear;
 
     public void setQuartersLastYear( boolean quartersLastYear )
@@ -124,13 +137,6 @@
         this.quartersLastYear = quartersLastYear;
     }
 
-    private boolean thisYear;
-
-    public void setThisYear( boolean thisYear )
-    {
-        this.thisYear = thisYear;
-    }
-
     private boolean lastYear;
 
     public void setLastYear( boolean lastYear )
@@ -145,13 +151,6 @@
         this.lastFiveYears = lastFiveYears;
     }
 
-    private Collection<Integer> organisationUnitIds;
-
-    public void setOrganisationUnitIds( Collection<Integer> organisationUnitIds )
-    {
-        this.organisationUnitIds = organisationUnitIds;
-    }
-
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
@@ -172,11 +171,11 @@
     {
         if ( dataElementIds != null
             && organisationUnitIds != null
-            && (lastMonth == true || monthsThisYear == true || monthsLastYear == true || lastQuarter == true
-                || quartersThisYear == true || quartersLastYear == true || thisYear == true || lastYear == true || lastFiveYears == true) )
+            && ( lastMonth || lastQuarter || monthsThisYear || quartersThisYear || thisYear
+                || monthsLastYear || quartersLastYear || lastYear || lastFiveYears ) )
         {
-            RelativePeriods relativePeriod = new RelativePeriods( lastMonth, monthsThisYear, monthsLastYear,
-                lastQuarter, quartersThisYear, quartersLastYear, thisYear, lastYear, lastFiveYears );
+            RelativePeriods relativePeriod = new RelativePeriods( lastMonth, false, lastQuarter, monthsThisYear, quartersThisYear,
+                thisYear, monthsLastYear, quartersLastYear, lastYear, lastFiveYears );
 
             Collection<Integer> relativePeriods = ConversionUtils.getIdentifiers( Period.class,
                 periodService.reloadPeriods( relativePeriod.getRelativePeriods( 1, format, true ) ) );

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedIndicatorValuesAction.java'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedIndicatorValuesAction.java	2011-09-28 15:21:59 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedIndicatorValuesAction.java	2011-10-11 11:27:38 +0000
@@ -41,7 +41,6 @@
 
 /**
  * @author Jan Henrik Overland
- * @version $Id$
  */
 public class GetAggregatedIndicatorValuesAction
     implements Action
@@ -82,6 +81,13 @@
         this.indicatorIds = indicatorIds;
     }
 
+    private Collection<Integer> organisationUnitIds;
+
+    public void setOrganisationUnitIds( Collection<Integer> organisationUnitIds )
+    {
+        this.organisationUnitIds = organisationUnitIds;
+    }
+
     private boolean lastMonth;
 
     public void setLastMonth( boolean lastMonth )
@@ -89,6 +95,13 @@
         this.lastMonth = lastMonth;
     }
 
+    private boolean lastQuarter;
+
+    public void setLastQuarter( boolean lastQuarter )
+    {
+        this.lastQuarter = lastQuarter;
+    }
+
     private boolean monthsThisYear;
 
     public void setMonthsThisYear( boolean monthsThisYear )
@@ -96,6 +109,20 @@
         this.monthsThisYear = monthsThisYear;
     }
 
+    private boolean quartersThisYear;
+
+    public void setQuartersThisYear( boolean quartersThisYear )
+    {
+        this.quartersThisYear = quartersThisYear;
+    }
+
+    private boolean thisYear;
+
+    public void setThisYear( boolean thisYear )
+    {
+        this.thisYear = thisYear;
+    }
+
     private boolean monthsLastYear;
 
     public void setMonthsLastYear( boolean monthsLastYear )
@@ -103,20 +130,6 @@
         this.monthsLastYear = monthsLastYear;
     }
 
-    private boolean lastQuarter;
-
-    public void setLastQuarter( boolean lastQuarter )
-    {
-        this.lastQuarter = lastQuarter;
-    }
-
-    private boolean quartersThisYear;
-
-    public void setQuartersThisYear( boolean quartersThisYear )
-    {
-        this.quartersThisYear = quartersThisYear;
-    }
-
     private boolean quartersLastYear;
 
     public void setQuartersLastYear( boolean quartersLastYear )
@@ -124,13 +137,6 @@
         this.quartersLastYear = quartersLastYear;
     }
 
-    private boolean thisYear;
-
-    public void setThisYear( boolean thisYear )
-    {
-        this.thisYear = thisYear;
-    }
-
     private boolean lastYear;
 
     public void setLastYear( boolean lastYear )
@@ -145,13 +151,6 @@
         this.lastFiveYears = lastFiveYears;
     }
 
-    private Collection<Integer> organisationUnitIds;
-
-    public void setOrganisationUnitIds( Collection<Integer> organisationUnitIds )
-    {
-        this.organisationUnitIds = organisationUnitIds;
-    }
-
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
@@ -172,11 +171,11 @@
     {
         if ( indicatorIds != null
             && organisationUnitIds != null
-            && (lastMonth == true || monthsThisYear == true || monthsLastYear == true || lastQuarter == true
-                || quartersThisYear == true || quartersLastYear == true || thisYear == true || lastYear == true || lastFiveYears == true) )
+            && ( lastMonth || lastQuarter || monthsThisYear || quartersThisYear || thisYear
+                || monthsLastYear || quartersLastYear || lastYear || lastFiveYears ) )
         {
-            RelativePeriods relativePeriod = new RelativePeriods( lastMonth, false, lastQuarter, monthsThisYear,
-                quartersThisYear, thisYear, monthsLastYear, quartersLastYear, lastYear );
+            RelativePeriods relativePeriod = new RelativePeriods( lastMonth, false, lastQuarter, monthsThisYear, quartersThisYear,
+                thisYear, monthsLastYear, quartersLastYear, lastYear, lastFiveYears );
 
             Collection<Integer> relativePeriods = ConversionUtils.getIdentifiers( Period.class,
                 periodService.reloadPeriods( relativePeriod.getRelativePeriods( 1, format, true ) ) );