=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/excelitem/ExcelItemGroup.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/excelitem/ExcelItemGroup.java 2009-10-29 05:21:01 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/excelitem/ExcelItemGroup.java 2009-10-30 13:04:40 +0000 @@ -32,152 +32,184 @@ import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.organisationunit.OrganisationUnitGroup; +import org.hisp.dhis.period.PeriodType; import org.hisp.dhis.reportexcel.DataElementGroupOrder; /** * @author Chau Thu Tran * @version $Id$ */ -public class ExcelItemGroup { - private int id; - - private String name; - - private Set excelItems; - - private String excelTemplateFile; - - private String type; - - private Set organisationAssocitions; - - private List organisationUnitGroups; - - private List dataElementOrders; - - // ---------------------------------------------------------------------- - // Constructors - // ---------------------------------------------------------------------- - - public ExcelItemGroup() { - - } - - // ------------------------------------------------------------------------- - // Internal classes - // ------------------------------------------------------------------------- - - public static class TYPE { - public static final String NORMAL = "NORMAL"; - - public static final String CATEGORY = "CATEGORY"; - - public static final String PERIOD_COLUMN_LISTING = "PERIOD_COLUMN_LISTING"; - - public static final String ORGANIZATION_GROUP_LISTING = "ORGANIZATION_GROUP_LISTING"; - } - - // ------------------------------------------------------------------------- - // hashCode and equals - // ------------------------------------------------------------------------- - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + name.hashCode(); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - ExcelItemGroup other = (ExcelItemGroup) obj; - if (name != other.name) - return false; - return true; - } - - // ---------------------------------------------------------------------- - // Getters and setters - // ---------------------------------------------------------------------- - - public int getId() { - return id; - } - - public List getDataElementOrders() { - return dataElementOrders; - } - - public void setDataElementOrders(List dataElementOrders) { - this.dataElementOrders = dataElementOrders; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public List getOrganisationUnitGroups() { - return organisationUnitGroups; - } - - public void setOrganisationUnitGroups( - List organisationUnitGroups) { - this.organisationUnitGroups = organisationUnitGroups; - } - - public void setName(String name) { - this.name = name; - } - - public String getExcelTemplateFile() { - return excelTemplateFile; - } - - public void setExcelTemplateFile(String excelTemplateFile) { - this.excelTemplateFile = excelTemplateFile; - } - - public Set getExcelItems() { - return excelItems; - } - - public void setExcelItems(Set excelItems) { - this.excelItems = excelItems; - } - - public Set getOrganisationAssocitions() { - return organisationAssocitions; - } - - public void setOrganisationAssocitions( - Set organisationAssocitions) { - this.organisationAssocitions = organisationAssocitions; - } - - // ---------------------------------------------------------------------- - // getType - // ---------------------------------------------------------------------- - - public boolean isCategory() +public class ExcelItemGroup +{ + private int id; + + private String name; + + private Set excelItems; + + private String excelTemplateFile; + + private String type; + + private Set organisationAssocitions; + + private List organisationUnitGroups; + + private List dataElementOrders; + + private PeriodType periodType; + + // ---------------------------------------------------------------------- + // Constructors + // ---------------------------------------------------------------------- + + public ExcelItemGroup() + { + + } + + // ------------------------------------------------------------------------- + // Internal classes + // ------------------------------------------------------------------------- + + public static class TYPE + { + public static final String NORMAL = "NORMAL"; + + public static final String CATEGORY = "CATEGORY"; + + public static final String PERIOD_COLUMN_LISTING = "PERIOD_COLUMN_LISTING"; + + public static final String ORGANIZATION_GROUP_LISTING = "ORGANIZATION_GROUP_LISTING"; + } + + // ------------------------------------------------------------------------- + // hashCode and equals + // ------------------------------------------------------------------------- + + @Override + public int hashCode() + { + final int prime = 31; + int result = 1; + result = prime * result + name.hashCode(); + return result; + } + + @Override + public boolean equals( Object obj ) + { + if ( this == obj ) + return true; + if ( obj == null ) + return false; + if ( getClass() != obj.getClass() ) + return false; + ExcelItemGroup other = (ExcelItemGroup) obj; + if ( name != other.name ) + return false; + return true; + } + + // ---------------------------------------------------------------------- + // Getters and setters + // ---------------------------------------------------------------------- + + public int getId() + { + return id; + } + + public List getDataElementOrders() + { + return dataElementOrders; + } + + public void setDataElementOrders( List dataElementOrders ) + { + this.dataElementOrders = dataElementOrders; + } + + public String getType() + { + return type; + } + + public void setType( String type ) + { + this.type = type; + } + + public void setId( int id ) + { + this.id = id; + } + + public String getName() + { + return name; + } + + public List getOrganisationUnitGroups() + { + return organisationUnitGroups; + } + + public void setOrganisationUnitGroups( List organisationUnitGroups ) + { + this.organisationUnitGroups = organisationUnitGroups; + } + + public void setName( String name ) + { + this.name = name; + } + + public String getExcelTemplateFile() + { + return excelTemplateFile; + } + + public void setExcelTemplateFile( String excelTemplateFile ) + { + this.excelTemplateFile = excelTemplateFile; + } + + public Set getExcelItems() + { + return excelItems; + } + + public void setExcelItems( Set excelItems ) + { + this.excelItems = excelItems; + } + + public Set getOrganisationAssocitions() + { + return organisationAssocitions; + } + + public void setOrganisationAssocitions( Set organisationAssocitions ) + { + this.organisationAssocitions = organisationAssocitions; + } + + public PeriodType getPeriodType() + { + return periodType; + } + + public void setPeriodType( PeriodType periodType ) + { + this.periodType = periodType; + } + + // ---------------------------------------------------------------------- + // getType + // ---------------------------------------------------------------------- + + public boolean isCategory() { return this.getType().equalsIgnoreCase( TYPE.CATEGORY ); } @@ -196,5 +228,4 @@ { return this.getType().equalsIgnoreCase( TYPE.NORMAL ); } - }