dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #31572
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16110: Minor
------------------------------------------------------------
revno: 16110
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2014-07-13 01:24:13 +0200
message:
Minor
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/BaseChart.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.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/chart/BaseChart.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/BaseChart.java 2014-07-12 14:18:34 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/BaseChart.java 2014-07-12 23:24:13 +0000
@@ -31,6 +31,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.lang.StringUtils;
import org.hisp.dhis.common.AnalyticsType;
import org.hisp.dhis.common.BaseAnalyticalObject;
import org.hisp.dhis.common.DimensionalObject;
@@ -177,7 +178,7 @@
public String generateTitle()
{
- return IdentifiableObjectUtils.join( getFilterItems() );
+ return StringUtils.defaultIfBlank( IdentifiableObjectUtils.join( getFilterItems() ), StringUtils.EMPTY );
}
public boolean isAnalyticsType( AnalyticsType type )
=== 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 2014-07-12 22:07:01 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java 2014-07-12 23:24:13 +0000
@@ -71,6 +71,7 @@
import org.hisp.dhis.common.QueryOperator;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.eventchart.EventChart;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
@@ -230,7 +231,8 @@
for ( List<Object> row : grid.getRows() )
{
String key = StringUtils.join( ListUtils.getAtIndexes( row, metaIndexes ), DIMENSION_SEP );
- Double value = (Double) row.get( valueIndex );
+ Object val = row.get( valueIndex );
+ Double value = val != null ? ((Integer) val).doubleValue() : null;
map.put( key, value );
}
@@ -239,7 +241,7 @@
public Map<String, Double> getAggregatedEventDataMappping( BaseAnalyticalObject object, I18nFormat format )
{
- EventQueryParams params = getFromAnalyticalObject( object, format );
+ EventQueryParams params = getFromAnalyticalObject( (EventChart) object, format );
return getAggregatedEventDataMappping( params );
}
@@ -342,50 +344,6 @@
return params;
}
- public EventQueryParams getFromAnalyticalObject( BaseAnalyticalObject object, I18nFormat format )
- {
- EventQueryParams params = new EventQueryParams();
-
- if ( object != null )
- {
- Date date = object.getRelativePeriodDate();
-
- object.populateAnalyticalProperties();
-
- for ( DimensionalObject dimension : ListUtils.union( object.getColumns(), object.getRows() ) )
- {
- List<DimensionalObject> dimObj = analyticsService.
- getDimension( toDimension( dimension.getDimension() ), getUids( dimension.getItems() ), date, format, true );
-
- if ( dimObj != null )
- {
- params.getDimensions().addAll( dimObj );
- }
- else
- {
- params.getItems().add( getQueryItem( dimension.getDimension() ) );
- }
- }
-
- for ( DimensionalObject filter : object.getFilters() )
- {
- List<DimensionalObject> dimObj = analyticsService.
- getDimension( toDimension( filter.getDimension() ), getUids( filter.getItems() ), date, format, true );
-
- if ( dimObj != null )
- {
- params.getFilters().addAll( dimObj );
- }
- else
- {
- params.getItemFilters().add( getQueryItem( filter.getDimension() ) );
- }
- }
- }
-
- return params;
- }
-
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 hierarchyMeta, boolean coordinatesOnly, Integer page, Integer pageSize, I18nFormat format )
@@ -501,6 +459,60 @@
return params;
}
+
+ /**
+ * TODO Generalize and change from EventChart to EventAnayticalObject.
+ */
+ public EventQueryParams getFromAnalyticalObject( BaseAnalyticalObject object_, I18nFormat format )
+ {
+ EventChart object = (EventChart) object_; //TODO temporary
+
+ EventQueryParams params = new EventQueryParams();
+
+ if ( object != null )
+ {
+ Date date = object.getRelativePeriodDate();
+
+ object.populateAnalyticalProperties();
+
+ for ( DimensionalObject dimension : ListUtils.union( object.getColumns(), object.getRows() ) )
+ {
+ List<DimensionalObject> dimObj = analyticsService.
+ getDimension( toDimension( dimension.getDimension() ), getUids( dimension.getItems() ), date, format, true );
+
+ if ( dimObj != null )
+ {
+ params.getDimensions().addAll( dimObj );
+ }
+ else
+ {
+ params.getItems().add( getQueryItem( dimension.getDimension() ) );
+ }
+ }
+
+ for ( DimensionalObject filter : object.getFilters() )
+ {
+ List<DimensionalObject> dimObj = analyticsService.
+ getDimension( toDimension( filter.getDimension() ), getUids( filter.getItems() ), date, format, true );
+
+ if ( dimObj != null )
+ {
+ params.getFilters().addAll( dimObj );
+ }
+ else
+ {
+ params.getItemFilters().add( getQueryItem( filter.getDimension() ) );
+ }
+ }
+ }
+
+ params.setProgram( object.getProgram() );
+ params.setProgramStage( object.getProgramStage() );
+ params.setStartDate( object.getStartDate() );
+ params.setEndDate( object.getEndDate() );
+
+ return params;
+ }
// -------------------------------------------------------------------------
// Supportive methods