dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #41940
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21406: Expression service, removed null checks
------------------------------------------------------------
revno: 21406
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-12-10 12:53:47 +0100
message:
Expression service, removed null checks
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.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/expression/DefaultExpressionService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java 2015-12-10 11:41:13 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java 2015-12-10 11:53:47 +0000
@@ -252,7 +252,7 @@
private Set<DataElement> getDataElementsInExpressionInternal( Pattern pattern, String expression )
{
- Set<DataElement> dataElements = new HashSet<>();;
+ Set<DataElement> dataElements = new HashSet<>();
if ( expression != null )
{
@@ -369,18 +369,8 @@
for ( Indicator indicator : indicators )
{
- Set<DataElement> numerator = getDataElementsInExpression( indicator.getNumerator() );
- Set<DataElement> denominator = getDataElementsInExpression( indicator.getDenominator() );
-
- if ( numerator != null )
- {
- dataElements.addAll( numerator );
- }
-
- if ( denominator != null )
- {
- dataElements.addAll( denominator );
- }
+ dataElements.addAll( getDataElementsInExpression( indicator.getNumerator() ) );
+ dataElements.addAll( getDataElementsInExpression( indicator.getDenominator() ) );
}
return dataElements;
@@ -394,18 +384,8 @@
for ( Indicator indicator : indicators )
{
- Set<DataElement> numerator = getDataElementsInExpressionInternal( DATA_ELEMENT_TOTAL_PATTERN, indicator.getNumerator() );
- Set<DataElement> denominator = getDataElementsInExpressionInternal( DATA_ELEMENT_TOTAL_PATTERN, indicator.getDenominator() );
-
- if ( numerator != null )
- {
- dataElements.addAll( numerator );
- }
-
- if ( denominator != null )
- {
- dataElements.addAll( denominator );
- }
+ dataElements.addAll( getDataElementsInExpressionInternal( DATA_ELEMENT_TOTAL_PATTERN, indicator.getNumerator() ) );
+ dataElements.addAll( getDataElementsInExpressionInternal( DATA_ELEMENT_TOTAL_PATTERN, indicator.getDenominator() ) );
}
return dataElements;
@@ -419,18 +399,8 @@
for ( Indicator indicator : indicators )
{
- Set<DataElement> numerator = getDataElementsInExpressionInternal( OPTION_COMBO_OPERAND_PATTERN, indicator.getNumerator() );
- Set<DataElement> denominator = getDataElementsInExpressionInternal( OPTION_COMBO_OPERAND_PATTERN, indicator.getDenominator() );
-
- if ( numerator != null )
- {
- dataElements.addAll( numerator );
- }
-
- if ( denominator != null )
- {
- dataElements.addAll( denominator );
- }
+ dataElements.addAll( getDataElementsInExpressionInternal( OPTION_COMBO_OPERAND_PATTERN, indicator.getNumerator() ) );
+ dataElements.addAll( getDataElementsInExpressionInternal( OPTION_COMBO_OPERAND_PATTERN, indicator.getDenominator() ) );
}
return dataElements;