dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20964
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9806: Analytics, removing coc dimension if in or ds dimensions are present
------------------------------------------------------------
revno: 9806
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-02-14 15:25:21 +0200
message:
Analytics, removing coc dimension if in or ds dimensions are present
modified:
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
--
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/DataQueryParams.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java 2013-02-13 03:57:52 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java 2013-02-14 13:25:21 +0000
@@ -39,7 +39,6 @@
import org.apache.commons.lang.StringUtils;
import org.hisp.dhis.common.CombinationGenerator;
-import org.hisp.dhis.common.DxfNamespaces;
import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.dataelement.DataElementOperand;
import org.hisp.dhis.period.Period;
@@ -50,9 +49,6 @@
import org.hisp.dhis.system.util.MapMap;
import org.hisp.dhis.system.util.MathUtils;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
-
-@JacksonXmlRootElement( localName = "dxf2", namespace = DxfNamespaces.DXF_2_0)
public class DataQueryParams
{
public static final String DATA_X_DIM_ID = "dx"; // IN, DE, DS
@@ -121,12 +117,15 @@
// -------------------------------------------------------------------------
/**
- * Ensures conformity for this query. Removes the category option combo
- * dimension if it exists and if the data element dimension does not exist.
+ * Ensures conformity for this query. The category option combo dimension
+ * can only be present if the data element dimension exists and the indicator
+ * and data set dimensions do not exist.
*/
public void conform()
{
- if ( !dimensions.contains( new Dimension( DATAELEMENT_DIM_ID ) ) )
+ if ( !dimensions.contains( new Dimension( DATAELEMENT_DIM_ID ) ) ||
+ dimensions.contains( new Dimension( INDICATOR_DIM_ID ) ) ||
+ dimensions.contains( new Dimension( DATASET_DIM_ID ) ) )
{
removeDimension( CATEGORYOPTIONCOMBO_DIM_ID );
}
@@ -135,7 +134,7 @@
/**
* Returns the index of the category option combo dimension as it will appear
* in the data element query. Returns null if this query does not contain
- * the category option combo dimension.
+ * the category option combo dimension. Currently unused.
*/
public Integer getDeQueryCocIndex()
{
=== 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 2013-02-07 13:05:29 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java 2013-02-14 13:25:21 +0000
@@ -142,8 +142,6 @@
params.conform();
- Integer cocIndex = params.getDeQueryCocIndex();
-
// ---------------------------------------------------------------------
// Headers and meta-data
// ---------------------------------------------------------------------
@@ -201,16 +199,7 @@
List<DimensionOption> row = new ArrayList<DimensionOption>( options );
row.add( indicatorIndex, new DimensionOption( INDICATOR_DIM_ID, indicator ) );
-
- if ( cocIndex != null )
- {
- // ---------------------------------------------
- // Add null to get same number of columns
- // ---------------------------------------------
-
- row.add( cocIndex, null );
- }
-
+
grid.addRow();
grid.addValues( DimensionOption.getOptionIdentifiers( row ) );
grid.addValue( MathUtils.getRounded( value, 1 ) );
@@ -257,15 +246,6 @@
for ( Map.Entry<String, Double> entry : aggregatedDataMap.entrySet() )
{
List<String> row = new ArrayList<String>( Arrays.asList( entry.getKey().split( DIMENSION_SEP ) ) );
-
- if ( cocIndex != null )
- {
- // ---------------------------------------------------------
- // Add null to get same number of columns
- // ---------------------------------------------------------
-
- row.add( cocIndex, null );
- }
grid.addRow();
grid.addValues( row.toArray() );