dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15023
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5258: Work in progress on GIS service layer restructure. REmoved support for on-the-fly aggregation. Im...
------------------------------------------------------------
revno: 5258
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-12-01 16:43:25 +0100
message:
Work in progress on GIS service layer restructure. REmoved support for on-the-fly aggregation. Improved performance on data retrieval.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java
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/jdbc/JdbcAggregatedDataValueStore.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java
dhis-2/dhis-services/dhis-service-mapping/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetDataElementMapValuesAction.java
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetIndicatorMapValuesAction.java
dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== 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 2011-09-23 14:45:35 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueService.java 2011-12-01 15:43:25 +0000
@@ -251,7 +251,7 @@
* @param periodId the Period identifier.
* @param level the OrganisationUnit level.
*/
- Collection<AggregatedMapValue> getAggregatedDataMapValues( int dataElementId, int periodId, int level );
+ Collection<AggregatedMapValue> getAggregatedDataMapValues( int dataElementId, int periodId, Collection<Integer> organisationUnitIds );
// ----------------------------------------------------------------------
// AggregatedIndicatorValue
@@ -333,9 +333,9 @@
*
* @param indicatorId the Indicator identifier.
* @param periodId the Period identifier.
- * @param level the OrganisationUnit level.
+ * @param organisationUnitIds the collection of OrganisationUnit identifiers.
*/
- Collection<AggregatedMapValue> getAggregatedIndicatorMapValues( int indicatorId, int periodId, int level );
+ Collection<AggregatedMapValue> getAggregatedIndicatorMapValues( int indicatorId, int periodId, Collection<Integer> organisationUnitIds );
/**
* Retrieves the AggregatedIndicatorMapValues for the given arguments.
=== 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 2011-09-23 14:45:35 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java 2011-12-01 15:43:25 +0000
@@ -217,9 +217,9 @@
*
* @param dataElementId the DataElement identifier.
* @param periodId the Period identifier.
- * @param level the OrganisationUnit level.
+ * @param organisationUnitIds the set of OrganisationUnit identifiers.
*/
- Collection<AggregatedMapValue> getAggregatedDataMapValues( int dataElementId, int periodId, int level );
+ Collection<AggregatedMapValue> getAggregatedDataMapValues( int dataElementId, int periodId, Collection<Integer> organisationUnitIds );
// ----------------------------------------------------------------------
// AggregatedIndicatorValue
@@ -310,9 +310,9 @@
*
* @param indicatorId the Indicator identifier.
* @param periodId the Period identifier.
- * @param level the OrganisationUnit level.
+ * @param organisationUnitIds the collection of OrganisationUnit identifiers.
*/
- Collection<AggregatedMapValue> getAggregatedIndicatorMapValues( int indicatorId, int periodId, int level );
+ Collection<AggregatedMapValue> getAggregatedIndicatorMapValues( int indicatorId, int periodId, Collection<Integer> organisationUnitIds );
/**
* Retrieves the AggregatedIndicatorMapValues for the given arguments.
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2011-11-12 12:54:31 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2011-12-01 15:43:25 +0000
@@ -28,11 +28,9 @@
*/
import java.util.Collection;
-import java.util.Date;
import java.util.Set;
import org.hisp.dhis.aggregation.AggregatedMapValue;
-import org.hisp.dhis.period.Period;
/**
* @author Jan Henrik Overland
@@ -74,15 +72,13 @@
// IndicatorMapValue
// -------------------------------------------------------------------------
- Collection<AggregatedMapValue> getIndicatorMapValues( Integer indicatorId, Period period, Date startDate,
- Date endDate, Integer parentOrganisationUnitId, Integer level );
+ Collection<AggregatedMapValue> getIndicatorMapValues( int indicatorId, int periodId, int parentOrganisationUnitId, Integer level );
// -------------------------------------------------------------------------
// DataMapValue
// -------------------------------------------------------------------------
- Collection<AggregatedMapValue> getDataElementMapValues( Integer dataElementId, Period period, Date startDate,
- Date endDate, Integer parentOrganisationUnitId, Integer level );
+ Collection<AggregatedMapValue> getDataElementMapValues( int dataElementId, int periodId, int parentOrganisationUnitId, Integer level );
Collection<AggregatedMapValue> getInfrastructuralDataElementMapValues( Integer periodId, Integer organisationUnitId );
=== 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 2011-09-23 14:45:35 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedDataValueService.java 2011-12-01 15:43:25 +0000
@@ -30,11 +30,6 @@
import java.util.Collection;
import java.util.Map;
-import org.hisp.dhis.aggregation.AggregatedDataValue;
-import org.hisp.dhis.aggregation.AggregatedDataValueService;
-import org.hisp.dhis.aggregation.AggregatedDataValueStore;
-import org.hisp.dhis.aggregation.AggregatedIndicatorValue;
-import org.hisp.dhis.aggregation.AggregatedMapValue;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryOption;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
@@ -157,9 +152,9 @@
// AggregatedDataMapValue
// -------------------------------------------------------------------------
- public Collection<AggregatedMapValue> getAggregatedDataMapValues( int dataElementId, int periodId, int level )
+ public Collection<AggregatedMapValue> getAggregatedDataMapValues( int dataElementId, int periodId, Collection<Integer> organisationUnitIds )
{
- return aggregatedDataValueStore.getAggregatedDataMapValues( dataElementId, periodId, level );
+ return aggregatedDataValueStore.getAggregatedDataMapValues( dataElementId, periodId, organisationUnitIds );
}
// -------------------------------------------------------------------------
@@ -217,9 +212,9 @@
// AggregatedIndicatorMapValue
// -------------------------------------------------------------------------
- public Collection<AggregatedMapValue> getAggregatedIndicatorMapValues( int indicatorId, int periodId, int level )
+ public Collection<AggregatedMapValue> getAggregatedIndicatorMapValues( int indicatorId, int periodId, Collection<Integer> organisationUnitIds )
{
- return aggregatedDataValueStore.getAggregatedIndicatorMapValues( indicatorId, periodId, level );
+ return aggregatedDataValueStore.getAggregatedIndicatorMapValues( indicatorId, periodId, organisationUnitIds );
}
public Collection<AggregatedMapValue> getAggregatedIndicatorMapValues( int indicatorId, int periodId, int level, int organisationUnitId )
=== 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 2011-10-23 20:17:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java 2011-12-01 15:43:25 +0000
@@ -27,7 +27,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
import static org.hisp.dhis.system.util.ConversionUtils.getIdentifiers;
import static org.hisp.dhis.system.util.TextUtils.getCommaDelimitedString;
@@ -58,6 +57,7 @@
import org.hisp.dhis.datavalue.DeflatedDataValue;
import org.hisp.dhis.hibernate.HibernateGenericStore;
import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.system.objectmapper.AggregatedDataMapValueRowMapper;
import org.hisp.dhis.system.objectmapper.AggregatedDataValueRowMapper;
@@ -430,34 +430,17 @@
// AggregatedDataMapValue
// -------------------------------------------------------------------------
- public Collection<AggregatedMapValue> getAggregatedDataMapValues( int dataElementId, int periodId, int level )
+ public Collection<AggregatedMapValue> getAggregatedDataMapValues( int dataElementId, int periodId, Collection<Integer> organisationUnitIds )
{
- final StatementHolder holder = statementManager.getHolder();
-
- final ObjectMapper<AggregatedMapValue> mapper = new ObjectMapper<AggregatedMapValue>();
-
- try
- {
- final String sql =
- "SELECT o.organisationunitid, o.name, a.value, a.periodid " +
- "FROM aggregateddatavalue AS a, organisationunit AS o " +
- "WHERE a.dataelementid = " + dataElementId + " " +
- "AND a.periodid = " + periodId + " " +
- "AND a.level = " + level + " " +
- "AND a.organisationunitid = o.organisationunitid";
-
- final ResultSet resultSet = holder.getStatement().executeQuery( sql );
-
- return mapper.getCollection( resultSet, new AggregatedDataMapValueRowMapper() );
- }
- catch ( SQLException ex )
- {
- throw new RuntimeException( "Failed to get aggregated data map values", ex );
- }
- finally
- {
- holder.close();
- }
+ final String sql =
+ "SELECT o.organisationunitid, o.name, a.value, a.periodid " +
+ "FROM aggregateddatavalue AS a " +
+ "JOIN organisationunit AS o ON (a.organisationunitid=o.organisationunitid) " +
+ "WHERE a.dataelementid = " + dataElementId + " " +
+ "AND a.periodid = " + periodId + " " +
+ "AND a.organisationunitid IN (" + getCommaDelimitedString( organisationUnitIds ) + ")";
+
+ return jdbcTemplate.query( sql, new AggregatedDataMapValueRowMapper() );
}
// -------------------------------------------------------------------------
@@ -639,34 +622,16 @@
// AggregatedIndicatorMapValue
// -------------------------------------------------------------------------
- public Collection<AggregatedMapValue> getAggregatedIndicatorMapValues( int indicatorId, int periodId, int level )
+ public Collection<AggregatedMapValue> getAggregatedIndicatorMapValues( int indicatorId, int periodId, Collection<Integer> organisationUnitIds )
{
- final StatementHolder holder = statementManager.getHolder();
-
- final ObjectMapper<AggregatedMapValue> mapper = new ObjectMapper<AggregatedMapValue>();
-
- try
- {
- final String sql =
- "SELECT o.organisationunitid, o.name, a.value, a.periodid, a.factor, a.numeratorvalue, a.denominatorvalue " +
- "FROM aggregatedindicatorvalue AS a, organisationunit AS o " +
- "WHERE a.indicatorid = " + indicatorId + " " +
- "AND a.periodid = " + periodId + " " +
- "AND a.level = " + level + " " +
- "AND a.organisationunitid = o.organisationunitid";
-
- final ResultSet resultSet = holder.getStatement().executeQuery( sql );
-
- return mapper.getCollection( resultSet, new AggregatedIndicatorMapValueRowMapper() );
- }
- catch ( SQLException ex )
- {
- throw new RuntimeException( "Failed to get aggregated indicator map values", ex );
- }
- finally
- {
- holder.close();
- }
+ final String sql =
+ "SELECT o.organisationunitid, o.name, a.value, a.periodid, a.factor, a.numeratorvalue, a.denominatorvalue " +
+ "FROM aggregatedindicatorvalue AS a, organisationunit AS o " +
+ "WHERE a.indicatorid = " + indicatorId + " " +
+ "AND a.periodid = " + periodId + " " +
+ "AND a.organisationunitid IN (" + getCommaDelimitedString( organisationUnitIds ) + ")";
+
+ return jdbcTemplate.query( sql, new AggregatedIndicatorMapValueRowMapper() );
}
public Collection<AggregatedMapValue> getAggregatedIndicatorMapValues( int indicatorId, int periodId, int level, int organisationUnitId )
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2011-11-25 11:00:15 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2011-12-01 15:43:25 +0000
@@ -200,6 +200,7 @@
<bean id="org.hisp.dhis.aggregation.AggregatedDataValueStore" class="org.hisp.dhis.aggregation.jdbc.JdbcAggregatedDataValueStore">
<property name="statementManager" ref="statementManager" />
+ <property name="jdbcTemplate" ref="jdbcTemplate" />
</bean>
<bean id="org.hisp.dhis.user.UserAuthorityGroupStore" class="org.hisp.dhis.hibernate.HibernateGenericStore">
=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2011-11-12 12:54:31 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2011-12-01 15:43:25 +0000
@@ -27,19 +27,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.options.SystemSettingManager.AGGREGATION_STRATEGY_BATCH;
-import static org.hisp.dhis.options.SystemSettingManager.AGGREGATION_STRATEGY_REAL_TIME;
-import static org.hisp.dhis.options.SystemSettingManager.DEFAULT_AGGREGATION_STRATEGY;
-import static org.hisp.dhis.options.SystemSettingManager.KEY_AGGREGATION_STRATEGY;
-
import java.util.Collection;
-import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import org.hisp.dhis.aggregation.AggregatedDataValueService;
import org.hisp.dhis.aggregation.AggregatedMapValue;
-import org.hisp.dhis.aggregation.AggregationService;
import org.hisp.dhis.configuration.ConfigurationService;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementGroup;
@@ -47,19 +40,18 @@
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorGroup;
import org.hisp.dhis.indicator.IndicatorService;
-import org.hisp.dhis.options.SystemSettingManager;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.system.util.ConversionUtils;
import org.hisp.dhis.system.util.MathUtils;
import org.hisp.dhis.user.CurrentUserService;
import org.hisp.dhis.user.User;
import org.hisp.dhis.user.UserSettingService;
import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.Assert;
/**
* @author Jan Henrik Overland
@@ -115,13 +107,6 @@
this.userSettingService = userSettingService;
}
- private AggregationService aggregationService;
-
- public void setAggregationService( AggregationService aggregationService )
- {
- this.aggregationService = aggregationService;
- }
-
private AggregatedDataValueService aggregatedDataValueService;
public void setAggregatedDataValueService( AggregatedDataValueService aggregatedDataValueService )
@@ -129,13 +114,6 @@
this.aggregatedDataValueService = aggregatedDataValueService;
}
- private SystemSettingManager systemSettingManager;
-
- public void setSystemSettingManager( SystemSettingManager systemSettingManager )
- {
- this.systemSettingManager = systemSettingManager;
- }
-
private CurrentUserService currentUserService;
public void setCurrentUserService( CurrentUserService currentUserService )
@@ -207,43 +185,16 @@
* @param level the OrganisationUnit level. Ignored if null.
* @return a collection of AggregatedMapValues.
*/
- public Collection<AggregatedMapValue> getIndicatorMapValues( Integer indicatorId, Period period, Date startDate,
- Date endDate, Integer parentOrganisationUnitId, Integer level )
+ public Collection<AggregatedMapValue> getIndicatorMapValues( int indicatorId, int periodId, int parentOrganisationUnitId, Integer level )
{
- String aggregationStrategy = (String) systemSettingManager.getSystemSetting( KEY_AGGREGATION_STRATEGY,
- DEFAULT_AGGREGATION_STRATEGY );
-
- Assert.isTrue( !(period != null && (startDate != null || endDate != null)) );
- Assert.isTrue( !(aggregationStrategy.equals( AGGREGATION_STRATEGY_BATCH ) && period == null) );
- Assert.isTrue( indicatorId != null && parentOrganisationUnitId != null && level != null );
-
- Collection<AggregatedMapValue> values = new HashSet<AggregatedMapValue>();
-
- Indicator indicator = indicatorService.getIndicator( indicatorId );
-
- if ( period != null )
- {
- startDate = period.getStartDate();
- endDate = period.getEndDate();
- }
-
- for ( OrganisationUnit organisationUnit : getOrganisationUnits( parentOrganisationUnitId, level ) )
- {
- if ( organisationUnit.hasCoordinates() )
- {
- Double value = aggregationStrategy.equals( AGGREGATION_STRATEGY_REAL_TIME ) ? aggregationService
- .getAggregatedIndicatorValue( indicator, startDate, endDate, organisationUnit )
- : aggregatedDataValueService.getAggregatedValue( indicator, period, organisationUnit );
-
- value = value != null ? value : 0; // TODO improve
-
- AggregatedMapValue mapValue = new AggregatedMapValue();
- mapValue.setOrganisationUnitId( organisationUnit.getId() );
- mapValue.setOrganisationUnitName( organisationUnit.getName() );
- mapValue.setValue( MathUtils.getRounded( value, 2 ) );
-
- values.add( mapValue );
- }
+ Collection<OrganisationUnit> units = getOrganisationUnits( parentOrganisationUnitId, level );
+
+ Collection<AggregatedMapValue> values = aggregatedDataValueService.
+ getAggregatedIndicatorMapValues( indicatorId, periodId, ConversionUtils.getIdentifiers( OrganisationUnit.class, units ) );
+
+ for ( AggregatedMapValue value : values )
+ {
+ value.setValue( MathUtils.getRounded( value.getValue(), 2 ) );
}
return values;
@@ -269,43 +220,17 @@
* @param level the OrganisationUnit level. Ignored if null.
* @return a collection of AggregatedMapValues.
*/
- public Collection<AggregatedMapValue> getDataElementMapValues( Integer dataElementId, Period period,
- Date startDate, Date endDate, Integer parentOrganisationUnitId, Integer level )
+ public Collection<AggregatedMapValue> getDataElementMapValues( int dataElementId, int periodId,
+ int parentOrganisationUnitId, Integer level )
{
- String aggregationStrategy = (String) systemSettingManager.getSystemSetting( KEY_AGGREGATION_STRATEGY,
- DEFAULT_AGGREGATION_STRATEGY );
-
- Assert.isTrue( !(period != null && (startDate != null || endDate != null)) );
- Assert.isTrue( !(aggregationStrategy.equals( AGGREGATION_STRATEGY_BATCH ) && period == null) );
- Assert.isTrue( !(dataElementId == null || parentOrganisationUnitId == null || level == null) );
-
- Collection<AggregatedMapValue> values = new HashSet<AggregatedMapValue>();
-
- DataElement dataElement = dataElementService.getDataElement( dataElementId );
-
- if ( period != null )
- {
- startDate = period.getStartDate();
- endDate = period.getEndDate();
- }
-
- for ( OrganisationUnit organisationUnit : getOrganisationUnits( parentOrganisationUnitId, level ) )
- {
- if ( organisationUnit.hasCoordinates() )
- {
- Double value = aggregationStrategy.equals( AGGREGATION_STRATEGY_REAL_TIME ) ? aggregationService
- .getAggregatedDataValue( dataElement, null, startDate, endDate, organisationUnit )
- : aggregatedDataValueService.getAggregatedValue( dataElement, period, organisationUnit );
-
- value = value != null ? value : 0; // TODO improve
-
- AggregatedMapValue mapValue = new AggregatedMapValue();
- mapValue.setOrganisationUnitId( organisationUnit.getId() );
- mapValue.setOrganisationUnitName( organisationUnit.getName() );
- mapValue.setValue( MathUtils.getRounded( value, 2 ) );
-
- values.add( mapValue );
- }
+ Collection<OrganisationUnit> units = getOrganisationUnits( parentOrganisationUnitId, level );
+
+ Collection<AggregatedMapValue> values = aggregatedDataValueService.
+ getAggregatedDataMapValues( dataElementId, periodId, ConversionUtils.getIdentifiers( OrganisationUnit.class, units ) );
+
+ for ( AggregatedMapValue value : values )
+ {
+ value.setValue( MathUtils.getRounded( value.getValue(), 2 ) );
}
return values;
@@ -314,9 +239,6 @@
public Collection<AggregatedMapValue> getInfrastructuralDataElementMapValues( Integer periodId,
Integer organisationUnitId )
{
- String aggregationStrategy = (String) systemSettingManager.getSystemSetting( KEY_AGGREGATION_STRATEGY,
- DEFAULT_AGGREGATION_STRATEGY );
-
DataElementGroup group = configurationService.getConfiguration().getInfrastructuralDataElements();
if ( group == null )
@@ -326,14 +248,6 @@
Period period = periodService.getPeriod( periodId );
- Date startDate = new Date(), endDate = new Date();
-
- if ( period != null )
- {
- startDate = period.getStartDate();
- endDate = period.getEndDate();
- }
-
OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
Collection<AggregatedMapValue> values = new HashSet<AggregatedMapValue>();
@@ -342,9 +256,7 @@
{
for ( DataElement dataElement : group.getMembers() )
{
- Double value = aggregationStrategy.equals( AGGREGATION_STRATEGY_REAL_TIME ) ? aggregationService
- .getAggregatedDataValue( dataElement, null, startDate, endDate, organisationUnit )
- : aggregatedDataValueService.getAggregatedValue( dataElement, period, organisationUnit );
+ Double value = aggregatedDataValueService.getAggregatedValue( dataElement, period, organisationUnit );
value = value != null ? value : 0; // TODO improve
=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/resources/META-INF/dhis/beans.xml 2011-12-01 12:30:03 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/resources/META-INF/dhis/beans.xml 2011-12-01 15:43:25 +0000
@@ -22,10 +22,6 @@
ref="org.hisp.dhis.period.PeriodService"/>
<property name="userSettingService"
ref="org.hisp.dhis.user.UserSettingService"/>
- <property name="aggregationService"
- ref="org.hisp.dhis.aggregation.AggregationService"/>
- <property name="systemSettingManager"
- ref="org.hisp.dhis.options.SystemSettingManager"/>
<property name="aggregatedDataValueService"
ref="org.hisp.dhis.aggregation.AggregatedDataValueService"/>
<property name="currentUserService"
@@ -80,12 +76,6 @@
<aop:before pointcut="execution( * org.hisp.dhis.mapping.MappingService.deleteMapView(..) )" method="intercept"/>
</aop:aspect>
- <aop:aspect ref="statementInterceptor">
- <aop:around pointcut="execution( * org.hisp.dhis.mapping.MappingService.getDataElementMapValues(..) )" method="intercept"/>
- <aop:around pointcut="execution( * org.hisp.dhis.mapping.MappingService.getIndicatorMapValues(..) )" method="intercept"/>
- <aop:around pointcut="execution( * org.hisp.dhis.mapping.MappingService.getInfrastructuralDataElementMapValues(..) )" method="intercept"/>
- </aop:aspect>
-
</aop:config>
</beans>
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetDataElementMapValuesAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetDataElementMapValuesAction.java 2011-01-10 16:07:53 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetDataElementMapValuesAction.java 2011-12-01 15:43:25 +0000
@@ -31,9 +31,6 @@
import org.hisp.dhis.aggregation.AggregatedMapValue;
import org.hisp.dhis.mapping.MappingService;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.system.util.DateUtils;
import com.opensymphony.xwork2.Action;
@@ -55,13 +52,6 @@
this.mappingService = mappingService;
}
- private PeriodService periodService;
-
- public void setPeriodService( PeriodService periodService )
- {
- this.periodService = periodService;
- }
-
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -80,20 +70,6 @@
this.periodId = periodId;
}
- private String startDate;
-
- public void setStartDate( String startDate )
- {
- this.startDate = startDate;
- }
-
- private String endDate;
-
- public void setEndDate( String endDate )
- {
- this.endDate = endDate;
- }
-
private Integer parentId;
public void setParentId( Integer parentId )
@@ -125,12 +101,9 @@
public String execute()
throws Exception
- {
- Period period = periodService.getPeriod( periodId );
-
- object = mappingService.getDataElementMapValues( id, period, DateUtils.getMediumDate( startDate ), DateUtils
- .getMediumDate( endDate ), parentId, level );
-
+ {
+ object = mappingService.getDataElementMapValues( id, periodId, parentId, level );
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetIndicatorMapValuesAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetIndicatorMapValuesAction.java 2011-04-03 10:19:50 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetIndicatorMapValuesAction.java 2011-12-01 15:43:25 +0000
@@ -31,9 +31,6 @@
import org.hisp.dhis.aggregation.AggregatedMapValue;
import org.hisp.dhis.mapping.MappingService;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.system.util.DateUtils;
import com.opensymphony.xwork2.Action;
@@ -55,13 +52,6 @@
this.mappingService = mappingService;
}
- private PeriodService periodService;
-
- public void setPeriodService( PeriodService periodService )
- {
- this.periodService = periodService;
- }
-
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -80,20 +70,6 @@
this.periodId = periodId;
}
- private String startDate;
-
- public void setStartDate( String startDate )
- {
- this.startDate = startDate;
- }
-
- private String endDate;
-
- public void setEndDate( String endDate )
- {
- this.endDate = endDate;
- }
-
private Integer parentId;
public void setParentId( Integer parentId )
@@ -126,10 +102,7 @@
public String execute()
throws Exception
{
- Period period = periodId != null ? periodService.getPeriod( periodId ) : null;
-
- object = mappingService.getIndicatorMapValues( id, period, DateUtils.getMediumDate( startDate ), DateUtils
- .getMediumDate( endDate ), parentId, level );
+ object = mappingService.getIndicatorMapValues( id, periodId, parentId, level );
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml 2011-11-22 13:58:34 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml 2011-12-01 15:43:25 +0000
@@ -84,13 +84,11 @@
<bean id="org.hisp.dhis.mapping.action.GetIndicatorMapValuesAction"
class="org.hisp.dhis.mapping.action.GetIndicatorMapValuesAction" scope="prototype">
<property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />
- <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
</bean>
<bean id="org.hisp.dhis.mapping.action.GetDataElementMapValuesAction"
class="org.hisp.dhis.mapping.action.GetDataElementMapValuesAction" scope="prototype">
<property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />
- <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
</bean>
<bean id="org.hisp.dhis.mapping.action.GetInfrastructuralDataElementMapValuesAction"