← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2313: Minor fixed

 

------------------------------------------------------------
revno: 2313
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2010-12-08 16:13:31 +0100
message:
  Minor fixed
modified:
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/util/ParserUtil.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-datamart-default/src/main/java/org/hisp/dhis/datamart/util/ParserUtil.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/util/ParserUtil.java	2010-12-02 22:44:29 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/util/ParserUtil.java	2010-12-08 15:13:31 +0000
@@ -98,18 +98,15 @@
             
             while ( matcher.find() )
             {
-                String replaceString = matcher.group().replaceAll( "[\\[\\]]", "" );
-                
-                int dataElementId = Integer.parseInt( replaceString.substring( 0, replaceString.indexOf( SEPARATOR ) ) );
-                int categoryOptionComboId = Integer.parseInt( replaceString.substring( replaceString.indexOf( SEPARATOR ) + 1 ) );
-                
-                final DataElementOperand operand = new DataElementOperand( dataElementId, categoryOptionComboId );
+                String match = matcher.group();
+                
+                final DataElementOperand operand = DataElementOperand.getOperand( match );
                 
                 Double aggregatedValue = valueMap.get( operand );
                 
-                replaceString = ( aggregatedValue == null ) ? NULL_REPLACEMENT : String.valueOf( aggregatedValue );
+                match = ( aggregatedValue == null ) ? NULL_REPLACEMENT : String.valueOf( aggregatedValue );
                 
-                matcher.appendReplacement( buffer, replaceString );
+                matcher.appendReplacement( buffer, match );
             }
 
             matcher.appendTail( buffer );