=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java 2011-12-09 20:53:07 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java 2011-12-14 14:28:04 +0000 @@ -31,7 +31,10 @@ import org.codehaus.jackson.map.annotate.JsonSerialize; import org.hisp.dhis.common.BaseIdentifiableObject; import org.hisp.dhis.common.Dxf2Namespace; -import org.hisp.dhis.common.adapter.*; +import org.hisp.dhis.common.adapter.DataElementXmlAdapter; +import org.hisp.dhis.common.adapter.DataSetXmlAdapter; +import org.hisp.dhis.common.adapter.IndicatorXmlAdapter; +import org.hisp.dhis.common.adapter.OrganisationUnitXmlAdapter; import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataset.DataSet; import org.hisp.dhis.i18n.I18nFormat; @@ -516,7 +519,8 @@ this.dataSets = dataSets; } - // TODO marshall this? we probably want that.. + @XmlElement + @JsonProperty public List getPeriods() { return periods; @@ -552,6 +556,8 @@ this.format = format; } + @XmlElement( name = "relativePeriods" ) + @JsonProperty( value = "relativePeriods" ) public RelativePeriods getRelatives() { return relatives; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java 2011-12-14 13:00:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java 2011-12-14 14:28:04 +0000 @@ -27,13 +27,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import org.codehaus.jackson.annotate.JsonProperty; import org.hisp.dhis.common.BaseNameableObject; import org.hisp.dhis.common.Dxf2Namespace; import org.hisp.dhis.common.Weighted; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.*; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; @@ -121,7 +120,7 @@ * Copies the transient properties (name) from the argument Period * to this Period. * - * @param the Period to copy from. + * @param other Period to copy from. * @return this Period. */ public Period copyTransientProperties( Period other ) @@ -259,6 +258,8 @@ // Getters and setters // ------------------------------------------------------------------------- + @XmlElement + @JsonProperty public Date getEndDate() { return endDate; @@ -269,6 +270,7 @@ this.endDate = endDate; } + // TODO FIX THIS! public PeriodType getPeriodType() { return periodType; @@ -279,6 +281,8 @@ this.periodType = periodType; } + @XmlElement + @JsonProperty public Date getStartDate() { return startDate; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodType.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodType.java 2011-10-12 11:48:47 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodType.java 2011-12-14 14:28:04 +0000 @@ -27,6 +27,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import org.codehaus.jackson.annotate.JsonProperty; +import org.hisp.dhis.common.Dxf2Namespace; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; import java.io.Serializable; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -42,8 +49,9 @@ * The superclass of all PeriodTypes. * * @author Kristian Nordal - * @version $Id: PeriodType.java 5297 2008-05-29 16:49:33Z larshelg $ */ +@XmlRootElement( name = "periodType", namespace = Dxf2Namespace.NAMESPACE ) +@XmlAccessorType( value = XmlAccessType.NONE ) public abstract class PeriodType implements Serializable { === 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-12-09 20:53:07 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/RelativePeriods.java 2011-12-14 14:28:04 +0000 @@ -27,19 +27,23 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import org.codehaus.jackson.annotate.JsonProperty; +import org.hisp.dhis.common.Dxf2Namespace; +import org.hisp.dhis.i18n.I18nFormat; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; import java.io.Serializable; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.List; -import java.util.Set; - -import org.hisp.dhis.i18n.I18nFormat; +import java.util.*; /** * @author Lars Helge Overland * @version $Id$ */ +@XmlRootElement( name = "relativePeriods", namespace = Dxf2Namespace.NAMESPACE ) +@XmlAccessorType( value = XmlAccessType.NONE ) public class RelativePeriods implements Serializable { @@ -51,9 +55,9 @@ public static final String REPORTING_MONTH = "reporting_month"; public static final String REPORTING_BIMONTH = "reporting_bimonth"; public static final String REPORTING_QUARTER = "reporting_quarter"; - public static final String THIS_YEAR = "year"; + public static final String THIS_YEAR = "year"; public static final String LAST_YEAR = "last_year"; - + public static final String[] MONTHS_THIS_YEAR = { "january", "february", @@ -66,7 +70,7 @@ "september", "october", "november", - "december" }; + "december"}; public static final String[] MONTHS_LAST_YEAR = { "january_last_year", @@ -80,8 +84,8 @@ "september_last_year", "october_last_year", "november_last_year", - "december_last_year" }; - + "december_last_year"}; + public static final String[] MONTHS_LAST_12 = { "month1", "month2", @@ -94,97 +98,97 @@ "month9", "month10", "month11", - "month12" }; - + "month12"}; + public static final String[] BIMONTHS_LAST_6 = { "bimonth1", "bimonth2", "bimonth3", "bimonth4", "bimonth5", - "bimonth6" }; - + "bimonth6"}; + public static final String[] QUARTERS_THIS_YEAR = { "quarter1", "quarter2", "quarter3", - "quarter4" }; - + "quarter4"}; + public static final String[] SIXMONHTS_LAST_2 = { "sixmonth1", - "sixmonth2" }; + "sixmonth2"}; public static final String[] QUARTERS_LAST_YEAR = { "quarter1_last_year", "quarter2_last_year", "quarter3_last_year", - "quarter4_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" }; + "year_this"}; private static final int MONTHS_IN_YEAR = 12; - - private Boolean reportingMonth = false; - - private Boolean reportingBimonth = false; - - private Boolean reportingQuarter = 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; - - private Boolean last5Years = false; - - private Boolean last12Months = false; - - private Boolean last6BiMonths = false; - - private Boolean last4Quarters = false; - - private Boolean last2SixMonths = false; - + + private boolean reportingMonth = false; + + private boolean reportingBimonth = false; + + private boolean reportingQuarter = 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; + + private boolean last5Years = false; + + private boolean last12Months = false; + + private boolean last6BiMonths = false; + + private boolean last4Quarters = false; + + private boolean last2SixMonths = false; + // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- public RelativePeriods() - { + { } - + /** - * @param reportingMonth reporting month + * @param reportingMonth reporting month * @param reportingBimonth reporting bi-month * @param reportingQuarter reporting quarter - * @param monthsThisYear months this year + * @param monthsThisYear months this year * @param quartersThisYear quarters this year - * @param thisYear this year - * @param monthsLastYear months last year + * @param thisYear this year + * @param monthsLastYear months last year * @param quartersLastYear quarters last year - * @param lastYear last year - * @param last5Years last 5 years - * @param last12Months last 12 months - * @param last6BiMonths last 6 bi-months - * @param last4Quarters last 4 quarters - * @param last2SixMonths last 2 six-months + * @param lastYear last year + * @param last5Years last 5 years + * @param last12Months last 12 months + * @param last6BiMonths last 6 bi-months + * @param last4Quarters last 4 quarters + * @param last2SixMonths last 2 six-months */ public RelativePeriods( boolean reportingMonth, boolean reportingBimonth, boolean reportingQuarter, - boolean monthsThisYear, boolean quartersThisYear, boolean thisYear, - boolean monthsLastYear, boolean quartersLastYear, boolean lastYear, boolean last5Years, - boolean last12Months, boolean last6BiMonths, boolean last4Quarters, boolean last2SixMonths ) + boolean monthsThisYear, boolean quartersThisYear, boolean thisYear, + boolean monthsLastYear, boolean quartersLastYear, boolean lastYear, boolean last5Years, + boolean last12Months, boolean last6BiMonths, boolean last4Quarters, boolean last2SixMonths ) { this.reportingMonth = reportingMonth; this.reportingBimonth = reportingBimonth; @@ -205,7 +209,7 @@ // ------------------------------------------------------------------------- // Logic // ------------------------------------------------------------------------- - + /** * Sets all options to false. */ @@ -225,13 +229,13 @@ this.last6BiMonths = false; this.last4Quarters = false; this.last2SixMonths = false; - + return this; } /** * Returns the period type for the option with the lowest frequency. - * + * * @return the period type. */ public PeriodType getPeriodType() @@ -240,24 +244,24 @@ { return PeriodType.getPeriodTypeByName( MonthlyPeriodType.NAME ); } - + if ( isReportingBimonth() ) { return PeriodType.getPeriodTypeByName( BiMonthlyPeriodType.NAME ); } - + if ( isReportingQuarter() ) { return PeriodType.getPeriodTypeByName( QuarterlyPeriodType.NAME ); } - + return PeriodType.getPeriodTypeByName( YearlyPeriodType.NAME ); } - + /** * Return the name of the reporting period. - * - * @param date the start date of the reporting period. + * + * @param date the start date of the reporting period. * @param format the i18n format. * @return the name of the reporting period. */ @@ -268,9 +272,9 @@ } /** - * Return the name of the reporting period. The current date is set to + * Return the name of the reporting period. The current date is set to * todays date minus one month. - * + * * @param format the i18n format. * @return the name of the reporting period. */ @@ -279,7 +283,7 @@ Period period = getPeriodType().createPeriod( getDate( 1, new Date() ) ); return format.formatPeriod( period ); } - + /** * Gets a list of Periods relative to current date. */ @@ -289,9 +293,9 @@ } /** - * Gets a list of Periods based on the given input and the state of this + * Gets a list of Periods based on the given input and the state of this * RelativePeriods. The current date is set to todays date minus one month. - * + * * @param format the i18n format. * @return a list of relative Periods. */ @@ -299,44 +303,44 @@ { return getRelativePeriods( getDate( 1, new Date() ), format, dynamicNames ); } - + /** - * Gets a list of Periods based on the given input and the state of this + * Gets a list of Periods based on the given input and the state of this * RelativePeriods. - * - * @param date the date representing now. + * + * @param date the date representing now. * @param format the i18n format. * @return a list of relative Periods. */ public List getRelativePeriods( Date date, I18nFormat format, boolean dynamicNames ) { List periods = new ArrayList(); - + if ( isReportingMonth() ) { periods.add( getRelativePeriod( new MonthlyPeriodType(), REPORTING_MONTH, date, dynamicNames, format ) ); } - + if ( isReportingBimonth() ) { periods.add( getRelativePeriod( new BiMonthlyPeriodType(), REPORTING_BIMONTH, date, dynamicNames, format ) ); } - + if ( isReportingQuarter() ) { periods.add( getRelativePeriod( new QuarterlyPeriodType(), REPORTING_QUARTER, date, dynamicNames, format ) ); } - + if ( isMonthsThisYear() ) { periods.addAll( getRelativePeriodList( new MonthlyPeriodType(), MONTHS_THIS_YEAR, date, dynamicNames, format ) ); } - + if ( isQuartersThisYear() ) { periods.addAll( getRelativePeriodList( new QuarterlyPeriodType(), QUARTERS_THIS_YEAR, date, dynamicNames, format ) ); } - + if ( isThisYear() ) { periods.add( getRelativePeriod( new YearlyPeriodType(), THIS_YEAR, date, dynamicNames, format ) ); @@ -346,56 +350,56 @@ { periods.addAll( getRelativePeriodList( new YearlyPeriodType().generateLast5Years( date ), LAST_5_YEARS, dynamicNames, format ) ); } - + if ( isLast12Months() ) { periods.addAll( getRelativePeriodList( new MonthlyPeriodType().generateRollingPeriods( date ), MONTHS_LAST_12, dynamicNames, format ) ); } - + if ( isLast6BiMonths() ) { periods.addAll( getRelativePeriodList( new BiMonthlyPeriodType().generateRollingPeriods( date ), BIMONTHS_LAST_6, dynamicNames, format ) ); } - + if ( isLast4Quarters() ) { periods.addAll( getRelativePeriodList( new QuarterlyPeriodType().generateRollingPeriods( date ), QUARTERS_THIS_YEAR, dynamicNames, format ) ); } - + if ( isLast2SixMonths() ) { periods.addAll( getRelativePeriodList( new SixMonthlyPeriodType().generateRollingPeriods( date ), SIXMONHTS_LAST_2, dynamicNames, format ) ); } - + date = getDate( MONTHS_IN_YEAR, date ); - + if ( isMonthsLastYear() ) { periods.addAll( getRelativePeriodList( new MonthlyPeriodType(), MONTHS_LAST_YEAR, date, dynamicNames, format ) ); } - + if ( isQuartersLastYear() ) { periods.addAll( getRelativePeriodList( new QuarterlyPeriodType(), QUARTERS_LAST_YEAR, date, dynamicNames, format ) ); } - + if ( isLastYear() ) { periods.add( getRelativePeriod( new YearlyPeriodType(), LAST_YEAR, date, dynamicNames, format ) ); } - + return periods; } /** * Returns a list of relative periods. The name will be dynamic depending on * the dynamicNames argument. The short name will always be dynamic. - * - * @param periodType the period type. - * @param periodNames the array of period names. - * @param date the current date. + * + * @param periodType the period type. + * @param periodNames the array of period names. + * @param date the current date. * @param dynamicNames indication of whether dynamic names should be used. - * @param format the I18nFormat. + * @param format the I18nFormat. * @return a list of periods. */ private List getRelativePeriodList( CalendarPeriodType periodType, String[] periodNames, Date date, boolean dynamicNames, I18nFormat format ) @@ -406,90 +410,90 @@ /** * 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 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. + * @param format the I18nFormat. * @return a list of periods. */ private List getRelativePeriodList( List relatives, String[] periodNames, boolean dynamicNames, I18nFormat format ) { List periods = new ArrayList(); - + int c = 0; - + for ( Period period : relatives ) { periods.add( setName( period, periodNames[c++], dynamicNames, format ) ); } - + return periods; } /** * Returns relative period. The name will be dynamic depending on the * dynamicNames argument. The short name will always be dynamic. - * - * @param periodType the period type. - * @param periodName the period name. - * @param date the current date. + * + * @param periodType the period type. + * @param periodName the period name. + * @param date the current date. * @param dynamicNames indication of whether dynamic names should be used. - * @param format the I18nFormat. + * @param format the I18nFormat. * @return a list of periods. */ private Period getRelativePeriod( CalendarPeriodType periodType, String periodName, Date date, boolean dynamicNames, I18nFormat format ) { return setName( periodType.createPeriod( date ), periodName, dynamicNames, format ); } - + /** * Sets the name and short name of the given Period. - * - * @param period the period. - * @param periodName the period name. + * + * @param period the period. + * @param periodName the period name. * @param dynamicNames indication of whether dynamic names should be used. - * @param format the I18nFormat. + * @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; } - + /** * Returns a date. - * + * * @param months the number of months to subtract from the current date. - * @param date the date representing now, ignored if null. + * @param date the date representing now, ignored if null. * @return a date. */ public Date getDate( int months, Date date ) { Calendar cal = PeriodType.createCalendarInstance(); - + if ( date != null ) // For testing purposes { cal.setTime( date ); } - - cal.add( Calendar.MONTH, ( months * -1 ) ); - + + cal.add( Calendar.MONTH, (months * -1) ); + return cal.getTime(); } /** * Creates an instance of RelativePeriods based on given set of PeriodType * names. - * + * * @return a RelativePeriods instance. */ public RelativePeriods getRelativePeriods( Set periodTypes ) { RelativePeriods relatives = new RelativePeriods(); - + if ( periodTypes == null || periodTypes.isEmpty() ) { relatives.setLast12Months( true ); @@ -504,224 +508,178 @@ relatives.setLast2SixMonths( periodTypes.contains( SixMonthlyPeriodType.NAME ) ); relatives.setLastYear( periodTypes.contains( YearlyPeriodType.NAME ) ); } - + return relatives; } - - // ------------------------------------------------------------------------- - // Is methods - // ------------------------------------------------------------------------- - + + // ------------------------------------------------------------------------- + // Getters & setters + // ------------------------------------------------------------------------- + + @XmlElement + @JsonProperty public boolean isReportingMonth() { - return reportingMonth != null && reportingMonth; - } - + return reportingMonth; + } + + public void setReportingMonth( boolean reportingMonth ) + { + this.reportingMonth = reportingMonth; + } + + @XmlElement + @JsonProperty public boolean isReportingBimonth() { - return reportingBimonth != null && reportingBimonth; - } - + return reportingBimonth; + } + + public void setReportingBimonth( boolean reportingBimonth ) + { + this.reportingBimonth = reportingBimonth; + } + + @XmlElement + @JsonProperty public boolean isReportingQuarter() { - return reportingQuarter != null && reportingQuarter; - } - + return reportingQuarter; + } + + public void setReportingQuarter( boolean reportingQuarter ) + { + this.reportingQuarter = reportingQuarter; + } + + @XmlElement + @JsonProperty public boolean isMonthsThisYear() { - return monthsThisYear != null && monthsThisYear; - } - + return monthsThisYear; + } + + public void setMonthsThisYear( boolean monthsThisYear ) + { + this.monthsThisYear = monthsThisYear; + } + + @XmlElement + @JsonProperty public boolean isQuartersThisYear() { - return quartersThisYear != null && quartersThisYear; - } - + return quartersThisYear; + } + + public void setQuartersThisYear( boolean quartersThisYear ) + { + this.quartersThisYear = quartersThisYear; + } + + @XmlElement + @JsonProperty public boolean isThisYear() { - return thisYear != null && thisYear; - } - + return thisYear; + } + + public void setThisYear( boolean thisYear ) + { + this.thisYear = thisYear; + } + + @XmlElement + @JsonProperty public boolean isMonthsLastYear() { - return monthsLastYear != null && monthsLastYear; - } - + return monthsLastYear; + } + + public void setMonthsLastYear( boolean monthsLastYear ) + { + this.monthsLastYear = monthsLastYear; + } + + @XmlElement + @JsonProperty public boolean isQuartersLastYear() { - return quartersLastYear != null && quartersLastYear; - } - + return quartersLastYear; + } + + public void setQuartersLastYear( boolean quartersLastYear ) + { + this.quartersLastYear = quartersLastYear; + } + + @XmlElement + @JsonProperty public boolean isLastYear() { - return lastYear != null && lastYear; - } - + return lastYear; + } + + public void setLastYear( boolean lastYear ) + { + this.lastYear = lastYear; + } + + @XmlElement + @JsonProperty public boolean isLast5Years() { - return last5Years != null && last5Years; - } - + return last5Years; + } + + public void setLast5Years( boolean last5Years ) + { + this.last5Years = last5Years; + } + + @XmlElement + @JsonProperty public boolean isLast12Months() { - return last12Months != null && last12Months; - } - + return last12Months; + } + + public void setLast12Months( boolean last12Months ) + { + this.last12Months = last12Months; + } + + @XmlElement + @JsonProperty public boolean isLast6BiMonths() { - return last6BiMonths != null && last6BiMonths; - } - + return last6BiMonths; + } + + public void setLast6BiMonths( boolean last6BiMonths ) + { + this.last6BiMonths = last6BiMonths; + } + + @XmlElement + @JsonProperty public boolean isLast4Quarters() { - return last4Quarters != null && last4Quarters; - } - + return last4Quarters; + } + + public void setLast4Quarters( boolean last4Quarters ) + { + this.last4Quarters = last4Quarters; + } + + @XmlElement + @JsonProperty public boolean isLast2SixMonths() { - return last2SixMonths != null && last2SixMonths; - } - - // ------------------------------------------------------------------------- - // Getters & setters - // ------------------------------------------------------------------------- - - public Boolean getReportingMonth() - { - return reportingMonth; - } - - public void setReportingMonth( Boolean reportingMonth ) - { - this.reportingMonth = reportingMonth; - } - - public Boolean getReportingBimonth() - { - return reportingBimonth; - } - - public void setReportingBimonth( Boolean reportingBimonth ) - { - this.reportingBimonth = reportingBimonth; - } - - public Boolean getReportingQuarter() - { - return reportingQuarter; - } - - public void setReportingQuarter( Boolean reportingQuarter ) - { - this.reportingQuarter = reportingQuarter; - } - - 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; - } - - public Boolean getLast5Years() - { - return last5Years; - } - - public void setLast5Years( Boolean last5Years ) - { - this.last5Years = last5Years; - } - - public Boolean getLast12Months() - { - return last12Months; - } - - public void setLast12Months( Boolean last12Months ) - { - this.last12Months = last12Months; - } - - public Boolean getLast6BiMonths() - { - return last6BiMonths; - } - - public void setLast6BiMonths( Boolean last6BiMonths ) - { - this.last6BiMonths = last6BiMonths; - } - - public Boolean getLast4Quarters() - { - return last4Quarters; - } - - public void setLast4Quarters( Boolean last4Quarters ) - { - this.last4Quarters = last4Quarters; - } - - public Boolean getLast2SixMonths() - { return last2SixMonths; } - public void setLast2SixMonths( Boolean last2SixMonths ) + public void setLast2SixMonths( boolean last2SixMonths ) { this.last2SixMonths = last2SixMonths; } @@ -734,24 +692,24 @@ public int hashCode() { final int prime = 31; - + int result = 1; - result = prime * result + ( ( reportingMonth == null ) ? 0 : reportingMonth.hashCode() ); - result = prime * result + ( ( reportingBimonth == null ) ? 0 : reportingBimonth.hashCode() ); - result = prime * result + ( ( reportingQuarter == null ) ? 0 : reportingQuarter.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() ); - result = prime * result + ( ( last5Years == null ) ? 0 : last5Years.hashCode() ); - result = prime * result + ( ( last12Months == null ) ? 0 : last12Months.hashCode() ); - result = prime * result + ( ( last6BiMonths == null ) ? 0 : last6BiMonths.hashCode() ); - result = prime * result + ( ( last4Quarters == null ) ? 0 : last4Quarters.hashCode() ); - result = prime * result + ( ( last2SixMonths == null ) ? 0 : last2SixMonths.hashCode() ); - + result = prime * result + (reportingMonth ? 1 : 0); + result = prime * result + (reportingBimonth ? 1 : 0); + result = prime * result + (reportingQuarter ? 1 : 0); + result = prime * result + (monthsThisYear ? 1 : 0); + result = prime * result + (quartersThisYear ? 1 : 0); + result = prime * result + (thisYear ? 1 : 0); + result = prime * result + (monthsLastYear ? 1 : 0); + result = prime * result + (quartersLastYear ? 1 : 0); + result = prime * result + (lastYear ? 1 : 0); + result = prime * result + (last5Years ? 1 : 0); + result = prime * result + (last12Months ? 1 : 0); + result = prime * result + (last6BiMonths ? 1 : 0); + result = prime * result + (last4Quarters ? 1 : 0); + result = prime * result + (last2SixMonths ? 1 : 0); + return result; } @@ -762,187 +720,89 @@ { return true; } - + if ( object == null ) { return false; } - + if ( getClass() != object.getClass() ) { return false; } - + final RelativePeriods other = (RelativePeriods) object; - - if ( reportingMonth == null ) - { - if ( other.reportingMonth != null ) - { - return false; - } - } - else if ( !reportingMonth.equals( other.reportingMonth ) ) - { - return false; - } - - if ( reportingBimonth == null ) - { - if ( other.reportingBimonth != null ) - { - return false; - } - } - else if ( !reportingBimonth.equals( other.reportingBimonth ) ) - { - return false; - } - - if ( reportingQuarter == null ) - { - if ( other.reportingQuarter != null ) - { - return false; - } - } - else if ( !reportingQuarter.equals( other.reportingQuarter ) ) - { - 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; - } - - if ( last5Years == null ) - { - if ( other.last5Years != null ) - { - return false; - } - } - else if ( !last5Years.equals( other.last5Years ) ) - { - return false; - } - - if ( last12Months == null ) - { - if ( other.last12Months != null ) - { - return false; - } - } - else if ( !last12Months.equals( other.last12Months ) ) - { - return false; - } - - if ( last6BiMonths == null ) - { - if ( other.last6BiMonths != null ) - { - return false; - } - } - else if ( !last6BiMonths.equals( other.last6BiMonths ) ) - { - return false; - } - - if ( last4Quarters == null ) - { - if ( other.last4Quarters != null ) - { - return false; - } - } - else if ( !last4Quarters.equals( other.last4Quarters ) ) - { - return false; - } - - if ( last2SixMonths == null ) - { - if ( other.last2SixMonths != null ) - { - return false; - } - } - else if ( !last2SixMonths.equals( other.last2SixMonths ) ) - { - return false; - } - + + if ( !reportingMonth == other.reportingMonth ) + { + return false; + } + + if ( !reportingBimonth == other.reportingBimonth ) + { + return false; + } + + if ( !reportingQuarter == other.reportingQuarter ) + { + return false; + } + + if ( !monthsThisYear == other.monthsThisYear ) + { + return false; + } + + if ( !quartersThisYear == other.quartersThisYear ) + { + return false; + } + + if ( !thisYear == other.thisYear ) + { + return false; + } + + if ( !monthsLastYear == other.monthsLastYear ) + { + return false; + } + + if ( !quartersLastYear == other.quartersLastYear ) + { + return false; + } + + if ( !lastYear == other.lastYear ) + { + return false; + } + + if ( !last5Years == other.last5Years ) + { + return false; + } + + if ( !last12Months == other.last12Months ) + { + return false; + } + + if ( !last6BiMonths == other.last6BiMonths ) + { + return false; + } + + if ( !last4Quarters == other.last4Quarters ) + { + return false; + } + + if ( !last2SixMonths == other.last2SixMonths ) + { + return false; + } + return true; } } === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulator.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulator.java 2011-12-14 11:27:45 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulator.java 2011-12-14 14:28:04 +0000 @@ -965,7 +965,6 @@ handleIdentifiableObjectCollection( chart.getDataElements() ); handleIdentifiableObjectCollection( chart.getOrganisationUnits() ); handleIdentifiableObjectCollection( chart.getDataSets() ); - handleIdentifiableObjectCollection( chart.getPeriods() ); } }