← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11053: Analytics, rendering co dimension properly for table layout responses

 

------------------------------------------------------------
revno: 11053
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-05-28 16:34:42 +0200
message:
  Analytics, rendering co dimension properly for table layout responses
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-05-28 14:01:31 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java	2013-05-28 14:34:42 +0000
@@ -62,6 +62,7 @@
 import org.hisp.dhis.common.DimensionalObject;
 import org.hisp.dhis.common.ListMap;
 import org.hisp.dhis.common.NameableObject;
+import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategory;
 import org.hisp.dhis.dataelement.DataElementGroupSet;
 import org.hisp.dhis.dataelement.DataElementOperand;
@@ -1081,9 +1082,11 @@
     /**
      * Retrieves the options for the given dimension identifier. If the dx dimension
      * is specified, all concrete dimensions (in|de|dc|ds) are returned as a single
-     * dimension. Returns an empty array if the dimension is not present.
+     * dimension. If the co dimension is specified, all category option combos for
+     * the first data element is returned. Returns an empty array if the dimension 
+     * is not present.
      */
-    public NameableObject[] getDimensionArrayCollapseDx( String dimension )
+    public NameableObject[] getDimensionArrayCollapseDxExplodeCoc( String dimension )
     {
         List<NameableObject> items = new ArrayList<NameableObject>();
         
@@ -1094,6 +1097,17 @@
             items.addAll( getDimensionOptionsNullSafe( DATAELEMENT_OPERAND_ID ) );
             items.addAll( getDimensionOptionsNullSafe( DATASET_DIM_ID ) );
         }
+        else if ( CATEGORYOPTIONCOMBO_DIM_ID.equals( dimension ) )
+        {
+            List<NameableObject> des = getDimensionOrFilter( DATAELEMENT_DIM_ID );
+            
+            if ( des != null && !des.isEmpty() )
+            {
+                DataElement de = (DataElement) des.get( 0 );
+                
+                items.addAll( de.getCategoryCombo().getSortedOptionCombos() );
+            }
+        }
         else
         {
             items.addAll( getDimensionOptionsNullSafe( dimension ) );

=== 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-05-28 14:01:31 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java	2013-05-28 14:34:42 +0000
@@ -407,7 +407,7 @@
             {
                 reportTable.getColumnDimensions().add( dimension );
                 
-                tableColumns.add( params.getDimensionArrayCollapseDx( dimension ) );
+                tableColumns.add( params.getDimensionArrayCollapseDxExplodeCoc( dimension ) );
             }
         }
         
@@ -417,7 +417,7 @@
             {
                 reportTable.getRowDimensions().add( dimension );
                 
-                tableRows.add( params.getDimensionArrayCollapseDx( dimension ) );
+                tableRows.add( params.getDimensionArrayCollapseDxExplodeCoc( dimension ) );
             }
         }