dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #07146
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2019: Added server side support for start and end-dates in gis
------------------------------------------------------------
revno: 2019
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Tue 2010-08-31 11:13:46 +0200
message:
Added server side support for start and end-dates in gis
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-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GenerateDataElementChartAction.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GenerateOrganisationInChartAction.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/datasetcompleted/action/GetSelectedOrganisationUnitAction.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/ListReportExcelItemAction.java
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetDataMapValuesByParentOrganisationUnitAction.java
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetIndicatorMapValuesByParentOrganisationUnitAction.java
--
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 2010-08-26 16:20:21 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2010-08-31 09:13:46 +0000
@@ -28,6 +28,7 @@
*/
import java.util.Collection;
+import java.util.Date;
import java.util.Set;
import org.hisp.dhis.aggregation.AggregatedMapValue;
@@ -60,21 +61,20 @@
Collection<AggregatedMapValue> getAggregatedDataMapValues( int dataElementId, int periodId, String mapLayerPath );
- Collection<AggregatedMapValue> getAggregatedDataMapValues( int dataElementId, int periodId, int level );
-
+ Collection<AggregatedMapValue> getDataElementMapValues( int dataElementId, Date startDate, Date endDate, int parentOrganisationUnitId );
+
Collection<AggregatedMapValue> getDataElementMapValues( int dataElementId, int periodId, int parentOrganisationUnitId );
// -------------------------------------------------------------------------
// IndicatorMapValue
// -------------------------------------------------------------------------
- Collection<AggregatedMapValue> getAggregatedIndicatorMapValues( int indicatorId, Collection<Integer> periodIds,
- String mapLayerPath, String featureId );
+ Collection<AggregatedMapValue> getAggregatedIndicatorMapValues( int indicatorId, Collection<Integer> periodIds, String mapLayerPath, String featureId );
+ Collection<AggregatedMapValue> getIndicatorMapValues( int indicatorId, Date startDate, Date endDate, int parentOrganisationUnitId );
+
Collection<AggregatedMapValue> getAggregatedIndicatorMapValues( int indicatorId, int periodId, String mapLayerPath );
- Collection<AggregatedMapValue> getAggregatedIndicatorMapValues( int indicatorId, int periodId, int level );
-
Collection<AggregatedMapValue> getIndicatorMapValues( int indicatorId, int periodId, int parentOrganisationUnitId );
// -------------------------------------------------------------------------
=== 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 2010-08-31 05:47:11 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2010-08-31 09:13:46 +0000
@@ -31,6 +31,7 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -139,39 +140,38 @@
// DataMapValues
// -------------------------------------------------------------------------
- public Collection<AggregatedMapValue> getAggregatedDataMapValues( int dataElementId, int periodId,
- String mapLayerPath )
+ public Collection<AggregatedMapValue> getAggregatedDataMapValues( int dataElementId, int periodId, String mapLayerPath )
{
int level = getMapByMapLayerPath( mapLayerPath ).getOrganisationUnitLevel().getLevel();
- return getAggregatedDataMapValues( dataElementId, periodId, level );
- }
-
- public Collection<AggregatedMapValue> getAggregatedDataMapValues( int dataElementId, int periodId, int level )
- {
return aggregatedDataValueService.getAggregatedDataMapValues( dataElementId, periodId, level );
}
public Collection<AggregatedMapValue> getDataElementMapValues( int dataElementId, int periodId, int parentOrganisationUnitId )
{
+ Period period = periodService.getPeriod( periodId );
+
+ return getDataElementMapValues( dataElementId, period.getStartDate(), period.getEndDate(), parentOrganisationUnitId );
+ }
+
+ public Collection<AggregatedMapValue> getDataElementMapValues( int dataElementId, Date startDate, Date endDate, int parentOrganisationUnitId )
+ {
Collection<AggregatedMapValue> values = new HashSet<AggregatedMapValue>();
OrganisationUnit parent = organisationUnitService.getOrganisationUnit( parentOrganisationUnitId );
DataElement dataElement = dataElementService.getDataElement( dataElementId );
- Period period = periodService.getPeriod( periodId );
for ( OrganisationUnit organisationUnit : parent.getChildren() )
{
if ( organisationUnit.hasCoordinates() )
{
- Double value = aggregationService.getAggregatedDataValue( dataElement, null, period.getStartDate(), period.getEndDate(), organisationUnit );
+ Double value = aggregationService.getAggregatedDataValue( dataElement, null, startDate, endDate, organisationUnit );
value = value != null ? value : 0; // TODO improve
AggregatedMapValue mapValue = new AggregatedMapValue();
mapValue.setOrganisationUnitId( organisationUnit.getId() );
mapValue.setOrganisationUnitName( organisationUnit.getName() );
- mapValue.setPeriodId( period.getId() );
mapValue.setValue( MathUtils.getRounded( value, 2 ) );
values.add( mapValue );
@@ -214,34 +214,34 @@
{
int level = getMapByMapLayerPath( mapLayerPath ).getOrganisationUnitLevel().getLevel();
- return getAggregatedIndicatorMapValues( indicatorId, periodId, level );
- }
-
- public Collection<AggregatedMapValue> getAggregatedIndicatorMapValues( int indicatorId, int periodId, int level )
- {
return aggregatedDataValueService.getAggregatedIndicatorMapValues( indicatorId, periodId, level );
}
- public Collection<AggregatedMapValue> getIndicatorMapValues( int indicatorId, int periodId, int parentOrganisationUnitId )
+ public Collection<AggregatedMapValue> getIndicatorMapValues( int indicatorId, int periodId, int parentOrganisationUnitId )
+ {
+ Period period = periodService.getPeriod( periodId );
+
+ return getIndicatorMapValues( indicatorId, period.getStartDate(), period.getEndDate(), parentOrganisationUnitId );
+ }
+
+ public Collection<AggregatedMapValue> getIndicatorMapValues( int indicatorId, Date startDate, Date endDate, int parentOrganisationUnitId )
{
Collection<AggregatedMapValue> values = new HashSet<AggregatedMapValue>();
OrganisationUnit parent = organisationUnitService.getOrganisationUnit( parentOrganisationUnitId );
Indicator indicator = indicatorService.getIndicator( indicatorId );
- Period period = periodService.getPeriod( periodId );
for ( OrganisationUnit organisationUnit : parent.getChildren() )
{
if ( organisationUnit.hasCoordinates() )
{
- Double value = aggregationService.getAggregatedIndicatorValue( indicator, period.getStartDate(), period.getEndDate(), organisationUnit );
+ Double value = aggregationService.getAggregatedIndicatorValue( indicator, startDate, endDate, organisationUnit );
value = value != null ? value : 0; // TODO improve
AggregatedMapValue mapValue = new AggregatedMapValue();
mapValue.setOrganisationUnitId( organisationUnit.getId() );
mapValue.setOrganisationUnitName( organisationUnit.getName() );
- mapValue.setPeriodId( period.getId() );
mapValue.setValue( MathUtils.getRounded( value, 2 ) );
values.add( mapValue );
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GenerateDataElementChartAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GenerateDataElementChartAction.java 2010-07-10 14:50:48 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GenerateDataElementChartAction.java 2010-08-31 09:13:46 +0000
@@ -31,7 +31,6 @@
import java.util.HashMap;
import java.util.List;
-import org.hisp.dhis.aggregation.AggregationService;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataelement.DataElementCategoryService;
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GenerateOrganisationInChartAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GenerateOrganisationInChartAction.java 2010-07-10 14:50:48 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/chart/action/GenerateOrganisationInChartAction.java 2010-08-31 09:13:46 +0000
@@ -31,7 +31,6 @@
import java.util.HashMap;
import java.util.List;
-import org.hisp.dhis.aggregation.AggregationService;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/datasetcompleted/action/GetSelectedOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/datasetcompleted/action/GetSelectedOrganisationUnitAction.java 2010-07-13 15:50:08 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/datasetcompleted/action/GetSelectedOrganisationUnitAction.java 2010-08-31 09:13:46 +0000
@@ -26,14 +26,8 @@
*/
package org.hisp.dhis.reportexcel.datasetcompleted.action;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
-import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.period.PeriodType;
import com.opensymphony.xwork2.Action;
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/ListReportExcelItemAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/ListReportExcelItemAction.java 2010-08-31 08:12:53 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/ListReportExcelItemAction.java 2010-08-31 09:13:46 +0000
@@ -30,12 +30,6 @@
import java.util.Collections;
import java.util.List;
-import org.hisp.dhis.dataelement.DataElementGroup;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.dataelement.comparator.DataElementGroupNameComparator;
-import org.hisp.dhis.indicator.IndicatorGroup;
-import org.hisp.dhis.indicator.IndicatorService;
-import org.hisp.dhis.indicator.comparator.IndicatorGroupNameComparator;
import org.hisp.dhis.reportexcel.ReportExcel;
import org.hisp.dhis.reportexcel.ReportExcelItem;
import org.hisp.dhis.reportexcel.ReportExcelService;
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetDataMapValuesByParentOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetDataMapValuesByParentOrganisationUnitAction.java 2010-07-10 20:13:44 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetDataMapValuesByParentOrganisationUnitAction.java 2010-08-31 09:13:46 +0000
@@ -31,7 +31,7 @@
import org.hisp.dhis.aggregation.AggregatedMapValue;
import org.hisp.dhis.mapping.MappingService;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.system.util.DateUtils;
import com.opensymphony.xwork2.Action;
@@ -57,27 +57,41 @@
// Input
// -------------------------------------------------------------------------
- private int id;
+ private Integer id;
- public void setId( int id )
+ public void setId( Integer id )
{
this.id = id;
}
- private int periodId;
+ private Integer periodId;
- public void setPeriodId( int periodId )
+ public void setPeriodId( Integer periodId )
{
this.periodId = periodId;
}
- private int parentId;
+ private Integer parentId;
- public void setParentId( int parentId )
+ public void setParentId( Integer parentId )
{
this.parentId = parentId;
}
+ private String startDate;
+
+ public void setStartDate( String startDate )
+ {
+ this.startDate = startDate;
+ }
+
+ private String endDate;
+
+ public void setEndDate( String endDate )
+ {
+ this.endDate = endDate;
+ }
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -96,7 +110,14 @@
public String execute()
throws Exception
{
- object = mappingService.getDataElementMapValues( id, periodId, parentId );
+ 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/java/org/hisp/dhis/mapping/action/GetIndicatorMapValuesByParentOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetIndicatorMapValuesByParentOrganisationUnitAction.java 2010-07-10 20:13:44 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetIndicatorMapValuesByParentOrganisationUnitAction.java 2010-08-31 09:13:46 +0000
@@ -31,7 +31,7 @@
import org.hisp.dhis.aggregation.AggregatedMapValue;
import org.hisp.dhis.mapping.MappingService;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.system.util.DateUtils;
import com.opensymphony.xwork2.Action;
@@ -57,26 +57,40 @@
// Input
// -------------------------------------------------------------------------
- private int id;
+ private Integer id;
- public void setId( int id )
+ public void setId( Integer id )
{
this.id = id;
}
- private int periodId;
+ private Integer periodId;
- public void setPeriodId( int periodId )
+ public void setPeriodId( Integer periodId )
{
this.periodId = periodId;
}
- private int parentId;
+ private Integer parentId;
- public void setParentId( int parentId )
+ public void setParentId( Integer parentId )
{
this.parentId = parentId;
}
+
+ private String startDate;
+
+ public void setStartDate( String startDate )
+ {
+ this.startDate = startDate;
+ }
+
+ private String endDate;
+
+ public void setEndDate( String endDate )
+ {
+ this.endDate = endDate;
+ }
// -------------------------------------------------------------------------
// Input
@@ -96,7 +110,14 @@
public String execute()
throws Exception
{
- object = mappingService.getIndicatorMapValues( id, periodId, parentId );
+ if ( periodId != null ) // Period
+ {
+ object = mappingService.getIndicatorMapValues( id, periodId, parentId );
+ }
+ else // Start and end date
+ {
+ object = mappingService.getIndicatorMapValues( id, DateUtils.getMediumDate( startDate ), DateUtils.getMediumDate( endDate ), parentId );
+ }
return SUCCESS;
}