dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #33095
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16853: Analytics. Added support for displayProperty query parameter. Supports NAME and SHORNAME.
------------------------------------------------------------
revno: 16853
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-09-29 18:10:58 +0200
message:
Analytics. Added support for displayProperty query parameter. Supports NAME and SHORNAME.
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DisplayProperty.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectUtils.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/dimension/DefaultDimensionService.java
dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsServiceTest.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/common/DimensionalObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObject.java 2014-09-29 14:21:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObject.java 2014-09-29 16:10:58 +0000
@@ -76,7 +76,7 @@
PERIOD_DIM_ID, "Period",
ORGUNIT_DIM_ID, "Organisation unit" );
- final Map<DimensionType, Class<? extends DimensionalObject>> DIMENSION_TYPE_CLASS_MAP = new HashMap<DimensionType, Class<? extends DimensionalObject>>() { {
+ final Map<DimensionType, Class<? extends DimensionalObject>> DYNAMIC_DIMENSION_TYPE_CLASS_MAP = new HashMap<DimensionType, Class<? extends DimensionalObject>>() { {
put( DimensionType.CATEGORY, DataElementCategory.class );
put( DimensionType.DATAELEMENT_GROUPSET, DataElementGroupSet.class );
put( DimensionType.ORGANISATIONUNIT_GROUPSET, OrganisationUnitGroupSet.class );
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DisplayProperty.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DisplayProperty.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DisplayProperty.java 2014-09-29 16:10:58 +0000
@@ -0,0 +1,37 @@
+package org.hisp.dhis.common;
+
+/*
+ * Copyright (c) 2004-2014, 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.
+ */
+
+/**
+ * @author Lars Helge Overland
+ */
+public enum DisplayProperty
+{
+ NAME, SHORTNAME
+}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObject.java 2014-03-27 04:44:41 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObject.java 2014-09-29 16:10:58 +0000
@@ -35,6 +35,9 @@
import java.util.Date;
import java.util.Set;
+/**
+ * @author Lars Helge Overland
+ */
public interface IdentifiableObject
extends ImportableObject, LinkableObject, Comparable<IdentifiableObject>, Mergeable<IdentifiableObject>
{
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectUtils.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectUtils.java 2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectUtils.java 2014-09-29 16:10:58 +0000
@@ -39,9 +39,12 @@
import java.util.ListIterator;
import java.util.Map;
+import org.hisp.dhis.calendar.Calendar;
+import org.hisp.dhis.calendar.DateTimeUnit;
import org.hisp.dhis.dataelement.DataElementCategory;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryOption;
+import org.hisp.dhis.period.Period;
/**
* @author Lars Helge Overland
@@ -105,6 +108,28 @@
return uids;
}
+
+ /**
+ * Returns a list of iso period identifiers for the given collection of
+ * periods and calendar.
+ *
+ * @param periods the list of periods.
+ * @param calendar the calendar to use for generation of iso periods.
+ * @return a list of iso period identifiers.
+ */
+ public static <T extends IdentifiableObject> List<String> getIsoPeriods( Collection<T> periods, Calendar calendar )
+ {
+ List<String> isoPeriods = new ArrayList<>();
+
+ for ( IdentifiableObject object : periods )
+ {
+ Period period = (Period) object;
+ DateTimeUnit dateTimeUnit = calendar.fromIso( period.getStartDate() );
+ isoPeriods.add( period.getPeriodType().getIsoDate( dateTimeUnit ) );
+ }
+
+ return isoPeriods;
+ }
/**
* Returns a list of internal identifiers for the given collection of IdentifiableObjects.
=== 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 2014-07-15 14:36:07 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsService.java 2014-09-29 16:10:58 +0000
@@ -35,6 +35,7 @@
import org.hisp.dhis.common.AnalyticalObject;
import org.hisp.dhis.common.DimensionalObject;
+import org.hisp.dhis.common.DisplayProperty;
import org.hisp.dhis.common.Grid;
import org.hisp.dhis.common.IllegalQueryException;
import org.hisp.dhis.i18n.I18nFormat;
@@ -156,11 +157,12 @@
* @param ignoreLimit whether to ignore the max number of cells limit.
* @param hideEmptyRows whether to hide rows without data values, applis to table layout.
* @param showHierarchy whether to show the org unit hierarchy together with the name.
+ * @param displayProperty the property to display for meta-data.
* @param format the i18n format.
* @return a data query parameter object created based on the given URL info.
*/
DataQueryParams getFromUrl( Set<String> dimensionParams, Set<String> filterParams, AggregationType aggregationType, String measureCriteria,
- boolean skipMeta, boolean skipRounding, boolean hierarchyMeta, boolean ignoreLimit, boolean hideEmptyRows, boolean showHierarchy, I18nFormat format );
+ boolean skipMeta, boolean skipRounding, boolean hierarchyMeta, boolean ignoreLimit, boolean hideEmptyRows, boolean showHierarchy, DisplayProperty displayProperty, I18nFormat format );
/**
* Creates a data query parameter object from the given BaseAnalyticalObject.
=== 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 2014-09-24 07:43:19 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java 2014-09-29 16:10:58 +0000
@@ -63,6 +63,7 @@
import org.hisp.dhis.common.DimensionType;
import org.hisp.dhis.common.DimensionalObject;
import org.hisp.dhis.common.DimensionalObjectUtils;
+import org.hisp.dhis.common.DisplayProperty;
import org.hisp.dhis.common.ListMap;
import org.hisp.dhis.common.NameableObject;
import org.hisp.dhis.dataelement.DataElement;
@@ -146,6 +147,11 @@
*/
private boolean showHierarchy;
+ /**
+ * Indicates which property to display for meta-data.
+ */
+ private DisplayProperty displayProperty;
+
// -------------------------------------------------------------------------
// Transient properties
// -------------------------------------------------------------------------
@@ -213,6 +219,7 @@
params.skipPartitioning = this.skipPartitioning;
params.organisationUnits = new ArrayList<>( this.organisationUnits );
params.dataApprovalLevels = new HashMap<>( this.dataApprovalLevels );
+ params.displayProperty = this.displayProperty;
return params;
}
@@ -1171,6 +1178,16 @@
this.showHierarchy = showHierarchy;
}
+ public DisplayProperty getDisplayProperty()
+ {
+ return displayProperty;
+ }
+
+ public void setDisplayProperty( DisplayProperty displayProperty )
+ {
+ this.displayProperty = displayProperty;
+ }
+
// -------------------------------------------------------------------------
// Get and set methods for transient properties
// -------------------------------------------------------------------------
=== 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 2014-09-29 14:21:33 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java 2014-09-29 16:10:58 +0000
@@ -28,6 +28,54 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.hisp.dhis.analytics.AnalyticsTableManager.ANALYTICS_TABLE_NAME;
+import static org.hisp.dhis.analytics.AnalyticsTableManager.COMPLETENESS_TABLE_NAME;
+import static org.hisp.dhis.analytics.AnalyticsTableManager.COMPLETENESS_TARGET_TABLE_NAME;
+import static org.hisp.dhis.analytics.AnalyticsTableManager.ORGUNIT_TARGET_TABLE_NAME;
+import static org.hisp.dhis.analytics.DataQueryParams.DISPLAY_NAME_CATEGORYOPTIONCOMBO;
+import static org.hisp.dhis.analytics.DataQueryParams.DISPLAY_NAME_DATA_X;
+import static org.hisp.dhis.analytics.DataQueryParams.DISPLAY_NAME_LATITUDE;
+import static org.hisp.dhis.analytics.DataQueryParams.DISPLAY_NAME_LONGITUDE;
+import static org.hisp.dhis.analytics.DataQueryParams.DISPLAY_NAME_ORGUNIT;
+import static org.hisp.dhis.analytics.DataQueryParams.DISPLAY_NAME_PERIOD;
+import static org.hisp.dhis.analytics.DataQueryParams.FIXED_DIMS;
+import static org.hisp.dhis.common.DimensionalObject.CATEGORYOPTIONCOMBO_DIM_ID;
+import static org.hisp.dhis.common.DimensionalObject.DATAELEMENT_DIM_ID;
+import static org.hisp.dhis.common.DimensionalObject.DATASET_DIM_ID;
+import static org.hisp.dhis.common.DimensionalObject.DATA_X_DIM_ID;
+import static org.hisp.dhis.common.DimensionalObject.DIMENSION_SEP;
+import static org.hisp.dhis.common.DimensionalObject.INDICATOR_DIM_ID;
+import static org.hisp.dhis.common.DimensionalObject.LATITUDE_DIM_ID;
+import static org.hisp.dhis.common.DimensionalObject.LONGITUDE_DIM_ID;
+import static org.hisp.dhis.common.DimensionalObject.ORGUNIT_DIM_ID;
+import static org.hisp.dhis.common.DimensionalObject.PERIOD_DIM_ID;
+import static org.hisp.dhis.common.DimensionalObjectUtils.toDimension;
+import static org.hisp.dhis.common.IdentifiableObjectUtils.getIsoPeriods;
+import static org.hisp.dhis.common.IdentifiableObjectUtils.getUids;
+import static org.hisp.dhis.common.NameableObjectUtils.asList;
+import static org.hisp.dhis.common.NameableObjectUtils.asTypedList;
+import static org.hisp.dhis.organisationunit.OrganisationUnit.KEY_LEVEL;
+import static org.hisp.dhis.organisationunit.OrganisationUnit.KEY_ORGUNIT_GROUP;
+import static org.hisp.dhis.organisationunit.OrganisationUnit.KEY_USER_ORGUNIT;
+import static org.hisp.dhis.organisationunit.OrganisationUnit.KEY_USER_ORGUNIT_CHILDREN;
+import static org.hisp.dhis.organisationunit.OrganisationUnit.KEY_USER_ORGUNIT_GRANDCHILDREN;
+import static org.hisp.dhis.organisationunit.OrganisationUnit.getParentGraphMap;
+import static org.hisp.dhis.organisationunit.OrganisationUnit.getParentNameGraphMap;
+import static org.hisp.dhis.period.PeriodType.getPeriodTypeFromIsoString;
+import static org.hisp.dhis.reporttable.ReportTable.IRT2D;
+import static org.hisp.dhis.reporttable.ReportTable.addIfEmpty;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Future;
+
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -49,9 +97,9 @@
import org.hisp.dhis.common.DimensionType;
import org.hisp.dhis.common.DimensionalObject;
import org.hisp.dhis.common.DimensionalObjectUtils;
+import org.hisp.dhis.common.DisplayProperty;
import org.hisp.dhis.common.Grid;
import org.hisp.dhis.common.GridHeader;
-import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.common.IdentifiableObjectUtils;
import org.hisp.dhis.common.IllegalQueryException;
import org.hisp.dhis.common.NameableObject;
@@ -97,29 +145,6 @@
import org.hisp.dhis.user.User;
import org.springframework.beans.factory.annotation.Autowired;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.Future;
-
-import static org.hisp.dhis.analytics.AnalyticsTableManager.*;
-import static org.hisp.dhis.analytics.DataQueryParams.*;
-import static org.hisp.dhis.common.DimensionalObject.*;
-import static org.hisp.dhis.common.DimensionalObjectUtils.toDimension;
-import static org.hisp.dhis.common.IdentifiableObjectUtils.getUids;
-import static org.hisp.dhis.common.NameableObjectUtils.asList;
-import static org.hisp.dhis.common.NameableObjectUtils.asTypedList;
-import static org.hisp.dhis.organisationunit.OrganisationUnit.*;
-import static org.hisp.dhis.period.PeriodType.getPeriodTypeFromIsoString;
-import static org.hisp.dhis.reporttable.ReportTable.IRT2D;
-import static org.hisp.dhis.reporttable.ReportTable.addIfEmpty;
-
/**
* @author Lars Helge Overland
*/
@@ -480,12 +505,7 @@
}
else
{
- for ( NameableObject nameableObject : params.getDimensionOrFilter( PERIOD_DIM_ID ) )
- {
- Period period = (Period) nameableObject;
- DateTimeUnit dateTimeUnit = calendar.fromIso( period.getStartDate() );
- periodUids.add( period.getPeriodType().getIsoDate( dateTimeUnit ) );
- }
+ periodUids = getIsoPeriods( params.getDimensionOrFilter( PERIOD_DIM_ID ), calendar );
}
metaData.put( PERIOD_DIM_ID, periodUids );
@@ -772,7 +792,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, I18nFormat format )
+ String measureCriteria, boolean skipMeta, boolean skipRounding, boolean hierarchyMeta, boolean ignoreLimit,
+ boolean hideEmptyRows, boolean showHierarchy, DisplayProperty displayProperty, I18nFormat format )
{
DataQueryParams params = new DataQueryParams();
@@ -817,6 +838,7 @@
params.setHierarchyMeta( hierarchyMeta );
params.setHideEmptyRows( hideEmptyRows );
params.setShowHierarchy( showHierarchy );
+ params.setDisplayProperty( displayProperty );
return params;
}
@@ -1134,7 +1156,7 @@
* Replaces the indicator dimension including items with the data elements
* part of the indicator expressions.
*
- * @param params the data query parameters.
+ * @param params the data query parameters.
* @param indicatorIndex the index of the indicator dimension in the given query.
*/
private DataQueryParams replaceIndicatorsWithDataElements( DataQueryParams params, int indicatorIndex )
@@ -1157,8 +1179,8 @@
private Map<String, String> getUidNameMap( DataQueryParams params )
{
Map<String, String> map = new HashMap<>();
- map.putAll( getUidNameMap( params.getDimensions(), params.isHierarchyMeta() ) );
- map.putAll( getUidNameMap( params.getFilters(), params.isHierarchyMeta() ) );
+ map.putAll( getUidNameMap( params.getDimensions(), params.isHierarchyMeta(), params.getDisplayProperty() ) );
+ map.putAll( getUidNameMap( params.getFilters(), params.isHierarchyMeta(), params.getDisplayProperty() ) );
map.put( DATA_X_DIM_ID, DISPLAY_NAME_DATA_X );
return map;
@@ -1168,11 +1190,11 @@
* Returns a mapping between identifiers and names for the given dimensional
* objects.
*
- * @param dimensions the dimensional objects.
+ * @param dimensions the dimensional objects.
* @param hierarchyMeta indicates whether to include meta data of the
- * organisation unit hierarchy.
+ * organisation unit hierarchy.
*/
- private Map<String, String> getUidNameMap( List<DimensionalObject> dimensions, boolean hierarchyMeta )
+ private Map<String, String> getUidNameMap( List<DimensionalObject> dimensions, boolean hierarchyMeta, DisplayProperty displayProperty )
{
Map<String, String> map = new HashMap<>();
@@ -1180,7 +1202,7 @@
{
List<NameableObject> items = new ArrayList<>( dimension.getItems() );
- boolean hierarchy = hierarchyMeta && DimensionType.ORGANISATIONUNIT.equals( dimension.getDimensionType() );
+ boolean orgUnitHierarchy = hierarchyMeta && DimensionType.ORGANISATIONUNIT.equals( dimension.getDimensionType() );
// -----------------------------------------------------------------
// If dimension is not fixed and has no options, insert all options
@@ -1199,7 +1221,7 @@
Calendar calendar = PeriodType.getCalendar();
- for ( IdentifiableObject idObject : items )
+ for ( NameableObject idObject : items )
{
if ( !calendar.isIso8601() && Period.class.isInstance( idObject ) )
{
@@ -1209,10 +1231,17 @@
}
else
{
- map.put( idObject.getUid(), idObject.getDisplayName() );
+ if ( DisplayProperty.SHORTNAME.equals( displayProperty ) )
+ {
+ map.put( idObject.getUid(), idObject.getDisplayShortName() );
+ }
+ else // NAME is default
+ {
+ map.put( idObject.getUid(), idObject.getDisplayName() );
+ }
}
- if ( hierarchy )
+ if ( orgUnitHierarchy )
{
OrganisationUnit unit = (OrganisationUnit) idObject;
=== 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 2014-07-15 14:36:07 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/MockAnalyticsService.java 2014-09-29 16:10:58 +0000
@@ -39,6 +39,7 @@
import org.hisp.dhis.analytics.DataQueryParams;
import org.hisp.dhis.common.AnalyticalObject;
import org.hisp.dhis.common.DimensionalObject;
+import org.hisp.dhis.common.DisplayProperty;
import org.hisp.dhis.common.Grid;
import org.hisp.dhis.i18n.I18nFormat;
@@ -81,7 +82,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, I18nFormat format )
+ String measureCriteria, boolean skipMeta, boolean skipRounding, boolean hierarchyMeta, boolean ignoreLimit, boolean hideEmptyRows,
+ boolean showHierarchy, DisplayProperty displayProperty, I18nFormat format )
{
throw new NotImplementedException();
}
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/dimension/DefaultDimensionService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/dimension/DefaultDimensionService.java 2014-09-29 14:21:33 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/dimension/DefaultDimensionService.java 2014-09-29 16:10:58 +0000
@@ -173,7 +173,14 @@
return null;
}
- return identifiableObjectManager.get( DimensionalObject.DIMENSION_TYPE_CLASS_MAP.get( dimensionType ), uid );
+ Class<? extends DimensionalObject> clazz = DimensionalObject.DYNAMIC_DIMENSION_TYPE_CLASS_MAP.get( dimensionType );
+
+ if ( clazz == null )
+ {
+ return null;
+ }
+
+ return identifiableObjectManager.get( clazz, uid );
}
public List<NameableObject> getCanReadDimensionItems( String uid )
=== 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 2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsServiceTest.java 2014-09-29 16:10:58 +0000
@@ -164,7 +164,7 @@
Set<String> filterParams = new HashSet<>();
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 );
+ DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, false, false, false, false, false, false, null, null );
assertEquals( 4, params.getDataElements().size() );
assertEquals( 3, params.getPeriods().size() );
@@ -181,7 +181,7 @@
Set<String> filterParams = new HashSet<>();
filterParams.add( "ou:" + ouA.getUid() );
- DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, false, false, false, false, false, false, null );
+ DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, false, false, false, false, false, false, null, null );
assertEquals( 4, params.getDataElements().size() );
assertEquals( 1, params.getFilterOrganisationUnits().size() );
@@ -197,7 +197,7 @@
Set<String> filterParams = new HashSet<>();
filterParams.add( "ou:" + ouA.getUid() + ";" + ouB.getUid() );
- DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, false, false, false, false, false, false, null );
+ DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, false, false, false, false, false, false, null, null );
assertEquals( 4, params.getDataElements().size() );
assertEquals( 12, params.getPeriods().size() );
@@ -212,7 +212,7 @@
dimensionParams.add( "dx:" + deA.getUid() + ";" + deB.getUid() );
dimensionParams.add( "pe:2011;2012" );
- DataQueryParams params = analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null );
+ DataQueryParams params = analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null );
assertEquals( 1, params.getOrganisationUnits().size() );
assertEquals( 2, params.getDataElements().size() );
@@ -227,7 +227,7 @@
dimensionParams.add( "dx:" + deA.getUid() + ";" + deB.getUid() );
dimensionParams.add( "pe:2011;2012" );
- DataQueryParams params = analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null );
+ DataQueryParams params = analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null );
assertEquals( 2, params.getOrganisationUnits().size() );
assertEquals( 2, params.getDataElements().size() );
@@ -241,7 +241,7 @@
dimensionParams.add( "dx" );
dimensionParams.add( "pe:2012,2012S1,2012S2" );
- analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null );
+ analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null );
}
@Test( expected = IllegalQueryException.class )
@@ -251,7 +251,7 @@
dimensionParams.add( "dx:" + BASE_UID + "A;" + BASE_UID + "B;" + BASE_UID + "C;" + BASE_UID + "D" );
dimensionParams.add( "pe" );
- analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null );
+ analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null );
}
@Test( expected = IllegalQueryException.class )
@@ -261,7 +261,7 @@
dimensionParams.add( "dx:" + BASE_UID + "A;" + BASE_UID + "B;" + BASE_UID + "C;" + BASE_UID + "D" );
dimensionParams.add( "ou" );
- analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null );
+ analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null );
}
@Test( expected = IllegalQueryException.class )
@@ -271,7 +271,7 @@
dimensionParams.add( "dx:" + BASE_UID + "A;" + BASE_UID + "B;" + BASE_UID + "C;" + BASE_UID + "D" );
dimensionParams.add( "yebo:2012,2012S1,2012S2" );
- analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null );
+ analyticsService.getFromUrl( dimensionParams, null, null, null, false, false, false, false, false, false, null, null );
}
@Test
=== 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 2014-07-10 10:27:53 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AnalyticsController.java 2014-09-29 16:10:58 +0000
@@ -39,6 +39,7 @@
import org.hisp.dhis.analytics.AggregationType;
import org.hisp.dhis.analytics.AnalyticsService;
import org.hisp.dhis.analytics.DataQueryParams;
+import org.hisp.dhis.common.DisplayProperty;
import org.hisp.dhis.common.Grid;
import org.hisp.dhis.i18n.I18nManager;
import org.hisp.dhis.system.grid.GridUtils;
@@ -85,13 +86,14 @@
@RequestParam( required = false ) boolean tableLayout,
@RequestParam( required = false ) boolean hideEmptyRows,
@RequestParam( required = false ) boolean showHierarchy,
+ @RequestParam( required = false ) DisplayProperty displayProperty,
@RequestParam( required = false ) String columns,
@RequestParam( required = false ) String rows,
Model model,
HttpServletResponse response ) throws Exception
{
DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria,
- skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, i18nManager.getI18nFormat() );
+ skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_JSON, CacheStrategy.RESPECT_SYSTEM_SETTING );
Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getDimensionsFromParam( columns ), getDimensionsFromParam( rows ) );
@@ -113,13 +115,14 @@
@RequestParam( required = false ) boolean tableLayout,
@RequestParam( required = false ) boolean hideEmptyRows,
@RequestParam( required = false ) boolean showHierarchy,
+ @RequestParam( required = false ) DisplayProperty displayProperty,
@RequestParam( required = false ) String columns,
@RequestParam( required = false ) String rows,
Model model,
HttpServletResponse response ) throws Exception
{
DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria,
- skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, i18nManager.getI18nFormat() );
+ skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_XML, CacheStrategy.RESPECT_SYSTEM_SETTING );
Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getDimensionsFromParam( columns ), getDimensionsFromParam( rows ) );
@@ -139,13 +142,14 @@
@RequestParam( required = false ) boolean tableLayout,
@RequestParam( required = false ) boolean hideEmptyRows,
@RequestParam( required = false ) boolean showHierarchy,
+ @RequestParam( required = false ) DisplayProperty displayProperty,
@RequestParam( required = false ) String columns,
@RequestParam( required = false ) String rows,
Model model,
HttpServletResponse response ) throws Exception
{
DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria,
- skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, i18nManager.getI18nFormat() );
+ skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, CacheStrategy.RESPECT_SYSTEM_SETTING );
Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getDimensionsFromParam( columns ), getDimensionsFromParam( rows ) );
@@ -165,13 +169,14 @@
@RequestParam( required = false ) boolean tableLayout,
@RequestParam( required = false ) boolean hideEmptyRows,
@RequestParam( required = false ) boolean showHierarchy,
+ @RequestParam( required = false ) DisplayProperty displayProperty,
@RequestParam( required = false ) String columns,
@RequestParam( required = false ) String rows,
Model model,
HttpServletResponse response ) throws Exception
{
DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria,
- skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, i18nManager.getI18nFormat() );
+ skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_CSV, CacheStrategy.RESPECT_SYSTEM_SETTING, "data.csv", true );
Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getDimensionsFromParam( columns ), getDimensionsFromParam( rows ) );
@@ -191,13 +196,14 @@
@RequestParam( required = false ) boolean tableLayout,
@RequestParam( required = false ) boolean hideEmptyRows,
@RequestParam( required = false ) boolean showHierarchy,
+ @RequestParam( required = false ) DisplayProperty displayProperty,
@RequestParam( required = false ) String columns,
@RequestParam( required = false ) String rows,
Model model,
HttpServletResponse response ) throws Exception
{
DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria,
- skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, i18nManager.getI18nFormat() );
+ skipMeta, skipRounding, hierarchyMeta, ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_EXCEL, CacheStrategy.RESPECT_SYSTEM_SETTING, "data.xls", true );
Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getDimensionsFromParam( columns ), getDimensionsFromParam( rows ) );
@@ -217,13 +223,14 @@
@RequestParam( required = false ) boolean tableLayout,
@RequestParam( required = false ) boolean hideEmptyRows,
@RequestParam( required = false ) boolean showHierarchy,
+ @RequestParam( required = false ) DisplayProperty displayProperty,
@RequestParam( required = false ) String columns,
@RequestParam( required = false ) String rows,
Model model,
HttpServletResponse response ) throws Exception
{
DataQueryParams params = analyticsService.getFromUrl( dimension, filter, null, null,
- true, false, false, false, false, false, i18nManager.getI18nFormat() );
+ true, false, false, false, false, false, null, i18nManager.getI18nFormat() );
contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_XML, CacheStrategy.RESPECT_SYSTEM_SETTING, "data.jrxml", false );
Grid grid = analyticsService.getAggregatedDataValues( 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 2014-08-18 13:24:55 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/GeoFeatureController.java 2014-09-29 16:10:58 +0000
@@ -98,7 +98,7 @@
Set<String> set = new HashSet<>();
set.add( ou );
- DataQueryParams params = analyticsService.getFromUrl( set, null, AggregationType.SUM, null, false, false, false, false, false, false, null );
+ DataQueryParams params = analyticsService.getFromUrl( set, null, AggregationType.SUM, null, false, false, false, false, false, false, null, null );
DimensionalObject dim = params.getDimension( DimensionalObject.ORGUNIT_DIM_ID );