← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19989: ProgramIndicator, removed valueType and rootDate properties, not in use

 

------------------------------------------------------------
revno: 19989
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-09-04 10:57:35 +0200
message:
  ProgramIndicator, removed valueType and rootDate properties, not in use
modified:
  dhis-2/dhis-api/pom.xml
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicatorService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/program/hibernate/ProgramIndicator.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java
  dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/TrackedEntityInstanceDashboardAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/AddProgramIndicatorAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/UpdateProgramIndicatorAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramIndicator.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramIndicator.vm


--
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/pom.xml'
--- dhis-2/dhis-api/pom.xml	2015-07-20 02:01:37 +0000
+++ dhis-2/dhis-api/pom.xml	2015-09-04 08:57:35 +0000
@@ -40,7 +40,7 @@
       <artifactId>jasperreports</artifactId>
     </dependency>
     <dependency>
-      <groupId>net.sf.jasperreports</groupId>
+      <groupId>net.sf.jasperreports</groupIdjar>
       <artifactId>jasperreports-fonts</artifactId>
     </dependency>
     <dependency>

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java	2015-09-03 15:30:38 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java	2015-09-04 08:57:35 +0000
@@ -71,9 +71,6 @@
     public static final String VAR_VALUE_COUNT = "value_count";
     public static final String VAR_ZERO_POS_VALUE_COUNT = "zero_pos_value_count";
 
-    public static final String VALUE_TYPE_DATE = "date";
-    public static final String VALUE_TYPE_INT = "int";
-
     private static final String EXPRESSION_REGEXP = "(" + KEY_DATAELEMENT + "|" + KEY_ATTRIBUTE + "|" + KEY_PROGRAM_VARIABLE + "|" + KEY_CONSTANT + ")\\{(\\w+|" +
         VAR_INCIDENT_DATE + "|" + VAR_ENROLLMENT_DATE + "|" + VAR_CURRENT_DATE + ")" + SEPARATOR_ID + "?(\\w*)\\}";
     private static final String SQL_FUNC_REGEXP = "d2:(.+?)\\(([^,]+)\\,?([^,]*)\\,?([^,]*)\\)";
@@ -91,8 +88,6 @@
 
     private Program program;
 
-    private String valueType;
-
     private String expression;
 
     private String filter;
@@ -106,8 +101,6 @@
 
     private Boolean displayInForm;
 
-    private String rootDate;
-
     // -------------------------------------------------------------------------
     // Constructors
     // -------------------------------------------------------------------------
@@ -183,19 +176,6 @@
     @JsonProperty
     @JsonView( { DetailedView.class, ExportView.class } )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
-    public String getValueType()
-    {
-        return valueType;
-    }
-
-    public void setValueType( String valueType )
-    {
-        this.valueType = valueType;
-    }
-
-    @JsonProperty
-    @JsonView( { DetailedView.class, ExportView.class } )
-    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public String getExpression()
     {
         return expression;
@@ -258,19 +238,6 @@
         this.displayInForm = displayInForm;
     }
 
-    @JsonProperty
-    @JsonView( { DetailedView.class, ExportView.class } )
-    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
-    public String getRootDate()
-    {
-        return rootDate;
-    }
-
-    public void setRootDate( String rootDate )
-    {
-        this.rootDate = rootDate;
-    }
-
     @Override
     public void mergeWith( IdentifiableObject other, MergeStrategy strategy )
     {
@@ -283,22 +250,18 @@
             if ( strategy.isReplace() )
             {
                 program = programIndicator.getProgram();
-                valueType = programIndicator.getValueType();
                 expression = programIndicator.getExpression();
                 filter = programIndicator.getFilter();
                 decimals = programIndicator.getDecimals();
                 displayInForm = programIndicator.getDisplayInForm();
-                rootDate = programIndicator.getRootDate();
             }
             else if ( strategy.isMerge() )
             {
                 program = programIndicator.getProgram() == null ? program : programIndicator.getProgram();
-                valueType = programIndicator.getValueType() == null ? valueType : programIndicator.getValueType();
                 expression = programIndicator.getExpression() == null ? expression : programIndicator.getExpression();
                 filter = programIndicator.getFilter() == null ? filter : programIndicator.getFilter();
                 decimals = programIndicator.getDecimals() == null ? decimals : programIndicator.getDecimals();
                 displayInForm = programIndicator.getDisplayInForm() == null ? displayInForm : programIndicator.getDisplayInForm();
-                rootDate = programIndicator.getRootDate() == null ? rootDate : programIndicator.getRootDate();
             }
         }
     }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicatorService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicatorService.java	2015-08-26 10:20:41 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicatorService.java	2015-09-04 08:57:35 +0000
@@ -111,7 +111,7 @@
      * @param programInstance  ProgramInstance
      * @return Indicator value
      */
-    String getProgramIndicatorValue( ProgramIndicator programIndicator, ProgramInstance programInstance );
+    Double getProgramIndicatorValue( ProgramIndicator programIndicator, ProgramInstance programInstance );
 
     /**
      * Get indicator values of all program indicators defined for a TrackedEntityInstance
@@ -119,7 +119,7 @@
      * @param programInstance ProgramInstance
      * @return a mapping of indicator display name and indicator value.
      */
-    Map<String, String> getProgramIndicatorValues( ProgramInstance programInstance );
+    Map<String, Double> getProgramIndicatorValues( ProgramInstance programInstance );
 
     /**
      * Get description of an indicator expression.

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java	2015-09-03 08:15:09 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java	2015-09-04 08:57:35 +0000
@@ -28,7 +28,16 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import com.google.common.collect.ImmutableMap;
+import static org.hisp.dhis.i18n.I18nUtils.i18n;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Matcher;
+
 import org.hisp.dhis.common.ValueType;
 import org.hisp.dhis.commons.sqlfunc.ConditionalSqlFunction;
 import org.hisp.dhis.commons.sqlfunc.DaysBetweenSqlFunction;
@@ -57,15 +66,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Matcher;
-
-import static org.hisp.dhis.i18n.I18nUtils.i18n;
+import com.google.common.collect.ImmutableMap;
 
 /**
  * @author Chau Thu Tran
@@ -218,47 +219,168 @@
 
     @Override
     @Transactional
-    public String getProgramIndicatorValue( ProgramIndicator programIndicator, ProgramInstance programInstance )
+    public Double getProgramIndicatorValue( ProgramIndicator indicator, ProgramInstance programInstance )
     {
-        Double value = getValue( programIndicator, programInstance, null );
-
-        if ( value != null )
-        {
-            if ( programIndicator.getValueType().equals( ProgramIndicator.VALUE_TYPE_DATE ) )
-            {
-                Date baseDate = new Date();
-
-                if ( ProgramIndicator.VAR_INCIDENT_DATE.equals( programIndicator.getRootDate() ) )
-                {
-                    baseDate = programInstance.getDateOfIncident();
-                }
-                else if ( ProgramIndicator.VAR_ENROLLMENT_DATE.equals( programIndicator.getRootDate() ) )
-                {
-                    baseDate = programInstance.getEnrollmentDate();
-                }
-
-                Date date = DateUtils.getDateAfterAddition( baseDate, value.intValue() );
-
-                return DateUtils.getMediumDateString( date );
-            }
-
-            return String.valueOf( Math.floor( value ) );
-        }
-
-        return null;
+        StringBuffer buffer = new StringBuffer();
+
+        String expression = indicator.getExpression();
+
+        Matcher matcher = ProgramIndicator.EXPRESSION_PATTERN.matcher( expression );
+
+        int valueCount = 0;
+        int zeroPosValueCount = 0;
+
+        while ( matcher.find() )
+        {
+            String key = matcher.group( 1 );
+            String uid = matcher.group( 2 );
+
+            if ( ProgramIndicator.KEY_DATAELEMENT.equals( key ) )
+            {
+                String de = matcher.group( 3 );
+                ProgramStage programStage = programStageService.getProgramStage( uid );
+                DataElement dataElement = dataElementService.getDataElement( de );
+
+                if ( programStage != null && dataElement != null )
+                {
+                    ProgramStageInstance psi = programStageInstanceService.getProgramStageInstance( programInstance, programStage );
+
+                    TrackedEntityDataValue dataValue = dataValueService.getTrackedEntityDataValue( psi, dataElement );
+
+                    if ( dataValue == null )
+                    {
+                        return null;
+                    }
+
+                    String value = dataValue.getValue();
+
+                    if ( dataElement.getType().equals( DataElement.VALUE_TYPE_DATE ) )
+                    {
+                        value = DateUtils.daysBetween( new Date(), DateUtils.getDefaultDate( value ) ) + " ";
+                    }
+
+                    matcher.appendReplacement( buffer, value );
+
+                    valueCount++;
+                    zeroPosValueCount = isZeroOrPositive( value ) ? (zeroPosValueCount + 1) : zeroPosValueCount;
+                }
+                else
+                {
+                    return null;
+                }
+            }
+            else if ( ProgramIndicator.KEY_ATTRIBUTE.equals( key ) )
+            {
+                TrackedEntityAttribute attribute = attributeService.getTrackedEntityAttribute( uid );
+
+                if ( attribute != null )
+                {
+                    TrackedEntityAttributeValue attributeValue = attributeValueService.getTrackedEntityAttributeValue(
+                        programInstance.getEntityInstance(), attribute );
+
+                    if ( attributeValue != null )
+                    {
+                        String value = attributeValue.getValue();
+
+                        if ( ValueType.DATE == attribute.getValueType() )
+                        {
+                            value = DateUtils.daysBetween( new Date(), DateUtils.getDefaultDate( value ) ) + " ";
+                        }
+
+                        matcher.appendReplacement( buffer, value );
+
+                        valueCount++;
+                        zeroPosValueCount = isZeroOrPositive( value ) ? (zeroPosValueCount + 1) : zeroPosValueCount;
+                    }
+                    else
+                    {
+                        return null;
+                    }
+                }
+                else
+                {
+                    return null;
+                }
+            }
+            else if ( ProgramIndicator.KEY_CONSTANT.equals( key ) )
+            {
+                Constant constant = constantService.getConstant( uid );
+
+                if ( constant != null )
+                {
+                    matcher.appendReplacement( buffer, String.valueOf( constant.getValue() ) );
+                }
+                else
+                {
+                    return null;
+                }
+            }
+            else if ( ProgramIndicator.KEY_PROGRAM_VARIABLE.equals( key ) )
+            {
+                Date currentDate = new Date();
+                Date date = null;
+
+                if ( ProgramIndicator.VAR_ENROLLMENT_DATE.equals( uid ) )
+                {
+                    date = programInstance.getEnrollmentDate();
+                }
+                else if ( ProgramIndicator.VAR_INCIDENT_DATE.equals( uid ) )
+                {
+                    date = programInstance.getDateOfIncident();
+                }
+                else if ( ProgramIndicator.VAR_CURRENT_DATE.equals( uid ) )
+                {
+                    date = currentDate;
+                }
+                
+                // TODO ProgramIndicator.VAR_EXECUTION_DATE;
+
+                if ( date != null )
+                {
+                    matcher.appendReplacement( buffer, DateUtils.daysBetween( currentDate, date ) + "" );
+                }
+            }
+        }
+
+        expression = TextUtils.appendTail( matcher, buffer );
+
+        // ---------------------------------------------------------------------
+        // Value count variable
+        // ---------------------------------------------------------------------
+
+        buffer = new StringBuffer();
+        matcher = ProgramIndicator.VALUECOUNT_PATTERN.matcher( expression );
+
+        while ( matcher.find() )
+        {
+            String var = matcher.group( 1 );
+
+            if ( ProgramIndicator.VAR_VALUE_COUNT.equals( var ) )
+            {
+                matcher.appendReplacement( buffer, String.valueOf( valueCount ) );
+            }
+            else if ( ProgramIndicator.VAR_ZERO_POS_VALUE_COUNT.equals( var ) )
+            {
+                matcher.appendReplacement( buffer, String.valueOf( zeroPosValueCount ) );
+            }
+        }
+
+        expression = TextUtils.appendTail( matcher, buffer );
+
+        return MathUtils.calculateExpression( expression );
     }
 
     @Override
     @Transactional
-    public Map<String, String> getProgramIndicatorValues( ProgramInstance programInstance )
+    public Map<String, Double> getProgramIndicatorValues( ProgramInstance programInstance )
     {
-        Map<String, String> result = new HashMap<>();
+        Map<String, Double> result = new HashMap<>();
 
         Set<ProgramIndicator> programIndicators = programInstance.getProgram().getProgramIndicators();
 
         for ( ProgramIndicator programIndicator : programIndicators )
         {
-            String value = getProgramIndicatorValue( programIndicator, programInstance );
+            Double value = getProgramIndicatorValue( programIndicator, programInstance );
 
             if ( value != null )
             {
@@ -611,170 +733,6 @@
     // -------------------------------------------------------------------------
 
     /**
-     * Get indicator value for the given arguments. If programStageInstance
-     * argument is null, the program stage instance will be retrieved based on
-     * the given program instance in combination with the program stage from the indicator expression.
-     *
-     * @param indicator            the indicator, must be not null.
-     * @param programInstance      the program instance, can be null.
-     * @param programStageInstance the program stage instance, can be null.
-     */
-    private Double getValue( ProgramIndicator indicator, ProgramInstance programInstance, ProgramStageInstance programStageInstance )
-    {
-        StringBuffer buffer = new StringBuffer();
-
-        String expression = indicator.getExpression();
-
-        Matcher matcher = ProgramIndicator.EXPRESSION_PATTERN.matcher( expression );
-
-        int valueCount = 0;
-        int zeroPosValueCount = 0;
-
-        while ( matcher.find() )
-        {
-            String key = matcher.group( 1 );
-            String uid = matcher.group( 2 );
-
-            if ( ProgramIndicator.KEY_DATAELEMENT.equals( key ) )
-            {
-                String de = matcher.group( 3 );
-                ProgramStage programStage = programStageService.getProgramStage( uid );
-                DataElement dataElement = dataElementService.getDataElement( de );
-
-                if ( programStage != null && dataElement != null )
-                {
-                    ProgramStageInstance psi = programStageInstance != null ?
-                        programStageInstance :
-                        programStageInstanceService.getProgramStageInstance( programInstance, programStage );
-
-                    TrackedEntityDataValue dataValue = dataValueService.getTrackedEntityDataValue( psi, dataElement );
-
-                    if ( dataValue == null )
-                    {
-                        return null;
-                    }
-
-                    String value = dataValue.getValue();
-
-                    if ( dataElement.getType().equals( DataElement.VALUE_TYPE_DATE ) )
-                    {
-                        value = DateUtils.daysBetween( new Date(), DateUtils.getDefaultDate( value ) ) + " ";
-                    }
-
-                    matcher.appendReplacement( buffer, value );
-
-                    valueCount++;
-                    zeroPosValueCount = isZeroOrPositive( value ) ? (zeroPosValueCount + 1) : zeroPosValueCount;
-                }
-                else
-                {
-                    return null;
-                }
-            }
-            else if ( ProgramIndicator.KEY_ATTRIBUTE.equals( key ) )
-            {
-                TrackedEntityAttribute attribute = attributeService.getTrackedEntityAttribute( uid );
-
-                if ( attribute != null )
-                {
-                    TrackedEntityAttributeValue attributeValue = attributeValueService.getTrackedEntityAttributeValue(
-                        programInstance.getEntityInstance(), attribute );
-
-                    if ( attributeValue != null )
-                    {
-                        String value = attributeValue.getValue();
-
-                        if ( ValueType.DATE == attribute.getValueType() )
-                        {
-                            value = DateUtils.daysBetween( new Date(), DateUtils.getDefaultDate( value ) ) + " ";
-                        }
-
-                        matcher.appendReplacement( buffer, value );
-
-                        valueCount++;
-                        zeroPosValueCount = isZeroOrPositive( value ) ? (zeroPosValueCount + 1) : zeroPosValueCount;
-                    }
-                    else
-                    {
-                        return null;
-                    }
-                }
-                else
-                {
-                    return null;
-                }
-            }
-            else if ( ProgramIndicator.KEY_CONSTANT.equals( key ) )
-            {
-                Constant constant = constantService.getConstant( uid );
-
-                if ( constant != null )
-                {
-                    matcher.appendReplacement( buffer, String.valueOf( constant.getValue() ) );
-                }
-                else
-                {
-                    return null;
-                }
-            }
-            else if ( ProgramIndicator.KEY_PROGRAM_VARIABLE.equals( key ) )
-            {
-                Date currentDate = new Date();
-                Date date = null;
-
-                if ( ProgramIndicator.VAR_ENROLLMENT_DATE.equals( uid ) )
-                {
-                    date = programInstance.getEnrollmentDate();
-                }
-                else if ( ProgramIndicator.VAR_INCIDENT_DATE.equals( uid ) )
-                {
-                    date = programInstance.getDateOfIncident();
-                }
-                else if ( ProgramIndicator.VAR_EXECUTION_DATE.equals( uid ) )
-                {
-                    date = programStageInstance != null ? programStageInstance.getExecutionDate() : null;
-                }
-                else if ( ProgramIndicator.VAR_CURRENT_DATE.equals( uid ) )
-                {
-                    date = currentDate;
-                }
-
-                if ( date != null )
-                {
-                    matcher.appendReplacement( buffer, DateUtils.daysBetween( currentDate, date ) + "" );
-                }
-            }
-        }
-
-        expression = TextUtils.appendTail( matcher, buffer );
-
-        // ---------------------------------------------------------------------
-        // Value count variable
-        // ---------------------------------------------------------------------
-
-        buffer = new StringBuffer();
-        matcher = ProgramIndicator.VALUECOUNT_PATTERN.matcher( expression );
-
-        while ( matcher.find() )
-        {
-            String var = matcher.group( 1 );
-
-            if ( ProgramIndicator.VAR_VALUE_COUNT.equals( var ) )
-            {
-                matcher.appendReplacement( buffer, String.valueOf( valueCount ) );
-            }
-            else if ( ProgramIndicator.VAR_ZERO_POS_VALUE_COUNT.equals( var ) )
-            {
-                matcher.appendReplacement( buffer, String.valueOf( zeroPosValueCount ) );
-            }
-        }
-
-        expression = TextUtils.appendTail( matcher, buffer );
-
-        return MathUtils.calculateExpression( expression );
-    }
-
-    /**
      * Creates a SQL select clause from the given program indicator variable
      * based on the given expression. Wraps the count variables with
      * <code>nullif</code> to avoid potential division by zero.

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java	2015-08-26 11:37:24 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java	2015-09-04 08:57:35 +0000
@@ -306,6 +306,9 @@
 
         executeSql( "ALTER TABLE programindicator ALTER description TYPE text" );
         executeSql( "ALTER TABLE programindicator ALTER expression TYPE text" );
+        executeSql( "alter table programindicator drop column valuetype" );
+        executeSql( "alter table programindicator drop column rootdate" );
+        
         executeSql( "ALTER TABLE programstage ALTER description TYPE text" );
         
         executeSql( "update programindicator set displayinform = false where displayinform is null" );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/program/hibernate/ProgramIndicator.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/program/hibernate/ProgramIndicator.hbm.xml	2015-08-28 10:23:48 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/program/hibernate/ProgramIndicator.hbm.xml	2015-09-04 08:57:35 +0000
@@ -22,8 +22,6 @@
     <many-to-one name="program" class="org.hisp.dhis.program.Program"
       column="programid" foreign-key="fk_programindicator_program" not-null="true" />
 
-    <property name="valueType" />
-
     <property name="expression" type="text" />
 
     <property name="filter" type="text" />
@@ -45,9 +43,7 @@
     <property name="decimals" />
 
     <property name="displayInForm" />
-    
-    <property name="rootDate" />
-    
+        
     <!-- Access properties -->
     <many-to-one name="user" class="org.hisp.dhis.user.User" column="userid" foreign-key="fk_programindicator_userid" />
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java	2015-09-03 08:15:09 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java	2015-09-04 08:57:35 +0000
@@ -291,7 +291,7 @@
         programA.getProgramIndicators().add( indicatorA );
 
         indicatorB = createProgramIndicator( 'B', programA, "70", null );
-        indicatorB.setValueType( ProgramIndicator.VALUE_TYPE_DATE );
+        //indicatorB.setValueType( ProgramIndicator.VALUE_TYPE_DATE );
         programA.getProgramIndicators().add( indicatorB );
 
         indicatorC = createProgramIndicator( 'C', programA, "0", null );
@@ -325,13 +325,13 @@
             + KEY_DATAELEMENT + "{" + psA.getUid() + "." + deB.getUid() + "} ) + " + KEY_DATAELEMENT + "{"
             + psA.getUid() + "." + deA.getUid() + "}";
         indicatorI = createProgramIndicator( 'I', programB, expressionI, null );
-        indicatorI.setValueType( VALUE_TYPE_DATE );
+        //indicatorI.setValueType( VALUE_TYPE_DATE );
 
         String expressionJ = "(" + KEY_ATTRIBUTE + "{" + atC.getUid() + "}  - " + KEY_PROGRAM_VARIABLE + "{"
             + ProgramIndicator.VAR_ENROLLMENT_DATE + "} ) + " + KEY_DATAELEMENT + "{" + psA.getUid() + "." + deA.getUid()
             + "} * " + ProgramIndicator.KEY_CONSTANT + "{" + constantA.getUid() + "}";
         indicatorJ = createProgramIndicator( 'J', programB, expressionJ, null );
-        indicatorJ.setValueType( VALUE_TYPE_DATE );
+        //indicatorJ.setValueType( VALUE_TYPE_DATE );
     }
 
     // -------------------------------------------------------------------------
@@ -450,20 +450,17 @@
         programIndicatorService.addProgramIndicator( indicatorI );
         programIndicatorService.addProgramIndicator( indicatorJ );
 
-        String valueINT = programIndicatorService.getProgramIndicatorValue( indicatorA, programInstance );
-        assertEquals( "10.0", valueINT );
-
-        String valueDATE = programIndicatorService.getProgramIndicatorValue( indicatorB, programInstance );
-        assertEquals( DateUtils.getMediumDateString( enrollmentDate ), valueDATE );
-
-        String valueE = programIndicatorService.getProgramIndicatorValue( indicatorE, programInstance );
-        assertEquals( "9.0", valueE );
-
-        String valueF = programIndicatorService.getProgramIndicatorValue( indicatorF, programInstance );
-        assertEquals( "17.0", valueF );
-
-        String valueG = programIndicatorService.getProgramIndicatorValue( indicatorG, programInstance );
-        assertEquals( "29.0", valueG );
+        Double valueINT = programIndicatorService.getProgramIndicatorValue( indicatorA, programInstance );
+        assertEquals( 10.0, valueINT, 0.01 );
+
+        Double valueE = programIndicatorService.getProgramIndicatorValue( indicatorE, programInstance );
+        assertEquals( 9.0, valueE, 0.01 );
+
+        Double valueF = programIndicatorService.getProgramIndicatorValue( indicatorF, programInstance );
+        assertEquals( 17.0, valueF, 0.01 );
+
+        Double valueG = programIndicatorService.getProgramIndicatorValue( indicatorG, programInstance );
+        assertEquals( 29.0, valueG, 0.01 );
     }
 
     @Test
@@ -471,12 +468,9 @@
     {
         programIndicatorService.addProgramIndicator( indicatorA );
         programIndicatorService.addProgramIndicator( indicatorB );
-        programIndicatorService.addProgramIndicator( indicatorC );
 
-        Map<String, String> indicatorMap = programIndicatorService.getProgramIndicatorValues( programInstance );
-        assertEquals( 3, indicatorMap.keySet().size() );
-        assertEquals( "10.0", indicatorMap.get( "IndicatorA" ) );
-        assertEquals( DateUtils.getMediumDateString( enrollmentDate ), indicatorMap.get( "IndicatorB" ) );
+        Map<String, Double> indicatorMap = programIndicatorService.getProgramIndicatorValues( programInstance );
+        assertEquals( 10.0, indicatorMap.get( "IndicatorA" ), 0.01 );
     }
 
     @Test

=== modified file 'dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java'
--- dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java	2015-09-04 05:55:14 +0000
+++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java	2015-09-04 08:57:35 +0000
@@ -1293,10 +1293,8 @@
         indicator.setCode( "IndicatorCode" + uniqueCharacter );
         indicator.setDescription( "IndicatorDescription" + uniqueCharacter );
         indicator.setProgram( program );
-        indicator.setValueType( ProgramIndicator.VALUE_TYPE_INT );
         indicator.setExpression( expression );
         indicator.setFilter( filter );
-        indicator.setRootDate( ProgramIndicator.VAR_INCIDENT_DATE );
 
         return indicator;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java	2015-04-21 08:42:34 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java	2015-09-04 08:57:35 +0000
@@ -252,9 +252,9 @@
         return latitude;
     }
 
-    private Map<String, String> programIndicatorsMap = new HashMap<>();
+    private Map<String, Double> programIndicatorsMap = new HashMap<>();
 
-    public Map<String, String> getProgramIndicatorsMap()
+    public Map<String, Double> getProgramIndicatorsMap()
     {
         return programIndicatorsMap;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/TrackedEntityInstanceDashboardAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/TrackedEntityInstanceDashboardAction.java	2015-07-02 07:05:55 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/TrackedEntityInstanceDashboardAction.java	2015-09-04 08:57:35 +0000
@@ -107,13 +107,13 @@
 
     private Collection<Relationship> relationships = new HashSet<>();
 
-    private Map<String, String> programIndicatorsMap = new HashMap<>();
+    private Map<String, Double> programIndicatorsMap = new HashMap<>();
 
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
 
-    public Map<String, String> getProgramIndicatorsMap()
+    public Map<String, Double> getProgramIndicatorsMap()
     {
         return programIndicatorsMap;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/AddProgramIndicatorAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/AddProgramIndicatorAction.java	2015-08-28 10:23:48 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/AddProgramIndicatorAction.java	2015-09-04 08:57:35 +0000
@@ -28,9 +28,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
 import org.apache.commons.lang3.StringUtils;
 import org.hisp.dhis.analytics.AggregationType;
 import org.hisp.dhis.analytics.EventOutputType;
@@ -110,13 +107,6 @@
         this.description = description;
     }
 
-    private String valueType;
-
-    public void setValueType( String valueType )
-    {
-        this.valueType = valueType;
-    }
-
     private String expression;
 
     public void setExpression( String expression )
@@ -159,13 +149,6 @@
         this.displayInForm = displayInForm;
     }
 
-    private String rootDate;
-
-    public void setRootDate( String rootDate )
-    {
-        this.rootDate = rootDate;
-    }
-
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -174,20 +157,6 @@
     public String execute()
         throws Exception
     {
-        code = (code == null && code.trim().length() == 0) ? null : code;
-        expression = expression.trim();
-
-        if ( valueType.equals( ProgramIndicator.VALUE_TYPE_DATE ) )
-        {
-            Pattern pattern = Pattern.compile( "[(+|-|*|\\)]+" );
-            Matcher matcher = pattern.matcher( expression );
-            
-            if ( matcher.find() && matcher.start() != 0 )
-            {
-                expression = "+" + expression;
-            }
-        }
-
         Program program = programService.getProgram( programId );
         
         ProgramIndicator indicator = new ProgramIndicator();
@@ -196,18 +165,15 @@
         indicator.setCode( StringUtils.trimToNull( code ) );
         indicator.setDescription( StringUtils.trimToNull( description ) );
         indicator.setProgram( program );
-        indicator.setValueType( StringUtils.trimToNull( valueType ) );
         indicator.setExpression( StringUtils.trimToNull( expression ) );
         indicator.setFilter( StringUtils.trimToNull( filter ) );
         indicator.setAggregationType( AggregationType.valueOf( aggregationType ) );
         indicator.setEventOutputType( EventOutputType.valueOf( eventOutputType ) );
         indicator.setDecimals( decimals );
         indicator.setDisplayInForm( displayInForm );
-        indicator.setRootDate( StringUtils.trimToNull( rootDate ) );
 
         programIndicatorService.addProgramIndicator( indicator );
 
         return SUCCESS;
     }
-
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/UpdateProgramIndicatorAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/UpdateProgramIndicatorAction.java	2015-08-28 10:23:48 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/UpdateProgramIndicatorAction.java	2015-09-04 08:57:35 +0000
@@ -28,9 +28,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
 import org.apache.commons.lang.StringUtils;
 import org.hisp.dhis.analytics.AggregationType;
 import org.hisp.dhis.analytics.EventOutputType;
@@ -96,13 +93,6 @@
         this.description = description;
     }
 
-    private String valueType;
-
-    public void setValueType( String valueType )
-    {
-        this.valueType = valueType;
-    }
-
     private String expression;
 
     public void setExpression( String expression )
@@ -145,13 +135,6 @@
         this.displayInForm = displayInForm;
     }
 
-    private String rootDate;
-
-    public void setRootDate( String rootDate )
-    {
-        this.rootDate = rootDate;
-    }
-
     private Integer programId;
 
     public Integer getProgramId()
@@ -167,34 +150,18 @@
     public String execute()
         throws Exception
     {
-        code = (code == null && code.trim().length() == 0) ? null : code;
-        expression = expression.trim();
-
-        if ( valueType.equals( ProgramIndicator.VALUE_TYPE_DATE ) )
-        {
-            Pattern pattern = Pattern.compile( "[(+|-|*|\\)]+" );
-            Matcher matcher = pattern.matcher( expression );
-            
-            if ( matcher.find() && matcher.start() != 0 )
-            {
-                expression = "+" + expression;
-            }
-        }
-
         ProgramIndicator indicator = programIndicatorService.getProgramIndicator( id );
 
         indicator.setName( StringUtils.trimToNull( name ) );
         indicator.setShortName( StringUtils.trimToNull( shortName ) );
         indicator.setCode( StringUtils.trimToNull( code ) );
         indicator.setDescription( StringUtils.trimToNull( description ) );
-        indicator.setValueType( StringUtils.trimToNull( valueType ) );
         indicator.setExpression( StringUtils.trimToNull( expression ) );
         indicator.setFilter( StringUtils.trimToNull( filter ) );
         indicator.setAggregationType( AggregationType.valueOf( aggregationType ) );
         indicator.setEventOutputType( EventOutputType.valueOf( eventOutputType ) );
         indicator.setDecimals( decimals );
         indicator.setDisplayInForm( displayInForm );
-        indicator.setRootDate( StringUtils.trimToNull( rootDate ) );
 
         programIndicatorService.updateProgramIndicator( indicator );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramIndicator.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramIndicator.vm	2015-08-28 10:23:48 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramIndicator.vm	2015-09-04 08:57:35 +0000
@@ -53,16 +53,6 @@
 			<td></td>
 		</tr>
 		<tr>
-			<td><label for="valueType">$i18n.getString( "value_type" ) </label></td>
-			<td>
-				<select id="valueType" name="valueType" onchange='programIndicatorOnChange();' >
-					<option value='int'>$i18n.getString('int')</option>
-					<option value='date'>$i18n.getString('date')</option>
-				</select>
-			</td>
-			<td></td>
-		</tr>
-		<tr>
 	        <td><label for="aggregationType">$i18n.getString( "aggregation_type" )</label></td>
 	        <td>
 	            <select id="aggregationType" name="aggregationType">
@@ -107,17 +97,6 @@
 			<td><input type="checkbox" id="displayInForm" name="displayInForm" value="true"></td>
 			<td></td>
 		</tr>
-		<tr id='rootDateTR' style='display:none'>
-			<td><label for="rootDate">$i18n.getString( "date_for_calculating" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
-			<td>
-				<select id="rootDate" name="rootDate" >
-					<option value='incident_date'>$i18n.getString('incident_date')</option>
-					<option value='execution_date'>$i18n.getString('report_date')</option>
-					<option value='current_date'>$i18n.getString('current_date')</option>
-				</select>
-			</td>
-			<td></td>
-		</tr>
 </table>
 <br>
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramIndicator.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramIndicator.vm	2015-09-03 08:15:09 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramIndicator.vm	2015-09-04 08:57:35 +0000
@@ -53,16 +53,6 @@
 		<td></td>
 	</tr>
 	<tr>
-		<td><label for="valueType">$i18n.getString( "value_type" )</label></td>
-		<td>
-			<select id="valueType" name="valueType" onchange='programIndicatorOnChange();' >
-				<option value='int' #if( $programIndicator.valueType=='int' ) selected #end>$i18n.getString('int')</option>
-				<option value='date' #if( $programIndicator.valueType=='date' ) fasdfasdf selected #end>$i18n.getString('date')</option>
-			</select>
-		</td>
-		<td></td>
-	</tr>
-	<tr>
         <td><label for="aggregationType">$i18n.getString( "aggregation_type" )</label></td>
         <td>
           <select id="aggregationType" name="aggregationType">
@@ -107,17 +97,6 @@
 		<td><input type="checkbox" id="displayInForm" name="displayInForm" value="true"#if( $programIndicator.displayInForm ) checked="checked"#end></td>
 		<td></td>
 	</tr>
-	<tr id='rootDateTR' #if($programIndicator.valueType!='date') style='display:none' #end >
-		<td><label for="rootDate">$i18n.getString( "date_for_calculating" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
-		<td>
-			<select id="rootDate" name="rootDate" >
-				<option value='incident_date'>$i18n.getString('incident_date')</option>
-				<option value='execution_date'>$i18n.getString('report_date')</option>
-				<option value='current_date'>$i18n.getString('current_date')</option>
-			</select>
-		</td>
-		<td></td>
-	</tr>
 </table>
 <br>