← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17129: Event analytics, display property in meta data

 

------------------------------------------------------------
revno: 17129
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-10-15 19:53:21 +0200
message:
  Event analytics, display property in meta data
modified:
  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-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-10-14 11:14:39 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java	2014-10-15 17:53:21 +0000
@@ -562,21 +562,32 @@
             }
         }
 
-        for ( QueryItem item : params.getItems() )
-        {
-            map.put( item.getItem().getUid(), item.getItem().getDisplayName() );
-        }
-
-        for ( QueryItem item : params.getItemFilters() )
-        {
-            map.put( item.getItem().getUid(), item.getItem().getDisplayName() );
-        }
-
+        map.putAll( getUidNameMap( params.getItems(), params.getDisplayProperty() ) );
+        map.putAll( getUidNameMap( params.getItemFilters(), params.getDisplayProperty() ) );
         map.putAll( getUidNameMap( params.getDimensions(), params.isHierarchyMeta(), params.getDisplayProperty() ) );
         map.putAll( getUidNameMap( params.getFilters(), params.isHierarchyMeta(), params.getDisplayProperty() ) );
 
         return map;
     }
+    
+    private Map<String, String> getUidNameMap( List<QueryItem> queryItems, DisplayProperty displayProperty )
+    {
+        Map<String, String> map = new HashMap<>();
+        
+        for ( QueryItem item : queryItems )
+        {
+            if ( DisplayProperty.SHORTNAME.equals( displayProperty ) )
+            {
+                map.put( item.getItem().getUid(), item.getItem().getDisplayShortName() );
+            }
+            else
+            {
+                map.put( item.getItem().getUid(), item.getItem().getDisplayName() );
+            }
+        }
+        
+        return map;
+    }
 
     private Map<String, String> getUidNameMap( List<DimensionalObject> dimensions, boolean hierarchyMeta, DisplayProperty displayProperty )
     {