← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21059: Analytics. Minor performance improvement

 

------------------------------------------------------------
revno: 21059
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2015-11-15 21:30:50 +0100
message:
  Analytics. Minor performance improvement
modified:
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultDataQueryService.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventDataQueryService.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/data/DefaultDataQueryService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultDataQueryService.java	2015-11-05 02:57:57 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultDataQueryService.java	2015-11-15 20:30:50 +0000
@@ -299,8 +299,8 @@
             
             //TODO proper handling of operands and option combinations
         }
-
-        if ( CATEGORYOPTIONCOMBO_DIM_ID.equals( dimension ) )
+        
+        else if ( CATEGORYOPTIONCOMBO_DIM_ID.equals( dimension ) )
         {
             List<NameableObject> cocs = new ArrayList<NameableObject>();
             
@@ -319,7 +319,7 @@
             return object;
         }
 
-        if ( ATTRIBUTEOPTIONCOMBO_DIM_ID.equals( dimension ) )
+        else if ( ATTRIBUTEOPTIONCOMBO_DIM_ID.equals( dimension ) )
         {
             List<NameableObject> aocs = new ArrayList<NameableObject>();
             
@@ -338,7 +338,7 @@
             return object;
         }
         
-        if ( PERIOD_DIM_ID.equals( dimension ) )
+        else if ( PERIOD_DIM_ID.equals( dimension ) )
         {
             Calendar calendar = PeriodType.getCalendar();
 
@@ -388,7 +388,7 @@
             return object;
         }
 
-        if ( ORGUNIT_DIM_ID.equals( dimension ) )
+        else if ( ORGUNIT_DIM_ID.equals( dimension ) )
         {
             List<NameableObject> ous = new ArrayList<>();
             List<Integer> levels = new ArrayList<>();
@@ -475,33 +475,36 @@
             return object;
         }
 
-        if ( LONGITUDE_DIM_ID.contains( dimension ) )
+        else if ( LONGITUDE_DIM_ID.contains( dimension ) )
         {
             DimensionalObject object = new BaseDimensionalObject( dimension, DimensionType.STATIC, null, DISPLAY_NAME_LONGITUDE, new ArrayList<NameableObject>() );
 
             return object;
         }
 
-        if ( LATITUDE_DIM_ID.contains( dimension ) )
+        else if ( LATITUDE_DIM_ID.contains( dimension ) )
         {
             DimensionalObject object = new BaseDimensionalObject( dimension, DimensionType.STATIC, null, DISPLAY_NAME_LATITUDE, new ArrayList<NameableObject>() );
 
             return object;
         }
 
-        DimensionalObject dimObject = idObjectManager.get( DataQueryParams.DYNAMIC_DIM_CLASSES, dimension );
-
-        if ( dimObject != null && dimObject.isDataDimension() )
+        else
         {
-            Class<?> dimClass = ReflectionUtils.getRealClass( dimObject.getClass() );
-            
-            Class<? extends NameableObject> itemClass = DimensionalObject.DIMENSION_CLASS_ITEM_CLASS_MAP.get( dimClass );
-            
-            List<NameableObject> dimItems = !allItems ? asList( idObjectManager.getByUidOrdered( itemClass, items ) ) : dimObject.getItems();
-                        
-            DimensionalObject object = new BaseDimensionalObject( dimension, dimObject.getDimensionType(), null, dimObject.getName(), dimItems, allItems );
-            
-            return object;
+            DimensionalObject dimObject = idObjectManager.get( DataQueryParams.DYNAMIC_DIM_CLASSES, dimension );
+    
+            if ( dimObject != null && dimObject.isDataDimension() )
+            {
+                Class<?> dimClass = ReflectionUtils.getRealClass( dimObject.getClass() );
+                
+                Class<? extends NameableObject> itemClass = DimensionalObject.DIMENSION_CLASS_ITEM_CLASS_MAP.get( dimClass );
+                
+                List<NameableObject> dimItems = !allItems ? asList( idObjectManager.getByUidOrdered( itemClass, items ) ) : dimObject.getItems();
+                            
+                DimensionalObject object = new BaseDimensionalObject( dimension, dimObject.getDimensionType(), null, dimObject.getName(), dimItems, allItems );
+                
+                return object;
+            }
         }
 
         if ( allowNull )

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventDataQueryService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventDataQueryService.java	2015-11-05 02:57:57 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventDataQueryService.java	2015-11-15 20:30:50 +0000
@@ -78,6 +78,9 @@
 import com.google.common.base.MoreObjects;
 import com.google.common.collect.Lists;
 
+/**
+ * @author Lars Helge Overland
+ */
 public class DefaultEventDataQueryService
     implements EventDataQueryService
 {