dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #12763
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3990: Fixed bug with ExpressionService.explodeExpression
------------------------------------------------------------
revno: 3990
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-06-22 21:04:55 +0200
message:
Fixed bug with ExpressionService.explodeExpression
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/Expression.java
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-api/src/main/java/org/hisp/dhis/expression/Expression.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/Expression.java 2011-06-03 13:11:34 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/Expression.java 2011-06-22 19:04:55 +0000
@@ -61,6 +61,8 @@
public static final String SEPARATOR = ".";
public static final String EXP_OPEN = "[";
public static final String EXP_CLOSE = "]";
+ public static final String PAR_OPEN = "(";
+ public static final String PAR_CLOSE = ")";
/**
* The unique identifier for this Expression.
=== 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 2011-06-03 13:11:34 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java 2011-06-22 19:04:55 +0000
@@ -30,6 +30,8 @@
import static org.hisp.dhis.expression.Expression.EXP_CLOSE;
import static org.hisp.dhis.expression.Expression.EXP_OPEN;
import static org.hisp.dhis.expression.Expression.SEPARATOR;
+import static org.hisp.dhis.expression.Expression.PAR_OPEN;
+import static org.hisp.dhis.expression.Expression.PAR_CLOSE;
import static org.hisp.dhis.system.util.MathUtils.calculateExpression;
import java.util.Collection;
@@ -396,7 +398,7 @@
if ( operand.isTotal() )
{
- final StringBuilder replace = new StringBuilder();
+ final StringBuilder replace = new StringBuilder( PAR_OPEN );
final DataElement dataElement = dataElementService.getDataElement( operand.getDataElementId() );
@@ -408,7 +410,7 @@
categoryOptionCombo.getId() ).append( EXP_CLOSE ).append( "+" );
}
- replace.deleteCharAt( replace.length() - 1 );
+ replace.deleteCharAt( replace.length() - 1 ).append( PAR_CLOSE );
matcher.appendReplacement( buffer, replace.toString() );
}