dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #09449
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2508: Data element map value bug fixed + Deprecated methods and actions removed.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 2508 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-01-10 17:09:44 +0100
message:
Data element map value bug fixed + Deprecated methods and actions removed.
removed:
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetDataElementMapValuesByLevelAction.java
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetDataElementMapValuesByParentAction.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java
dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java
dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java
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/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.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/mapping/MappingService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2011-01-10 14:35:40 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2011-01-10 16:07:53 +0000
@@ -77,22 +77,8 @@
// DataMapValue
// -------------------------------------------------------------------------
- Collection<AggregatedMapValue> getDataElementMapValues( int dataElementId, int periodId,
- int parentOrganisationUnitId );
-
- Collection<AggregatedMapValue> getDataElementMapValues( int dataElementId, Date startDate, Date endDate,
- int parentOrganisationUnitId );
-
- Collection<AggregatedMapValue> getDataElementMapValues( int dataElementId, int periodId,
- int parentOrganisationUnitId, int level );
-
- Collection<AggregatedMapValue> getDataElementMapValues( int dataElementId, Date startDate, Date endDate,
- int parentOrganisationUnitId, int level );
-
- Collection<AggregatedMapValue> getDataElementMapValuesByLevel( int dataElementId, int periodId, int level );
-
- Collection<AggregatedMapValue> getDataElementMapValuesByLevel( int dataElementId, Date startDate, Date endDate,
- int level );
+ Collection<AggregatedMapValue> getDataElementMapValues( Integer dataElementId, Period period, Date startDate, Date endDate,
+ Integer parentOrganisationUnitId, Integer level );
// -------------------------------------------------------------------------
// MapLegend
=== 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-01-10 14:35:40 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2011-01-10 16:07:53 +0000
@@ -135,65 +135,10 @@
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
- // IndicatorMapValues
+ // OrganisationUnits
// -------------------------------------------------------------------------
/**
- * Generates a collection AggregatedMapValues. Only one of Period and start/end
- * date can be specified. At least one of parent organisation unit and level
- * must be specified. Period should be specified with "real time" aggregation
- * strategy, any may be specified with "batch" aggregation strategy.
- *
- * @param indicatorId the Indicator identifier.
- * @param period the Period identifier. Ignored if null.
- * @param startDate the start date. Ignored if null.
- * @param endDate the end date. Ignored if null.
- * @param parentOrganisationUnitId the parent OrganisationUnit identifier. Ignored if null.
- * @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 )
- {
- 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 );
- }
- }
-
- return values;
- }
-
- /**
* Returns the relevant OrganisationUnits for the given parent identifier
* and / or level.
*
@@ -220,85 +165,110 @@
return organisationUnits;
}
-
- // -------------------------------------------------------------------------
- // DataMapValues
- // -------------------------------------------------------------------------
-
- public Collection<AggregatedMapValue> getDataElementMapValues( int dataElementId, int periodId,
- int parentOrganisationUnitId )
- {
- Period period = periodService.getPeriod( periodId );
-
- return getDataElementMapValuesInternal( dataElementId, period, null, null, parentOrganisationUnitId, null );
- }
-
- public Collection<AggregatedMapValue> getDataElementMapValues( int dataElementId, Date startDate, Date endDate,
- int parentOrganisationUnitId )
- {
- return getDataElementMapValuesInternal( dataElementId, null, startDate, endDate, parentOrganisationUnitId, null );
- }
-
- public Collection<AggregatedMapValue> getDataElementMapValues( int dataElementId, int periodId,
- int parentOrganisationUnitId, int level )
- {
- Period period = periodService.getPeriod( periodId );
-
- return getDataElementMapValuesInternal( dataElementId, period, null, null, parentOrganisationUnitId, level );
- }
-
- public Collection<AggregatedMapValue> getDataElementMapValues( int dataElementId, Date startDate, Date endDate,
- int parentOrganisationUnitId, int level )
- {
- return getDataElementMapValuesInternal( dataElementId, null, startDate, endDate, parentOrganisationUnitId, level );
- }
-
- public Collection<AggregatedMapValue> getDataElementMapValuesByLevel( int dataElementId, int periodId, int level )
- {
- Period period = periodService.getPeriod( periodId );
-
- return getDataElementMapValuesInternal( dataElementId, period, null, null, null, level );
- }
-
- public Collection<AggregatedMapValue> getDataElementMapValuesByLevel( int dataElementId, Date startDate,
- Date endDate, int level )
- {
- return getDataElementMapValuesInternal( dataElementId, null, startDate, endDate, null, level );
- }
-
- /**
- * Generates a collection AggregatedMapValues. Only one of Period and start/end
- * date can be specified. At least one of parent organisation unit and level
- * must be specified. Period should be specified with "real time" aggregation
- * strategy, any may be specified with "batch" aggregation strategy.
- *
- * @param indicatorId the Indicator identifier.
- * @param period the Period identifier. Ignored if null.
- * @param startDate the start date. Ignored if null.
- * @param endDate the end date. Ignored if null.
- * @param parentOrganisationUnitId the parent OrganisationUnit identifier. Ignored if null.
- * @param level the OrganisationUnit level. Ignored if null.
- * @return a collection of AggregatedMapValues.
- */
- public Collection<AggregatedMapValue> getDataElementMapValuesInternal( Integer dataElementId, Period period, Date startDate, Date endDate,
- Integer 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( !( parentOrganisationUnitId == null && level == null ) );
+
+ // -------------------------------------------------------------------------
+ // IndicatorMapValues
+ // -------------------------------------------------------------------------
+
+ /**
+ * Generates a collection AggregatedMapValues. Only one of Period and start/end
+ * date can be specified. At least one of parent organisation unit and level
+ * must be specified. Period should be specified with "real time" aggregation
+ * strategy, any may be specified with "batch" aggregation strategy.
+ *
+ * @param indicatorId the Indicator identifier.
+ * @param period the Period identifier. Ignored if null.
+ * @param startDate the start date. Ignored if null.
+ * @param endDate the end date. Ignored if null.
+ * @param parentOrganisationUnitId the parent OrganisationUnit identifier. Ignored if null.
+ * @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 )
+ {
+ 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 );
+ }
+ }
+
+ return values;
+ }
+
+ // -------------------------------------------------------------------------
+ // DataElementMapValues
+ // -------------------------------------------------------------------------
+
+ /**
+ * Generates a collection AggregatedMapValues. Only one of Period and start/end
+ * date can be specified. At least one of parent organisation unit and level
+ * must be specified. Period should be specified with "real time" aggregation
+ * strategy, any may be specified with "batch" aggregation strategy.
+ *
+ * @param indicatorId the Indicator identifier.
+ * @param period the Period identifier. Ignored if null.
+ * @param startDate the start date. Ignored if null.
+ * @param endDate the end date. Ignored if null.
+ * @param parentOrganisationUnitId the parent OrganisationUnit identifier. Ignored if null.
+ * @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 )
+ {
+ 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 = aggregationService.getAggregatedDataValue( dataElement, null, startDate, endDate,
- organisationUnit );
+ 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
=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java'
--- dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java 2011-01-10 14:35:40 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java 2011-01-10 16:07:53 +0000
@@ -520,7 +520,7 @@
@Test
public void testMapValues()
{
- mappingService.getDataElementMapValues( dataElement.getId(), period.getId(), organisationUnit.getId() );
+ mappingService.getDataElementMapValues( dataElement.getId(), period, new Date(), new Date(), organisationUnit.getId(), 1 );
mappingService.getIndicatorMapValues( indicator.getId(), period, new Date(), new Date(), organisationUnit.getId(), 1 );
}
}
=== 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 2010-11-19 12:18:38 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetDataElementMapValuesAction.java 2011-01-10 16:07:53 +0000
@@ -31,6 +31,8 @@
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;
@@ -53,6 +55,13 @@
this.mappingService = mappingService;
}
+ private PeriodService periodService;
+
+ public void setPeriodService( PeriodService periodService )
+ {
+ this.periodService = periodService;
+ }
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -117,16 +126,10 @@
public String execute()
throws Exception
{
- if ( periodId != null ) // Period
- {
- object = mappingService.getDataElementMapValues( id, periodId, parentId, level );
- }
- else
- // Start and end date
- {
- object = mappingService.getDataElementMapValues( id, DateUtils.getMediumDate( startDate ),
- DateUtils.getMediumDate( endDate ), parentId, level );
- }
+ Period period = periodService.getPeriod( periodId );
+
+ object = mappingService.getDataElementMapValues( id, period, DateUtils.getMediumDate( startDate ), DateUtils
+ .getMediumDate( endDate ), parentId, level );
return SUCCESS;
}
=== removed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetDataElementMapValuesByLevelAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetDataElementMapValuesByLevelAction.java 2010-11-17 16:20:22 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetDataElementMapValuesByLevelAction.java 1970-01-01 00:00:00 +0000
@@ -1,124 +0,0 @@
-package org.hisp.dhis.mapping.action;
-
-/*
- * Copyright (c) 2004-2010, 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 org.hisp.dhis.aggregation.AggregatedMapValue;
-import org.hisp.dhis.mapping.MappingService;
-import org.hisp.dhis.system.util.DateUtils;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Jan Henrik Overland
- * @version $Id$
- */
-public class GetDataElementMapValuesByLevelAction
- implements Action
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private MappingService mappingService;
-
- public void setMappingService( MappingService mappingService )
- {
- this.mappingService = mappingService;
- }
-
- // -------------------------------------------------------------------------
- // Input
- // -------------------------------------------------------------------------
-
- private Integer id;
-
- public void setId( Integer id )
- {
- this.id = id;
- }
-
- private Integer periodId;
-
- public void setPeriodId( Integer periodId )
- {
- 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 level;
-
- public void setLevel( Integer level )
- {
- this.level = level;
- }
-
- // -------------------------------------------------------------------------
- // Input
- // -------------------------------------------------------------------------
-
- private Collection<AggregatedMapValue> object;
-
- public Collection<AggregatedMapValue> getObject()
- {
- return object;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- throws Exception
- {
- if ( periodId != null ) // Period
- {
- object = mappingService.getDataElementMapValues( id, periodId, level );
- }
- else // Start and end date
- {
- object = mappingService.getDataElementMapValues( id, DateUtils.getMediumDate( startDate ), DateUtils.getMediumDate( endDate ), level );
- }
-
- return SUCCESS;
- }
-}
=== removed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetDataElementMapValuesByParentAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetDataElementMapValuesByParentAction.java 2010-11-17 16:20:22 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetDataElementMapValuesByParentAction.java 1970-01-01 00:00:00 +0000
@@ -1,124 +0,0 @@
-package org.hisp.dhis.mapping.action;
-
-/*
- * Copyright (c) 2004-2010, 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 org.hisp.dhis.aggregation.AggregatedMapValue;
-import org.hisp.dhis.mapping.MappingService;
-import org.hisp.dhis.system.util.DateUtils;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Jan Henrik Overland
- * @version $Id$
- */
-public class GetDataElementMapValuesByParentAction
- implements Action
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private MappingService mappingService;
-
- public void setMappingService( MappingService mappingService )
- {
- this.mappingService = mappingService;
- }
-
- // -------------------------------------------------------------------------
- // Input
- // -------------------------------------------------------------------------
-
- private Integer id;
-
- public void setId( Integer id )
- {
- this.id = id;
- }
-
- private Integer periodId;
-
- public void setPeriodId( Integer periodId )
- {
- 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 )
- {
- this.parentId = parentId;
- }
-
- // -------------------------------------------------------------------------
- // Input
- // -------------------------------------------------------------------------
-
- private Collection<AggregatedMapValue> object;
-
- public Collection<AggregatedMapValue> getObject()
- {
- return object;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- throws Exception
- {
- if ( periodId != null ) // Period
- {
- object = mappingService.getDataElementMapValues( id, periodId, parentId );
- }
- else // Start and end date
- {
- object = mappingService.getDataElementMapValues( id, DateUtils.getMediumDate( startDate ), DateUtils.getMediumDate( endDate ), parentId );
- }
-
- 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-01-10 14:35:40 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml 2011-01-10 16:07:53 +0000
@@ -73,16 +73,7 @@
<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" />
- </bean>
-
- <bean id="org.hisp.dhis.mapping.action.GetDataElementMapValuesByParentAction"
- class="org.hisp.dhis.mapping.action.GetDataElementMapValuesByParentAction" scope="prototype">
- <property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />
- </bean>
-
- <bean id="org.hisp.dhis.mapping.action.GetDataElementMapValuesByLevelAction"
- class="org.hisp.dhis.mapping.action.GetDataElementMapValuesByLevelAction" scope="prototype">
- <property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />
+ <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
</bean>
<!-- MapLegend -->
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml 2011-01-10 14:35:40 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml 2011-01-10 16:07:53 +0000
@@ -85,18 +85,6 @@
<result name="success" type="velocity-json">
/dhis-web-mapping/jsonminAggregatedMapValues.vm</result>
</action>
-
- <action name="getDataElementMapValuesByParent"
- class="org.hisp.dhis.mapping.action.GetDataElementMapValuesByParentAction">
- <result name="success" type="velocity-json">
- /dhis-web-mapping/jsonminAggregatedMapValues.vm</result>
- </action>
-
- <action name="getDataElementMapValuesByLevel"
- class="org.hisp.dhis.mapping.action.GetDataElementMapValuesByLevelAction">
- <result name="success" type="velocity-json">
- /dhis-web-mapping/jsonminAggregatedMapValues.vm</result>
- </action>
<!-- MapLegend -->