=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueService.java 2010-08-31 05:47:11 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueService.java 2010-08-31 07:06:55 +0000 @@ -107,7 +107,7 @@ * @param organisationUnit The OrganisationUnit. * @return the aggregated value, or -1 if no value exists. */ - Double getAggregatedValue( Indicator indicator, Period period, OrganisationUnit unit ); + Double getAggregatedValue( Indicator indicator, Period period, OrganisationUnit organisationUnit ); /** * Gets a collection of AggregatedIndicatorValues. === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java 2010-08-31 05:47:11 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java 2010-08-31 07:06:55 +0000 @@ -4,12 +4,10 @@ import java.util.Map; import org.hisp.dhis.dataelement.DataElement; -import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; import org.hisp.dhis.dataelement.DataElementOperand; import org.hisp.dhis.datavalue.DataValue; import org.hisp.dhis.datavalue.DeflatedDataValue; import org.hisp.dhis.dimension.DimensionOption; -import org.hisp.dhis.indicator.Indicator; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.period.Period; @@ -24,13 +22,24 @@ /** * Gets the total aggregated value from the datamart table for the given parameters. * + * @param dataElement The DataElement identifier. + * @param period The Period identifier. + * @param organisationUnit The OrganisationUnit identifier. + * @return the aggregated value. + */ + Double getAggregatedDataValue( int dataElement, int period, int organisationUnit ); + + /** + * Gets the aggregated value from the datamart table for the given parameters. + * * @param dataElement The DataElement. + * @param categoryOptionCombo The DataElementCategoryOptionCombo. * @param period The Period. * @param organisationUnit The OrganisationUnit. - * @return the aggregated value. + * @return the aggregated value, or -1 if no value exists. */ - Double getAggregatedValue( DataElement dataElement, Period period, OrganisationUnit organisationUnit ); - + Double getAggregatedDataValue( int dataElement, int categoryOptionCombo, int period, int organisationUnit ); + /** * Gets the total aggregated value from the datamart table for the given parameters. * @@ -40,18 +49,7 @@ * @param organisationUnit The OrganisationUnit. * @return the aggregated value. */ - Double getAggregatedValue( DataElement dataElement, DimensionOption dimensionOption, Period period, OrganisationUnit organisationUnit ); - - /** - * Gets the aggregated value from the datamart table for the given parameters. - * - * @param dataElement The DataElement. - * @param categoryOptionCombo The DataElementCategoryOptionCombo. - * @param period The Period. - * @param organisationUnit The OrganisationUnit. - * @return the aggregated value, or -1 if no value exists. - */ - Double getAggregatedValue( DataElement dataElement, DataElementCategoryOptionCombo categoryOptionCombo, Period period, OrganisationUnit organisationUnit ); + Double getAggregatedDataValue( DataElement dataElement, DimensionOption dimensionOption, Period period, OrganisationUnit organisationUnit ); /** * Gets a collection of AggregatedDataValues. @@ -102,12 +100,12 @@ /** * Gets the aggregated value from the datamart table for the given parameters. * - * @param indicator The Indicator. - * @param period The Period. - * @param organisationUnit The OrganisationUnit. + * @param indicator The Indicator identifier. + * @param period The Period identifier. + * @param organisationUnit The OrganisationUnit identifier. * @return the aggregated value, or -1 if no value exists. */ - Double getAggregatedValue( Indicator indicator, Period period, OrganisationUnit unit ); + Double getAggregatedIndicatorValue( int indicator, int period, int organisationUnit ); /** * Gets a collection of AggregatedIndicatorValues. === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedDataValueService.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedDataValueService.java 2010-08-31 05:47:11 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedDataValueService.java 2010-08-31 07:06:55 +0000 @@ -32,19 +32,29 @@ // AggregatedDataValue // ------------------------------------------------------------------------- + public Double getAggregatedDataValue( int dataElement, int period, int organisationUnit ) + { + return aggregatedDataValueStore.getAggregatedDataValue( dataElement, period, organisationUnit ); + } + public Double getAggregatedValue( DataElement dataElement, Period period, OrganisationUnit organisationUnit ) { - return aggregatedDataValueStore.getAggregatedValue( dataElement, period, organisationUnit ); - } - + return aggregatedDataValueStore.getAggregatedDataValue( dataElement.getId(), period.getId(), organisationUnit.getId() ); + } + + public Double getAggregatedDataValue( int dataElement, int categoryOptionCombo, int period, int organisationUnit ) + { + return aggregatedDataValueStore.getAggregatedDataValue( dataElement, categoryOptionCombo, period, organisationUnit ); + } + + public Double getAggregatedValue( DataElement dataElement, DataElementCategoryOptionCombo categoryOptionCombo, Period period, OrganisationUnit organisationUnit ) + { + return aggregatedDataValueStore.getAggregatedDataValue( dataElement.getId(), categoryOptionCombo.getId(), period.getId(), organisationUnit.getId() ); + } + public Double getAggregatedValue( DataElement dataElement, DimensionOption dimensionOption, Period period, OrganisationUnit organisationUnit ) { - return aggregatedDataValueStore.getAggregatedValue( dataElement, dimensionOption, period, organisationUnit ); - } - - public Double getAggregatedValue( DataElement dataElement, DataElementCategoryOptionCombo categoryOptionCombo, Period period, OrganisationUnit organisationUnit ) - { - return aggregatedDataValueStore.getAggregatedValue( dataElement, categoryOptionCombo, period, organisationUnit ); + return aggregatedDataValueStore.getAggregatedDataValue( dataElement, dimensionOption, period, organisationUnit ); } public Collection getAggregatedDataValues( int dataElementId, Collection periodIds, Collection organisationUnitIds ) @@ -75,9 +85,14 @@ // AggregatedIndicatorValue // ------------------------------------------------------------------------- - public Double getAggregatedValue( Indicator indicator, Period period, OrganisationUnit unit ) - { - return aggregatedDataValueStore.getAggregatedValue( indicator, period, unit ); + public Double getAggregatedIndicatorValue( int indicator, int period, int organisationUnit ) + { + return aggregatedDataValueStore.getAggregatedIndicatorValue( indicator, period, organisationUnit ); + } + + public Double getAggregatedValue( Indicator indicator, Period period, OrganisationUnit organisationUnit ) + { + return aggregatedDataValueStore.getAggregatedIndicatorValue( indicator.getId(), period.getId(), organisationUnit.getId() ); } public Collection getAggregatedIndicatorValues( Collection periodIds, Collection organisationUnitIds ) === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java 2010-08-31 05:47:11 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java 2010-08-31 07:06:55 +0000 @@ -23,7 +23,6 @@ import org.hisp.dhis.datavalue.DeflatedDataValue; import org.hisp.dhis.dimension.DimensionOption; import org.hisp.dhis.dimension.DimensionType; -import org.hisp.dhis.indicator.Indicator; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.period.Period; import org.hisp.dhis.system.objectmapper.AggregatedDataMapValueRowMapper; @@ -48,19 +47,32 @@ // AggregatedDataValue // ------------------------------------------------------------------------- - public Double getAggregatedValue( DataElement dataElement, Period period, OrganisationUnit organisationUnit ) + public Double getAggregatedDataValue( int dataElement, int period, int organisationUnit ) { final String sql = "SELECT SUM(value) " + "FROM aggregateddatavalue " + - "WHERE dataelementid = " + dataElement.getId() + " " + - "AND periodid = " + period.getId() + " " + - "AND organisationunitid = " + organisationUnit.getId(); - - return statementManager.getHolder().queryForDouble( sql ); - } - - public Double getAggregatedValue( DataElement dataElement, DimensionOption dimensionOption, Period period, OrganisationUnit organisationUnit ) + "WHERE dataelementid = " + dataElement + " " + + "AND periodid = " + period + " " + + "AND organisationunitid = " + organisationUnit; + + return statementManager.getHolder().queryForDouble( sql ); + } + + public Double getAggregatedDataValue( int dataElement, int categoryOptionCombo, int period, int organisationUnit ) + { + final String sql = + "SELECT value " + + "FROM aggregateddatavalue " + + "WHERE dataelementid = " + dataElement + " " + + "AND categoryoptioncomboid = " + categoryOptionCombo + " " + + "AND periodid = " + period + " " + + "AND organisationunitid = " + organisationUnit; + + return statementManager.getHolder().queryForDouble( sql ); + } + + public Double getAggregatedDataValue( DataElement dataElement, DimensionOption dimensionOption, Period period, OrganisationUnit organisationUnit ) { if ( dimensionOption.getDimensionType().equals( DimensionType.CATEGORY ) ) { @@ -80,20 +92,6 @@ throw new IllegalArgumentException(); } - public Double getAggregatedValue( DataElement dataElement, - DataElementCategoryOptionCombo categoryOptionCombo, Period period, OrganisationUnit organisationUnit ) - { - final String sql = - "SELECT value " + - "FROM aggregateddatavalue " + - "WHERE dataelementid = " + dataElement.getId() + " " + - "AND categoryoptioncomboid = " + categoryOptionCombo.getId() + " " + - "AND periodid = " + period.getId() + " " + - "AND organisationunitid = " + organisationUnit.getId(); - - return statementManager.getHolder().queryForDouble( sql ); - } - public Collection getAggregatedDataValues( int dataElementId, Collection periodIds, Collection organisationUnitIds ) { @@ -178,14 +176,14 @@ // AggregatedIndicatorValue // ------------------------------------------------------------------------- - public Double getAggregatedValue( Indicator indicator, Period period, OrganisationUnit organisationUnit ) + public Double getAggregatedIndicatorValue( int indicator, int period, int organisationUnit ) { final String sql = "SELECT value " + "FROM aggregatedindicatorvalue " + - "WHERE indicatorid = " + indicator.getId() + " " + - "AND periodid = " + period.getId() + " " + - "AND organisationunitid = " + organisationUnit.getId(); + "WHERE indicatorid = " + indicator + " " + + "AND periodid = " + period + " " + + "AND organisationunitid = " + organisationUnit; return statementManager.getHolder().queryForDouble( sql ); } === modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/RoutineDataValueRowHandler.java' --- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/RoutineDataValueRowHandler.java 2010-08-31 05:47:11 +0000 +++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/RoutineDataValueRowHandler.java 2010-08-31 07:06:55 +0000 @@ -33,7 +33,6 @@ import org.hisp.dhis.aggregation.AggregatedDataValueService; import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; -import org.hisp.dhis.datamart.DataMartService; import org.hisp.dhis.datavalue.DataValue; import org.hisp.dhis.importexport.ImportDataValue; import org.hisp.dhis.importexport.ImportParams; === modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/SemiPermanentDataValueRowHandler.java' --- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/SemiPermanentDataValueRowHandler.java 2010-08-31 05:47:11 +0000 +++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/SemiPermanentDataValueRowHandler.java 2010-08-31 07:06:55 +0000 @@ -33,7 +33,6 @@ import org.hisp.dhis.aggregation.AggregatedDataValueService; import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; -import org.hisp.dhis.datamart.DataMartService; import org.hisp.dhis.datavalue.DataValue; import org.hisp.dhis.importexport.ImportDataValue; import org.hisp.dhis.importexport.ImportParams;