← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7703: Removed unused methods. Moved around some others

 

------------------------------------------------------------
revno: 7703
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-07-25 16:44:02 +0200
message:
  Removed unused methods. Moved around some others
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/ExpressionService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedDataValueService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueStore.java
  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/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataanalysis/MinMaxOutlierAnalysisServiceTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/expression/ExpressionServiceTest.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/DefaultCrossTabService.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/jdbc/CrossTabStore.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/jdbc/JDBCCrossTabStore.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/META-INF/dhis/beans.xml


--
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/aggregation/AggregatedDataValueService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueService.java	2012-02-27 14:12:54 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueService.java	2012-07-25 14:44:02 +0000
@@ -28,13 +28,11 @@
  */
 
 import java.util.Collection;
-import java.util.Map;
 
 import org.hisp.dhis.completeness.DataSetCompletenessResult;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOption;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementOperand;
 import org.hisp.dhis.datavalue.DataValue;
 import org.hisp.dhis.datavalue.DeflatedDataValue;
 import org.hisp.dhis.indicator.Indicator;
@@ -378,13 +376,4 @@
      * @param sourceId the Source identifier.
      */
     DataValue getDataValue( int dataElementId, int categoryOptionComboId, int periodId, int sourceId );
-    
-    /**
-     * Gets a Map with entries containing Operand and value for all DataValues registered for the given Period and Source.
-     * 
-     * @param periodId the Period identifier.
-     * @param sourceId the Source identifier.
-     * @return map of data values.
-     */
-    Map<DataElementOperand, String> getDataValueMap( int periodId, int sourceId );
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java	2012-02-27 14:12:54 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java	2012-07-25 14:44:02 +0000
@@ -28,12 +28,10 @@
  */
 
 import java.util.Collection;
-import java.util.Map;
 
 import org.hisp.dhis.completeness.DataSetCompletenessResult;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOption;
-import org.hisp.dhis.dataelement.DataElementOperand;
 import org.hisp.dhis.datavalue.DataValue;
 import org.hisp.dhis.datavalue.DeflatedDataValue;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -356,13 +354,4 @@
      * @param sourceId the Source identifier.
      */
     DataValue getDataValue( int dataElementId, int categoryOptionComboId, int periodId, int sourceId );
-    
-    /**
-     * Gets a Map with entries containing Operand and value for all DataValues registered for the given Period and Source.
-     * 
-     * @param periodId the Period identifier.
-     * @param sourceId the Source identifier.
-     * @return map of data values.
-     */
-    Map<DataElementOperand, String> getDataValueMap( int periodId, int sourceId );
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueService.java	2012-07-20 11:41:57 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueService.java	2012-07-25 14:44:02 +0000
@@ -29,7 +29,6 @@
 
 import java.util.Collection;
 import java.util.Map;
-import java.util.Set;
 
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
@@ -109,17 +108,6 @@
      */
     DataValue getDataValue( OrganisationUnit source, DataElement dataElement, Period period, DataElementCategoryOptionCombo optionCombo );
 
-    /**
-     * Returns a DataValue.
-     * 
-     * @param dataElementId the DataElement identifier.
-     * @param periodId the Period identifier.
-     * @param sourceId the Source identifier.
-     * @param categoryOptionComboId the DataElementCategoryOptionCombo identifier.
-     * @return the DataValue.
-     */
-    String getValue( int dataElementId, int periodId, int sourceId, int categoryOptionComboId );
-    
     // -------------------------------------------------------------------------
     // Collections of DataValues
     // -------------------------------------------------------------------------
@@ -256,15 +244,6 @@
     DataValue getLatestDataValues( DataElement dataElement, PeriodType periodType, OrganisationUnit organisationUnit );
     
     /**
-     * Filters and returns the data element operands which have registered data values
-     * out of the given collection.
-     * 
-     * @param operands the data element operands to filter.
-     * @return the data element operands with registered data values.
-     */
-    Set<DataElementOperand> getOperandsWithDataValues( Set<DataElementOperand> operands );
-
-    /**
      * Gets the number of DataValues persisted since the given number of days.
      * 
      * @param days the number of days since now to include in the count.

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueStore.java	2012-07-20 11:41:57 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueStore.java	2012-07-25 14:44:02 +0000
@@ -30,7 +30,6 @@
 import java.util.Collection;
 import java.util.Date;
 import java.util.Map;
-import java.util.Set;
 
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
@@ -101,17 +100,6 @@
      */
     DataValue getDataValue( OrganisationUnit source, DataElement dataElement, Period period, DataElementCategoryOptionCombo optionCombo );
 
-    /**
-     * Returns a DataValue.
-     * 
-     * @param dataElementId the DataElement identifier.
-     * @param periodId the Period identifier.
-     * @param sourceId the Source identifier.
-     * @param categoryOptionComboId the DataElementCategoryOptionCombo identifier.
-     * @return the DataValue.
-     */
-    String getValue( int dataElementId, int periodId, int sourceId, int categoryOptionComboId );
-    
     // -------------------------------------------------------------------------
     // Collections of DataValues
     // -------------------------------------------------------------------------
@@ -249,15 +237,6 @@
     DataValue getLatestDataValues( DataElement dataElement, PeriodType periodType, OrganisationUnit organisationUnit );
     
     /**
-     * Filters and returns the data element operands which have registered data values
-     * out of the given collection.
-     * 
-     * @param operands the data element operands to filter.
-     * @return the data element operands with registered data values.
-     */
-    Set<DataElementOperand> getOperandsWithDataValues( Set<DataElementOperand> operands );
-    
-    /**
      * Gets the number of DataValues persisted since the given data.
      * 
      * @param date the date.

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/ExpressionService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/ExpressionService.java	2012-07-21 17:19:38 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/ExpressionService.java	2012-07-25 14:44:02 +0000
@@ -35,8 +35,6 @@
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.dataelement.DataElementOperand;
 import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.period.Period;
 
 /**
  * Interface for ExpressionService. Defines service functionality for
@@ -104,23 +102,6 @@
      */
     Collection<Expression> getAllExpressions();
 
-    /**
-     * Calculates the value of the given Expression.
-     * 
-     * @param expression The Expression.
-     * @param source The Source.
-     * @param period The Period.
-     * @param nullIfNoValues indicates whether null should be returned if no
-     *        DataValues are registered for a DataElement in the expression.
-     * @param aggregated indicates whether aggregated or raw data should be
-     *        used when evaluating the expression.     *        
-     * @param days The number to be substituted with the days expression in the formula.
-     * @return The value of the given Expression, or null
-     *         if no values are registered for a given combination of 
-     *         DataElement, Source, and Period.
-     */
-    Double getExpressionValue( Expression expression, Period period, OrganisationUnit source, boolean nullIfNoValues, boolean aggregate, Integer days );
-    
     Double getExpressionValue( Expression expression, Map<DataElementOperand, Double> valueMap, 
         Map<Integer, Double> constantMap, Integer days, boolean nullIfNoValues );
     
@@ -240,24 +221,6 @@
     String substituteExpression( String expression, Integer days );
     
     /**
-     * Converts an expression on the form [34] + [23], where the numbers are 
-     * IDs of DataElements, to the form 200 + 450, where the numbers are the 
-     * values of the DataValues registered for the Period and Source. "0" is
-     * included if there is no DataValue registered for the given parameters.
-     * 
-     * @param expression The expression string.
-     * @param period The Period.
-     * @param source The Source.
-     * @param nullIfNoValues indicates whether null should be returned if no
-     *        DataValues are registered for a DataElement in the expression.
-     * @param aggregated indicates whether aggregated or raw data should be
-     *        used when evaluating the expression.
-     * @param days The number to be substituted with the days expression in the formula.
-     * @return A numerical expression.
-     */    
-    String generateExpression( String expression, Period period, OrganisationUnit source, boolean nullIfNoValues, boolean aggregated, Integer days );
-
-    /**
      * Generates an expression where the Operand identifiers, consisting of 
      * data element id and category option combo id, are replaced
      * by the aggregated value for the relevant combination of data element,

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedDataValueService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedDataValueService.java	2012-02-27 14:12:54 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedDataValueService.java	2012-07-25 14:44:02 +0000
@@ -28,13 +28,11 @@
  */
 
 import java.util.Collection;
-import java.util.Map;
 
 import org.hisp.dhis.completeness.DataSetCompletenessResult;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOption;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementOperand;
 import org.hisp.dhis.datavalue.DataValue;
 import org.hisp.dhis.datavalue.DeflatedDataValue;
 import org.hisp.dhis.indicator.Indicator;
@@ -250,9 +248,4 @@
     {
         return aggregatedDataValueStore.getDataValue( dataElementId, categoryOptionComboId, periodId, sourceId );
     }
-    
-    public Map<DataElementOperand, String> getDataValueMap( int periodId, int sourceId )
-    {
-        return aggregatedDataValueStore.getDataValueMap( periodId, sourceId );
-    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java	2012-02-27 14:12:54 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java	2012-07-25 14:44:02 +0000
@@ -34,8 +34,6 @@
 import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
 
 import org.amplecode.quick.StatementHolder;
 import org.amplecode.quick.StatementManager;
@@ -52,7 +50,6 @@
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOption;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementOperand;
 import org.hisp.dhis.datavalue.DataValue;
 import org.hisp.dhis.datavalue.DeflatedDataValue;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -750,39 +747,4 @@
             holder.close();
         }
     }
-    
-    public Map<DataElementOperand, String> getDataValueMap( int periodId, int sourceId )
-    {
-        final StatementHolder holder = statementManager.getHolder();
-            
-        try
-        {
-            final String sql =
-                "SELECT dataelementid, categoryoptioncomboid, value " +
-                "FROM datavalue " +
-                "WHERE periodid = " + periodId + " " +
-                "AND sourceid = " + sourceId;
-            
-            final ResultSet resultSet = holder.getStatement().executeQuery( sql );
-            
-            final Map<DataElementOperand, String> map = new HashMap<DataElementOperand, String>();
-            
-            while ( resultSet.next() )
-            {
-                final DataElementOperand operand = new DataElementOperand( resultSet.getInt( 1 ), resultSet.getInt( 2 ) );
-                
-                map.put( operand, resultSet.getString( 3 ) );
-            }
-            
-            return map;
-        }
-        catch ( SQLException ex )
-        {
-            throw new RuntimeException( "Failed to get DataValues", ex );
-        }
-        finally
-        {
-            holder.close();
-        }
-    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueService.java	2012-07-20 11:41:57 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueService.java	2012-07-25 14:44:02 +0000
@@ -32,7 +32,6 @@
 import java.util.Calendar;
 import java.util.Collection;
 import java.util.Map;
-import java.util.Set;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -114,11 +113,6 @@
         return dataValueStore.getDataValue( source, dataElement, period, optionCombo );
     }
 
-    public String getValue( int dataElementId, int periodId, int sourceId, int categoryOptionComboId )
-    {
-        return dataValueStore.getValue( dataElementId, periodId, sourceId, categoryOptionComboId );
-    }
-
     // -------------------------------------------------------------------------
     // Collections of DataValues
     // -------------------------------------------------------------------------
@@ -201,11 +195,6 @@
         return true;
     }
 
-    public Set<DataElementOperand> getOperandsWithDataValues( Set<DataElementOperand> operands )
-    {
-        return dataValueStore.getOperandsWithDataValues( operands );
-    }
-
     public int getDataValueCount( int days )
     {
         Calendar cal = PeriodType.createCalendarInstance();

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueStore.java	2012-07-20 11:41:57 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueStore.java	2012-07-25 14:44:02 +0000
@@ -34,10 +34,7 @@
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
-import java.util.Set;
 
-import org.amplecode.quick.StatementHolder;
-import org.amplecode.quick.StatementManager;
 import org.hibernate.Criteria;
 import org.hibernate.Query;
 import org.hibernate.Session;
@@ -76,13 +73,6 @@
         this.sessionFactory = sessionFactory;
     }
 
-    private StatementManager statementManager;
-
-    public void setStatementManager( StatementManager statementManager )
-    {
-        this.statementManager = statementManager;
-    }
-
     private PeriodStore periodStore;
 
     public void setPeriodStore( PeriodStore periodStore )
@@ -167,15 +157,6 @@
         return (DataValue) criteria.uniqueResult();
     }
 
-    public String getValue( int dataElementId, int periodId, int sourceId, int categoryOptionComboId )
-    {
-        final String sql = "SELECT value " + "FROM datavalue " + "WHERE dataelementid='" + dataElementId + "' "
-            + "AND periodid='" + periodId + "' " + "AND sourceid='" + sourceId + "' " + "AND categoryoptioncomboid='"
-            + categoryOptionComboId + "'";
-
-        return statementManager.getHolder().queryForString( sql );
-    }
-
     // -------------------------------------------------------------------------
     // Collections of DataValues
     // -------------------------------------------------------------------------
@@ -411,31 +392,7 @@
 
         return (DataValue) query.uniqueResult();
     }
-    
-    public Set<DataElementOperand> getOperandsWithDataValues( Set<DataElementOperand> operands )
-    {
-        final Set<DataElementOperand> operandsWithData = new HashSet<DataElementOperand>();
-        
-        final StatementHolder holder = statementManager.getHolder();
-        
-        for ( DataElementOperand operand : operands )
-        {
-            final String sql = 
-                "SELECT COUNT(*) FROM datavalue " + 
-                "WHERE dataelementid=" + operand.getDataElementId() + " " +
-                "AND categoryoptioncomboid=" + operand.getOptionComboId();
-            
-            Integer count = holder.queryForInteger( sql );
-            
-            if ( count != null && count > 0 )
-            {
-                operandsWithData.add( operand );
-            }
-        }
-        
-        return operandsWithData;
-    }
-    
+        
     public int getDataValueCount( Date date )
     {
         Criteria criteria = sessionFactory.getCurrentSession().createCriteria( DataValue.class );

=== 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	2012-07-21 17:19:38 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java	2012-07-25 14:44:02 +0000
@@ -44,7 +44,6 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.aggregation.AggregatedDataValueService;
 import org.hisp.dhis.common.GenericStore;
 import org.hisp.dhis.constant.Constant;
 import org.hisp.dhis.constant.ConstantService;
@@ -54,10 +53,7 @@
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.dataelement.DataElementOperand;
 import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.datavalue.DataValueService;
 import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.period.Period;
 import org.hisp.dhis.system.util.MathUtils;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -106,20 +102,6 @@
         this.constantService = constantService;
     }
 
-    private DataValueService dataValueService;
-
-    public void setDataValueService( DataValueService dataValueService )
-    {
-        this.dataValueService = dataValueService;
-    }
-
-    private AggregatedDataValueService aggregatedDataValueService;
-
-    public void setAggregatedDataValueService( AggregatedDataValueService aggregatedDataValueService )
-    {
-        this.aggregatedDataValueService = aggregatedDataValueService;
-    }
-
     private DataElementCategoryService categoryService;
 
     public void setCategoryService( DataElementCategoryService categoryService )
@@ -159,15 +141,6 @@
     // -------------------------------------------------------------------------
     // Business logic
     // -------------------------------------------------------------------------
-
-    public Double getExpressionValue( Expression expression, Period period, OrganisationUnit source,
-        boolean nullIfNoValues, boolean aggregate, Integer days )
-    {
-        final String expressionString = generateExpression( expression.getExpression(), period, source, nullIfNoValues,
-            aggregate, days );
-
-        return expressionString != null ? calculateExpression( expressionString ) : null;
-    }
     
     public Double getExpressionValue( Expression expression, Map<DataElementOperand, Double> valueMap, 
         Map<Integer, Double> constantMap, Integer days, boolean nullIfNoValues )
@@ -590,67 +563,6 @@
         return buffer != null ? buffer.toString() : null;
     }
     
-    public String generateExpression( String expression, Period period, OrganisationUnit source,
-        boolean nullIfNoValues, boolean aggregated, Integer days )
-    {
-        StringBuffer buffer = null;
-
-        if ( expression != null )
-        {
-            buffer = new StringBuffer();
-
-            final Matcher matcher = FORMULA_PATTERN.matcher( expression );
-
-            while ( matcher.find() )
-            {
-                String match = matcher.group();
-                
-                if ( DAYS_EXPRESSION.equals( match ) ) // Days
-                {
-                    match = days != null ? String.valueOf( days ) : NULL_REPLACEMENT;
-                }
-                else if ( match.matches( CONSTANT_EXPRESSION ) ) // Constant
-                {
-                    final Constant constant = constantService.getConstant( Integer.parseInt( stripConstantExpression( match ) ) );
-                    
-                    match = constant != null ? String.valueOf( constant.getValue() ) : NULL_REPLACEMENT; 
-                }
-                else // Operand
-                {
-                    final DataElementOperand operand = DataElementOperand.getOperand( match );
-
-                    String value = null;
-
-                    if ( aggregated )
-                    {
-                        final Double aggregatedValue = aggregatedDataValueService.getAggregatedDataValue( operand
-                            .getDataElementId(), operand.getOptionComboId(), period.getId(), source.getId() );
-
-                        value = aggregatedValue != null ? String.valueOf( aggregatedValue ) : null;
-                    }
-                    else
-                    {
-                        value = dataValueService.getValue( operand.getDataElementId(), period.getId(), source.getId(),
-                            operand.getOptionComboId() );
-                    }
-
-                    if ( value == null && nullIfNoValues )
-                    {
-                        return null;
-                    }
-
-                    match = value != null ? value : NULL_REPLACEMENT;
-                }
-
-                matcher.appendReplacement( buffer, match );
-            }
-
-            matcher.appendTail( buffer );
-        }
-
-        return buffer != null ? buffer.toString() : null;
-    }
-
     public String generateExpression( String expression, Map<DataElementOperand, Double> valueMap, Map<Integer, Double> constantMap, Integer days, boolean nullIfNoValues )
     {
         StringBuffer buffer = null;

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2012-07-25 13:18:48 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2012-07-25 14:44:02 +0000
@@ -53,7 +53,6 @@
 
   <bean id="org.hisp.dhis.datavalue.DataValueStore" class="org.hisp.dhis.datavalue.hibernate.HibernateDataValueStore">
     <property name="sessionFactory" ref="sessionFactory" />
-    <property name="statementManager" ref="statementManager" />
     <property name="periodStore" ref="org.hisp.dhis.period.PeriodStore" />
 	<property name="jdbcTemplate" ref="jdbcTemplate" />
   </bean>
@@ -357,8 +356,6 @@
     <property name="expressionStore" ref="org.hisp.dhis.expression.ExpressionStore" />
     <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
     <property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
-    <property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
-    <property name="aggregatedDataValueService" ref="org.hisp.dhis.aggregation.AggregatedDataValueService" />
     <property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
   </bean>
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataanalysis/MinMaxOutlierAnalysisServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataanalysis/MinMaxOutlierAnalysisServiceTest.java	2012-07-25 13:18:48 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataanalysis/MinMaxOutlierAnalysisServiceTest.java	2012-07-25 14:44:02 +0000
@@ -53,8 +53,6 @@
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.system.util.ListUtils;
 import org.junit.Test;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.jdbc.support.rowset.SqlRowSet;
 
 /**
  * @author eirikmi
@@ -98,8 +96,6 @@
 
     private MinMaxDataElement minMaxDataElement;
 
-    private JdbcTemplate jdbcTemplate;
-    
     // ----------------------------------------------------------------------
     // Fixture
     // ----------------------------------------------------------------------
@@ -108,8 +104,6 @@
     public void setUpTest()
         throws Exception
     {
-        jdbcTemplate = (JdbcTemplate) getBean( "jdbcTemplate" );
-        
         minMaxOutlierAnalysisService = (DataAnalysisService) getBean( "org.hisp.dhis.dataanalysis.MinMaxOutlierAnalysisService" );
 
         dataElementService = (DataElementService) getBean( DataElementService.ID );
@@ -192,13 +186,6 @@
         
         minMaxDataElement = new MinMaxDataElement( organisationUnitA, dataElementA, categoryOptionCombo, -40, 40, false );
         minMaxDataElementService.addMinMaxDataElement( minMaxDataElement );
-
-        SqlRowSet rowSet = jdbcTemplate.queryForRowSet( "select mm.minvalue from minmaxdataelement mm" );
-        
-        while ( rowSet.next() )
-        {
-            System.out.println( "min value " + rowSet.getInt( "minvalue" ) );
-        }
                 
         Collection<Period> periods = new ArrayList<Period>();
         periods.add( periodI );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/expression/ExpressionServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/expression/ExpressionServiceTest.java	2012-07-20 11:41:57 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/expression/ExpressionServiceTest.java	2012-07-25 14:44:02 +0000
@@ -254,34 +254,6 @@
     }
 
     @Test
-    public void testGetExpressionValue()
-    {
-        Expression expression = new Expression( expressionA, descriptionA, dataElements, optionCombos );
-
-        Double value = expressionService.getExpressionValue( expression, period, source, false, false, null );
-
-        assertEquals( value, 15.0, 0.1 );
-
-        expression = new Expression( expressionB, descriptionB, dataElements, optionCombos );
-
-        value = expressionService.getExpressionValue( expression, period, source, false, false, null );
-
-        assertEquals( 0.0, value, 0.1 );
-
-        expression = new Expression( expressionD, descriptionB, dataElements, optionCombos );
-
-        value = expressionService.getExpressionValue( expression, period, source, false, false, 5 );
-
-        assertEquals( 15.0, value, 0.1 );
-
-        expression = new Expression( expressionE, descriptionB, dataElements, optionCombos );
-
-        value = expressionService.getExpressionValue( expression, period, source, false, false, null );
-
-        assertEquals( 20.0, value, 0.1 );
-    }
-
-    @Test
     public void testGetDataElementsInExpression()
     {
         Set<DataElement> dataElements = expressionService.getDataElementsInExpression( expressionA );
@@ -380,15 +352,6 @@
     }
 
     @Test
-    public void testGenerateExpression()
-    {
-        assertEquals( "10+5", expressionService.generateExpression( expressionA, period, source, false, false, null ) );
-        assertEquals( "0-0", expressionService.generateExpression( expressionB, period, source, false, false, null ) );
-        assertEquals( "10+7", expressionService.generateExpression( expressionD, period, source, false, false, 7 ) );
-        assertEquals( "10*2.0", expressionService.generateExpression( expressionE, period, source, false, false, null ) );
-    }
-
-    @Test
     public void testGenerateExpressionMap()
     {
         Map<DataElementOperand, Double> valueMap = new HashMap<DataElementOperand, Double>();

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/DefaultCrossTabService.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/DefaultCrossTabService.java	2012-01-09 20:03:56 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/DefaultCrossTabService.java	2012-07-25 14:44:02 +0000
@@ -43,11 +43,9 @@
 import org.apache.commons.lang.RandomStringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.aggregation.AggregatedDataValueService;
 import org.hisp.dhis.dataelement.DataElementOperand;
 import org.hisp.dhis.datamart.CrossTabDataValue;
 import org.hisp.dhis.datamart.crosstab.jdbc.CrossTabStore;
-import org.hisp.dhis.datavalue.DataValueService;
 import org.hisp.dhis.jdbc.batchhandler.GenericBatchHandler;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
@@ -81,21 +79,7 @@
     {
         this.crossTabStore = crossTabTableManager;
     }
-
-    private AggregatedDataValueService aggregatedDataValueService;
-
-    public void setAggregatedDataValueService( AggregatedDataValueService aggregatedDataValueService )
-    {
-        this.aggregatedDataValueService = aggregatedDataValueService;
-    }
-    
-    private DataValueService dataValueService;
-
-    public void setDataValueService( DataValueService dataValueService )
-    {
-        this.dataValueService = dataValueService;
-    }
-    
+        
     private StatementManager statementManager;
 
     public void setStatementManager( StatementManager statementManager )
@@ -109,7 +93,7 @@
 
     public Set<DataElementOperand> getOperandsWithData( Set<DataElementOperand> operands )
     {
-        return dataValueService.getOperandsWithDataValues( operands );
+        return crossTabStore.getOperandsWithDataValues( operands );
     }
     
     public String createCrossTabTable( List<DataElementOperand> operands )
@@ -137,7 +121,7 @@
         {
             for ( final Integer sourceId : organisationUnitIds )
             {
-                final Map<DataElementOperand, String> map = aggregatedDataValueService.getDataValueMap( periodId, sourceId );
+                final Map<DataElementOperand, String> map = crossTabStore.getDataValueMap( periodId, sourceId );
 
                 final List<String> valueList = new ArrayList<String>( operands.size() + 2 );
 

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/jdbc/CrossTabStore.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/jdbc/CrossTabStore.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/jdbc/CrossTabStore.java	2012-07-25 14:44:02 +0000
@@ -30,6 +30,7 @@
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import org.hisp.dhis.dataelement.DataElementOperand;
 import org.hisp.dhis.datamart.CrossTabDataValue;
@@ -142,4 +143,21 @@
      */
     Map<DataElementOperand, Double> getAggregatedOrgUnitDataCacheValue( Collection<DataElementOperand> operands, 
         int periodId, int sourceId, int organisationUnitGroupId, String key );
+    
+    /**
+     * Gets a set of DataElementOperands which have data values associated.
+     * 
+     * @param operands the DataElementOperands to check.
+     * @return a set of DataElementOperands.
+     */
+    Set<DataElementOperand> getOperandsWithDataValues( Set<DataElementOperand> operands );
+
+    /**
+     * Gets a Map with entries containing Operand and value for all DataValues registered for the given Period and Source.
+     * 
+     * @param periodId the Period identifier.
+     * @param sourceId the Source identifier.
+     * @return map of data values.
+     */
+    Map<DataElementOperand, String> getDataValueMap( int periodId, int sourceId );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/jdbc/JDBCCrossTabStore.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/jdbc/JDBCCrossTabStore.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/jdbc/JDBCCrossTabStore.java	2012-07-25 14:44:02 +0000
@@ -34,8 +34,10 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import org.amplecode.quick.StatementHolder;
 import org.amplecode.quick.StatementManager;
@@ -44,7 +46,6 @@
 
 /**
  * @author Lars Helge Overland
- * @version $Id: JDBCCrossTabStore.java 6216 2008-11-06 18:06:42Z eivindwa $
  */
 public class JDBCCrossTabStore
     implements CrossTabStore
@@ -59,6 +60,13 @@
     {
         this.statementManager = statementManager;
     }
+    
+    private StatementManager fileDbStatementManager;
+
+    public void setFileDbStatementManager( StatementManager fileDbStatementManager )
+    {
+        this.fileDbStatementManager = fileDbStatementManager;
+    }
 
     // -------------------------------------------------------------------------
     // CrossTabStore implementation
@@ -238,6 +246,69 @@
             holder.close();
         }
     }
+
+    // -------------------------------------------------------------------------
+    // Methods on file database
+    // -------------------------------------------------------------------------
+
+    public Set<DataElementOperand> getOperandsWithDataValues( Set<DataElementOperand> operands )
+    {
+        final Set<DataElementOperand> operandsWithData = new HashSet<DataElementOperand>();
+        
+        final StatementHolder holder = fileDbStatementManager.getHolder();
+        
+        for ( DataElementOperand operand : operands )
+        {
+            final String sql = 
+                "SELECT COUNT(*) FROM datavalue " + 
+                "WHERE dataelementid=" + operand.getDataElementId() + " " +
+                "AND categoryoptioncomboid=" + operand.getOptionComboId();
+            
+            Integer count = holder.queryForInteger( sql );
+            
+            if ( count != null && count > 0 )
+            {
+                operandsWithData.add( operand );
+            }
+        }
+        
+        return operandsWithData;
+    }
+
+    public Map<DataElementOperand, String> getDataValueMap( int periodId, int sourceId )
+    {
+        final StatementHolder holder = fileDbStatementManager.getHolder();
+            
+        try
+        {
+            final String sql =
+                "SELECT dataelementid, categoryoptioncomboid, value " +
+                "FROM datavalue " +
+                "WHERE periodid = " + periodId + " " +
+                "AND sourceid = " + sourceId;
+            
+            final ResultSet resultSet = holder.getStatement().executeQuery( sql );
+            
+            final Map<DataElementOperand, String> map = new HashMap<DataElementOperand, String>();
+            
+            while ( resultSet.next() )
+            {
+                final DataElementOperand operand = new DataElementOperand( resultSet.getInt( 1 ), resultSet.getInt( 2 ) );
+                
+                map.put( operand, resultSet.getString( 3 ) );
+            }
+            
+            return map;
+        }
+        catch ( SQLException ex )
+        {
+            throw new RuntimeException( "Failed to get DataValues", ex );
+        }
+        finally
+        {
+            holder.close();
+        }
+    }
     
     // -------------------------------------------------------------------------
     // Supportive methods

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/META-INF/dhis/beans.xml	2012-02-12 20:32:14 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/META-INF/dhis/beans.xml	2012-07-25 14:44:02 +0000
@@ -28,13 +28,12 @@
 
   <bean id="org.hisp.dhis.datamart.crosstab.jdbc.CrossTabStore" class="org.hisp.dhis.datamart.crosstab.jdbc.JDBCCrossTabStore">
     <property name="statementManager" ref="inMemoryStatementManager" />
+	<property name="fileDbStatementManager" ref="statementManager" />
   </bean>
 
   <bean id="org.hisp.dhis.datamart.crosstab.CrossTabService" class="org.hisp.dhis.datamart.crosstab.DefaultCrossTabService">
     <property name="batchHandlerFactory" ref="inMemoryBatchHandlerFactory" />
     <property name="crossTabStore" ref="org.hisp.dhis.datamart.crosstab.jdbc.CrossTabStore" />
-    <property name="aggregatedDataValueService" ref="org.hisp.dhis.aggregation.AggregatedDataValueService" />
-    <property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
     <property name="statementManager" ref="statementManager" />
   </bean>