dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #38796
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19703: Analytics. Added support for explicitly defining user org units
------------------------------------------------------------
revno: 19703
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-08-03 14:01:11 +0200
message:
Analytics. Added support for explicitly defining user org units
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/User.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsService.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/MockAnalyticsService.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/data/AnalyticsServiceTest.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/jdbc/AnalyticsDataSetReportStore.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AnalyticsController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/GeoFeatureController.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/user/User.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/User.java 2015-07-08 09:56:56 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/User.java 2015-08-03 12:01:11 +0000
@@ -43,12 +43,14 @@
import org.hisp.dhis.common.IdentifiableObjectUtils;
import org.hisp.dhis.common.MergeStrategy;
import org.hisp.dhis.common.annotation.Scanned;
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
import org.hisp.dhis.common.view.DetailedView;
import org.hisp.dhis.common.view.ExportView;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.schema.annotation.PropertyRange;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
@@ -197,6 +199,15 @@
{
return CollectionUtils.isEmpty( organisationUnits ) ? null : organisationUnits.iterator().next();
}
+
+ public List<OrganisationUnit> getSortedOrganisationUnits()
+ {
+ List<OrganisationUnit> sortedOrgUnits = new ArrayList<>( organisationUnits );
+
+ Collections.sort( sortedOrgUnits, IdentifiableObjectNameComparator.INSTANCE );
+
+ return sortedOrgUnits;
+ }
public boolean hasOrganisationUnit()
{
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsService.java 2015-06-23 18:09:55 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsService.java 2015-08-03 12:01:11 +0000
@@ -40,6 +40,7 @@
import org.hisp.dhis.common.IdentifiableProperty;
import org.hisp.dhis.common.IllegalQueryException;
import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
/**
* <p>This interface is responsible for retrieving aggregated data. Data will be
@@ -164,6 +165,7 @@
* @param displayProperty the property to display for meta-data.
* @param outputIdScheme the identifier scheme to use in the query response.
* @param approvalLevel the approval level identifier.
+ * @param userOrgUnit the user organisation unit to use, overrides current user.
* @param program the program identifier.
* @param stage the program stage identifier.
* @param format the i18n format.
@@ -171,7 +173,8 @@
*/
DataQueryParams getFromUrl( Set<String> dimensionParams, Set<String> filterParams, AggregationType aggregationType, String measureCriteria,
boolean skipMeta, boolean skipRounding, boolean hierarchyMeta, boolean ignoreLimit, boolean hideEmptyRows, boolean showHierarchy,
- DisplayProperty displayProperty, IdentifiableProperty outputIdScheme, String approvalLevel, String program, String stage, I18nFormat format );
+ DisplayProperty displayProperty, IdentifiableProperty outputIdScheme, String approvalLevel, String userOrgUnit,
+ String program, String stage, I18nFormat format );
/**
* Creates a data query parameter object from the given BaseAnalyticalObject.
@@ -186,10 +189,12 @@
* Creates a list of DimensionalObject from the given set of dimension params.
*
* @param dimensionParams the dimension URL params.
+ * @param userOrgUnit the user organisation unit param, overrides current
+ * user, can be null.
* @param format the i18n format.
* @return a list of DimensionalObject.
*/
- List<DimensionalObject> getDimensionalObjects( Set<String> dimensionParams, I18nFormat format );
+ List<DimensionalObject> getDimensionalObjects( Set<String> dimensionParams, String userOrgUnit, I18nFormat format );
/**
* Returns a persisted DimensionalObject generated from the given dimension
@@ -204,10 +209,13 @@
* @param dimension the dimension identifier.
* @param items the dimension items.
* @param relativePeriodDate the date to use for generating relative periods, can be null.
+ * @param userOrgUnits the list of user organisation units, overrides current
+ * user, can be null.
* @param format the I18nFormat, can be null.
* @param allowNull return null if no dimension was found.
* @throws IllegalQueryException if no dimensions was found.
* @return list of DimensionalObjects.
*/
- DimensionalObject getDimension( String dimension, List<String> items, Date relativePeriodDate, I18nFormat format, boolean allowNull );
+ DimensionalObject getDimension( String dimension, List<String> items, Date relativePeriodDate,
+ List<OrganisationUnit> userOrgUnits, I18nFormat format, boolean allowNull );
}
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java 2015-07-15 11:21:27 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java 2015-08-03 12:01:11 +0000
@@ -120,12 +120,24 @@
private static final DimensionItem[] DIM_OPT_ARR = new DimensionItem[0];
private static final DimensionItem[][] DIM_OPT_2D_ARR = new DimensionItem[0][];
+ /**
+ * The dimensions.
+ */
protected List<DimensionalObject> dimensions = new ArrayList<>();
+ /**
+ * The filters.
+ */
protected List<DimensionalObject> filters = new ArrayList<>();
+ /**
+ * The aggregation type.
+ */
protected AggregationType aggregationType;
-
+
+ /**
+ * The measure criteria, which is measure filters and corresponding values.
+ */
protected Map<MeasureFilter, Double> measureCriteria = new HashMap<>();
/**
@@ -178,7 +190,7 @@
* The required approval level identifier for data to be included in query response.
*/
protected String approvalLevel;
-
+
// -------------------------------------------------------------------------
// Event properties
// -------------------------------------------------------------------------
@@ -903,7 +915,7 @@
}
/**
- * Indicates whether this params defines an identifier scheme different from
+ * Indicates whether this query defines an identifier scheme different from
* UID.
*/
public boolean hasNonUidOutputIdScheme()
@@ -912,7 +924,7 @@
}
/**
- * Indicates whether this params specifies data approval levels.
+ * Indicates whether this query specifies data approval levels.
*/
public boolean isDataApproval()
{
@@ -920,14 +932,13 @@
}
/**
- * Indicates whether this params specifies a approval level.
- * @return
+ * Indicates whether this query specifies a approval level.
*/
public boolean hasApprovalLevel()
{
return approvalLevel != null;
}
-
+
/**
* Ignore data approval constraints for this query.
*/
@@ -937,7 +948,7 @@
}
/**
- * Indicates whether this params requires aggregation of data. No aggregation
+ * Indicates whether this query requires aggregation of data. No aggregation
* takes place if aggregation type is none or if data type is text.
*/
public boolean isAggregation()
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java 2015-08-03 10:21:51 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java 2015-08-03 12:01:11 +0000
@@ -973,21 +973,21 @@
public DataQueryParams getFromUrl( Set<String> dimensionParams, Set<String> filterParams, AggregationType aggregationType,
String measureCriteria, boolean skipMeta, boolean skipRounding, boolean hierarchyMeta, boolean ignoreLimit,
boolean hideEmptyRows, boolean showHierarchy, DisplayProperty displayProperty, IdentifiableProperty outputIdScheme,
- String approvalLevel, String program, String stage, I18nFormat format )
+ String approvalLevel, String userOrgUnit, String program, String stage, I18nFormat format )
{
DataQueryParams params = new DataQueryParams();
-
+
params.setAggregationType( aggregationType );
params.setIgnoreLimit( ignoreLimit );
if ( dimensionParams != null && !dimensionParams.isEmpty() )
{
- params.addDimensions( getDimensionalObjects( dimensionParams, format ) );
+ params.addDimensions( getDimensionalObjects( dimensionParams, userOrgUnit, format ) );
}
if ( filterParams != null && !filterParams.isEmpty() )
{
- params.getFilters().addAll( getDimensionalObjects( filterParams, format ) );
+ params.getFilters().addAll( getDimensionalObjects( filterParams, userOrgUnit, format ) );
}
if ( measureCriteria != null && !measureCriteria.isEmpty() )
@@ -1003,7 +1003,7 @@
params.setDisplayProperty( displayProperty );
params.setOutputIdScheme( outputIdScheme );
params.setApprovalLevel( approvalLevel );
-
+
if ( program != null )
{
params.setProgram( programService.getProgram( program ) );
@@ -1021,7 +1021,7 @@
public DataQueryParams getFromAnalyticalObject( AnalyticalObject object, I18nFormat format )
{
DataQueryParams params = new DataQueryParams();
-
+
if ( object != null )
{
Date date = object.getRelativePeriodDate();
@@ -1030,17 +1030,17 @@
for ( DimensionalObject column : object.getColumns() )
{
- params.addDimension( getDimension( column.getDimension(), getUids( column.getItems() ), date, format, false ) );
+ params.addDimension( getDimension( column.getDimension(), getUids( column.getItems() ), date, null, format, false ) );
}
for ( DimensionalObject row : object.getRows() )
{
- params.addDimension( getDimension( row.getDimension(), getUids( row.getItems() ), date, format, false ) );
+ params.addDimension( getDimension( row.getDimension(), getUids( row.getItems() ), date, null, format, false ) );
}
for ( DimensionalObject filter : object.getFilters() )
{
- params.getFilters().add( getDimension( filter.getDimension(), getUids( filter.getItems() ), date, format, false ) );
+ params.getFilters().add( getDimension( filter.getDimension(), getUids( filter.getItems() ), date, null, format, false ) );
}
}
@@ -1048,9 +1048,11 @@
}
@Override
- public List<DimensionalObject> getDimensionalObjects( Set<String> dimensionParams, I18nFormat format )
+ public List<DimensionalObject> getDimensionalObjects( Set<String> dimensionParams, String userOrgUnit, I18nFormat format )
{
List<DimensionalObject> list = new ArrayList<>();
+
+ List<OrganisationUnit> userOrgUnits = getUserOrgUnits( userOrgUnit );
if ( dimensionParams != null )
{
@@ -1061,7 +1063,7 @@
if ( dimension != null && items != null )
{
- list.add( getDimension( dimension, items, null, format, false ) );
+ list.add( getDimension( dimension, items, null, userOrgUnits, format, false ) );
}
}
}
@@ -1073,7 +1075,8 @@
// TODO optimize so that org unit levels + boundary are used in query instead of fetching all org units one by one
@Override
- public DimensionalObject getDimension( String dimension, List<String> items, Date relativePeriodDate, I18nFormat format, boolean allowNull )
+ public DimensionalObject getDimension( String dimension, List<String> items, Date relativePeriodDate,
+ List<OrganisationUnit> userOrgUnits, I18nFormat format, boolean allowNull )
{
final boolean allItems = items.isEmpty();
@@ -1215,24 +1218,21 @@
if ( ORGUNIT_DIM_ID.equals( dimension ) )
{
- User user = currentUserService.getCurrentUser();
- Set<OrganisationUnit> userOrgUnits = user != null ? user.getOrganisationUnits() : new HashSet<OrganisationUnit>();
-
List<NameableObject> ous = new UniqueArrayList<>();
List<Integer> levels = new UniqueArrayList<>();
List<OrganisationUnitGroup> groups = new UniqueArrayList<>();
for ( String ou : items )
{
- if ( KEY_USER_ORGUNIT.equals( ou ) && !userOrgUnits.isEmpty() )
+ if ( KEY_USER_ORGUNIT.equals( ou ) && userOrgUnits != null && !userOrgUnits.isEmpty() )
{
ous.addAll( userOrgUnits );
}
- else if ( KEY_USER_ORGUNIT_CHILDREN.equals( ou ) && !userOrgUnits.isEmpty() )
+ else if ( KEY_USER_ORGUNIT_CHILDREN.equals( ou ) && userOrgUnits != null && !userOrgUnits.isEmpty() )
{
ous.addAll( OrganisationUnit.getSortedChildren( userOrgUnits ) );
}
- else if ( KEY_USER_ORGUNIT_GRANDCHILDREN.equals( ou ) && !userOrgUnits.isEmpty() )
+ else if ( KEY_USER_ORGUNIT_GRANDCHILDREN.equals( ou ) && userOrgUnits != null && !userOrgUnits.isEmpty() )
{
ous.addAll( OrganisationUnit.getSortedGrandChildren( userOrgUnits ) );
}
@@ -1529,6 +1529,42 @@
return metaData;
}
+
+ /**
+ * Returns a list of user organisation units, looking first at the given user
+ * org unit parameter, second at the organisation units associated with the
+ * current user. Returns an empty list if no organisation units are found.
+ *
+ * @param userOrgUnit the user org unit parameter string.
+ * @return a list of organisation units.
+ */
+ private List<OrganisationUnit> getUserOrgUnits( String userOrgUnit)
+ {
+ List<OrganisationUnit> units = new ArrayList<>();
+
+ User currentUser = currentUserService.getCurrentUser();
+
+ if ( userOrgUnit != null )
+ {
+ List<String> ous = DimensionalObjectUtils.getItemsFromParam( userOrgUnit );
+
+ for ( String ou : ous )
+ {
+ OrganisationUnit unit = idObjectManager.get( OrganisationUnit.class, ou );
+
+ if ( unit != null )
+ {
+ units.add( unit );
+ }
+ }
+ }
+ else if ( currentUser != null && currentUser.hasOrganisationUnit() )
+ {
+ units = currentUser.getSortedOrganisationUnits();
+ }
+
+ return units;
+ }
/**
* Gets the number of available cores. Uses explicit number from system
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/MockAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/MockAnalyticsService.java 2015-06-23 18:11:13 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/MockAnalyticsService.java 2015-08-03 12:01:11 +0000
@@ -43,6 +43,7 @@
import org.hisp.dhis.common.Grid;
import org.hisp.dhis.common.IdentifiableProperty;
import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
/**
* Configurable mock implementation of AnalyticsService for testing purposes.
@@ -84,7 +85,8 @@
@Override
public DataQueryParams getFromUrl( Set<String> dimensionParams, Set<String> filterParams, AggregationType aggregationType,
String measureCriteria, boolean skipMeta, boolean skipRounding, boolean hierarchyMeta, boolean ignoreLimit, boolean hideEmptyRows,
- boolean showHierarchy, DisplayProperty displayProperty, IdentifiableProperty idScheme, String approvalLevel, String program, String stage, I18nFormat format )
+ boolean showHierarchy, DisplayProperty displayProperty, IdentifiableProperty idScheme, String approvalLevel, String userOrgUnit,
+ String program, String stage, I18nFormat format )
{
throw new NotImplementedException("");
}
@@ -96,14 +98,14 @@
}
@Override
- public List<DimensionalObject> getDimensionalObjects( Set<String> dimensionParams, I18nFormat format )
+ public List<DimensionalObject> getDimensionalObjects( Set<String> dimensionParams, String userOrgUnit, I18nFormat format )
{
throw new NotImplementedException("");
}
@Override
public DimensionalObject getDimension( String dimension, List<String> items, Date relativePeriodDate,
- I18nFormat format, boolean allowNull )
+ List<OrganisationUnit> userOrgUnits, I18nFormat format, boolean allowNull )
{
throw new NotImplementedException("");
}
=== 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-08-02 14:59:59 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java 2015-08-03 12:01:11 +0000
@@ -432,7 +432,7 @@
{
String dimensionId = getDimensionFromParam( dim );
List<String> items = getDimensionItemsFromParam( dim );
- DimensionalObject dimObj = analyticsService.getDimension( dimensionId, items, null, format, true );
+ DimensionalObject dimObj = analyticsService.getDimension( dimensionId, items, null, null, format, true );
if ( dimObj != null )
{
@@ -451,7 +451,7 @@
{
String dimensionId = getDimensionFromParam( dim );
List<String> items = getDimensionItemsFromParam( dim );
- DimensionalObject dimObj = analyticsService.getDimension( dimensionId, items, null, format, true );
+ DimensionalObject dimObj = analyticsService.getDimension( dimensionId, items, null, null, format, true );
if ( dimObj != null )
{
@@ -509,7 +509,7 @@
for ( DimensionalObject dimension : ListUtils.union( object.getColumns(), object.getRows() ) )
{
DimensionalObject dimObj = analyticsService.
- getDimension( dimension.getDimension(), getUids( dimension.getItems() ), date, format, true );
+ getDimension( dimension.getDimension(), getUids( dimension.getItems() ), date, null, format, true );
if ( dimObj != null )
{
@@ -524,7 +524,7 @@
for ( DimensionalObject filter : object.getFilters() )
{
DimensionalObject dimObj = analyticsService.
- getDimension( filter.getDimension(), getUids( filter.getItems() ), date, format, true );
+ getDimension( filter.getDimension(), getUids( filter.getItems() ), date, null, format, true );
if ( dimObj != null )
{
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsServiceTest.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsServiceTest.java 2015-06-26 17:13:14 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsServiceTest.java 2015-08-03 12:01:11 +0000
@@ -193,7 +193,7 @@
filterParams.add( "ou:" + ouA.getUid() + ";" + ouB.getUid() + ";" + ouC.getUid() + ";" + ouD.getUid() + ";" + ouE.getUid() );
DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null,
- false, false, false, false, false, false, null, null, null, null, null, null );
+ false, false, false, false, false, false, null, null, null, null, null, null, null );
assertEquals( 4, params.getDataElements().size() );
assertEquals( 3, params.getPeriods().size() );
@@ -211,7 +211,7 @@
filterParams.add( "ou:" + ouA.getUid() );
DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null,
- false, false, false, false, false, false, null, null, null, null, null, null );
+ false, false, false, false, false, false, null, null, null, null, null, null, null );
assertEquals( 4, params.getDataElements().size() );
assertEquals( 1, params.getFilterOrganisationUnits().size() );
@@ -227,7 +227,7 @@
filterParams.add( "ou:" + ouA.getUid() );
DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null,
- false, false, false, false, false, false, null, null, null, null, null, null );
+ false, false, false, false, false, false, null, null, null, null, null, null, null );
assertEquals( 2, params.getDataElements().size() );
assertEquals( 2, params.getProgramDataElements().size() );
@@ -244,7 +244,7 @@
filterParams.add( "ou:" + ouA.getUid() );
DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null,
- false, false, false, false, false, false, null, null, null, null, null, null );
+ false, false, false, false, false, false, null, null, null, null, null, null, null );
assertEquals( 2, params.getDataElements().size() );
assertEquals( 2, params.getProgramAttributes().size() );
@@ -263,7 +263,7 @@
filterParams.add( "ou:" + ouA.getUid() + ";" + ouB.getUid() + ";" + ouC.getUid() );
DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null,
- false, false, false, false, false, false, null, null, null, null, null, null );
+ false, false, false, false, false, false, null, null, null, null, null, null, null );
assertEquals( 3, params.getDataElements().size() );
assertEquals( 2, params.getPeriods().size() );
@@ -282,7 +282,7 @@
filterParams.add( "ou:" + ouA.getUid() + ";" + ouB.getUid() );
DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null,
- false, false, false, false, false, false, null, null, null, null, null, null );
+ false, false, false, false, false, false, null, null, null, null, null, null, null );
assertEquals( 4, params.getDataElements().size() );
assertEquals( 12, params.getPeriods().size() );
@@ -298,7 +298,7 @@
dimensionParams.add( "pe:2011;2012" );
DataQueryParams params = analyticsService.getFromUrl( dimensionParams, null, null, null,
- false, false, false, false, false, false, null, null, null, null, null, null );
+ false, false, false, false, false, false, null, null, null, null, null, null, null );
assertEquals( 1, params.getOrganisationUnits().size() );
assertEquals( 2, params.getDataElements().size() );
@@ -314,7 +314,7 @@
dimensionParams.add( "pe:2011;2012" );
DataQueryParams params = analyticsService.getFromUrl( dimensionParams, null, null, null,
- false, false, false, false, false, false, null, null, null, null, null, null );
+ false, false, false, false, false, false, null, null, null, null, null, null, null );
assertEquals( 3, params.getOrganisationUnits().size() );
assertEquals( 2, params.getDataElements().size() );
@@ -330,7 +330,7 @@
dimensionParams.add( "pe:2011;2012" );
DataQueryParams params = analyticsService.getFromUrl( dimensionParams, null, null, null,
- false, false, false, false, false, false, null, null, null, null, null, null );
+ false, false, false, false, false, false, null, null, null, null, null, null, null );
assertEquals( 2, params.getOrganisationUnits().size() );
assertEquals( 2, params.getDataElements().size() );
@@ -345,7 +345,7 @@
dimensionParams.add( "pe:2012,2012S1,2012S2" );
analyticsService.getFromUrl( dimensionParams, null, null, null,
- false, false, false, false, false, false, null, null, null, null, null, null );
+ false, false, false, false, false, false, null, null, null, null, null, null, null );
}
@Test( expected = IllegalQueryException.class )
@@ -356,7 +356,7 @@
dimensionParams.add( "pe" );
analyticsService.getFromUrl( dimensionParams, null, null, null,
- false, false, false, false, false, false, null, null, null, null, null, null );
+ false, false, false, false, false, false, null, null, null, null, null, null, null );
}
@Test( expected = IllegalQueryException.class )
@@ -367,7 +367,7 @@
dimensionParams.add( "ou" );
analyticsService.getFromUrl( dimensionParams, null, null, null,
- false, false, false, false, false, false, null, null, null, null, null, null );
+ false, false, false, false, false, false, null, null, null, null, null, null, null );
}
@Test( expected = IllegalQueryException.class )
@@ -378,7 +378,7 @@
dimensionParams.add( "yebo:2012,2012S1,2012S2" );
analyticsService.getFromUrl( dimensionParams, null, null, null,
- false, false, false, false, false, false, null, null, null, null, null, null );
+ false, false, false, false, false, false, null, null, null, null, null, null, null );
}
@Test
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/jdbc/AnalyticsDataSetReportStore.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/jdbc/AnalyticsDataSetReportStore.java 2015-07-03 11:42:28 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/jdbc/AnalyticsDataSetReportStore.java 2015-08-03 12:01:11 +0000
@@ -88,7 +88,7 @@
if ( dimensions != null )
{
- params.setFilters( analyticsService.getDimensionalObjects( dimensions, null ) );
+ params.setFilters( analyticsService.getDimensionalObjects( dimensions, null, null ) );
}
Map<String, Object> map = analyticsService.getAggregatedDataValueMapping( params );
@@ -137,7 +137,7 @@
if ( dimensions != null )
{
- params.setFilters( analyticsService.getDimensionalObjects( dimensions, null ) );
+ params.setFilters( analyticsService.getDimensionalObjects( dimensions, null, null ) );
}
Map<String, Object> map = analyticsService.getAggregatedDataValueMapping( params );
@@ -173,7 +173,7 @@
if ( dimensions != null )
{
- params.setFilters( analyticsService.getDimensionalObjects( dimensions, null ) );
+ params.setFilters( analyticsService.getDimensionalObjects( dimensions, null, null ) );
}
Map<String, Object> map = analyticsService.getAggregatedDataValueMapping( params );
@@ -207,7 +207,7 @@
if ( dimensions != null )
{
- params.setFilters( analyticsService.getDimensionalObjects( dimensions, null ) );
+ params.setFilters( analyticsService.getDimensionalObjects( dimensions, null, null ) );
}
Map<String, Object> map = analyticsService.getAggregatedDataValueMapping( params );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AnalyticsController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AnalyticsController.java 2015-08-03 10:39:50 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AnalyticsController.java 2015-08-03 12:01:11 +0000
@@ -90,6 +90,7 @@
@RequestParam( required = false ) DisplayProperty displayProperty,
@RequestParam( required = false ) IdentifiableProperty outputIdScheme,
@RequestParam( required = false ) String approvalLevel,
+ @RequestParam( required = false ) String userOrgUnit,
@RequestParam( required = false ) String program,
@RequestParam( required = false ) String stage,
@RequestParam( required = false ) String columns,
@@ -97,8 +98,8 @@
Model model,
HttpServletResponse response ) throws Exception
{
- DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipRounding,
- hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, program, stage, i18nManager.getI18nFormat() );
+ DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipRounding, hierarchyMeta,
+ ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, userOrgUnit, program, stage, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_JSON, CacheStrategy.RESPECT_SYSTEM_SETTING );
Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getItemsFromParam( columns ), getItemsFromParam( rows ) );
@@ -123,6 +124,7 @@
@RequestParam( required = false ) DisplayProperty displayProperty,
@RequestParam( required = false ) IdentifiableProperty outputIdScheme,
@RequestParam( required = false ) String approvalLevel,
+ @RequestParam( required = false ) String userOrgUnit,
@RequestParam( required = false ) String program,
@RequestParam( required = false ) String stage,
@RequestParam( required = false ) String columns,
@@ -130,8 +132,8 @@
Model model,
HttpServletResponse response ) throws Exception
{
- DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipRounding,
- hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, program, stage, i18nManager.getI18nFormat() );
+ DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipRounding, hierarchyMeta,
+ ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, userOrgUnit, program, stage, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_XML, CacheStrategy.RESPECT_SYSTEM_SETTING );
Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getItemsFromParam( columns ), getItemsFromParam( rows ) );
@@ -154,6 +156,7 @@
@RequestParam( required = false ) DisplayProperty displayProperty,
@RequestParam( required = false ) IdentifiableProperty outputIdScheme,
@RequestParam( required = false ) String approvalLevel,
+ @RequestParam( required = false ) String userOrgUnit,
@RequestParam( required = false ) String program,
@RequestParam( required = false ) String stage,
@RequestParam( required = false ) String columns,
@@ -161,8 +164,8 @@
Model model,
HttpServletResponse response ) throws Exception
{
- DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipRounding,
- hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, program, stage, i18nManager.getI18nFormat() );
+ DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipRounding, hierarchyMeta,
+ ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, userOrgUnit, program, stage, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, CacheStrategy.RESPECT_SYSTEM_SETTING );
Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getItemsFromParam( columns ), getItemsFromParam( rows ) );
@@ -185,6 +188,7 @@
@RequestParam( required = false ) DisplayProperty displayProperty,
@RequestParam( required = false ) IdentifiableProperty outputIdScheme,
@RequestParam( required = false ) String approvalLevel,
+ @RequestParam( required = false ) String userOrgUnit,
@RequestParam( required = false ) String program,
@RequestParam( required = false ) String stage,
@RequestParam( required = false ) String columns,
@@ -192,8 +196,8 @@
Model model,
HttpServletResponse response ) throws Exception
{
- DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipRounding,
- hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, program, stage, i18nManager.getI18nFormat() );
+ DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipRounding, hierarchyMeta,
+ ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, userOrgUnit, program, stage, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, CacheStrategy.RESPECT_SYSTEM_SETTING );
Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getItemsFromParam( columns ), getItemsFromParam( rows ) );
@@ -216,6 +220,7 @@
@RequestParam( required = false ) DisplayProperty displayProperty,
@RequestParam( required = false ) IdentifiableProperty outputIdScheme,
@RequestParam( required = false ) String approvalLevel,
+ @RequestParam( required = false ) String userOrgUnit,
@RequestParam( required = false ) String program,
@RequestParam( required = false ) String stage,
@RequestParam( required = false ) String columns,
@@ -223,8 +228,8 @@
Model model,
HttpServletResponse response ) throws Exception
{
- DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipRounding,
- hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, program, stage, i18nManager.getI18nFormat() );
+ DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipRounding, hierarchyMeta,
+ ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, userOrgUnit, program, stage, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_CSV, CacheStrategy.RESPECT_SYSTEM_SETTING, "data.csv", true );
Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getItemsFromParam( columns ), getItemsFromParam( rows ) );
@@ -247,6 +252,7 @@
@RequestParam( required = false ) DisplayProperty displayProperty,
@RequestParam( required = false ) IdentifiableProperty outputIdScheme,
@RequestParam( required = false ) String approvalLevel,
+ @RequestParam( required = false ) String userOrgUnit,
@RequestParam( required = false ) String program,
@RequestParam( required = false ) String stage,
@RequestParam( required = false ) String columns,
@@ -254,8 +260,8 @@
Model model,
HttpServletResponse response ) throws Exception
{
- DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipRounding,
- hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, program, stage, i18nManager.getI18nFormat() );
+ DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipRounding, hierarchyMeta,
+ ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, userOrgUnit, program, stage, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_EXCEL, CacheStrategy.RESPECT_SYSTEM_SETTING, "data.xls", true );
Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getItemsFromParam( columns ), getItemsFromParam( rows ) );
@@ -278,6 +284,7 @@
@RequestParam( required = false ) DisplayProperty displayProperty,
@RequestParam( required = false ) IdentifiableProperty outputIdScheme,
@RequestParam( required = false ) Integer approvalLevel,
+ @RequestParam( required = false ) String userOrgUnit,
@RequestParam( required = false ) String program,
@RequestParam( required = false ) String stage,
@RequestParam( required = false ) String columns,
@@ -286,7 +293,7 @@
HttpServletResponse response ) throws Exception
{
DataQueryParams params = analyticsService.getFromUrl( dimension, filter, null, null,
- true, false, false, false, false, false, null, null, null, null, null, i18nManager.getI18nFormat() );
+ true, false, false, false, false, false, null, null, null, null, null, null, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_XML, CacheStrategy.RESPECT_SYSTEM_SETTING, "data.jrxml", false );
Grid grid = analyticsService.getAggregatedDataValues( params );
@@ -310,6 +317,7 @@
@RequestParam( required = false ) DisplayProperty displayProperty,
@RequestParam( required = false ) IdentifiableProperty outputIdScheme,
@RequestParam( required = false ) String approvalLevel,
+ @RequestParam( required = false ) String userOrgUnit,
@RequestParam( required = false ) String program,
@RequestParam( required = false ) String stage,
@RequestParam( required = false ) String columns,
@@ -317,8 +325,8 @@
Model model,
HttpServletResponse response ) throws Exception
{
- DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipRounding,
- hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, program, stage, i18nManager.getI18nFormat() );
+ DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipRounding, hierarchyMeta,
+ ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, userOrgUnit, program, stage, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_TEXT, CacheStrategy.NO_CACHE, "debug.sql", false );
return AnalyticsUtils.getDebugDataSql( params );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/GeoFeatureController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/GeoFeatureController.java 2015-07-08 08:27:27 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/GeoFeatureController.java 2015-08-03 12:01:11 +0000
@@ -138,7 +138,7 @@
set.add( ou );
DataQueryParams params = analyticsService.getFromUrl( set, null, AggregationType.SUM, null,
- false, false, false, false, false, false, displayProperty, null, null, null, null, null );
+ false, false, false, false, false, false, displayProperty, null, null, null, null, null, null );
DimensionalObject dim = params.getDimension( DimensionalObject.ORGUNIT_DIM_ID );