dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27215
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13514: Event analytics, impl withCoordinates option for retrieving events with coordinates only, useful ...
------------------------------------------------------------
revno: 13514
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-12-31 10:28:55 +0100
message:
Event analytics, impl withCoordinates option for retrieving events with coordinates only, useful for GIS
modified:
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/EventAnalyticsService.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/EventQueryParams.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/EventAnalyticsController.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-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/EventAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/EventAnalyticsService.java 2013-10-16 19:06:05 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/EventAnalyticsService.java 2013-12-31 09:28:55 +0000
@@ -53,5 +53,5 @@
* Used for event query.
*/
EventQueryParams getFromUrl( String program, String stage, String startDate, String endDate, Set<String> dimension, Set<String> filter,
- String ouMode, Set<String> asc, Set<String> desc, boolean hierarchyMeta, Integer page, Integer pageSize, I18nFormat format );
+ String ouMode, Set<String> asc, Set<String> desc, boolean hierarchyMeta, boolean coordinatesOnly, Integer page, Integer pageSize, I18nFormat format );
}
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/EventQueryParams.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/EventQueryParams.java 2013-10-16 19:06:05 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/EventQueryParams.java 2013-12-31 09:28:55 +0000
@@ -80,6 +80,8 @@
private Integer limit;
+ private boolean coordinatesOnly;
+
// -------------------------------------------------------------------------
// Transient properties
// -------------------------------------------------------------------------
@@ -121,6 +123,7 @@
params.pageSize = this.pageSize;
params.sortOrder = this.sortOrder;
params.limit = this.limit;
+ params.coordinatesOnly = this.coordinatesOnly;
params.periodType = this.periodType;
params.aggregate = this.aggregate;
@@ -346,6 +349,16 @@
this.limit = limit;
}
+ public boolean isCoordinatesOnly()
+ {
+ return coordinatesOnly;
+ }
+
+ public void setCoordinatesOnly( boolean coordinatesOnly )
+ {
+ this.coordinatesOnly = coordinatesOnly;
+ }
+
public String getPeriodType()
{
return periodType;
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java 2013-12-20 15:05:23 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java 2013-12-31 09:28:55 +0000
@@ -264,7 +264,7 @@
public EventQueryParams getFromUrl( String program, String stage, String startDate, String endDate,
Set<String> dimension, Set<String> filter, boolean hierarchyMeta, SortOrder sortOrder, Integer limit, I18nFormat format )
{
- EventQueryParams params = getFromUrl( program, stage, startDate, endDate, dimension, filter, null, null, null, hierarchyMeta, null, null, format );
+ EventQueryParams params = getFromUrl( program, stage, startDate, endDate, dimension, filter, null, null, null, hierarchyMeta, false, null, null, format );
params.setSortOrder( sortOrder );
params.setLimit( limit );
params.setAggregate( true );
@@ -273,7 +273,7 @@
}
public EventQueryParams getFromUrl( String program, String stage, String startDate, String endDate, Set<String> dimension, Set<String> filter,
- String ouMode, Set<String> asc, Set<String> desc, boolean hierarchyMeta, Integer page, Integer pageSize, I18nFormat format )
+ String ouMode, Set<String> asc, Set<String> desc, boolean hierarchyMeta, boolean coordinatesOnly, Integer page, Integer pageSize, I18nFormat format )
{
EventQueryParams params = new EventQueryParams();
@@ -373,6 +373,7 @@
params.setEndDate( end );
params.setOrganisationUnitMode( ouMode );
params.setHierarchyMeta( hierarchyMeta );
+ params.setCoordinatesOnly( coordinatesOnly );
params.setPage( page );
params.setPageSize( pageSize );
params.setAggregate( false );
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java 2013-12-20 15:05:23 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java 2013-12-31 09:28:55 +0000
@@ -388,6 +388,11 @@
sql += "and " + getColumn( filter ) + " " + filter.getSqlOperator() + " " + getSqlFilter( filter ) + " ";
}
}
+
+ if ( params.isCoordinatesOnly() )
+ {
+ sql += "and (longitude is not null and latitude is not null) ";
+ }
return sql;
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/EventAnalyticsController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/EventAnalyticsController.java 2013-12-05 11:51:31 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/EventAnalyticsController.java 2013-12-31 09:28:55 +0000
@@ -155,13 +155,14 @@
@RequestParam(required=false) Set<String> asc,
@RequestParam(required=false) Set<String> desc,
@RequestParam(required=false) boolean hierarchyMeta,
+ @RequestParam(required=false) boolean coordinatesOnly,
@RequestParam(required=false) Integer page,
@RequestParam(required=false) Integer pageSize,
Model model,
HttpServletResponse response ) throws Exception
{
EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter, ouMode,
- asc, desc, hierarchyMeta, page, pageSize, i18nManager.getI18nFormat() );
+ asc, desc, hierarchyMeta, coordinatesOnly, page, pageSize, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_JSON, CacheStrategy.RESPECT_SYSTEM_SETTING );
Grid grid = analyticsService.getEvents( params );
@@ -182,13 +183,14 @@
@RequestParam(required=false) Set<String> asc,
@RequestParam(required=false) Set<String> desc,
@RequestParam(required=false) boolean hierarchyMeta,
+ @RequestParam(required=false) boolean coordinatesOnly,
@RequestParam(required=false) Integer page,
@RequestParam(required=false) Integer pageSize,
Model model,
HttpServletResponse response ) throws Exception
{
EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter,
- ouMode, asc, desc, hierarchyMeta, page, pageSize, i18nManager.getI18nFormat() );
+ ouMode, asc, desc, hierarchyMeta, coordinatesOnly, page, pageSize, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_EXCEL, CacheStrategy.RESPECT_SYSTEM_SETTING, "events.xls", true );
Grid grid = analyticsService.getEvents( params );
@@ -207,13 +209,14 @@
@RequestParam(required=false) Set<String> asc,
@RequestParam(required=false) Set<String> desc,
@RequestParam(required=false) boolean hierarchyMeta,
+ @RequestParam(required=false) boolean coordinatesOnly,
@RequestParam(required=false) Integer page,
@RequestParam(required=false) Integer pageSize,
Model model,
HttpServletResponse response ) throws Exception
{
EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter,
- ouMode, asc, desc, hierarchyMeta, page, pageSize, i18nManager.getI18nFormat() );
+ ouMode, asc, desc, hierarchyMeta, coordinatesOnly, page, pageSize, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_CSV, CacheStrategy.RESPECT_SYSTEM_SETTING, "events.csv", true );
Grid grid = analyticsService.getEvents( params );