dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #39919
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20221: Event analytics. Added support for userOrgUnit query parameter.
------------------------------------------------------------
revno: 20221
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-09-17 18:41:41 +0200
message:
Event analytics. Added support for userOrgUnit query parameter.
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/data/DefaultEventAnalyticsService.java
dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/event/data/EventAnalyticsServiceTest.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/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 2015-09-08 18:09:34 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/EventAnalyticsService.java 2015-09-17 16:41:41 +0000
@@ -73,12 +73,13 @@
* @param collapseDataDimensions collapse data dimensions into a single dimension.
* @param aggregateData return aggregated data values for data dimensions instead of items.
* @param displayProperty the display property to use for meta-data.
+ * @param userOrgUnit the user organisation unit to use, overrides current user.
* @param format the i18n format.
*/
EventQueryParams getFromUrl( String program, String stage, String startDate, String endDate,
Set<String> dimension, Set<String> filter, String value, AggregationType aggregationType,
boolean skipMeta, boolean skipData, boolean skipRounding, boolean completedOnly, boolean hierarchyMeta, boolean showHierarchy, SortOrder sortOrder, Integer limit,
- EventOutputType outputType, boolean collapseDataDimensions, boolean aggregateData, DisplayProperty displayProperty, I18nFormat format );
+ EventOutputType outputType, boolean collapseDataDimensions, boolean aggregateData, DisplayProperty displayProperty, String userOrgUnit, I18nFormat format );
/**
* Used for event query.
@@ -98,13 +99,14 @@
* @param hierarchyMeta whether to include hierarchy meta-data in the response.
* @param coordinatesOnly whether to only return events which have coordinates.
* @param displayProperty the display property to use for meta-data.
+ * @param userOrgUnit the user organisation unit to use, overrides current user.
* @param page the page number.
* @param pageSize the page size.
* @param format the i18n format.
*/
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 skipMeta, boolean skipData, boolean completedOnly, boolean hierarchyMeta, boolean coordinatesOnly,
- DisplayProperty displayProperty, Integer page, Integer pageSize, I18nFormat format );
+ DisplayProperty displayProperty, String userOrgUnit, Integer page, Integer pageSize, I18nFormat format );
EventQueryParams getFromAnalyticalObject( EventAnalyticalObject object, I18nFormat format );
}
=== 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 2015-09-17 16:33:12 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java 2015-09-17 16:41:41 +0000
@@ -385,10 +385,10 @@
public EventQueryParams getFromUrl( String program, String stage, String startDate, String endDate,
Set<String> dimension, Set<String> filter, String value, AggregationType aggregationType, boolean skipMeta, boolean skipData, boolean skipRounding,
boolean completedOnly, boolean hierarchyMeta, boolean showHierarchy, SortOrder sortOrder, Integer limit, EventOutputType outputType, boolean collapseDataDimensions,
- boolean aggregateData, DisplayProperty displayProperty, I18nFormat format )
+ boolean aggregateData, DisplayProperty displayProperty, String userOrgUnit, I18nFormat format )
{
EventQueryParams params = getFromUrl( program, stage, startDate, endDate, dimension, filter, null, null, null,
- skipMeta, skipData, completedOnly, hierarchyMeta, false, displayProperty, null, null, format );
+ skipMeta, skipData, completedOnly, hierarchyMeta, false, displayProperty, userOrgUnit, null, null, format );
params.setValue( getValueDimension( value ) );
params.setAggregationType( aggregationType );
@@ -407,11 +407,11 @@
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 skipMeta, boolean skipData, boolean completedOnly, boolean hierarchyMeta, boolean coordinatesOnly,
- DisplayProperty displayProperty, Integer page, Integer pageSize, I18nFormat format )
+ DisplayProperty displayProperty, String userOrgUnit, Integer page, Integer pageSize, I18nFormat format )
{
EventQueryParams params = new EventQueryParams();
- List<OrganisationUnit> userOrgUnits = analyticsService.getUserOrgUnits( null );
+ List<OrganisationUnit> userOrgUnits = analyticsService.getUserOrgUnits( userOrgUnit );
Program pr = programService.getProgram( program );
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/event/data/EventAnalyticsServiceTest.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/event/data/EventAnalyticsServiceTest.java 2015-09-08 18:09:34 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/event/data/EventAnalyticsServiceTest.java 2015-09-17 16:41:41 +0000
@@ -181,7 +181,8 @@
filterParams.add( "pe:201401;201402" );
EventQueryParams params = analyticsService.getFromUrl( prA.getUid(), null,
- null, null, dimensionParams, filterParams, null, null, false, false, false, false, false, false, null, null, null, false, false, null, null );
+ null, null, dimensionParams, filterParams, null, null, false, false,
+ false, false, false, false, null, null, null, false, false, null, null, null );
assertEquals( prA, params.getProgram() );
assertEquals( 1, params.getOrganisationUnits().size() );
@@ -200,7 +201,8 @@
filterParams.add( "pe:201401" );
EventQueryParams params = analyticsService.getFromUrl( prA.getUid(), null,
- null, null, dimensionParams, filterParams, deA.getUid(), AggregationType.AVERAGE, false, false, false, false, false, false, null, null, null, false, false, null, null );
+ null, null, dimensionParams, filterParams, deA.getUid(), AggregationType.AVERAGE,
+ false, false, false, false, false, false, null, null, null, false, false, null, null, null );
assertEquals( prA, params.getProgram() );
assertEquals( 1, params.getOrganisationUnits().size() );
@@ -339,7 +341,8 @@
filterParams.add( atA.getUid() + ":LE:5" );
EventQueryParams params = analyticsService.getFromUrl( prA.getUid(), null,
- null, null, dimensionParams, filterParams, null, null, false, false, false, false, false, false, null, null, null, false, false, null, null );
+ null, null, dimensionParams, filterParams, null, null, false, false,
+ false, false, false, false, null, null, null, false, false, null, null, null );
assertEquals( prA, params.getProgram() );
assertEquals( 1, params.getItems().size() );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/EventAnalyticsController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/EventAnalyticsController.java 2015-09-08 18:09:34 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/EventAnalyticsController.java 2015-09-17 16:41:41 +0000
@@ -97,12 +97,13 @@
@RequestParam( required = false ) boolean collapseDataDimensions,
@RequestParam( required = false ) boolean aggregateData,
@RequestParam( required = false ) DisplayProperty displayProperty,
+ @RequestParam( required = false ) String userOrgUnit,
Model model,
HttpServletResponse response ) throws Exception
{
EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter,
value, aggregationType, skipMeta, skipData, skipRounding, completedOnly, hierarchyMeta, showHierarchy, sortOrder, limit, outputType,
- collapseDataDimensions, aggregateData, displayProperty, i18nManager.getI18nFormat() );
+ collapseDataDimensions, aggregateData, displayProperty, userOrgUnit, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_JSON, CacheStrategy.RESPECT_SYSTEM_SETTING );
Grid grid = analyticsService.getAggregatedEventData( params );
@@ -133,12 +134,13 @@
@RequestParam( required = false ) boolean collapseDataDimensions,
@RequestParam( required = false ) boolean aggregateData,
@RequestParam( required = false ) DisplayProperty displayProperty,
+ @RequestParam( required = false ) String userOrgUnit,
Model model,
HttpServletResponse response ) throws Exception
{
EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter,
value, aggregationType, skipMeta, skipData, skipRounding, completedOnly, hierarchyMeta, showHierarchy, sortOrder, limit, outputType,
- collapseDataDimensions, aggregateData, displayProperty, i18nManager.getI18nFormat() );
+ collapseDataDimensions, aggregateData, displayProperty, userOrgUnit, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_XML, CacheStrategy.RESPECT_SYSTEM_SETTING, "events.xml", false );
Grid grid = analyticsService.getAggregatedEventData( params );
@@ -167,12 +169,13 @@
@RequestParam( required = false ) boolean collapseDataDimensions,
@RequestParam( required = false ) boolean aggregateData,
@RequestParam( required = false ) DisplayProperty displayProperty,
+ @RequestParam( required = false ) String userOrgUnit,
Model model,
HttpServletResponse response ) throws Exception
{
EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter,
value, aggregationType, skipMeta, skipData, skipRounding, completedOnly, hierarchyMeta, showHierarchy, sortOrder, limit, outputType,
- collapseDataDimensions, aggregateData, displayProperty, i18nManager.getI18nFormat() );
+ collapseDataDimensions, aggregateData, displayProperty, userOrgUnit, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_EXCEL, CacheStrategy.RESPECT_SYSTEM_SETTING, "events.xls", true );
Grid grid = analyticsService.getAggregatedEventData( params );
@@ -201,12 +204,13 @@
@RequestParam( required = false ) boolean collapseDataDimensions,
@RequestParam( required = false ) boolean aggregateData,
@RequestParam( required = false ) DisplayProperty displayProperty,
+ @RequestParam( required = false ) String userOrgUnit,
Model model,
HttpServletResponse response ) throws Exception
{
EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter,
value, aggregationType, skipMeta, skipData, skipRounding, completedOnly, hierarchyMeta, showHierarchy, sortOrder, limit, outputType,
- collapseDataDimensions, aggregateData, displayProperty, i18nManager.getI18nFormat() );
+ collapseDataDimensions, aggregateData, displayProperty, userOrgUnit, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_CSV, CacheStrategy.RESPECT_SYSTEM_SETTING, "events.csv", true );
Grid grid = analyticsService.getAggregatedEventData( params );
@@ -235,12 +239,13 @@
@RequestParam( required = false ) boolean collapseDataDimensions,
@RequestParam( required = false ) boolean aggregateData,
@RequestParam( required = false ) DisplayProperty displayProperty,
+ @RequestParam( required = false ) String userOrgUnit,
Model model,
HttpServletResponse response ) throws Exception
{
EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter,
value, aggregationType, skipMeta, skipData, skipRounding, completedOnly, hierarchyMeta, showHierarchy, sortOrder, limit, outputType,
- collapseDataDimensions, aggregateData, displayProperty, i18nManager.getI18nFormat() );
+ collapseDataDimensions, aggregateData, displayProperty, userOrgUnit, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, CacheStrategy.RESPECT_SYSTEM_SETTING, "events.html", false );
Grid grid = analyticsService.getAggregatedEventData( params );
@@ -269,12 +274,13 @@
@RequestParam( required = false ) boolean collapseDataDimensions,
@RequestParam( required = false ) boolean aggregateData,
@RequestParam( required = false ) DisplayProperty displayProperty,
+ @RequestParam( required = false ) String userOrgUnit,
Model model,
HttpServletResponse response ) throws Exception
{
EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter,
value, aggregationType, skipMeta, skipData, skipRounding, completedOnly, hierarchyMeta, showHierarchy, sortOrder, limit, outputType,
- collapseDataDimensions, aggregateData, displayProperty, i18nManager.getI18nFormat() );
+ collapseDataDimensions, aggregateData, displayProperty, userOrgUnit, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, CacheStrategy.RESPECT_SYSTEM_SETTING, "events.html", false );
Grid grid = analyticsService.getAggregatedEventData( params );
@@ -304,11 +310,12 @@
@RequestParam( required = false ) Integer page,
@RequestParam( required = false ) Integer pageSize,
@RequestParam( required = false ) DisplayProperty displayProperty,
+ @RequestParam( required = false ) String userOrgUnit,
Model model,
HttpServletResponse response ) throws Exception
{
EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter,
- ouMode, asc, desc, skipMeta, skipData, completedOnly, hierarchyMeta, coordinatesOnly, displayProperty, page, pageSize, i18nManager.getI18nFormat() );
+ ouMode, asc, desc, skipMeta, skipData, completedOnly, hierarchyMeta, coordinatesOnly, displayProperty, userOrgUnit, page, pageSize, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_JSON, CacheStrategy.RESPECT_SYSTEM_SETTING );
Grid grid = analyticsService.getEvents( params );
@@ -336,11 +343,12 @@
@RequestParam( required = false ) Integer page,
@RequestParam( required = false ) Integer pageSize,
@RequestParam( required = false ) DisplayProperty displayProperty,
+ @RequestParam( required = false ) String userOrgUnit,
Model model,
HttpServletResponse response ) throws Exception
{
EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter,
- ouMode, asc, desc, skipMeta, skipData, completedOnly, hierarchyMeta, coordinatesOnly, displayProperty, page, pageSize, i18nManager.getI18nFormat() );
+ ouMode, asc, desc, skipMeta, skipData, completedOnly, hierarchyMeta, coordinatesOnly, displayProperty, userOrgUnit, page, pageSize, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_XML, CacheStrategy.RESPECT_SYSTEM_SETTING, "events.xml", false );
Grid grid = analyticsService.getEvents( params );
@@ -366,11 +374,12 @@
@RequestParam( required = false ) Integer page,
@RequestParam( required = false ) Integer pageSize,
@RequestParam( required = false ) DisplayProperty displayProperty,
+ @RequestParam( required = false ) String userOrgUnit,
Model model,
HttpServletResponse response ) throws Exception
{
EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter,
- ouMode, asc, desc, skipMeta, skipData, completedOnly, hierarchyMeta, coordinatesOnly, displayProperty, page, pageSize, i18nManager.getI18nFormat() );
+ ouMode, asc, desc, skipMeta, skipData, completedOnly, hierarchyMeta, coordinatesOnly, displayProperty, userOrgUnit, page, pageSize, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_EXCEL, CacheStrategy.RESPECT_SYSTEM_SETTING, "events.xls", true );
Grid grid = analyticsService.getEvents( params );
@@ -396,11 +405,12 @@
@RequestParam( required = false ) Integer page,
@RequestParam( required = false ) Integer pageSize,
@RequestParam( required = false ) DisplayProperty displayProperty,
+ @RequestParam( required = false ) String userOrgUnit,
Model model,
HttpServletResponse response ) throws Exception
{
EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter,
- ouMode, asc, desc, skipMeta, skipData, completedOnly, hierarchyMeta, coordinatesOnly, displayProperty, page, pageSize, i18nManager.getI18nFormat() );
+ ouMode, asc, desc, skipMeta, skipData, completedOnly, hierarchyMeta, coordinatesOnly, displayProperty, userOrgUnit, page, pageSize, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_CSV, CacheStrategy.RESPECT_SYSTEM_SETTING, "events.csv", true );
Grid grid = analyticsService.getEvents( params );
@@ -426,11 +436,12 @@
@RequestParam( required = false ) Integer page,
@RequestParam( required = false ) Integer pageSize,
@RequestParam( required = false ) DisplayProperty displayProperty,
+ @RequestParam( required = false ) String userOrgUnit,
Model model,
HttpServletResponse response ) throws Exception
{
EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter,
- ouMode, asc, desc, skipMeta, skipData, completedOnly, hierarchyMeta, coordinatesOnly, displayProperty, page, pageSize, i18nManager.getI18nFormat() );
+ ouMode, asc, desc, skipMeta, skipData, completedOnly, hierarchyMeta, coordinatesOnly, displayProperty, userOrgUnit, page, pageSize, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, CacheStrategy.RESPECT_SYSTEM_SETTING, "events.html", false );
Grid grid = analyticsService.getEvents( params );
@@ -456,11 +467,12 @@
@RequestParam( required = false ) Integer page,
@RequestParam( required = false ) Integer pageSize,
@RequestParam( required = false ) DisplayProperty displayProperty,
+ @RequestParam( required = false ) String userOrgUnit,
Model model,
HttpServletResponse response ) throws Exception
{
EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter,
- ouMode, asc, desc, skipMeta, skipData, completedOnly, hierarchyMeta, coordinatesOnly, displayProperty, page, pageSize, i18nManager.getI18nFormat() );
+ ouMode, asc, desc, skipMeta, skipData, completedOnly, hierarchyMeta, coordinatesOnly, displayProperty, userOrgUnit, page, pageSize, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, CacheStrategy.RESPECT_SYSTEM_SETTING, "events.html", false );
Grid grid = analyticsService.getEvents( params );