=== 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 2010-06-23 17:50:25 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/RelativePeriods.java 2011-01-06 09:03:29 +0000 @@ -33,7 +33,6 @@ import java.util.Date; import java.util.List; -import org.apache.commons.collections.CollectionUtils; import org.hisp.dhis.i18n.I18nFormat; /** @@ -43,29 +42,10 @@ public class RelativePeriods implements Serializable { - public static final String REPORTING_MONTH = "reporting_month"; - public static final String LAST_3_MONTHS = "last3_months"; - public static final String LAST_6_MONTHS = "last6_months"; - public static final String LAST_12_MONTHS = "last12_months"; - public static final String SO_FAR_THIS_YEAR = "so_far_this_year"; - public static final String LAST_3_TO_6_MONTHS = "last3_6_months"; - public static final String LAST_6_TO_9_MONTHS = "last6_9_months"; - public static final String LAST_9_TO_12_MONTHS = "last9_12_months"; - - public static final String[] PREVIOUS_MONTH_NAMES = { - "previous_month_12", - "previous_month_11", - "previous_month_10", - "previous_month_9", - "previous_month_8", - "previous_month_7", - "previous_month_6", - "previous_month_5", - "previous_month_4", - "previous_month_3", - "previous_month_3", - "previous_month_1" }; - + public static final String REPORTING_MONTH = "reporting_month"; + public static final String THIS_YEAR = "year"; + public static final String LAST_YEAR = "last_year"; + public static final String[] MONTHS_THIS_YEAR = { "january", "february", @@ -79,34 +59,48 @@ "october", "november", "december" }; + + public static final String[] MONTHS_LAST_YEAR = { + "january_last_year", + "february_last_year", + "march_last_year", + "april_last_year", + "may_last_year", + "june_last_year", + "july_last_year", + "august_last_year", + "september_last_year", + "october_last_year", + "november_last_year", + "december_last_year" }; public static final String[] QUARTERS_THIS_YEAR = { "quarter1", "quarter2", "quarter3", "quarter4" }; - - private Boolean reportingMonth; - - private Boolean last3Months; - - private Boolean last6Months; - - private Boolean last12Months; - - private Boolean soFarThisYear; - - private Boolean last3To6Months; - - private Boolean last6To9Months; - - private Boolean last9To12Months; - - private Boolean last12IndividualMonths; - - private Boolean individualMonthsThisYear; - - private Boolean individualQuartersThisYear; + + public static final String[] QUARTERS_LAST_YEAR = { + "quarter1_last_year", + "quarter2_last_year", + "quarter3_last_year", + "quarter4_last_year" }; + + private static final int MONTHS_IN_YEAR = 12; + + private Boolean reportingMonth = false; + + private Boolean monthsThisYear = false; + + private Boolean quartersThisYear = false; + + private Boolean thisYear = false; + + private Boolean monthsLastYear = false; + + private Boolean quartersLastYear = false; + + private Boolean lastYear = false; // ------------------------------------------------------------------------- // Constructors @@ -115,23 +109,26 @@ public RelativePeriods() { } - - public RelativePeriods( boolean reportingMonth, boolean last3Months, - boolean last6Months, boolean last12Months, boolean soFarThisYear, - boolean last3To6Months, boolean last6To9Months, boolean last9To12Months, - boolean last12IndividualMonths, boolean individualMonthsThisYear, boolean individualQuartersThisYear ) + + /** + * @param reportingMonth reporting month + * @param monthsThisYear months this year + * @param quartersThisYear quarters this year + * @param thisYear this year + * @param monthsLastYear months last year + * @param quartersLastYear quarters last year + * @param lastYear last year + */ + public RelativePeriods( boolean reportingMonth, boolean monthsThisYear, boolean quartersThisYear, boolean thisYear, + boolean monthsLastYear, boolean quartersLastYear, boolean lastYear ) { this.reportingMonth = reportingMonth; - this.last3Months = last3Months; - this.last6Months = last6Months; - this.last12Months = last12Months; - this.soFarThisYear = soFarThisYear; - this.last3To6Months = last3To6Months; - this.last6To9Months = last6To9Months; - this.last9To12Months = last9To12Months; - this.last12IndividualMonths = last12IndividualMonths; - this.individualMonthsThisYear = individualMonthsThisYear; - this.individualQuartersThisYear = individualQuartersThisYear; + this.monthsThisYear = monthsThisYear; + this.quartersThisYear = quartersThisYear; + this.thisYear = thisYear; + this.monthsLastYear = monthsLastYear; + this.quartersLastYear = quartersLastYear; + this.lastYear = lastYear; } // ------------------------------------------------------------------------- @@ -166,7 +163,7 @@ /** * Gets a list of Periods based on the given input and the state of this RelativePeriods. * - * @param months the number of months back in time representing the current month. + * @param months the number of months back in time representing the current reporting month. * @param format the i18n format. * @param date the date representing now (for testing purposes). * @return a list of relative Periods. @@ -183,85 +180,86 @@ period.setName( dynamicNames ? format.formatPeriod( period ) : REPORTING_MONTH ); periods.add( period ); } - if ( isLast3Months() ) - { - Period period = new QuarterlyPeriodType().createPeriod( getDate( months + 2, date ) ); - period.setName( dynamicNames ? format.formatPeriod( period ) : LAST_3_MONTHS ); - periods.add( period ); - } - if ( isLast6Months() ) - { - Period period = new SixMonthlyPeriodType().createPeriod( getDate( months + 5, date ) ); - period.setName( dynamicNames ? format.formatPeriod( period ) : LAST_6_MONTHS ); - periods.add( period ); - } - if ( isLast12Months() ) - { - Period period = new YearlyPeriodType().createPeriod( getDate( months + 11, date ) ); - period.setName( dynamicNames ? format.formatPeriod( period ) : LAST_12_MONTHS ); - periods.add( period ); - } - if ( isSoFarThisYear() ) - { - Period period = new YearlyPeriodType().createPeriod( current ); - period.setName( dynamicNames ? format.formatPeriod( period ) : SO_FAR_THIS_YEAR ); - periods.add( period ); - } - if ( isLast3To6Months() ) - { - Period period = new QuarterlyPeriodType().createPeriod( getDate( months + 5, date ) ); - period.setName( dynamicNames ? format.formatPeriod( period ) : LAST_3_TO_6_MONTHS ); - periods.add( period ); - } - if ( isLast6To9Months() ) - { - Period period = new QuarterlyPeriodType().createPeriod( getDate( months + 8, date ) ); - period.setName( dynamicNames ? format.formatPeriod( period ) : LAST_6_TO_9_MONTHS ); - periods.add( period ); - } - if ( isLast9To12Months() ) - { - Period period = new QuarterlyPeriodType().createPeriod( getDate( months + 11, date ) ); - period.setName( dynamicNames ? format.formatPeriod( period ) : LAST_9_TO_12_MONTHS ); - periods.add( period ); - } - if ( isLast12IndividualMonths() ) - { - for ( int i = 11; i >= 0; i-- ) - { - Period period = new MonthlyPeriodType().createPeriod( getDate( months + i, date ) ); - period.setName( dynamicNames ? format.formatPeriod( period ) : PREVIOUS_MONTH_NAMES[i] ); - periods.add( period ); - } - } - if ( isIndividualMonthsThisYear() ) - { - List individualMonths = new MonthlyPeriodType().generatePeriods( new MonthlyPeriodType().createPeriod( current ) ); - CollectionUtils.filter( individualMonths, new PastPeriodPredicate( current ) ); - - int c = 0; - for ( Period period : individualMonths ) - { - period.setName( dynamicNames ? format.formatPeriod( period ) : MONTHS_THIS_YEAR[c++] ); - periods.add( period ); - } - } - if ( isIndividualQuartersThisYear() ) - { - List individualQuarters = new QuarterlyPeriodType().generatePeriods( new QuarterlyPeriodType().createPeriod( current ) ); - CollectionUtils.filter( individualQuarters, new PastPeriodPredicate( current ) ); - - int c = 0; - for ( Period period : individualQuarters ) - { - period.setName( dynamicNames ? format.formatPeriod( period ) : QUARTERS_THIS_YEAR[c++] ); - periods.add( period ); - } - } - - return periods; - } - + + if ( isMonthsThisYear() ) + { + periods.addAll( getRelativePeriodList( new MonthlyPeriodType(), MONTHS_THIS_YEAR, current, dynamicNames, format ) ); + } + + if ( isQuartersThisYear() ) + { + periods.addAll( getRelativePeriodList( new QuarterlyPeriodType(), QUARTERS_THIS_YEAR, current, dynamicNames, format ) ); + } + + if ( isThisYear() ) + { + periods.add( getRelativePeriod( new YearlyPeriodType(), THIS_YEAR, current, dynamicNames, format ) ); + } + + current = getDate( MONTHS_IN_YEAR, current ); + + if ( isMonthsLastYear() ) + { + periods.addAll( getRelativePeriodList( new MonthlyPeriodType(), MONTHS_LAST_YEAR, current, dynamicNames, format ) ); + } + + if ( isQuartersLastYear() ) + { + periods.addAll( getRelativePeriodList( new QuarterlyPeriodType(), QUARTERS_LAST_YEAR, current, dynamicNames, format ) ); + } + + if ( isLastYear() ) + { + periods.add( getRelativePeriod( new YearlyPeriodType(), LAST_YEAR, current, dynamicNames, format ) ); + } + + return periods; + } + + /** + * Returns a list of relative periods. + * + * @param periodType the period type. + * @param periodNames the array of period names. + * @param current the current date. + * @param dynamicNames indication of whether dynamic names should be used. + * @param format the I18nFormat. + * @return a list of periods. + */ + private List getRelativePeriodList( CalendarPeriodType periodType, String[] periodNames, Date current, boolean dynamicNames, I18nFormat format ) + { + List relatives = periodType.generatePeriods( current ); + List periods = new ArrayList(); + + int c = 0; + + for ( Period period : relatives ) + { + period.setName( dynamicNames ? format.formatPeriod( period ) : MONTHS_THIS_YEAR[c++] ); + periods.add( period ); + } + + return periods; + } + + /** + * Returns relative period. + * + * @param periodType the period type. + * @param periodName the period name. + * @param current the current date. + * @param dynamicNames indication of whether dynamic names should be used. + * @param format the I18nFormat. + * @return a list of periods. + */ + private Period getRelativePeriod( CalendarPeriodType periodType, String periodName, Date current, boolean dynamicNames, I18nFormat format ) + { + Period period = periodType.createPeriod( current ); + period.setName( dynamicNames ? format.formatPeriod( period ) : periodName ); + + return period; + } + /** * Returns a date. * @@ -288,54 +286,34 @@ return reportingMonth != null && reportingMonth; } - public boolean isLast3Months() - { - return last3Months != null && last3Months; - } - - public boolean isLast6Months() - { - return last6Months != null && last6Months; - } - - public boolean isLast12Months() - { - return last12Months != null && last12Months; - } - - public boolean isSoFarThisYear() - { - return soFarThisYear != null && soFarThisYear; - } - - public boolean isLast3To6Months() - { - return last3To6Months != null && last3To6Months; - } - - public boolean isLast6To9Months() - { - return last6To9Months != null && last6To9Months; - } - - public boolean isLast9To12Months() - { - return last9To12Months != null && last9To12Months; - } - - public boolean isLast12IndividualMonths() - { - return last12IndividualMonths != null && last12IndividualMonths; - } - - public boolean isIndividualMonthsThisYear() - { - return individualMonthsThisYear != null && individualMonthsThisYear; - } - - public boolean isIndividualQuartersThisYear() - { - return individualQuartersThisYear != null && individualQuartersThisYear; + public boolean isMonthsThisYear() + { + return monthsThisYear != null && monthsThisYear; + } + + public boolean isQuartersThisYear() + { + return quartersThisYear != null && quartersThisYear; + } + + public boolean isThisYear() + { + return thisYear != null && thisYear; + } + + public boolean isMonthsLastYear() + { + return monthsLastYear != null && monthsLastYear; + } + + public boolean isQuartersLastYear() + { + return quartersLastYear != null && quartersLastYear; + } + + public boolean isLastYear() + { + return lastYear != null && lastYear; } // ------------------------------------------------------------------------- @@ -351,105 +329,65 @@ { this.reportingMonth = reportingMonth; } - - public Boolean getLast3Months() - { - return last3Months; - } - - public void setLast3Months( Boolean last3Months ) - { - this.last3Months = last3Months; - } - - public Boolean getLast6Months() - { - return last6Months; - } - - public void setLast6Months( Boolean last6Months ) - { - this.last6Months = last6Months; - } - - public Boolean getLast12Months() - { - return last12Months; - } - - public void setLast12Months( Boolean last12Months ) - { - this.last12Months = last12Months; - } - - public Boolean getSoFarThisYear() - { - return soFarThisYear; - } - - public void setSoFarThisYear( Boolean soFarThisYear ) - { - this.soFarThisYear = soFarThisYear; - } - - public Boolean getLast3To6Months() - { - return last3To6Months; - } - - public void setLast3To6Months( Boolean last3To6Months ) - { - this.last3To6Months = last3To6Months; - } - - public Boolean getLast6To9Months() - { - return last6To9Months; - } - - public void setLast6To9Months( Boolean last6To9Months ) - { - this.last6To9Months = last6To9Months; - } - - public Boolean getLast9To12Months() - { - return last9To12Months; - } - - public void setLast9To12Months( Boolean last9To12Months ) - { - this.last9To12Months = last9To12Months; - } - - public Boolean getLast12IndividualMonths() - { - return last12IndividualMonths; - } - - public void setLast12IndividualMonths( Boolean last12IndividualMonths ) - { - this.last12IndividualMonths = last12IndividualMonths; - } - - public Boolean getIndividualMonthsThisYear() - { - return individualMonthsThisYear; - } - - public void setIndividualMonthsThisYear( Boolean individualMonthsThisYear ) - { - this.individualMonthsThisYear = individualMonthsThisYear; - } - - public Boolean getIndividualQuartersThisYear() - { - return individualQuartersThisYear; - } - - public void setIndividualQuartersThisYear( Boolean individualQuartersThisYear ) - { - this.individualQuartersThisYear = individualQuartersThisYear; + + public Boolean getMonthsThisYear() + { + return monthsThisYear; + } + + public void setMonthsThisYear( Boolean monthsThisYear ) + { + this.monthsThisYear = monthsThisYear; + } + + public Boolean getQuartersThisYear() + { + return quartersThisYear; + } + + public void setQuartersThisYear( Boolean quartersThisYear ) + { + this.quartersThisYear = quartersThisYear; + } + + public Boolean getThisYear() + { + return thisYear; + } + + public void setThisYear( Boolean thisYear ) + { + this.thisYear = thisYear; + } + + public Boolean getMonthsLastYear() + { + return monthsLastYear; + } + + public void setMonthsLastYear( Boolean monthsLastYear ) + { + this.monthsLastYear = monthsLastYear; + } + + public Boolean getQuartersLastYear() + { + return quartersLastYear; + } + + public void setQuartersLastYear( Boolean quartersLastYear ) + { + this.quartersLastYear = quartersLastYear; + } + + public Boolean getLastYear() + { + return lastYear; + } + + public void setLastYear( Boolean lastYear ) + { + this.lastYear = lastYear; } // ------------------------------------------------------------------------- @@ -457,41 +395,19 @@ // ------------------------------------------------------------------------- @Override - public String toString() - { - String toString = "[Reporting month: " + reportingMonth + - ", Last 3 months: " + last3Months + - ", Last 6 months: " + last6Months + - ", Last 12 months: " + last12Months + - ", So far this year: " + soFarThisYear + - ", Last 3 to 6 months: " + last3To6Months + - ", Last 6 to 9 months: " + last6To9Months + - ", Last 9 to 12 months: " + last9To12Months + - ", Last 12 Individual months: " + last12IndividualMonths + - ", Individual months this year: " + individualMonthsThisYear + - ", Individual quarters this year: " + individualQuartersThisYear + "]"; - - return toString; - } - - @Override public int hashCode() { final int prime = 31; int result = 1; - - result = prime * result + ( ( last12Months == null ) ? 0 : last12Months.hashCode() ); - result = prime * result + ( ( last3Months == null ) ? 0 : last3Months.hashCode() ); - result = prime * result + ( ( last3To6Months == null ) ? 0 : last3To6Months.hashCode() ); - result = prime * result + ( ( last6Months == null ) ? 0 : last6Months.hashCode() ); - result = prime * result + ( ( last6To9Months == null ) ? 0 : last6To9Months.hashCode() ); - result = prime * result + ( ( last9To12Months == null ) ? 0 : last9To12Months.hashCode() ); + result = prime * result + ( ( reportingMonth == null ) ? 0 : reportingMonth.hashCode() ); - result = prime * result + ( ( soFarThisYear == null ) ? 0 : soFarThisYear.hashCode() ); - result = prime * result + ( ( last12IndividualMonths == null ) ? 0 : last12IndividualMonths.hashCode() ); - result = prime * result + ( ( individualMonthsThisYear == null ) ? 0 : individualMonthsThisYear.hashCode() ); - result = prime * result + ( ( individualQuartersThisYear == null ) ? 0 : individualQuartersThisYear.hashCode() ); + result = prime * result + ( ( monthsThisYear == null ) ? 0 : monthsThisYear.hashCode() ); + result = prime * result + ( ( quartersThisYear == null ) ? 0 : quartersThisYear.hashCode() ); + result = prime * result + ( ( thisYear == null ) ? 0 : thisYear.hashCode() ); + result = prime * result + ( ( monthsLastYear == null ) ? 0 : monthsLastYear.hashCode() ); + result = prime * result + ( ( quartersLastYear == null ) ? 0 : quartersLastYear.hashCode() ); + result = prime * result + ( ( lastYear == null ) ? 0 : lastYear.hashCode() ); return result; } @@ -516,78 +432,6 @@ final RelativePeriods other = (RelativePeriods) object; - if ( last12Months == null ) - { - if ( other.last12Months != null ) - { - return false; - } - } - else if ( !last12Months.equals( other.last12Months ) ) - { - return false; - } - - if ( last3Months == null ) - { - if ( other.last3Months != null ) - { - return false; - } - } - else if ( !last3Months.equals( other.last3Months ) ) - { - return false; - } - - if ( last3To6Months == null ) - { - if ( other.last3To6Months != null ) - { - return false; - } - } - else if ( !last3To6Months.equals( other.last3To6Months ) ) - { - return false; - } - - if ( last6Months == null ) - { - if ( other.last6Months != null ) - { - return false; - } - } - else if ( !last6Months.equals( other.last6Months ) ) - { - return false; - } - - if ( last6To9Months == null ) - { - if ( other.last6To9Months != null ) - { - return false; - } - } - else if ( !last6To9Months.equals( other.last6To9Months ) ) - { - return false; - } - - if ( last9To12Months == null ) - { - if ( other.last9To12Months != null ) - { - return false; - } - } - else if ( !last9To12Months.equals( other.last9To12Months ) ) - { - return false; - } - if ( reportingMonth == null ) { if ( other.reportingMonth != null ) @@ -600,54 +444,78 @@ return false; } - if ( soFarThisYear == null ) - { - if ( other.soFarThisYear != null ) - { - return false; - } - } - else if ( !soFarThisYear.equals( other.soFarThisYear ) ) - { - return false; - } - - if ( last12IndividualMonths == null ) - { - if ( other.last12IndividualMonths != null ) - { - return false; - } - } - else if ( !last12IndividualMonths.equals( other.last12IndividualMonths ) ) - { - return false; - } - - if ( individualMonthsThisYear == null ) - { - if ( other.individualMonthsThisYear != null ) - { - return false; - } - } - else if ( !individualMonthsThisYear.equals( other.individualMonthsThisYear ) ) - { - return false; - } - - if ( individualQuartersThisYear == null ) - { - if ( other.individualQuartersThisYear != null ) - { - return false; - } - } - else if ( !individualQuartersThisYear.equals( other.individualQuartersThisYear ) ) - { - return false; - } - + if ( monthsThisYear == null ) + { + if ( other.monthsThisYear != null ) + { + return false; + } + } + else if ( !monthsThisYear.equals( other.monthsThisYear ) ) + { + return false; + } + + if ( quartersThisYear == null ) + { + if ( other.quartersThisYear != null ) + { + return false; + } + } + else if ( !quartersThisYear.equals( other.quartersThisYear ) ) + { + return false; + } + + if ( thisYear == null ) + { + if ( other.thisYear != null ) + { + return false; + } + } + else if ( !thisYear.equals( other.thisYear ) ) + { + return false; + } + + if ( monthsLastYear == null ) + { + if ( other.monthsLastYear != null ) + { + return false; + } + } + else if ( !monthsLastYear.equals( other.monthsLastYear ) ) + { + return false; + } + + if ( quartersLastYear == null ) + { + if ( other.quartersLastYear != null ) + { + return false; + } + } + else if ( !quartersLastYear.equals( other.quartersLastYear ) ) + { + return false; + } + + if ( lastYear == null ) + { + if ( other.lastYear != null ) + { + return false; + } + } + else if ( !lastYear.equals( other.lastYear ) ) + { + return false; + } + return true; } } === 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 2010-12-26 15:38:45 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2011-01-06 09:03:29 +0000 @@ -1005,7 +1005,7 @@ throw new IllegalStateException( falseMessage ); } } - + // ------------------------------------------------------------------------- // Equals and hashCode // ------------------------------------------------------------------------- === 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 2010-06-23 17:50:25 +0000 +++ dhis-2/dhis-api/src/test/java/org/hisp/dhis/period/RelativePeriodTest.java 2011-01-06 09:03:29 +0000 @@ -54,19 +54,30 @@ @Test public void getRelativePeriodsA() { - RelativePeriods periods = new RelativePeriods( true, true, true, true, true, true, true, true, true, true, true ); - - Collection relatives = periods.getRelativePeriods( 1, getDate( 2001, 1, 1 ), null, false ); - - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2000, 12, 1 ), getDate( 2000, 12, 31 ) ) ) ); - assertTrue( relatives.contains( new Period( new QuarterlyPeriodType(), getDate( 2000, 10, 1 ), getDate( 2000, 12, 31 ) ) ) ); - assertTrue( relatives.contains( new Period( new SixMonthlyPeriodType(), getDate( 2000, 7, 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 QuarterlyPeriodType(), getDate( 2000, 7, 1 ), getDate( 2000, 9, 30 ) ) ) ); - assertTrue( relatives.contains( new Period( new QuarterlyPeriodType(), getDate( 2000, 4, 1 ), getDate( 2000, 6, 30 ) ) ) ); - assertTrue( relatives.contains( new Period( new QuarterlyPeriodType(), getDate( 2000, 1, 1 ), getDate( 2000, 3, 31 ) ) ) ); - + RelativePeriods periods = new RelativePeriods( true, true, true, true, true, true, true ); + + Collection relatives = periods.getRelativePeriods( 1, getDate( 2002, 1, 1 ), null, false ); + + assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2001, 1, 1 ), getDate( 2001, 1, 31 ) ) ) ); + assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2001, 2, 1 ), getDate( 2001, 2, 28 ) ) ) ); + assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2001, 3, 1 ), getDate( 2001, 3, 31 ) ) ) ); + assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2001, 4, 1 ), getDate( 2001, 4, 30 ) ) ) ); + assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2001, 5, 1 ), getDate( 2001, 5, 31 ) ) ) ); + assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2001, 6, 1 ), getDate( 2001, 6, 30 ) ) ) ); + assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2001, 7, 1 ), getDate( 2001, 7, 31 ) ) ) ); + assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2001, 8, 1 ), getDate( 2001, 8, 31 ) ) ) ); + assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2001, 9, 1 ), getDate( 2001, 9, 30 ) ) ) ); + assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2001, 10, 1 ), getDate( 2001, 10, 31 ) ) ) ); + assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2001, 11, 1 ), getDate( 2001, 11, 30 ) ) ) ); + assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2001, 12, 1 ), getDate( 2001, 12, 31 ) ) ) ); + + assertTrue( relatives.contains( new Period( new QuarterlyPeriodType(), getDate( 2001, 1, 1 ), getDate( 2001, 3, 31 ) ) ) ); + assertTrue( relatives.contains( new Period( new QuarterlyPeriodType(), getDate( 2001, 4, 1 ), getDate( 2001, 6, 30 ) ) ) ); + assertTrue( relatives.contains( new Period( new QuarterlyPeriodType(), getDate( 2001, 7, 1 ), getDate( 2001, 9, 30 ) ) ) ); + assertTrue( relatives.contains( new Period( new QuarterlyPeriodType(), getDate( 2001, 10, 1 ), getDate( 2001, 12, 31 ) ) ) ); + + assertTrue( relatives.contains( new Period( new YearlyPeriodType(), getDate( 2001, 1, 1 ), getDate( 2001, 12, 31 ) ) ) ); + assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2000, 1, 1 ), getDate( 2000, 1, 31 ) ) ) ); assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2000, 2, 1 ), getDate( 2000, 2, 29 ) ) ) ); assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2000, 3, 1 ), getDate( 2000, 3, 31 ) ) ) ); @@ -84,82 +95,9 @@ assertTrue( relatives.contains( new Period( new QuarterlyPeriodType(), getDate( 2000, 4, 1 ), getDate( 2000, 6, 30 ) ) ) ); assertTrue( relatives.contains( new Period( new QuarterlyPeriodType(), getDate( 2000, 7, 1 ), getDate( 2000, 9, 30 ) ) ) ); assertTrue( relatives.contains( new Period( new QuarterlyPeriodType(), getDate( 2000, 10, 1 ), getDate( 2000, 12, 31 ) ) ) ); - - assertEquals( 36, relatives.size() ); - } - - @Test - public void getRelativePeriodsB() - { - RelativePeriods periods = new RelativePeriods( true, true, true, true, true, true, true, true, true, true, true ); - - Collection relatives = periods.getRelativePeriods( 2, getDate( 2001, 1, 1 ), null, false ); - - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2000, 11, 1 ), getDate( 2000, 11, 30 ) ) ) ); - assertTrue( relatives.contains( new Period( new QuarterlyPeriodType(), getDate( 2000, 7, 1 ), getDate( 2000, 9, 30 ) ) ) ); - assertTrue( relatives.contains( new Period( new SixMonthlyPeriodType(), getDate( 2000, 1, 1 ), getDate( 2000, 6, 30 ) ) ) ); - 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 QuarterlyPeriodType(), getDate( 2000, 4, 1 ), getDate( 2000, 6, 30 ) ) ) ); - assertTrue( relatives.contains( new Period( new QuarterlyPeriodType(), getDate( 2000, 1, 1 ), getDate( 2000, 3, 31 ) ) ) ); - assertTrue( relatives.contains( new Period( new QuarterlyPeriodType(), getDate( 1999, 10, 1 ), getDate( 1999, 12, 31 ) ) ) ); - - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 1999, 12, 1 ), getDate( 1999, 12, 31 ) ) ) ); - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2000, 1, 1 ), getDate( 2000, 1, 31 ) ) ) ); - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2000, 2, 1 ), getDate( 2000, 2, 29 ) ) ) ); - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2000, 3, 1 ), getDate( 2000, 3, 31 ) ) ) ); - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2000, 4, 1 ), getDate( 2000, 4, 30 ) ) ) ); - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2000, 5, 1 ), getDate( 2000, 5, 31 ) ) ) ); - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2000, 6, 1 ), getDate( 2000, 6, 30 ) ) ) ); - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2000, 7, 1 ), getDate( 2000, 7, 31 ) ) ) ); - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2000, 8, 1 ), getDate( 2000, 8, 31 ) ) ) ); - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2000, 9, 1 ), getDate( 2000, 9, 30 ) ) ) ); - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2000, 10, 1 ), getDate( 2000, 10, 31 ) ) ) ); - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2000, 11, 1 ), getDate( 2000, 11, 30 ) ) ) ); - - assertTrue( relatives.contains( new Period( new QuarterlyPeriodType(), getDate( 2000, 1, 1 ), getDate( 2000, 3, 31 ) ) ) ); - assertTrue( relatives.contains( new Period( new QuarterlyPeriodType(), getDate( 2000, 4, 1 ), getDate( 2000, 6, 30 ) ) ) ); - assertTrue( relatives.contains( new Period( new QuarterlyPeriodType(), getDate( 2000, 7, 1 ), getDate( 2000, 9, 30 ) ) ) ); - - assertEquals( 34, relatives.size() ); - } - - @Test - public void getRelativePeriodsC() - { - RelativePeriods periods = new RelativePeriods( true, true, true, true, true, true, true, true, true, true, true ); - - Collection relatives = periods.getRelativePeriods( 5, getDate( 2001, 1, 1 ), null, false ); - - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2000, 8, 1 ), getDate( 2000, 8, 31 ) ) ) ); - assertTrue( relatives.contains( new Period( new QuarterlyPeriodType(), getDate( 2000, 4, 1 ), getDate( 2000, 6, 30 ) ) ) ); - assertTrue( relatives.contains( new Period( new SixMonthlyPeriodType(), getDate( 2000, 1, 1 ), getDate( 2000, 6, 30 ) ) ) ); - 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 QuarterlyPeriodType(), getDate( 2000, 1, 1 ), getDate( 2000, 3, 31 ) ) ) ); - assertTrue( relatives.contains( new Period( new QuarterlyPeriodType(), getDate( 1999, 10, 1 ), getDate( 1999, 12, 31 ) ) ) ); - assertTrue( relatives.contains( new Period( new QuarterlyPeriodType(), getDate( 1999, 7, 1 ), getDate( 1999, 9, 30 ) ) ) ); - - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 1999, 9, 1 ), getDate( 1999, 9, 30 ) ) ) ); - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 1999, 10, 1 ), getDate( 1999, 10, 31 ) ) ) ); - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 1999, 11, 1 ), getDate( 1999, 11, 30 ) ) ) ); - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 1999, 12, 1 ), getDate( 1999, 12, 31 ) ) ) ); - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2000, 1, 1 ), getDate( 2000, 1, 31 ) ) ) ); - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2000, 2, 1 ), getDate( 2000, 2, 29 ) ) ) ); - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2000, 3, 1 ), getDate( 2000, 3, 31 ) ) ) ); - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2000, 4, 1 ), getDate( 2000, 4, 30 ) ) ) ); - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2000, 5, 1 ), getDate( 2000, 5, 31 ) ) ) ); - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2000, 6, 1 ), getDate( 2000, 6, 30 ) ) ) ); - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2000, 7, 1 ), getDate( 2000, 7, 31 ) ) ) ); - assertTrue( relatives.contains( new Period( new MonthlyPeriodType(), getDate( 2000, 8, 1 ), getDate( 2000, 8, 31 ) ) ) ); - - assertTrue( relatives.contains( new Period( new QuarterlyPeriodType(), getDate( 2000, 1, 1 ), getDate( 2000, 3, 31 ) ) ) ); - assertTrue( relatives.contains( new Period( new QuarterlyPeriodType(), getDate( 2000, 4, 1 ), getDate( 2000, 6, 30 ) ) ) ); - - assertEquals( 30, relatives.size() ); + + assertTrue( relatives.contains( new Period( new YearlyPeriodType(), getDate( 2000, 1, 1 ), getDate( 2000, 12, 31 ) ) ) ); + + assertEquals( 35, relatives.size() ); } } === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/hibernate/EnumUserType.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/hibernate/EnumUserType.java 2010-12-29 10:06:33 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/hibernate/EnumUserType.java 2011-01-06 09:03:29 +0000 @@ -63,12 +63,11 @@ return result; } - @SuppressWarnings( "rawtypes" ) public void nullSafeSet(PreparedStatement preparedStatement, Object value, int index) throws HibernateException, SQLException { if (null == value) { preparedStatement.setNull(index, Types.VARCHAR); } else { - preparedStatement.setString(index, ((Enum)value).name()); + preparedStatement.setString(index, ((Enum)value).name()); } } === modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/org/hisp/dhis/datamart/hibernate/DataMartExport.hbm.xml' --- dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/org/hisp/dhis/datamart/hibernate/DataMartExport.hbm.xml 2010-06-23 22:12:43 +0000 +++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/org/hisp/dhis/datamart/hibernate/DataMartExport.hbm.xml 2011-01-06 09:03:29 +0000 @@ -33,16 +33,12 @@ - - - - - - - - - - + + + + + + === 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 2010-06-23 22:12:43 +0000 +++ dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartExportStoreTest.java 2011-01-06 09:03:29 +0000 @@ -134,7 +134,7 @@ periods.add( periodA ); periods.add( periodB ); - relatives = new RelativePeriods( true, true, true, true, false, false, false, false, false, false, false ); + relatives = new RelativePeriods( true, true, true, true, 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-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml' --- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml 2010-06-23 17:50:25 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml 2011-01-06 09:03:29 +0000 @@ -49,16 +49,12 @@ - - - - - - - - - - + + + + + + === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml' --- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml 2010-12-26 15:38:45 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml 2011-01-06 09:03:29 +0000 @@ -79,16 +79,12 @@ - - - - - - - - - - + + + + + + === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableManagerTest.java' --- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableManagerTest.java 2010-06-21 14:17:13 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableManagerTest.java 2011-01-06 09:03:29 +0000 @@ -58,6 +58,7 @@ import org.hisp.dhis.period.Period; import org.hisp.dhis.period.PeriodType; import org.hisp.dhis.period.RelativePeriods; +import org.hisp.dhis.period.YearlyPeriodType; import org.hisp.dhis.reporttable.jdbc.ReportTableManager; import org.junit.Test; @@ -79,7 +80,8 @@ private List relativePeriods; private List units; - private PeriodType periodType; + private PeriodType monthlyPeriodType; + private PeriodType yearlyPeriodType; private DataElementCategoryOptionCombo categoryOptionComboA; private DataElementCategoryOptionCombo categoryOptionComboB; @@ -128,7 +130,8 @@ relativePeriods = new ArrayList(); units = new ArrayList(); - periodType = PeriodType.getPeriodTypeByName( MonthlyPeriodType.NAME ); + monthlyPeriodType = PeriodType.getPeriodTypeByName( MonthlyPeriodType.NAME ); + yearlyPeriodType = PeriodType.getPeriodTypeByName( YearlyPeriodType.NAME ); indicatorType = createIndicatorType( 'A' ); @@ -161,8 +164,8 @@ indicators.add( indicatorA ); indicators.add( indicatorB ); - dataSetA = createDataSet( 'A', periodType ); - dataSetB = createDataSet( 'B', periodType ); + dataSetA = createDataSet( 'A', monthlyPeriodType ); + dataSetB = createDataSet( 'B', monthlyPeriodType ); dataSetA.setId( 'A' ); dataSetB.setId( 'B' ); @@ -170,8 +173,8 @@ dataSets.add( dataSetA ); dataSets.add( dataSetB ); - periodA = createPeriod( periodType, getDate( 2008, 1, 1 ), getDate( 2008, 1, 31 ) ); - periodB = createPeriod( periodType, getDate( 2008, 2, 1 ), getDate( 2008, 2, 28 ) ); + periodA = createPeriod( monthlyPeriodType, getDate( 2008, 1, 1 ), getDate( 2008, 1, 31 ) ); + periodB = createPeriod( monthlyPeriodType, getDate( 2008, 2, 1 ), getDate( 2008, 2, 28 ) ); periodA.setId( 'A' ); periodB.setId( 'B' ); @@ -179,14 +182,14 @@ periods.add( periodA ); periods.add( periodB ); - periodC = createPeriod( periodType, getDate( 2008, 3, 1 ), getDate( 2008, 3, 31 ) ); - periodD = createPeriod( periodType, getDate( 2008, 2, 1 ), getDate( 2008, 4, 30 ) ); + periodC = createPeriod( monthlyPeriodType, getDate( 2008, 3, 1 ), getDate( 2008, 3, 31 ) ); + periodD = createPeriod( yearlyPeriodType, getDate( 2008, 1, 1 ), getDate( 2008, 12, 31 ) ); periodC.setId( 'C' ); periodD.setId( 'D' ); periodC.setName( RelativePeriods.REPORTING_MONTH ); - periodD.setName( RelativePeriods.LAST_3_MONTHS ); + periodD.setName( RelativePeriods.THIS_YEAR ); relativePeriods.add( periodC ); relativePeriods.add( periodD ); @@ -203,7 +206,7 @@ relatives = new RelativePeriods(); relatives.setReportingMonth( true ); - relatives.setLast3Months( true ); + relatives.setThisYear( true ); i18nFormat = new MockI18nFormat(); } === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableServiceTest.java' --- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableServiceTest.java 2010-06-21 14:17:13 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableServiceTest.java 2011-01-06 09:03:29 +0000 @@ -59,6 +59,7 @@ import org.hisp.dhis.period.PeriodService; import org.hisp.dhis.period.PeriodType; import org.hisp.dhis.period.RelativePeriods; +import org.hisp.dhis.period.YearlyPeriodType; import org.junit.Test; /** @@ -80,7 +81,8 @@ private List relativePeriods; private List units; - private PeriodType periodType; + private PeriodType montlyPeriodType; + private PeriodType yearlyPeriodType; private DataElement dataElementA; private DataElement dataElementB; @@ -159,7 +161,8 @@ relativePeriods = new ArrayList(); units = new ArrayList(); - periodType = PeriodType.getPeriodTypeByName( MonthlyPeriodType.NAME ); + montlyPeriodType = PeriodType.getPeriodTypeByName( MonthlyPeriodType.NAME ); + yearlyPeriodType = PeriodType.getPeriodTypeByName( YearlyPeriodType.NAME ); // --------------------------------------------------------------------- // Setup Dimensions @@ -230,8 +233,8 @@ // Setup DataSets // --------------------------------------------------------------------- - dataSetA = createDataSet( 'A', periodType ); - dataSetB = createDataSet( 'B', periodType ); + dataSetA = createDataSet( 'A', montlyPeriodType ); + dataSetB = createDataSet( 'B', montlyPeriodType ); dataSetService.addDataSet( dataSetA ); dataSetService.addDataSet( dataSetB ); @@ -243,8 +246,8 @@ // Setup Periods // --------------------------------------------------------------------- - periodA = createPeriod( periodType, getDate( 2008, 1, 1 ), getDate( 2008, 1, 31 ) ); - periodB = createPeriod( periodType, getDate( 2008, 2, 1 ), getDate( 2008, 2, 28 ) ); + periodA = createPeriod( montlyPeriodType, getDate( 2008, 1, 1 ), getDate( 2008, 1, 31 ) ); + periodB = createPeriod( montlyPeriodType, getDate( 2008, 2, 1 ), getDate( 2008, 2, 28 ) ); periodIdA = periodService.addPeriod( periodA ); periodIdB = periodService.addPeriod( periodB ); @@ -252,14 +255,14 @@ periods.add( periodA ); periods.add( periodB ); - periodC = createPeriod( periodType, getDate( 2008, 3, 1 ), getDate( 2008, 3, 31 ) ); - periodD = createPeriod( periodType, getDate( 2008, 2, 1 ), getDate( 2008, 4, 30 ) ); + periodC = createPeriod( montlyPeriodType, getDate( 2008, 3, 1 ), getDate( 2008, 3, 31 ) ); + periodD = createPeriod( yearlyPeriodType, getDate( 2008, 1, 1 ), getDate( 2008, 12, 31 ) ); periodService.addPeriod( periodC ); periodService.addPeriod( periodD ); periodC.setName( RelativePeriods.REPORTING_MONTH ); - periodD.setName( RelativePeriods.LAST_3_MONTHS ); + periodD.setName( RelativePeriods.THIS_YEAR ); relativePeriods.add( periodC ); relativePeriods.add( periodD ); @@ -280,7 +283,7 @@ relatives = new RelativePeriods(); relatives.setReportingMonth( true ); - relatives.setLast3Months( true ); + relatives.setThisYear( true ); i18nFormat = new MockI18nFormat(); === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableStatementTest.java' --- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableStatementTest.java 2010-06-21 14:17:13 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableStatementTest.java 2011-01-06 09:03:29 +0000 @@ -49,6 +49,7 @@ import org.hisp.dhis.period.Period; import org.hisp.dhis.period.PeriodType; import org.hisp.dhis.period.RelativePeriods; +import org.hisp.dhis.period.YearlyPeriodType; import org.hisp.dhis.reporttable.statement.CreateReportTableStatement; import org.hisp.dhis.reporttable.statement.GetReportTableDataStatement; import org.hisp.dhis.reporttable.statement.RemoveReportTableStatement; @@ -74,7 +75,8 @@ private DataElementCategoryCombo categoryCombo; - private PeriodType periodType; + private PeriodType monthlyPeriodType; + private PeriodType yearlyPeriodType; private IndicatorType indicatorType; @@ -100,7 +102,8 @@ relativePeriods = new ArrayList(); units = new ArrayList(); - periodType = PeriodType.getPeriodTypeByName( MonthlyPeriodType.NAME ); + monthlyPeriodType = PeriodType.getPeriodTypeByName( MonthlyPeriodType.NAME ); + yearlyPeriodType = PeriodType.getPeriodTypeByName( YearlyPeriodType.NAME ); dataElements.add( createDataElement( 'A' ) ); dataElements.add( createDataElement( 'B' ) ); @@ -117,17 +120,17 @@ indicators.add( createIndicator( 'A', indicatorType ) ); indicators.add( createIndicator( 'B', indicatorType ) ); - dataSets.add( createDataSet( 'A', periodType ) ); - dataSets.add( createDataSet( 'B', periodType ) ); + dataSets.add( createDataSet( 'A', monthlyPeriodType ) ); + dataSets.add( createDataSet( 'B', monthlyPeriodType ) ); - periods.add( createPeriod( periodType, getDate( 2008, 1, 1 ), getDate( 2008, 1, 31 ) ) ); - periods.add( createPeriod( periodType, getDate( 2008, 2, 1 ), getDate( 2008, 2, 28 ) ) ); + periods.add( createPeriod( monthlyPeriodType, getDate( 2008, 1, 1 ), getDate( 2008, 1, 31 ) ) ); + periods.add( createPeriod( monthlyPeriodType, getDate( 2008, 2, 1 ), getDate( 2008, 2, 28 ) ) ); - Period periodC = createPeriod( periodType, getDate( 2008, 3, 1 ), getDate( 2008, 3, 31 ) ); - Period periodD = createPeriod( periodType, getDate( 2008, 2, 1 ), getDate( 2008, 4, 30 ) ); + Period periodC = createPeriod( monthlyPeriodType, getDate( 2008, 3, 1 ), getDate( 2008, 3, 31 ) ); + Period periodD = createPeriod( yearlyPeriodType, getDate( 2008, 1, 1 ), getDate( 2008, 12, 31 ) ); periodC.setName( RelativePeriods.REPORTING_MONTH ); - periodD.setName( RelativePeriods.LAST_3_MONTHS ); + periodD.setName( RelativePeriods.THIS_YEAR ); periods.add( periodC ); periods.add( periodD ); @@ -138,7 +141,7 @@ relatives = new RelativePeriods(); relatives.setReportingMonth( true ); - relatives.setLast3Months( true ); + relatives.setThisYear( true ); i18nFormat = new MockI18nFormat(); } === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableStoreTest.java' --- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableStoreTest.java 2010-06-23 17:50:25 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableStoreTest.java 2011-01-06 09:03:29 +0000 @@ -172,7 +172,7 @@ relatives = new RelativePeriods(); relatives.setReportingMonth( true ); - relatives.setLast3Months( true ); + relatives.setThisYear( true ); i18nFormat = new MockI18nFormat(); } === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableTest.java' --- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableTest.java 2010-12-26 15:38:45 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableTest.java 2011-01-06 09:03:29 +0000 @@ -51,6 +51,7 @@ import org.hisp.dhis.period.Period; import org.hisp.dhis.period.PeriodType; import org.hisp.dhis.period.RelativePeriods; +import org.hisp.dhis.period.YearlyPeriodType; import org.junit.Test; /** @@ -68,7 +69,8 @@ private List relativePeriods; private List units; - private PeriodType periodType; + private PeriodType montlyPeriodType; + private PeriodType yearPeriodType; private DataElement dataElementA; private DataElement dataElementB; @@ -114,7 +116,8 @@ relativePeriods = new ArrayList(); units = new ArrayList(); - periodType = PeriodType.getPeriodTypeByName( MonthlyPeriodType.NAME ); + montlyPeriodType = PeriodType.getPeriodTypeByName( MonthlyPeriodType.NAME ); + yearPeriodType = PeriodType.getPeriodTypeByName( YearlyPeriodType.NAME ); dataElementA = createDataElement( 'A' ); dataElementB = createDataElement( 'B' ); @@ -149,8 +152,8 @@ indicators.add( indicatorA ); indicators.add( indicatorB ); - dataSetA = createDataSet( 'A', periodType ); - dataSetB = createDataSet( 'B', periodType ); + dataSetA = createDataSet( 'A', montlyPeriodType ); + dataSetB = createDataSet( 'B', montlyPeriodType ); dataSetA.setId( 'A' ); dataSetB.setId( 'B' ); @@ -158,8 +161,8 @@ dataSets.add( dataSetA ); dataSets.add( dataSetB ); - periodA = createPeriod( periodType, getDate( 2008, 1, 1 ), getDate( 2008, 1, 31 ) ); - periodB = createPeriod( periodType, getDate( 2008, 2, 1 ), getDate( 2008, 2, 28 ) ); + periodA = createPeriod( montlyPeriodType, getDate( 2008, 1, 1 ), getDate( 2008, 1, 31 ) ); + periodB = createPeriod( montlyPeriodType, getDate( 2008, 2, 1 ), getDate( 2008, 2, 28 ) ); periodA.setId( 'A' ); periodB.setId( 'B' ); @@ -167,14 +170,14 @@ periods.add( periodA ); periods.add( periodB ); - periodC = createPeriod( periodType, getDate( 2008, 3, 1 ), getDate( 2008, 3, 31 ) ); - periodD = createPeriod( periodType, getDate( 2008, 2, 1 ), getDate( 2008, 4, 30 ) ); + periodC = createPeriod( montlyPeriodType, getDate( 2008, 3, 1 ), getDate( 2008, 3, 31 ) ); + periodD = createPeriod( yearPeriodType, getDate( 2008, 1, 1 ), getDate( 2008, 12, 31 ) ); periodC.setId( 'C' ); periodD.setId( 'D' ); periodC.setName( RelativePeriods.REPORTING_MONTH ); - periodD.setName( RelativePeriods.LAST_3_MONTHS ); + periodD.setName( RelativePeriods.THIS_YEAR ); relativePeriods.add( periodC ); relativePeriods.add( periodD ); @@ -191,7 +194,7 @@ relatives = new RelativePeriods(); relatives.setReportingMonth( true ); - relatives.setLast3Months( true ); + relatives.setThisYear( true ); i18nFormat = new MockI18nFormat(); } @@ -234,9 +237,9 @@ assertEquals( 8, crossTabColumns.size() ); assertTrue( crossTabColumns.contains( "shortnamea_reporting_month" ) ); - assertTrue( crossTabColumns.contains( "shortnamea_last3_months" ) ); + assertTrue( crossTabColumns.contains( "shortnamea_year" ) ); assertTrue( crossTabColumns.contains( "shortnameb_reporting_month" ) ); - assertTrue( crossTabColumns.contains( "shortnameb_last3_months" ) ); + assertTrue( crossTabColumns.contains( "shortnameb_year" ) ); List crossTabIdentifiers = reportTable.getCrossTabIdentifiers(); @@ -408,9 +411,9 @@ assertEquals( 8, crossTabColumns.size() ); assertTrue( crossTabColumns.contains( "shortnamea_reporting_month" ) ); - assertTrue( crossTabColumns.contains( "shortnamea_last3_months" ) ); + assertTrue( crossTabColumns.contains( "shortnamea_year" ) ); assertTrue( crossTabColumns.contains( "shortnameb_reporting_month" ) ); - assertTrue( crossTabColumns.contains( "shortnameb_last3_months" ) ); + assertTrue( crossTabColumns.contains( "shortnameb_year" ) ); List crossTabIdentifiers = reportTable.getCrossTabIdentifiers(); @@ -584,13 +587,13 @@ assertEquals( 16, crossTabColumns.size() ); assertTrue( crossTabColumns.contains( "shortnamea_categoryoptiona_categoryoptionb_reporting_month" ) ); - assertTrue( crossTabColumns.contains( "shortnamea_categoryoptiona_categoryoptionb_last3_months" ) ); + assertTrue( crossTabColumns.contains( "shortnamea_categoryoptiona_categoryoptionb_year" ) ); assertTrue( crossTabColumns.contains( "shortnamea_categoryoptionc_categoryoptiond_reporting_month" ) ); - assertTrue( crossTabColumns.contains( "shortnamea_categoryoptionc_categoryoptiond_last3_months" ) ); + assertTrue( crossTabColumns.contains( "shortnamea_categoryoptionc_categoryoptiond_year" ) ); assertTrue( crossTabColumns.contains( "shortnameb_categoryoptiona_categoryoptionb_reporting_month" ) ); - assertTrue( crossTabColumns.contains( "shortnameb_categoryoptiona_categoryoptionb_last3_months" ) ); + assertTrue( crossTabColumns.contains( "shortnameb_categoryoptiona_categoryoptionb_year" ) ); assertTrue( crossTabColumns.contains( "shortnameb_categoryoptionc_categoryoptiond_reporting_month" ) ); - assertTrue( crossTabColumns.contains( "shortnameb_categoryoptionc_categoryoptiond_last3_months" ) ); + assertTrue( crossTabColumns.contains( "shortnameb_categoryoptionc_categoryoptiond_year" ) ); List crossTabIdentifiers = reportTable.getCrossTabIdentifiers(); @@ -724,9 +727,9 @@ assertNotNull( crossTabColumns ); assertEquals( 8, crossTabColumns.size() ); assertTrue( crossTabColumns.contains( "shortnamea_reporting_month" ) ); - assertTrue( crossTabColumns.contains( "shortnamea_last3_months" ) ); + assertTrue( crossTabColumns.contains( "shortnamea_year" ) ); assertTrue( crossTabColumns.contains( "shortnameb_reporting_month" ) ); - assertTrue( crossTabColumns.contains( "shortnameb_last3_months" ) ); + assertTrue( crossTabColumns.contains( "shortnameb_year" ) ); List crossTabIdentifiers = reportTable.getCrossTabIdentifiers(); === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/WEB-INF/classes/log4j.properties' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/WEB-INF/classes/log4j.properties 2010-05-09 12:59:49 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/WEB-INF/classes/log4j.properties 2011-01-06 09:03:29 +0000 @@ -25,3 +25,4 @@ # Categories (order: DEBUG, INFO, WARN, ERROR, FATAL) log4j.rootCategory = WARN, console log4j.category.org.hisp.dhis = INFO, AUDIT +log4j.category.org.amplecode = INFO === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2010-12-29 21:48:41 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2011-01-06 09:03:29 +0000 @@ -1283,3 +1283,19 @@ { return Math.floor( 1000000 * Math.random() ); } + +function relativePeriodsChecked() +{ + if ( isChecked( "reportingMonth" ) == true || + isChecked( "monthsThisYear" ) == true || + isChecked( "quartersThisYear" ) == true || + isChecked( "thisYear" ) == true || + isChecked( "monthsLastYear" ) == true || + isChecked( "quartersLastYear" ) == true || + isChecked( "lastYear" ) == true ) + { + return true; + } + + return false; +} === 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 2010-07-18 15:17:23 +0000 +++ dhis-2/dhis-web/dhis-web-datamart/src/main/java/org/hisp/dhis/datamart/action/SaveDataMartExportAction.java 2011-01-06 09:03:29 +0000 @@ -141,76 +141,48 @@ this.reportingMonth = reportingMonth; } - private boolean last3Months; - - public void setLast3Months( boolean last3Months ) - { - this.last3Months = last3Months; - } - - private boolean last6Months; - - public void setLast6Months( boolean last6Months ) - { - this.last6Months = last6Months; - } - - private boolean last12Months; - - public void setLast12Months( boolean last12Months ) - { - this.last12Months = last12Months; - } - - private boolean last3To6Months; - - public void setLast3To6Months( boolean last3To6Months ) - { - this.last3To6Months = last3To6Months; - } - - private boolean last6To9Months; - - public void setLast6To9Months( boolean last6To9Months ) - { - this.last6To9Months = last6To9Months; - } - - private boolean last9To12Months; - - public void setLast9To12Months( boolean last9To12Months ) - { - this.last9To12Months = last9To12Months; - } - - private boolean last12IndividualMonths; - - public void setLast12IndividualMonths( boolean last12IndividualMonths ) - { - this.last12IndividualMonths = last12IndividualMonths; - } - - private boolean soFarThisYear; - - public void setSoFarThisYear( boolean soFarThisYear ) - { - this.soFarThisYear = soFarThisYear; - } - - private boolean individualMonthsThisYear; - - public void setIndividualMonthsThisYear( boolean individualMonthsThisYear ) - { - this.individualMonthsThisYear = individualMonthsThisYear; - } - - private boolean individualQuartersThisYear; - - public void setIndividualQuartersThisYear( boolean individualQuartersThisYear ) - { - this.individualQuartersThisYear = individualQuartersThisYear; - } - + private boolean monthsThisYear; + + public void setMonthsThisYear( boolean monthsThisYear ) + { + 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 ) + { + this.monthsLastYear = monthsLastYear; + } + + private boolean quartersLastYear; + + public void setQuartersLastYear( boolean quartersLastYear ) + { + this.quartersLastYear = quartersLastYear; + } + + private boolean lastYear; + + public void setLastYear( boolean lastYear ) + { + this.lastYear = lastYear; + } + // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -218,21 +190,9 @@ public String execute() { DataMartExport export = id == null ? new DataMartExport() : dataMartService.getDataMartExport( id ); - - RelativePeriods relatives = new RelativePeriods(); - - relatives.setReportingMonth( reportingMonth ); - relatives.setLast3Months( last3Months ); - relatives.setLast6Months( last6Months ); - relatives.setLast12Months( last12Months ); - relatives.setSoFarThisYear( soFarThisYear ); - relatives.setLast3To6Months( last3To6Months ); - relatives.setLast6To9Months( last6To9Months ); - relatives.setLast9To12Months( last9To12Months ); - relatives.setLast12IndividualMonths( last12IndividualMonths ); - relatives.setIndividualMonthsThisYear( individualMonthsThisYear ); - relatives.setIndividualQuartersThisYear( individualQuartersThisYear ); - + + RelativePeriods relatives = new RelativePeriods( reportingMonth, monthsThisYear, quartersThisYear, thisYear, monthsLastYear, quartersLastYear, lastYear ); + export.setName( name ); export.setDataElements( getSet( dataElementService.getDataElements( getIntegerCollection( selectedDataElements ) ) ) ); export.setIndicators( getSet( indicatorService.getIndicators( getIntegerCollection( selectedIndicators ) ) ) ); === modified file 'dhis-2/dhis-web/dhis-web-datamart/src/main/resources/org/hisp/dhis/datamart/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-datamart/src/main/resources/org/hisp/dhis/datamart/i18n_module.properties 2010-12-09 06:15:40 +0000 +++ dhis-2/dhis-web/dhis-web-datamart/src/main/resources/org/hisp/dhis/datamart/i18n_module.properties 2011-01-06 09:03:29 +0000 @@ -66,15 +66,11 @@ export_process_failed = Export process failed - See log for details relative_periods= Relative periods reporting_month= Reporting month -last_3_months= Last 3 months -last_6_months= Last 6 months -last_12_months= Last 12 months -last_3_to_6_months= Last 3 to 6 months -last_6_to_9_months= Last 6 to 9 months -last_9_to_12_months= Last 9 to 12 months -last_12_individual_months= Last 12 individual months -so_far_this_year = So far this year -individual_months_this_year = Individual months this year -individual_quarters_this_year = Individual quarters this year +months_this_year = Months this year +quarters_this_year = Quarters this year +this_year = This year +months_last_year = Months last year +quarters_last_year = Quarters last year +last_year = Last year prev = Prev next = Next \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/exportForm.vm' --- dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/exportForm.vm 2010-09-13 08:15:46 +0000 +++ dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/exportForm.vm 2011-01-06 09:03:29 +0000 @@ -192,43 +192,22 @@ $i18n.getString( "relative_periods" ) - + -   - -   - -   - - - - - - - - - - -   - -   - -   - - - - - - - - - - -   - -   - - +   + +   + +   + +

+ + +   + +   + + === modified file 'dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/javascript/datamart.js' --- dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/javascript/datamart.js 2010-09-01 16:55:23 +0000 +++ dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/javascript/datamart.js 2011-01-06 09:03:29 +0000 @@ -319,26 +319,6 @@ return true; } -function relativePeriodsChecked() -{ - if ( isChecked( "reportingMonth" ) == true || - isChecked( "last3Months" ) == true || - isChecked( "last6Months" ) == true || - isChecked( "last12Months" ) == true || - isChecked( "last3To6Months" ) == true || - isChecked( "last6To9Months" ) == true || - isChecked( "last9To12Months" ) == true || - isChecked( "last12IndividualMonths" ) == true || - isChecked( "soFarThisYear" ) == true || - isChecked( "individualMonthsThisYear" ) == true || - isChecked( "individualQuartersThisYear" ) == true ) - { - return true; - } - - return false; -} - // ----------------------------------------------------------------------------- // Dashboard // ----------------------------------------------------------------------------- === 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 2010-08-31 14:34:31 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/SaveChartAction.java 2011-01-06 09:03:29 +0000 @@ -180,76 +180,48 @@ this.reportingMonth = reportingMonth; } - private boolean last3Months; - - public void setLast3Months( boolean last3Months ) - { - this.last3Months = last3Months; - } - - private boolean last6Months; - - public void setLast6Months( boolean last6Months ) - { - this.last6Months = last6Months; - } - - private boolean last12Months; - - public void setLast12Months( boolean last12Months ) - { - this.last12Months = last12Months; - } - - private boolean soFarThisYear; - - public void setSoFarThisYear( boolean soFarThisYear ) - { - this.soFarThisYear = soFarThisYear; - } - - private boolean last3To6Months; - - public void setLast3To6Months( boolean last3To6Months ) - { - this.last3To6Months = last3To6Months; - } - - private boolean last6To9Months; - - public void setLast6To9Months( boolean last6To9Months ) - { - this.last6To9Months = last6To9Months; - } - - private boolean last9To12Months; - - public void setLast9To12Months( boolean last9To12Months ) - { - this.last9To12Months = last9To12Months; - } - - private boolean last12IndividualMonths; - - public void setLast12IndividualMonths( boolean last12IndividualMonths ) - { - this.last12IndividualMonths = last12IndividualMonths; - } - - private boolean individualMonthsThisYear; - - public void setIndividualMonthsThisYear( boolean individualMonthsThisYear ) - { - this.individualMonthsThisYear = individualMonthsThisYear; - } - - private boolean individualQuartersThisYear; - - public void setIndividualQuartersThisYear( boolean individualQuartersThisYear ) - { - this.individualQuartersThisYear = individualQuartersThisYear; - } - + private boolean monthsThisYear; + + public void setMonthsThisYear( boolean monthsThisYear ) + { + 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 ) + { + this.monthsLastYear = monthsLastYear; + } + + private boolean quartersLastYear; + + public void setQuartersLastYear( boolean quartersLastYear ) + { + this.quartersLastYear = quartersLastYear; + } + + private boolean lastYear; + + public void setLastYear( boolean lastYear ) + { + this.lastYear = lastYear; + } + // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -286,19 +258,7 @@ chart.setPeriods( periods ); chart.setOrganisationUnits( organisationUnits ); - RelativePeriods relatives = new RelativePeriods(); - - relatives.setReportingMonth( reportingMonth ); - relatives.setLast3Months( last3Months ); - relatives.setLast6Months( last6Months ); - relatives.setLast12Months( last12Months ); - relatives.setSoFarThisYear( soFarThisYear ); - relatives.setLast3To6Months( last3To6Months ); - relatives.setLast6To9Months( last6To9Months ); - relatives.setLast9To12Months( last9To12Months ); - relatives.setLast12IndividualMonths( last12IndividualMonths ); - relatives.setIndividualMonthsThisYear( individualMonthsThisYear ); - relatives.setIndividualQuartersThisYear( individualQuartersThisYear ); + RelativePeriods relatives = new RelativePeriods( reportingMonth, monthsThisYear, quartersThisYear, thisYear, monthsLastYear, quartersLastYear, lastYear ); 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 2010-07-18 15:17:23 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/SaveTableAction.java 2011-01-06 09:03:29 +0000 @@ -213,76 +213,48 @@ this.reportingMonth = reportingMonth; } - private boolean last3Months; - - public void setLast3Months( boolean last3Months ) - { - this.last3Months = last3Months; - } - - private boolean last6Months; - - public void setLast6Months( boolean last6Months ) - { - this.last6Months = last6Months; - } - - private boolean last12Months; - - public void setLast12Months( boolean last12Months ) - { - this.last12Months = last12Months; - } - - private boolean last3To6Months; - - public void setLast3To6Months( boolean last3To6Months ) - { - this.last3To6Months = last3To6Months; - } - - private boolean last6To9Months; - - public void setLast6To9Months( boolean last6To9Months ) - { - this.last6To9Months = last6To9Months; - } - - private boolean last9To12Months; - - public void setLast9To12Months( boolean last9To12Months ) - { - this.last9To12Months = last9To12Months; - } - - private boolean last12IndividualMonths; - - public void setLast12IndividualMonths( boolean last12IndividualMonths ) - { - this.last12IndividualMonths = last12IndividualMonths; - } - - private boolean soFarThisYear; - - public void setSoFarThisYear( boolean soFarThisYear ) - { - this.soFarThisYear = soFarThisYear; - } - - private boolean individualMonthsThisYear; - - public void setIndividualMonthsThisYear( boolean individualMonthsThisYear ) - { - this.individualMonthsThisYear = individualMonthsThisYear; - } - - private boolean individualQuartersThisYear; - - public void setIndividualQuartersThisYear( boolean individualQuartersThisYear ) - { - this.individualQuartersThisYear = individualQuartersThisYear; - } - + private boolean monthsThisYear; + + public void setMonthsThisYear( boolean monthsThisYear ) + { + 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 ) + { + this.monthsLastYear = monthsLastYear; + } + + private boolean quartersLastYear; + + public void setQuartersLastYear( boolean quartersLastYear ) + { + this.quartersLastYear = quartersLastYear; + } + + private boolean lastYear; + + public void setLastYear( boolean lastYear ) + { + this.lastYear = lastYear; + } + private boolean paramReportingMonth; public void setParamReportingMonth( boolean paramReportingMonth ) @@ -333,19 +305,7 @@ DimensionSet dimensionSet = dimensionService.getDimensionSet( dimensionSetId ); - RelativePeriods relatives = new RelativePeriods(); - - relatives.setReportingMonth( reportingMonth ); - relatives.setLast3Months( last3Months ); - relatives.setLast6Months( last6Months ); - relatives.setLast12Months( last12Months ); - relatives.setSoFarThisYear( soFarThisYear ); - relatives.setLast3To6Months( last3To6Months ); - relatives.setLast6To9Months( last6To9Months ); - relatives.setLast9To12Months( last9To12Months ); - relatives.setLast12IndividualMonths( last12IndividualMonths ); - relatives.setIndividualMonthsThisYear( individualMonthsThisYear ); - relatives.setIndividualQuartersThisYear( individualQuartersThisYear ); + RelativePeriods relatives = new RelativePeriods( reportingMonth, monthsThisYear, quartersThisYear, thisYear, monthsLastYear, quartersLastYear, lastYear ); ReportParams reportParams = new ReportParams(); === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties 2010-12-26 18:47:16 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties 2011-01-06 09:03:29 +0000 @@ -40,14 +40,12 @@ periods= Periods relative_periods= Relative periods reporting_month= Reporting month -last_3_months= Last 3 months -last_6_months= Last 6 months -last_9_months= Last 9 months -last_12_months= Last 12 months -last_3_to_6_months= Last 3 to 6 months -last_6_to_9_months= Last 6 to 9 months -last_9_to_12_months= Last 9 to 12 months -last_12_individual_months= Last 12 individual months +months_this_year = Months this year +quarters_this_year = Quarters this year +this_year = This year +months_last_year = Months last year +quarters_last_year = Quarters last year +last_year = Last year report_table= Report Table crosstab_dimensions= Crosstab dimensions confirm_delete_table= Are you sure you want to remove table? @@ -141,8 +139,8 @@ report_table_parameters= Report table parameters so_far_this_year= So far this year so_far_this_financial_year= So far this financial year -individual_months_this_year= Individual months this year -individual_quarters_this_year= Individual quarters this year +months_this_year= Months this year +quarters_this_year= Quarters this year selected_report_tables= Selected report tables available_report_tables= Available report tables add_indicator_table= Add Indicator Table === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartIndicatorModeForm.vm' --- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartIndicatorModeForm.vm 2010-08-28 13:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartIndicatorModeForm.vm 2011-01-06 09:03:29 +0000 @@ -57,43 +57,22 @@ $i18n.getString( "relative_periods" ) - + -   - -   - -   - - - - - - - - - - -   - -   - -   - - - - - - - - - - -   - -   - - +   + +   + +   + +

+ + +   + +   + + === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartPeriodModeForm.vm' --- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartPeriodModeForm.vm 2010-08-28 10:44:15 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartPeriodModeForm.vm 2011-01-06 09:03:29 +0000 @@ -56,43 +56,22 @@ $i18n.getString( "relative_periods" ) - + -   - -   - -   - - - - - - - - - - -   - -   - -   - - - - - - - - - - -   - -   - - +   + +   + +   + +
+ + +   + +   + + === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addTableForm.vm' --- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addTableForm.vm 2010-07-18 15:17:23 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addTableForm.vm 2011-01-06 09:03:29 +0000 @@ -324,40 +324,19 @@   - -   - -   - - - - - - - - - - -   - -   - -   - - - - - - - - - - -   - -   - - + +   + +   + +

+ + +   + +   + + === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js' --- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js 2010-09-01 16:55:23 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js 2011-01-06 09:03:29 +0000 @@ -111,23 +111,3 @@ return true; } - -function relativePeriodsChecked() -{ - if ( isChecked( "reportingMonth" ) == true || - isChecked( "last3Months" ) == true || - isChecked( "last6Months" ) == true || - isChecked( "last12Months" ) == true || - isChecked( "last3To6Months" ) == true || - isChecked( "last6To9Months" ) == true || - isChecked( "last9To12Months" ) == true || - isChecked( "last12IndividualMonths" ) == true || - isChecked( "soFarThisYear" ) == true || - isChecked( "individualMonthsThisYear" ) == true || - isChecked( "individualQuartersThisYear" ) == true ) - { - return true; - } - - return false; -} === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js' --- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js 2010-12-26 15:38:45 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js 2011-01-06 09:03:29 +0000 @@ -137,26 +137,6 @@ return value && value == "true" ? true : false; } -function relativePeriodsChecked() -{ - if ( isChecked( "reportingMonth" ) == true || - isChecked( "last3Months" ) == true || - isChecked( "last6Months" ) == true || - isChecked( "last12Months" ) == true || - isChecked( "last3To6Months" ) == true || - isChecked( "last6To9Months" ) == true || - isChecked( "last9To12Months" ) == true || - isChecked( "last12IndividualMonths" ) == true || - isChecked( "soFarThisYear" ) == true || - isChecked( "individualMonthsThisYear" ) == true || - isChecked( "individualQuartersThisYear" ) == true ) - { - return true; - } - - return false; -} - function organisationUnitReportParamsChecked() { if ( isChecked( "paramParentOrganisationUnit" ) == true ||