=== 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 2013-04-19 12:35:23 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueService.java 2013-05-24 12:59:08 +0000 @@ -33,8 +33,6 @@ import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementCategoryOption; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; -import org.hisp.dhis.datavalue.DataValue; -import org.hisp.dhis.datavalue.DeflatedDataValue; import org.hisp.dhis.indicator.Indicator; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.organisationunit.OrganisationUnitLevel; @@ -320,28 +318,4 @@ */ Collection getAggregatedDataSetCompleteness( Collection dataSetIds, Collection periodIds, Collection organisationUnitIds ); - - // ---------------------------------------------------------------------- - // DataValue - // ---------------------------------------------------------------------- - - /** - * Gets a Collection of DeflatedDataValues. - * - * @param dataElementId the DataElement identifier. - * @param periodId the Period identifier. - * @param sourceIds the Collection of Source identifiers. - */ - Collection getDeflatedDataValues( int dataElementId, int periodId, Collection sourceIds ); - - /** - * Gets a DataValues. Note that this is a "deflated" data value as the objects - * in the composite identifier only has its id property populated. - * - * @param dataElementId the DataElement identifier. - * @param categoryOptionComboId the DataElementCategoryOptionCombo identifier. - * @param periodId the Period identifier. - * @param sourceId the Source identifier. - */ - DataValue getDataValue( int dataElementId, int categoryOptionComboId, int periodId, int sourceId ); } === 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 2013-04-19 12:35:23 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java 2013-05-24 12:59:08 +0000 @@ -32,8 +32,6 @@ import org.hisp.dhis.completeness.DataSetCompletenessResult; import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementCategoryOption; -import org.hisp.dhis.datavalue.DataValue; -import org.hisp.dhis.datavalue.DeflatedDataValue; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.organisationunit.OrganisationUnitLevel; import org.hisp.dhis.period.Period; @@ -298,28 +296,4 @@ */ Collection getAggregatedDataSetCompleteness( Collection dataSetIds, Collection periodIds, Collection organisationUnitIds ); - - // ---------------------------------------------------------------------- - // DataValue - // ---------------------------------------------------------------------- - - /** - * Gets a Collection of DeflatedDataValues. - * - * @param dataElementId the DataElement identifier. - * @param periodId the Period identifier. - * @param sourceIds the Collection of Source identifiers. - */ - Collection getDeflatedDataValues( int dataElementId, int periodId, Collection sourceIds ); - - /** - * Gets a DataValues. Note that this is a "deflated" data value as the objects - * in the composite identifier only has its id property populated. - * - * @param dataElementId the DataElement identifier. - * @param categoryOptionComboId the DataElementCategoryOptionCombo identifier. - * @param periodId the Period identifier. - * @param sourceId the Source identifier. - */ - DataValue getDataValue( int dataElementId, int categoryOptionComboId, int periodId, int sourceId ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueService.java 2012-07-25 14:44:02 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueService.java 2013-05-24 12:59:08 +0000 @@ -108,6 +108,11 @@ */ DataValue getDataValue( OrganisationUnit source, DataElement dataElement, Period period, DataElementCategoryOptionCombo optionCombo ); + /** + * Returns a non-persisted data value. + */ + DataValue getDataValue( int dataElementId, int categoryOptionComboId, int periodId, int sourceId ); + // ------------------------------------------------------------------------- // Collections of DataValues // ------------------------------------------------------------------------- @@ -252,4 +257,13 @@ int getDataValueCount( int days ); Map getDataValueMap( Collection dataElements, Period period, OrganisationUnit unit ); + + /** + * Gets a Collection of DeflatedDataValues. + * + * @param dataElementId the DataElement identifier. + * @param periodId the Period identifier. + * @param sourceIds the Collection of Source identifiers. + */ + Collection getDeflatedDataValues( int dataElementId, int periodId, Collection sourceIds ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueStore.java 2012-07-25 14:44:02 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueStore.java 2013-05-24 12:59:08 +0000 @@ -100,6 +100,11 @@ */ DataValue getDataValue( OrganisationUnit source, DataElement dataElement, Period period, DataElementCategoryOptionCombo optionCombo ); + /** + * Returns a non-persisted DataValue. + */ + DataValue getDataValue( int dataElementId, int categoryOptionComboId, int periodId, int sourceId ); + // ------------------------------------------------------------------------- // Collections of DataValues // ------------------------------------------------------------------------- @@ -245,4 +250,13 @@ int getDataValueCount( Date date ); Map getDataValueMap( Collection dataElements, Period period, OrganisationUnit unit ); + + /** + * Gets a Collection of DeflatedDataValues. + * + * @param dataElementId the DataElement identifier. + * @param periodId the Period identifier. + * @param sourceIds the Collection of Source identifiers. + */ + Collection getDeflatedDataValues( int dataElementId, int periodId, Collection sourceIds ); } === 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 2013-04-19 12:35:23 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedDataValueService.java 2013-05-24 12:59:08 +0000 @@ -33,8 +33,6 @@ import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementCategoryOption; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; -import org.hisp.dhis.datavalue.DataValue; -import org.hisp.dhis.datavalue.DeflatedDataValue; import org.hisp.dhis.indicator.Indicator; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.organisationunit.OrganisationUnitLevel; @@ -214,18 +212,4 @@ { return aggregatedDataValueStore.getAggregatedDataSetCompleteness( dataSetIds, periodIds, organisationUnitIds ); } - - // ------------------------------------------------------------------------- - // DataValue - // ------------------------------------------------------------------------- - - public Collection getDeflatedDataValues( int dataElementId, int periodId, Collection sourceIds ) - { - return aggregatedDataValueStore.getDeflatedDataValues( dataElementId, periodId, sourceIds ); - } - - public DataValue getDataValue( int dataElementId, int categoryOptionComboId, int periodId, int sourceId ) - { - return aggregatedDataValueStore.getDataValue( dataElementId, categoryOptionComboId, periodId, sourceId ); - } } === 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 2013-04-19 12:35:23 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java 2013-05-24 12:59:08 +0000 @@ -47,8 +47,6 @@ import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementCategoryOption; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; -import org.hisp.dhis.datavalue.DataValue; -import org.hisp.dhis.datavalue.DeflatedDataValue; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.organisationunit.OrganisationUnitLevel; import org.hisp.dhis.period.Period; @@ -57,8 +55,6 @@ import org.hisp.dhis.system.objectmapper.AggregatedDataValueRowMapper; import org.hisp.dhis.system.objectmapper.AggregatedIndicatorMapValueRowMapper; import org.hisp.dhis.system.objectmapper.AggregatedIndicatorValueRowMapper; -import org.hisp.dhis.system.objectmapper.DataValueRowMapper; -import org.hisp.dhis.system.objectmapper.DeflatedDataValueRowMapper; import org.springframework.jdbc.core.JdbcTemplate; /** @@ -432,7 +428,7 @@ " AND ous.idlevel" + rootlevel + "=" + rootOrgunit.getId() + " AND aiv.periodid IN (" + periodids + ") "; - return jdbcTemplate.queryForInt( sql ); + return jdbcTemplate.queryForObject( sql, Integer.class ); } // ------------------------------------------------------------------------- @@ -468,31 +464,4 @@ return jdbcTemplate.query( sql, new AggregatedDataSetCompletenessRowMapper() ); } - - // ------------------------------------------------------------------------- - // DataValue - // ------------------------------------------------------------------------- - - public Collection getDeflatedDataValues( int dataElementId, int periodId, Collection sourceIds ) - { - final String sql = - "SELECT * FROM datavalue " + - "WHERE dataelementid = " + dataElementId + " " + - "AND periodid = " + periodId + " " + - "AND sourceid IN ( " + getCommaDelimitedString( sourceIds ) + " )"; - - return jdbcTemplate.query( sql, new DeflatedDataValueRowMapper() ); - } - - public DataValue getDataValue( int dataElementId, int categoryOptionComboId, int periodId, int sourceId ) //TODO remove - { - final String sql = - "SELECT * FROM datavalue " + - "WHERE dataelementid = " + dataElementId + " " + - "AND categoryoptioncomboid = " + categoryOptionComboId + " " + - "AND periodid = " + periodId + " " + - "AND sourceid = " + sourceId; - - return jdbcTemplate.queryForObject( sql, new DataValueRowMapper() ); - } } === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueService.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueService.java 2013-04-19 15:58:28 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueService.java 2013-05-24 12:59:08 +0000 @@ -43,8 +43,6 @@ /** * @author Kristian Nordal - * @version $Id: DefaultDataValueService.java 5715 2008-09-17 14:05:28Z larshelg - * $ */ @Transactional public class DefaultDataValueService @@ -108,7 +106,12 @@ { return dataValueStore.getDataValue( source, dataElement, period, optionCombo ); } - + + public DataValue getDataValue( int dataElementId, int categoryOptionComboId, int periodId, int sourceId ) + { + return dataValueStore.getDataValue( dataElementId, categoryOptionComboId, periodId, sourceId ); + } + // ------------------------------------------------------------------------- // Collections of DataValues // ------------------------------------------------------------------------- @@ -190,4 +193,9 @@ { return dataValueStore.getDataValueMap( dataElements, period, unit ); } + + public Collection getDeflatedDataValues( int dataElementId, int periodId, Collection sourceIds ) + { + return dataValueStore.getDeflatedDataValues( dataElementId, periodId, sourceIds ); + } } === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueStore.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueStore.java 2013-01-05 15:22:55 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueStore.java 2013-05-24 12:59:08 +0000 @@ -27,6 +27,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import static org.hisp.dhis.system.util.TextUtils.getCommaDelimitedString; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -46,10 +48,13 @@ import org.hisp.dhis.dataelement.DataElementOperand; import org.hisp.dhis.datavalue.DataValue; import org.hisp.dhis.datavalue.DataValueStore; +import org.hisp.dhis.datavalue.DeflatedDataValue; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.period.Period; import org.hisp.dhis.period.PeriodStore; import org.hisp.dhis.period.PeriodType; +import org.hisp.dhis.system.objectmapper.DataValueRowMapper; +import org.hisp.dhis.system.objectmapper.DeflatedDataValueRowMapper; import org.hisp.dhis.system.util.ConversionUtils; import org.hisp.dhis.system.util.MathUtils; import org.hisp.dhis.system.util.TextUtils; @@ -156,7 +161,19 @@ return (DataValue) criteria.uniqueResult(); } - + + public DataValue getDataValue( int dataElementId, int categoryOptionComboId, int periodId, int sourceId ) + { + final String sql = + "SELECT * FROM datavalue " + + "WHERE dataelementid = " + dataElementId + " " + + "AND categoryoptioncomboid = " + categoryOptionComboId + " " + + "AND periodid = " + periodId + " " + + "AND sourceid = " + sourceId; + + return jdbcTemplate.queryForObject( sql, new DataValueRowMapper() ); + } + // ------------------------------------------------------------------------- // Collections of DataValues // ------------------------------------------------------------------------- @@ -439,4 +456,15 @@ return map; } + + public Collection getDeflatedDataValues( int dataElementId, int periodId, Collection sourceIds ) + { + final String sql = + "SELECT * FROM datavalue " + + "WHERE dataelementid = " + dataElementId + " " + + "AND periodid = " + periodId + " " + + "AND sourceid IN ( " + getCommaDelimitedString( sourceIds ) + " )"; + + return jdbcTemplate.query( sql, new DeflatedDataValueRowMapper() ); + } } === modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/importer/DefaultDhis14FileImportService.java' --- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/importer/DefaultDhis14FileImportService.java 2011-12-26 10:07:59 +0000 +++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/importer/DefaultDhis14FileImportService.java 2013-05-24 12:59:08 +0000 @@ -36,7 +36,6 @@ import org.amplecode.quick.BatchHandlerFactory; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.hisp.dhis.aggregation.AggregatedDataValueService; import org.hisp.dhis.cache.HibernateCacheManager; import org.hisp.dhis.common.ProcessState; import org.hisp.dhis.dataelement.DataElement; @@ -48,6 +47,7 @@ import org.hisp.dhis.dataset.DataSet; import org.hisp.dhis.dataset.DataSetService; import org.hisp.dhis.datavalue.DataValue; +import org.hisp.dhis.datavalue.DataValueService; import org.hisp.dhis.expression.ExpressionService; import org.hisp.dhis.importexport.GroupMemberAssociation; import org.hisp.dhis.importexport.ImportDataValue; @@ -210,11 +210,11 @@ this.indicatorService = indicatorService; } - private AggregatedDataValueService aggregatedDataValueService; - - public void setAggregatedDataValueService( AggregatedDataValueService aggregatedDataValueService ) + private DataValueService dataValueService; + + public void setDataValueService( DataValueService dataValueService ) { - this.aggregatedDataValueService = aggregatedDataValueService; + this.dataValueService = dataValueService; } private HibernateCacheManager cacheManager; @@ -670,7 +670,7 @@ RowHandler rowHandler = new RoutineDataValueRowHandler( batchHandler, importDataValueBatchHandler, - aggregatedDataValueService, + dataValueService, objectMappingGenerator.getDataElementMapping( params.skipMapping() ), objectMappingGenerator.getPeriodMapping( params.skipMapping() ), objectMappingGenerator.getOrganisationUnitMapping( params.skipMapping() ), @@ -731,7 +731,7 @@ RowHandler rowHandler = new SemiPermanentDataValueRowHandler( batchHandler, importDataValueBatchHandler, - aggregatedDataValueService, + dataValueService, objectMappingGenerator.getDataElementMapping( params.skipMapping() ), objectMappingGenerator.getPeriodObjectMapping( params.skipMapping() ), objectMappingGenerator.getOrganisationUnitMapping( params.skipMapping() ), === 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 2011-12-26 10:07:59 +0000 +++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/RoutineDataValueRowHandler.java 2013-05-24 12:59:08 +0000 @@ -30,10 +30,10 @@ import java.util.Map; import org.amplecode.quick.BatchHandler; -import org.hisp.dhis.aggregation.AggregatedDataValueService; import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; import org.hisp.dhis.datavalue.DataValue; +import org.hisp.dhis.datavalue.DataValueService; import org.hisp.dhis.importexport.ImportDataValue; import org.hisp.dhis.importexport.ImportParams; import org.hisp.dhis.importexport.dhis14.object.Dhis14RoutineDataValue; @@ -73,7 +73,7 @@ public RoutineDataValueRowHandler( BatchHandler batchHandler, BatchHandler importDataValueBatchHandler, - AggregatedDataValueService aggregatedDataValueService, + DataValueService dataValueService, Map dataElementMapping, Map periodMapping, Map organisationUnitMapping, @@ -82,7 +82,7 @@ { this.batchHandler = batchHandler; this.importDataValueBatchHandler = importDataValueBatchHandler; - this.aggregatedDataValueService = aggregatedDataValueService; + this.dataValueService = dataValueService; this.dataElementMapping = dataElementMapping; this.periodMapping = periodMapping; this.organisationUnitMapping = organisationUnitMapping; === 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 2011-12-26 10:07:59 +0000 +++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/SemiPermanentDataValueRowHandler.java 2013-05-24 12:59:08 +0000 @@ -30,10 +30,10 @@ import java.util.Map; import org.amplecode.quick.BatchHandler; -import org.hisp.dhis.aggregation.AggregatedDataValueService; import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; import org.hisp.dhis.datavalue.DataValue; +import org.hisp.dhis.datavalue.DataValueService; import org.hisp.dhis.importexport.ImportDataValue; import org.hisp.dhis.importexport.ImportParams; import org.hisp.dhis.importexport.dhis14.object.Dhis14SemiPermanentDataValue; @@ -71,7 +71,7 @@ public SemiPermanentDataValueRowHandler( BatchHandler batchHandler, BatchHandler importDataValueBatchHandler, - AggregatedDataValueService aggregatedDataValueService, + DataValueService dataValueService, Map dataElementMapping, Map periodMapping, Map organisationUnitMapping, @@ -80,7 +80,7 @@ { this.batchHandler = batchHandler; this.importDataValueBatchHandler = importDataValueBatchHandler; - this.aggregatedDataValueService = aggregatedDataValueService; + this.dataValueService = dataValueService; this.dataElementMapping = dataElementMapping; this.periodMapping = periodMapping; this.organisationUnitMapping = organisationUnitMapping; === modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataValueConverter.java' --- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataValueConverter.java 2013-04-15 15:49:53 +0000 +++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataValueConverter.java 2013-05-24 12:59:08 +0000 @@ -41,12 +41,12 @@ import java.util.zip.ZipOutputStream; import org.amplecode.quick.BatchHandler; -import org.hisp.dhis.aggregation.AggregatedDataValueService; import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; import org.hisp.dhis.dataelement.DataElementCategoryService; import org.hisp.dhis.dataelement.DataElementService; import org.hisp.dhis.datavalue.DataValue; +import org.hisp.dhis.datavalue.DataValueService; import org.hisp.dhis.datavalue.DeflatedDataValue; import org.hisp.dhis.importexport.CSVConverter; import org.hisp.dhis.importexport.ExportParams; @@ -95,11 +95,11 @@ // Constructor // ------------------------------------------------------------------------- - public DataValueConverter( PeriodService periodService, AggregatedDataValueService aggregatedDataValueService, + public DataValueConverter( PeriodService periodService, DataValueService dataValueService, DataElementService dataElementService ) { this.periodService = periodService; - this.aggregatedDataValueService = aggregatedDataValueService; + this.dataValueService = dataValueService; this.dataElementService = dataElementService; } @@ -162,7 +162,7 @@ { for ( final Period period : periods ) { - values = aggregatedDataValueService.getDeflatedDataValues( element, period.getId(), + values = dataValueService.getDeflatedDataValues( element, period.getId(), params.getOrganisationUnits() ); for ( final DeflatedDataValue value : values ) === modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/exporter/DefaultDhis14XMLExportService.java' --- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/exporter/DefaultDhis14XMLExportService.java 2013-04-15 15:49:53 +0000 +++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/exporter/DefaultDhis14XMLExportService.java 2013-05-24 12:59:08 +0000 @@ -33,6 +33,7 @@ import org.hibernate.SessionFactory; import org.hisp.dhis.aggregation.AggregatedDataValueService; import org.hisp.dhis.dataelement.DataElementService; +import org.hisp.dhis.datavalue.DataValueService; import org.hisp.dhis.importexport.ExportParams; import org.hisp.dhis.importexport.ExportPipeThread; import org.hisp.dhis.importexport.ExportService; @@ -92,11 +93,11 @@ this.periodService = periodService; } - private AggregatedDataValueService aggregatedDataValueService; + private DataValueService dataValueService; - public void setAggregatedDataValueService( AggregatedDataValueService aggregatedDataValueService ) + public void setDataValueService( DataValueService dataValueService ) { - this.aggregatedDataValueService = aggregatedDataValueService; + this.dataValueService = dataValueService; } private OrganisationUnitService organisationUnitService; @@ -166,7 +167,7 @@ thread.registerXMLConverter( new UserConverter() ); thread.registerXMLConverter( new UserRoleConverter() ); - thread.registerCSVConverter( new DataValueConverter( periodService, aggregatedDataValueService, dataElementService ) ); + thread.registerCSVConverter( new DataValueConverter( periodService, dataValueService, dataElementService ) ); thread.start(); === modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/importer/DataValueImporter.java' --- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/importer/DataValueImporter.java 2011-12-26 10:07:59 +0000 +++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/importer/DataValueImporter.java 2013-05-24 12:59:08 +0000 @@ -28,8 +28,8 @@ */ import org.amplecode.quick.BatchHandler; -import org.hisp.dhis.aggregation.AggregatedDataValueService; import org.hisp.dhis.datavalue.DataValue; +import org.hisp.dhis.datavalue.DataValueService; import org.hisp.dhis.importexport.GroupMemberType; import org.hisp.dhis.importexport.ImportParams; import org.hisp.dhis.importexport.Importer; @@ -41,7 +41,7 @@ public class DataValueImporter extends AbstractImporter implements Importer { - protected AggregatedDataValueService aggregatedDataValueService; + protected DataValueService dataValueService; protected ImportParams params; @@ -49,10 +49,10 @@ { } - public DataValueImporter( BatchHandler batchHandler, AggregatedDataValueService aggregatedDataValueService, ImportParams params ) + public DataValueImporter( BatchHandler batchHandler, DataValueService dataValueService, ImportParams params ) { this.batchHandler = batchHandler; - this.aggregatedDataValueService = aggregatedDataValueService; + this.dataValueService = dataValueService; this.params = params; } @@ -92,7 +92,7 @@ return null; } - return aggregatedDataValueService.getDataValue( object.getDataElement().getId(), object.getOptionCombo().getId(), + return dataValueService.getDataValue( object.getDataElement().getId(), object.getOptionCombo().getId(), object.getPeriod().getId(), object.getSource().getId() ); } === modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportObjectManager.java' --- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportObjectManager.java 2013-01-04 18:10:25 +0000 +++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportObjectManager.java 2013-05-24 12:59:08 +0000 @@ -36,7 +36,6 @@ import org.amplecode.quick.BatchHandlerFactory; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.hisp.dhis.aggregation.AggregatedDataValueService; import org.hisp.dhis.chart.Chart; import org.hisp.dhis.chart.ChartService; import org.hisp.dhis.constant.Constant; @@ -56,6 +55,7 @@ import org.hisp.dhis.dataset.DataSet; import org.hisp.dhis.dataset.DataSetService; import org.hisp.dhis.datavalue.DataValue; +import org.hisp.dhis.datavalue.DataValueService; import org.hisp.dhis.expression.ExpressionService; import org.hisp.dhis.importexport.GroupMemberAssociation; import org.hisp.dhis.importexport.GroupMemberType; @@ -290,11 +290,11 @@ this.periodService = periodService; } - private AggregatedDataValueService aggregatedDataValueService; + private DataValueService dataValueService; - public void setAggregatedDataValueService( AggregatedDataValueService aggregatedDataValueService ) + public void setDataValueService( DataValueService dataValueService ) { - this.aggregatedDataValueService = aggregatedDataValueService; + this.dataValueService = dataValueService; } // ------------------------------------------------------------------------- @@ -1055,7 +1055,7 @@ Collection importValues = importDataValueService.getImportDataValues( ImportObjectStatus.NEW ); - Importer importer = new DataValueImporter( batchHandler, aggregatedDataValueService, params ); + Importer importer = new DataValueImporter( batchHandler, dataValueService, params ); for ( ImportDataValue importValue : importValues ) { === modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml 2013-04-15 15:49:53 +0000 +++ dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml 2013-05-24 12:59:08 +0000 @@ -65,7 +65,7 @@ - + @@ -144,7 +144,7 @@ - + @@ -263,7 +263,7 @@ - + === removed file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedValuesAction.java' --- dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedValuesAction.java 2012-04-11 11:05:59 +0000 +++ dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedValuesAction.java 1970-01-01 00:00:00 +0000 @@ -1,232 +0,0 @@ -package org.hisp.dhis.visualizer.action; - -/* - * Copyright (c) 2004-2012, University of Oslo - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of the HISP project nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -import java.util.Collection; -import java.util.HashSet; - -import org.apache.struts2.ServletActionContext; -import org.hisp.dhis.aggregation.AggregatedDataValue; -import org.hisp.dhis.aggregation.AggregatedDataValueService; -import org.hisp.dhis.aggregation.AggregatedIndicatorValue; -import org.hisp.dhis.aggregation.AggregatedOrgUnitDataValueService; -import org.hisp.dhis.api.utils.ContextUtils; -import org.hisp.dhis.api.utils.ContextUtils.CacheStrategy; -import org.hisp.dhis.completeness.DataSetCompletenessResult; -import org.hisp.dhis.organisationunit.OrganisationUnitGroup; -import org.hisp.dhis.organisationunit.OrganisationUnitGroupService; -import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet; -import org.hisp.dhis.system.util.ConversionUtils; -import org.springframework.beans.factory.annotation.Autowired; - -import com.opensymphony.xwork2.Action; - -import static org.hisp.dhis.api.utils.ContextUtils.CONTENT_TYPE_JSON; - -/** - * @author Jan Henrik Overland - */ -public class GetAggregatedValuesAction - implements Action -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private AggregatedDataValueService aggregatedDataValueService; - - public void setAggregatedDataValueService( AggregatedDataValueService aggregatedDataValueService ) - { - this.aggregatedDataValueService = aggregatedDataValueService; - } - - private AggregatedOrgUnitDataValueService aggregatedOrgUnitDataValueService; - - public void setAggregatedOrgUnitDataValueService( - AggregatedOrgUnitDataValueService aggregatedOrgUnitDataValueService ) - { - this.aggregatedOrgUnitDataValueService = aggregatedOrgUnitDataValueService; - } - - private OrganisationUnitGroupService organisationUnitGroupService; - - public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService ) - { - this.organisationUnitGroupService = organisationUnitGroupService; - } - - @Autowired - private ContextUtils contextUtils; - - // ------------------------------------------------------------------------- - // Input - // ------------------------------------------------------------------------- - - private Collection indicatorIds; - - public void setIndicatorIds( Collection indicatorIds ) - { - this.indicatorIds = indicatorIds; - } - - private Collection dataElementIds; - - public void setDataElementIds( Collection dataElementIds ) - { - this.dataElementIds = dataElementIds; - } - - private Collection dataSetIds; - - public void setDataSetIds( Collection dataSetIds ) - { - this.dataSetIds = dataSetIds; - } - - private Collection periodIds; - - public void setPeriodIds( Collection periodIds ) - { - this.periodIds = periodIds; - } - - private Collection organisationUnitIds; - - public void setOrganisationUnitIds( Collection organisationUnitIds ) - { - this.organisationUnitIds = organisationUnitIds; - } - - private Integer organisationUnitGroupSetId; - - public void setOrganisationUnitGroupSetId( Integer organisationUnitGroupSetId ) - { - this.organisationUnitGroupSetId = organisationUnitGroupSetId; - } - - // ------------------------------------------------------------------------- - // Output - // ------------------------------------------------------------------------- - - private Collection indicatorValues = new HashSet(); - - public Collection getIndicatorValues() - { - return indicatorValues; - } - - private Collection dataElementValues = new HashSet(); - - public Collection getDataElementValues() - { - return dataElementValues; - } - - private Collection dataSetValues = new HashSet(); - - public Collection getDataSetValues() - { - return dataSetValues; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - public String execute() - throws Exception - { - // --------------------------------------------------------------------- - // Org unit group set data - // --------------------------------------------------------------------- - - if ( organisationUnitGroupSetId != null && periodIds != null && organisationUnitIds != null - && organisationUnitIds.size() > 0 ) - { - Integer organisationUnitId = organisationUnitIds.iterator().next(); - - OrganisationUnitGroupSet groupSet = organisationUnitGroupService - .getOrganisationUnitGroupSet( organisationUnitGroupSetId ); - - if ( organisationUnitId == null || groupSet == null ) - { - return SUCCESS; - } - - Collection groupIds = ConversionUtils.getIdentifiers( OrganisationUnitGroup.class, - groupSet.getOrganisationUnitGroups() ); - - if ( indicatorIds != null ) - { - indicatorValues = aggregatedOrgUnitDataValueService.getAggregatedIndicatorValues( indicatorIds, - periodIds, organisationUnitId, groupIds ); - } - - if ( dataElementIds != null ) - { - dataElementValues = aggregatedOrgUnitDataValueService.getAggregatedDataValueTotals( dataElementIds, - periodIds, organisationUnitId, groupIds ); - } - - if ( dataSetIds != null ) - { - // FIXME will be implemented soon - } - } - - // --------------------------------------------------------------------- - // Regular data - // --------------------------------------------------------------------- - - else if ( periodIds != null && organisationUnitIds != null ) - { - if ( indicatorIds != null ) - { - indicatorValues = aggregatedDataValueService.getAggregatedIndicatorValues( indicatorIds, periodIds, - organisationUnitIds ); - } - - if ( dataElementIds != null ) - { - dataElementValues = aggregatedDataValueService.getAggregatedDataValueTotals( dataElementIds, periodIds, - organisationUnitIds ); - } - - if ( dataSetIds != null ) - { - dataSetValues = aggregatedDataValueService.getAggregatedDataSetCompleteness( dataSetIds, periodIds, - organisationUnitIds ); - } - } - - contextUtils.configureResponse( ServletActionContext.getResponse(), CONTENT_TYPE_JSON, - CacheStrategy.RESPECT_SYSTEM_SETTING, null, false ); - - return SUCCESS; - } -} === modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/META-INF/dhis/beans.xml 2013-05-21 11:39:31 +0000 +++ dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/META-INF/dhis/beans.xml 2013-05-24 12:59:08 +0000 @@ -48,19 +48,6 @@ ref="org.hisp.dhis.organisationunit.OrganisationUnitService" /> - - - - - - - - - - - - - /dhis-web-visualizer/jsonminAggregatedValues.vm - - - /dhis-web-visualizer/void.vm - - -