← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19642: Analytics, adding support for specifying attribute option combo uids

 

------------------------------------------------------------
revno: 19642
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-07-14 14:25:21 +0200
message:
  Analytics, adding support for specifying attribute option combo uids
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionType.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObject.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/table/JdbcAnalyticsTableManager.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/DimensionType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionType.java	2015-06-18 14:35:18 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionType.java	2015-07-14 12:25:21 +0000
@@ -43,6 +43,7 @@
     DATA_X,
     DATA_COLLAPSED,
     CATEGORY_OPTION_COMBO,
+    ATTRIBUTE_OPTION_COMBO,
     PERIOD,
     ORGANISATIONUNIT,
     CATEGORYOPTION_GROUPSET,

=== 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	2015-06-19 12:16:36 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObject.java	2015-07-14 12:25:21 +0000
@@ -57,6 +57,7 @@
     final String PROGRAM_DATAELEMENT_DIM_ID = "pd";
     final String PROGRAM_ATTRIBUTE_DIM_ID = "pa";
     final String CATEGORYOPTIONCOMBO_DIM_ID = "co";
+    final String ATTRIBUTEOPTIONCOMBO_DIM_ID = "ao";
     final String PERIOD_DIM_ID = "pe";
     final String ORGUNIT_DIM_ID = "ou";
     final String ORGUNIT_GROUP_DIM_ID = "oug"; // Used for org unit target

=== 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-06-23 12:28:45 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java	2015-07-14 12:25:21 +0000
@@ -101,7 +101,8 @@
     public static final String KEY_DE_GROUP = "DE_GROUP-";
     
     public static final String DISPLAY_NAME_DATA_X = "Data";
-    public static final String DISPLAY_NAME_CATEGORYOPTIONCOMBO = "Category";
+    public static final String DISPLAY_NAME_CATEGORYOPTIONCOMBO = "Category option combo";
+    public static final String DISPLAY_NAME_ATTRIBUTEOPTIONCOMBO = "Attribute option combo";
     public static final String DISPLAY_NAME_PERIOD = "Period";
     public static final String DISPLAY_NAME_ORGUNIT = "Organisation unit";
     public static final String DISPLAY_NAME_LONGITUDE = "Longitude";

=== 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-07-14 11:17:34 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java	2015-07-14 12:25:21 +0000
@@ -34,6 +34,7 @@
 import static org.hisp.dhis.analytics.AnalyticsTableManager.ORGUNIT_TARGET_TABLE_NAME;
 import static org.hisp.dhis.analytics.DataQueryParams.COMPLETENESS_DIMENSION_TYPES;
 import static org.hisp.dhis.analytics.DataQueryParams.DISPLAY_NAME_CATEGORYOPTIONCOMBO;
+import static org.hisp.dhis.analytics.DataQueryParams.DISPLAY_NAME_ATTRIBUTEOPTIONCOMBO;
 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;
@@ -42,6 +43,7 @@
 import static org.hisp.dhis.analytics.DataQueryParams.DX_INDEX;
 import static org.hisp.dhis.analytics.DataQueryParams.KEY_DE_GROUP;
 import static org.hisp.dhis.common.DimensionalObject.CATEGORYOPTIONCOMBO_DIM_ID;
+import static org.hisp.dhis.common.DimensionalObject.ATTRIBUTEOPTIONCOMBO_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;
@@ -1187,6 +1189,25 @@
             return Lists.newArrayList( object );
         }
 
+        if ( ATTRIBUTEOPTIONCOMBO_DIM_ID.equals( dimension ) )
+        {
+            List<NameableObject> aocs = new ArrayList<NameableObject>();
+            
+            for ( String uid : items )
+            {
+                DataElementCategoryOptionCombo aoc = idObjectManager.get( DataElementCategoryOptionCombo.class, uid );
+                
+                if ( aoc != null )
+                {
+                    aocs.add( aoc );
+                }
+            }
+            
+            DimensionalObject object = new BaseDimensionalObject( dimension, DimensionType.ATTRIBUTE_OPTION_COMBO, null, DISPLAY_NAME_ATTRIBUTEOPTIONCOMBO, aocs );
+
+            return Lists.newArrayList( object );
+        }
+        
         if ( PERIOD_DIM_ID.equals( dimension ) )
         {
             Calendar calendar = PeriodType.getCalendar();

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java	2015-06-18 21:47:26 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java	2015-07-14 12:25:21 +0000
@@ -234,6 +234,7 @@
             "left join _dataelementstructure des on dv.dataelementid = des.dataelementid " +
             "inner join dataelement de on dv.dataelementid=de.dataelementid " +
             "inner join categoryoptioncombo co on dv.categoryoptioncomboid=co.categoryoptioncomboid " +
+            "inner join categoryoptioncombo ao on dv.attributeoptioncomboid=ao.categoryoptioncomboid " +
             "inner join _categoryoptioncomboname aon on dv.attributeoptioncomboid=aon.categoryoptioncomboid " +
             "inner join period pe on dv.periodid=pe.periodid " +
             "inner join _periodstructure ps on dv.periodid=ps.periodid " +
@@ -351,10 +352,11 @@
         
         String[] de = { quote( "de" ), "character(11) not null", "de.uid" };
         String[] co = { quote( "co" ), "character(11) not null", "co.uid" };
+        String[] ao = { quote( "ao" ), "character(11) not null", "ao.uid" };
         String[] ou = { quote( "ou" ), "character(11) not null", "ou.uid" };
         String[] level = { quote( "level" ), "integer", "ous.level" };
         
-        columns.addAll( Lists.newArrayList( de, co, ou, level ) );
+        columns.addAll( Lists.newArrayList( de, co, ao, ou, level ) );
 
         if ( isApprovalEnabled() )
         {