← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12919: Report table, fixed issue with uid showing instead of names as columsn for dynamic dimensions

 

------------------------------------------------------------
revno: 12919
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-11-12 00:01:07 +0100
message:
  Report table, fixed issue with uid showing instead of names as columsn for dynamic dimensions
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseAnalyticalObject.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.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/BaseAnalyticalObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseAnalyticalObject.java	2013-11-07 17:16:55 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseAnalyticalObject.java	2013-11-11 23:01:07 +0000
@@ -212,7 +212,7 @@
             this.transientOrganisationUnits.add( organisationUnit );
         }
     }
-        
+    
     /**
      * Assembles a DimensionalObject based on the persisted properties of this
      * AnalyticalObject. Collapses indicators, data elements, data element 
@@ -581,6 +581,32 @@
     }
 
     /**
+     * Returns meta-data mapping for this analytical object. Includes a identifier
+     * to name mapping for dynamic dimensions.
+     */
+    public Map<String, String> getMetaData()
+    {
+        Map<String, String> meta = new HashMap<String, String>();
+        
+        for ( DataElementGroup group : dataElementGroups )
+        {
+            meta.put( group.getGroupSet().getUid(), group.getGroupSet().getName() );
+        }
+        
+        for ( OrganisationUnitGroup group : organisationUnitGroups )
+        {
+            meta.put( group.getGroupSet().getUid(), group.getGroupSet().getName() );
+        }
+        
+        for ( DataElementCategoryDimension category : categoryDimensions )
+        {
+            meta.put( category.getDimension().getUid(), category.getDimension().getName() );
+        }
+        
+        return meta;
+    }
+    
+    /**
      * Clear or set to false all persistent properties for this object.
      */
     public void clear()

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2013-10-07 12:09:21 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2013-11-11 23:01:07 +0000
@@ -597,9 +597,12 @@
         // Headers
         // ---------------------------------------------------------------------
 
+        Map<String, String> metaData = getMetaData();
+        metaData.putAll( DimensionalObject.PRETTY_NAMES );
+        
         for ( String row : rowDimensions )
         {
-            String name = StringUtils.defaultIfEmpty( DimensionalObject.PRETTY_NAMES.get( row ), row );            
+            String name = StringUtils.defaultIfEmpty( metaData.get( row ), row );            
             String col = StringUtils.defaultIfEmpty( COLUMN_NAMES.get( row ), row );
             
             grid.addHeader( new GridHeader( name + " ID", col + "id", String.class.getName(), true, true ) );