=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitLevel.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitLevel.java 2009-03-03 16:46:36 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitLevel.java 2009-11-23 17:43:36 +0000 @@ -93,7 +93,7 @@ final OrganisationUnitLevel other = (OrganisationUnitLevel) object; - return level == other.level && name == other.name; + return level == other.level && name.equals( other.name ); } // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/ReportExcel.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/ReportExcel.java 2009-11-18 04:14:34 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/ReportExcel.java 2009-11-23 17:43:36 +0000 @@ -179,7 +179,7 @@ if ( getClass() != obj.getClass() ) return false; ReportExcel other = (ReportExcel) obj; - if ( name != other.name ) + if ( !name.equals( other.name ) ) return false; return true; } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/excelitem/ExcelItem.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/excelitem/ExcelItem.java 2009-10-27 06:36:41 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/excelitem/ExcelItem.java 2009-11-23 17:43:36 +0000 @@ -1,114 +1,131 @@ package org.hisp.dhis.reportexcel.excelitem; - -public class ExcelItem { - - private int id; - - private String name; - - private String expression; - - private int row; - - private int column; - - private int sheetNo; - - private ExcelItemGroup excelItemGroup; - - // ------------------------------------------------------------------------- - // Constructors - // ------------------------------------------------------------------------- - - public ExcelItem() { - - } - - // ------------------------------------------------------------------------- - // Getters and setters - // ------------------------------------------------------------------------- - - public int getRow() { - return row; - } - - public String getExpression() { - return expression; - } - - public void setExpression(String expression) { - this.expression = expression; - } - - public void setRow(int row) { - this.row = row; - } - - public int getColumn() { - return column; - } - - public void setColumn(int column) { - this.column = column; - } - - public ExcelItemGroup getExcelItemGroup() { - return excelItemGroup; - } - - public void setExcelItemGroup(ExcelItemGroup excelItemGroup) { - this.excelItemGroup = excelItemGroup; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getSheetNo() { - return sheetNo; - } - - public void setSheetNo(int sheetNo) { - this.sheetNo = sheetNo; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - // ------------------------------------------------------------------------- - // hashCode and equals - // ------------------------------------------------------------------------- - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + id; - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - ExcelItem other = (ExcelItem) obj; - if (id != other.id) - return false; - return true; - } +public class ExcelItem +{ + + private int id; + + private String name; + + private String expression; + + private int row; + + private int column; + + private int sheetNo; + + private ExcelItemGroup excelItemGroup; + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + public ExcelItem() + { + + } + + // ------------------------------------------------------------------------- + // Getters and setters + // ------------------------------------------------------------------------- + + public int getRow() + { + return row; + } + + public String getExpression() + { + return expression; + } + + public void setExpression( String expression ) + { + this.expression = expression; + } + + public void setRow( int row ) + { + this.row = row; + } + + public int getColumn() + { + return column; + } + + public void setColumn( int column ) + { + this.column = column; + } + + public ExcelItemGroup getExcelItemGroup() + { + return excelItemGroup; + } + + public void setExcelItemGroup( ExcelItemGroup excelItemGroup ) + { + this.excelItemGroup = excelItemGroup; + } + + public String getName() + { + return name; + } + + public void setName( String name ) + { + this.name = name; + } + + public int getSheetNo() + { + return sheetNo; + } + + public void setSheetNo( int sheetNo ) + { + this.sheetNo = sheetNo; + } + + public int getId() + { + return id; + } + + public void setId( int id ) + { + this.id = id; + } + + // ------------------------------------------------------------------------- + // hashCode and equals + // ------------------------------------------------------------------------- + + @Override + public int hashCode() + { + final int prime = 31; + int result = 1; + result = prime * result + id; + return result; + } + + @Override + public boolean equals( Object obj ) + { + if ( this == obj ) + return true; + if ( obj == null ) + return false; + if ( getClass() != obj.getClass() ) + return false; + ExcelItem other = (ExcelItem) obj; + if ( id != other.id ) + return false; + return true; + } } === 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-11-11 04:15:09 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/excelitem/ExcelItemGroup.java 2009-11-23 17:43:36 +0000 @@ -40,160 +40,182 @@ * @version $Id$ */ -public class ExcelItemGroup { - private int id; - - private String name; - - private Set excelItems; - - 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 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); - } - - public boolean isOrganisationUnitGroupListing() { - return this.getType().equalsIgnoreCase(TYPE.ORGANIZATION_GROUP_LISTING); - } - - public boolean isPeriodColumnListing() { - return this.getType().equalsIgnoreCase(TYPE.PERIOD_COLUMN_LISTING); - } - - public boolean isNormal() { - return this.getType().equalsIgnoreCase(TYPE.NORMAL); - } +public class ExcelItemGroup +{ + private int id; + + private String name; + + private Set excelItems; + + 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.equals( 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 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 ); + } + + public boolean isOrganisationUnitGroupListing() + { + return this.getType().equalsIgnoreCase( TYPE.ORGANIZATION_GROUP_LISTING ); + } + + public boolean isPeriodColumnListing() + { + return this.getType().equalsIgnoreCase( TYPE.PERIOD_COLUMN_LISTING ); + } + + public boolean isNormal() + { + return this.getType().equalsIgnoreCase( TYPE.NORMAL ); + } } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/excelitem/ExcelItemService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/excelitem/ExcelItemService.java 2009-11-11 04:15:09 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/excelitem/ExcelItemService.java 2009-11-23 17:43:36 +0000 @@ -5,50 +5,49 @@ import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.reportexcel.DataElementGroupOrder; -public interface ExcelItemService { - - String ID = ExcelItemService.class.getName(); - - // ---------------------------------------------------------------------------- - // Excelitem group services - // ---------------------------------------------------------------------------- - - public int addExcelItemGroup(ExcelItemGroup excelItemGroup); - - public void updateExcelItemGroup(ExcelItemGroup excelItemGroup); - - public void deleteExcelItemGroup(int id); - - public Collection getAllExcelItemGroup(); - - public ExcelItemGroup getExcelItemGroup(int id); - - public Collection getExcelItemGroupsByOrganisationUnit( - OrganisationUnit organisationUnit); - - // ---------------------------------------------------------------------------- - // Excelitem services - // ---------------------------------------------------------------------------- - - public int addExcelItem(ExcelItem excelItem); - - public void updateExcelItem(ExcelItem excelItem); - - public void deleteExcelItem(int id); - - public Collection getAllExcelItem(); - - public ExcelItem getExcelItem(int id); - - // -------------------------------------- - // DataElement Order - // -------------------------------------- - - public DataElementGroupOrder getDataElementGroupOrder(Integer id); - - public void updateDataElementGroupOrder( - DataElementGroupOrder dataElementGroupOrder); - - public void deleteDataElementGroupOrder(Integer id); +public interface ExcelItemService +{ + + String ID = ExcelItemService.class.getName(); + + // ---------------------------------------------------------------------------- + // Excelitem group services + // ---------------------------------------------------------------------------- + + public int addExcelItemGroup( ExcelItemGroup excelItemGroup ); + + public void updateExcelItemGroup( ExcelItemGroup excelItemGroup ); + + public void deleteExcelItemGroup( int id ); + + public Collection getAllExcelItemGroup(); + + public ExcelItemGroup getExcelItemGroup( int id ); + + public Collection getExcelItemGroupsByOrganisationUnit( OrganisationUnit organisationUnit ); + + // ---------------------------------------------------------------------------- + // Excelitem services + // ---------------------------------------------------------------------------- + + public int addExcelItem( ExcelItem excelItem ); + + public void updateExcelItem( ExcelItem excelItem ); + + public void deleteExcelItem( int id ); + + public Collection getAllExcelItem(); + + public ExcelItem getExcelItem( int id ); + + // -------------------------------------- + // DataElement Order + // -------------------------------------- + + public DataElementGroupOrder getDataElementGroupOrder( Integer id ); + + public void updateDataElementGroupOrder( DataElementGroupOrder dataElementGroupOrder ); + + public void deleteDataElementGroupOrder( Integer id ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/excelitem/ExcelItemStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/excelitem/ExcelItemStore.java 2009-11-11 04:15:09 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/excelitem/ExcelItemStore.java 2009-11-23 17:43:36 +0000 @@ -5,49 +5,48 @@ import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.reportexcel.DataElementGroupOrder; -public interface ExcelItemStore { - - String ID = ExcelItemStore.class.getName(); - - // ---------------------------------------------------------------------------- - // Excelitem group services - // ---------------------------------------------------------------------------- - - public int addExcelItemGroup(ExcelItemGroup excelItemGroup); - - public void updateExcelItemGroup(ExcelItemGroup excelItemGroup); - - public void deleteExcelItemGroup(int id); - - public Collection getAllExcelItemGroup(); - - public ExcelItemGroup getExcelItemGroup(int id); - - public Collection getExcelItemGroupsByOrganisationUnit( - OrganisationUnit organisationUnit); - - // ---------------------------------------------------------------------------- - // Excelitem services - // ---------------------------------------------------------------------------- - - public int addExcelItem(ExcelItem excelItem); - - public void updateExcelItem(ExcelItem excelItem); - - public void deleteExcelItem(int id); - - public Collection getAllExcelItem(); - - public ExcelItem getExcelItem(int id); - - // -------------------------------------- - // DataElement Order - // -------------------------------------- - - public DataElementGroupOrder getDataElementGroupOrder(Integer id); - - public void updateDataElementGroupOrder( - DataElementGroupOrder dataElementGroupOrder); - - public void deleteDataElementGroupOrder(Integer id); +public interface ExcelItemStore +{ + + String ID = ExcelItemStore.class.getName(); + + // ---------------------------------------------------------------------------- + // Excelitem group services + // ---------------------------------------------------------------------------- + + public int addExcelItemGroup( ExcelItemGroup excelItemGroup ); + + public void updateExcelItemGroup( ExcelItemGroup excelItemGroup ); + + public void deleteExcelItemGroup( int id ); + + public Collection getAllExcelItemGroup(); + + public ExcelItemGroup getExcelItemGroup( int id ); + + public Collection getExcelItemGroupsByOrganisationUnit( OrganisationUnit organisationUnit ); + + // ---------------------------------------------------------------------------- + // Excelitem services + // ---------------------------------------------------------------------------- + + public int addExcelItem( ExcelItem excelItem ); + + public void updateExcelItem( ExcelItem excelItem ); + + public void deleteExcelItem( int id ); + + public Collection getAllExcelItem(); + + public ExcelItem getExcelItem( int id ); + + // -------------------------------------- + // DataElement Order + // -------------------------------------- + + public DataElementGroupOrder getDataElementGroupOrder( Integer id ); + + public void updateDataElementGroupOrder( DataElementGroupOrder dataElementGroupOrder ); + + public void deleteDataElementGroupOrder( Integer id ); } === modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportObjectService.java' --- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportObjectService.java 2009-11-23 10:37:57 +0000 +++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportObjectService.java 2009-11-23 17:43:36 +0000 @@ -610,7 +610,7 @@ { DataValue dataValue = (DataValue) object; - object = updateDataValue( dataValue, dataValueService.getDataValue( dataValue.getSource(), dataValue.getDataElement(), dataValue.getPeriod() ) ); + dataValue = updateDataValue( dataValue, dataValueService.getDataValue( dataValue.getSource(), dataValue.getDataElement(), dataValue.getPeriod() ) ); } // --------------------------------------------------------------------- === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/DefaultPatientAttributeValueService.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/DefaultPatientAttributeValueService.java 2009-11-19 19:31:31 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/DefaultPatientAttributeValueService.java 2009-11-23 17:43:36 +0000 @@ -33,6 +33,7 @@ import java.util.Set; import java.util.SortedMap; import java.util.TreeMap; +import java.util.Map.Entry; import org.hisp.dhis.patient.Patient; import org.hisp.dhis.patient.PatientAttribute; @@ -137,15 +138,16 @@ Map> patentAttributeValueMap = new HashMap>(); - for ( Integer id : attributeValueMap.keySet() ) + for ( Entry> entry : attributeValueMap.entrySet() ) { SortedMap sortedByAttribute = new TreeMap(); - for ( PatientAttributeValue patientAttributeValue : attributeValueMap.get( id ) ) + + for ( PatientAttributeValue patientAttributeValue : entry.getValue() ) { sortedByAttribute.put( patientAttributeValue.getPatientAttribute().getName(), patientAttributeValue ); } - patentAttributeValueMap.put( id, sortedByAttribute.values() ); + patentAttributeValueMap.put( entry.getKey(), sortedByAttribute.values() ); } === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java' --- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java 2009-11-23 17:06:09 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java 2009-11-23 17:43:36 +0000 @@ -273,15 +273,15 @@ */ private CategoryDataset[] getCategoryDataSet( Chart chart ) { - Collections.sort( chart.getIndicators(), new IndicatorNameComparator() ); - Collections.sort( chart.getPeriods(), new AscendingPeriodComparator() ); - Collections.sort( chart.getOrganisationUnits(), new OrganisationUnitNameComparator() ); - final DefaultCategoryDataset regularDataSet = new DefaultCategoryDataset(); final DefaultCategoryDataset regressionDataSet = new DefaultCategoryDataset(); if ( chart != null ) { + Collections.sort( chart.getIndicators(), new IndicatorNameComparator() ); + Collections.sort( chart.getPeriods(), new AscendingPeriodComparator() ); + Collections.sort( chart.getOrganisationUnits(), new OrganisationUnitNameComparator() ); + Period selectedPeriod = chart.getPeriods().get( 0 ); OrganisationUnit selectedOrganisationUnit = chart.getOrganisationUnits().get( 0 );