=== modified file 'dhis-2/dhis-api/pom.xml' --- dhis-2/dhis-api/pom.xml 2013-04-15 15:32:38 +0000 +++ dhis-2/dhis-api/pom.xml 2013-04-15 15:49:53 +0000 @@ -34,7 +34,8 @@ net.sf.jasperreports jasperreports - + + com.fasterxml.jackson.core jackson-core === 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-15 15:32:38 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueService.java 2013-04-15 15:49:53 +0000 @@ -33,6 +33,7 @@ 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; @@ -332,4 +333,15 @@ * @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-15 15:32:38 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java 2013-04-15 15:49:53 +0000 @@ -32,6 +32,7 @@ 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; @@ -310,4 +311,15 @@ * @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-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-15 15:32:38 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedDataValueService.java 2013-04-15 15:49:53 +0000 @@ -33,6 +33,7 @@ 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; @@ -222,4 +223,9 @@ { 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-15 15:32:38 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java 2013-04-15 15:49:53 +0000 @@ -483,4 +483,16 @@ 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-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 2012-06-27 20:01:50 +0000 +++ 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 @@ -41,14 +41,11 @@ import java.util.zip.ZipOutputStream; import org.amplecode.quick.BatchHandler; -import org.amplecode.quick.StatementManager; import org.hisp.dhis.aggregation.AggregatedDataValueService; import org.hisp.dhis.dataelement.DataElement; -import org.hisp.dhis.dataelement.DataElementService; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; import org.hisp.dhis.dataelement.DataElementCategoryService; -import org.hisp.dhis.period.Period; -import org.hisp.dhis.period.PeriodService; +import org.hisp.dhis.dataelement.DataElementService; import org.hisp.dhis.datavalue.DataValue; import org.hisp.dhis.datavalue.DeflatedDataValue; import org.hisp.dhis.importexport.CSVConverter; @@ -57,10 +54,11 @@ import org.hisp.dhis.importexport.ImportObjectService; import org.hisp.dhis.importexport.ImportParams; import org.hisp.dhis.importexport.analysis.ImportAnalyser; +import org.hisp.dhis.importexport.dhis14.util.Dhis14TypeHandler; import org.hisp.dhis.importexport.importer.DataValueImporter; import org.hisp.dhis.organisationunit.OrganisationUnit; -import org.hisp.dhis.importexport.dhis14.util.Dhis14TypeHandler; - +import org.hisp.dhis.period.Period; +import org.hisp.dhis.period.PeriodService; import org.hisp.dhis.system.util.DateUtils; import org.hisp.dhis.system.util.MimicingHashMap; import org.hisp.dhis.system.util.StreamUtils; @@ -81,8 +79,6 @@ private PeriodService periodService; - private StatementManager statementManager; - private DataElementService dataElementService; // ------------------------------------------------------------------------- @@ -100,11 +96,10 @@ // ------------------------------------------------------------------------- public DataValueConverter( PeriodService periodService, AggregatedDataValueService aggregatedDataValueService, - StatementManager statementManager, DataElementService dataElementService ) + DataElementService dataElementService ) { this.periodService = periodService; this.aggregatedDataValueService = aggregatedDataValueService; - this.statementManager = statementManager; this.dataElementService = dataElementService; } @@ -163,8 +158,6 @@ Collection periods = periodService.getIntersectingPeriods( params.getStartDate(), params.getEndDate() ); - statementManager.initialise(); - for ( final Integer element : params.getDataElements() ) { for ( final Period period : periods ) @@ -190,8 +183,6 @@ } } } - - statementManager.destroy(); } } === 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 2012-06-25 18:21:40 +0000 +++ 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 @@ -71,13 +71,6 @@ this.sessionFactory = sessionFactory; } - private StatementManager statementManager; - - public void setStatementManager( StatementManager statementManager ) - { - this.statementManager = statementManager; - } - private DataElementService dataElementService; public void setDataElementService( DataElementService dataElementService ) @@ -173,7 +166,7 @@ thread.registerXMLConverter( new UserConverter() ); thread.registerXMLConverter( new UserRoleConverter() ); - thread.registerCSVConverter( new DataValueConverter( periodService, aggregatedDataValueService, statementManager, dataElementService ) ); + thread.registerCSVConverter( new DataValueConverter( periodService, aggregatedDataValueService, dataElementService ) ); thread.start(); === 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:12:27 +0000 +++ dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml 2013-04-15 15:49:53 +0000 @@ -259,7 +259,6 @@ -