← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14960: NP check

 

------------------------------------------------------------
revno: 14960
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-04-24 14:10:26 +0200
message:
  NP check
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.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-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java	2014-04-24 12:10:26 +0000
@@ -639,21 +639,23 @@
 
         for ( DataElement dataElement : dataElements )
         {
-            if ( !dataElement.getCategoryCombo().isDefault() && includeTotals )
-            {
-                DataElementOperand operand = new DataElementOperand();
-                operand.updateProperties( dataElement );
-
-                operands.add( operand );
-            }
-
-            for ( DataElementCategoryOptionCombo categoryOptionCombo : dataElement.getCategoryCombo()
-                .getSortedOptionCombos() )
-            {
-                DataElementOperand operand = new DataElementOperand();
-                operand.updateProperties( dataElement, categoryOptionCombo );
-
-                operands.add( operand );
+            if ( dataElement.getCategoryCombo() != null )
+            {
+                if ( !dataElement.getCategoryCombo().isDefault() && includeTotals )
+                {
+                    DataElementOperand operand = new DataElementOperand();
+                    operand.updateProperties( dataElement );
+    
+                    operands.add( operand );
+                }
+    
+                for ( DataElementCategoryOptionCombo categoryOptionCombo : dataElement.getCategoryCombo().getSortedOptionCombos() )
+                {
+                    DataElementOperand operand = new DataElementOperand();
+                    operand.updateProperties( dataElement, categoryOptionCombo );
+    
+                    operands.add( operand );
+                }
             }
         }
 
@@ -673,12 +675,15 @@
 
         for ( DataElement dataElement : dataElements )
         {
-            for ( DataElementCategoryOptionCombo categoryOptionCombo : dataElement.getCategoryCombo().getOptionCombos() )
+            if ( dataElement.getCategoryCombo() != null )
             {
-                DataElementOperand operand = new DataElementOperand( dataElement, categoryOptionCombo );
-                operand.updateProperties( dataElement, categoryOptionCombo );
-
-                operands.add( operand );
+                for ( DataElementCategoryOptionCombo categoryOptionCombo : dataElement.getCategoryCombo().getOptionCombos() )
+                {
+                    DataElementOperand operand = new DataElementOperand( dataElement, categoryOptionCombo );
+                    operand.updateProperties( dataElement, categoryOptionCombo );
+    
+                    operands.add( operand );
+                }
             }
         }