← Back to team overview

dhis2-devs team mailing list archive

Re: [Branch ~dhis2-devs-core/dhis2/trunk] Rev 3466: Removed CalculatedDataElement

 

 Feeling like some spring cleaning on Easter, Lars?

I am thinking if may be necessary to document how to convert CDEs to
indicators. We have  a large number of them in , and recreation by hand will
be very painful.

It would seem that transferring of the "expression"
from calculateddataelement to the "numerator" field of indicator would be
feasible.

The other thing I had thought before we hacked up the 1.4 code was to import
1.4 CDEs as indicators. This would seem to be feasible as well but would
obviously require work.

Any thoughts about how to convert CDEs to indicators, and if we are still
going to maintain some level of backwards compatibility?

Regards,
Jason



On Sun, Apr 24, 2011 at 5:51 PM, <noreply@xxxxxxxxxxxxx> wrote:

> ------------------------------------------------------------
> revno: 3466
> committer: Lars Helge Overland <larshelge@xxxxxxxxx>
> branch nick: dhis2
> timestamp: Sun 2011-04-24 17:50:02 +0200
> message:
>  Removed CalculatedDataElement
> removed:
>
>  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CalculatedDataElement.java
>
>  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/CalculatedDataElement.hbm.xml
>
>  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/calculateddataelement/
>
>  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/calculateddataelement/CalculatedDataElementDataMart.java
>
>  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/calculateddataelement/DefaultCalculatedDataElementDataMart.java
>
>  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/CalculatedDataElementConverter.java
>
>  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/importer/CalculatedDataElementImporter.java
> modified:
>  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/Objects.java
>
>  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java
>
>  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.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/dataelement/DefaultDataElementService.java
>
>  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.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/java/org/hisp/dhis/startup/TableAlteror.java
>
>  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementServiceTest.java
>
>  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementStoreTest.java
>
>  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java
>
>  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/test/java/org/hisp/dhis/datamart/DataMartServiceTest.java
>
>  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ExportParams.java
>
>  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportObjectManager.java
>
>  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/util/Dhis14ParsingUtils.java
>
>  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataElementConverter.java
>
>  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataElementGroupMemberConverter.java
>
>  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DXFConverter.java
>
>  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataElementConverter.java
>
>  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataElementGroupMemberConverter.java
>
>  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataElementGroupSetMemberConverter.java
>
>  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataSetMemberConverter.java
>
>  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/exporter/DefaultDXFExportService.java
>
>  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/importer/DataElementImporter.java
>
>  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportObjectManager.java
>
>  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportObjectService.java
>
>  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.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/CustomDataEntryAction.java
>
>  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ProgramStageCustomDataEntryAction.java
>
>  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/DataEntryScreenManager.java
>
>  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/DefaultDataEntryScreenManager.java
>
>  dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/exp/DetailedMetaDataExportAction.java
>
>  dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/exp/MetaDataExportAction.java
>
>  dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/imp/GetMatchOptionsAction.java
>
>  dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/imp/GetPreviewOptionsAction.java
>
>  dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/util/ClassMapUtil.java
>
>  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java
>
>  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowUpdateDataElementFormAction.java
>
>  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java
>
>  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/AddIndicatorAction.java
>
>  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/UpdateIndicatorAction.java
>
>  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml
>
>  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm
>
>  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementForm.js
>
>  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js
>
>  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementForm.js
>
>  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm
>
>  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/exp/MetaDataExportAction.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/common/Objects.java'
> --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/Objects.java
> 2011-04-24 12:47:31 +0000
> +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/Objects.java
> 2011-04-24 15:50:02 +0000
> @@ -34,7 +34,6 @@
>  public enum Objects
>  {
>     DATAELEMENT,
> -    CALCULATEDDATAELEMENT,
>     EXTENDEDDATAELEMENT,
>     DATAELEMENTGROUP,
>     DATAELEMENTGROUPSET,
>
> === removed file
> 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CalculatedDataElement.java'
> ---
> dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CalculatedDataElement.java
>  2010-04-12 21:23:33 +0000
> +++
> dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CalculatedDataElement.java
>  1970-01-01 00:00:00 +0000
> @@ -1,95 +0,0 @@
> -package org.hisp.dhis.dataelement;
> -
> -/*
> - * Copyright (c) 2004-2010, University of Oslo
> - * All rights reserved.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions are
> met:
> - * * Redistributions of source code must retain the above copyright
> notice, this
> - *   list of conditions and the following disclaimer.
> - * * Redistributions in binary form must reproduce the above copyright
> notice,
> - *   this list of conditions and the following disclaimer in the
> documentation
> - *   and/or other materials provided with the distribution.
> - * * Neither the name of the HISP project nor the names of its
> contributors may
> - *   be used to endorse or promote products derived from this software
> without
> - *   specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
> IS" AND
> - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> IMPLIED
> - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
> LIABLE FOR
> - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> DAMAGES
> - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
> SERVICES;
> - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
> AND ON
> - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> OF THIS
> - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> - */
> -
> -import org.hisp.dhis.expression.Expression;
> -
> -/**
> - * A CalculatedDataElement (CDE) is created for a set of other related
> - * DataElements. Each constituent DataElement may be multiplied with a
> factor.
> - *
> - * An example: A value for the CDE "Number of births" is summed together
> from
> - * two other Data Elements, "Number of still births" and "Number of live
> - * births".
> - *
> - * CDEs may be displayed as subtotals in a data entry form. The user may
> specify
> - * whether or not the calculated value should be stored in the database.
> In all
> - * other cases, a CDE behaves just like any other DataElement.
> - *
> - * @author Hans S. Toemmerholt
> - * @version $Id$
> - */
> -public class CalculatedDataElement
> -    extends DataElement
> -{
> -    private boolean saved;
> -
> -    private Expression expression;
> -
> -    //
> -------------------------------------------------------------------------
> -    // Constructors
> -    //
> -------------------------------------------------------------------------
> -
> -    public CalculatedDataElement()
> -    {
> -    }
> -
> -    //
> -------------------------------------------------------------------------
> -    // Getters and setters
> -    //
> -------------------------------------------------------------------------
> -
> -    public boolean isSaved()
> -    {
> -        return saved;
> -    }
> -
> -    public void setSaved( boolean saved )
> -    {
> -        this.saved = saved;
> -    }
> -
> -    public Expression getExpression()
> -    {
> -        return expression;
> -    }
> -
> -    public void setExpression( Expression expression )
> -    {
> -        this.expression = expression;
> -    }
> -
> -    public boolean equals( Object other )
> -    {
> -        return super.equals( other );
> -    }
> -
> -    public int hashCode()
> -    {
> -        return super.hashCode();
> -    }
> -}
>
> === modified file
> 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java'
> ---
> dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java
>     2011-03-22 05:49:48 +0000
> +++
> dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java
>     2011-04-24 15:50:02 +0000
> @@ -132,15 +132,6 @@
>     Collection<DataElement> getAllDataElements();
>
>     /**
> -     * Returns all DataElements which are not instances of
> -     * CalculatedDataElements.
> -     *
> -     * @return all DataElements which are not instances of
> -     *         CalculatedDataElements.
> -     */
> -    Collection<DataElement> getNonCalculatedDataElements();
> -
> -    /**
>      * Returns all DataElements with corresponding identifiers. Returns all
>      * DataElements if the given argument is null.
>      *
> @@ -150,24 +141,6 @@
>     Collection<DataElement> getDataElements( Collection<Integer>
> identifiers );
>
>     /**
> -     * Returns all CalculatedDataElements with corresponding identifiers.
> -     * Returns all CalculatedDataElements if the given argument is null.
> -     *
> -     * @param identifiers the collection of identifiers.
> -     * @return a collection of CalculatedDataElements.
> -     */
> -    Collection<CalculatedDataElement> getCalculatedDataElements(
> Collection<Integer> identifiers );
> -
> -    /**
> -     * Returns all non-calculated DataElements with corresponding
> identifiers.
> -     * Returns all non-calculated DataElements if the given argument is
> null.
> -     *
> -     * @param identifiers the collection of identifiers.
> -     * @return a collection of DataElements.
> -     */
> -    Collection<DataElement> getNonCalculatedDataElements(
> Collection<Integer> identifiers );
> -
> -    /**
>      * Returns all DataElements with types that are possible to aggregate.
> The
>      * types are currently INT and BOOL.
>      *
> @@ -299,76 +272,6 @@
>     int getDataElementCountByName( String name );
>
>     //
> -------------------------------------------------------------------------
> -    // Calculated Data Elements
> -    //
> -------------------------------------------------------------------------
> -
> -    /**
> -     * Returns a CalclulatedDataElement which contains a given dataElement
> -     *
> -     * @param dataElement the DataElement which is contained by the
> -     *        CalculatedDataElement to return.
> -     * @return a CalculatedDataElement which contains the given
> DataElement, or
> -     *         null if the DataElement is not part of a
> CalculatedDataElement.
> -     */
> -    CalculatedDataElement getCalculatedDataElementByDataElement(
> DataElement dataElement );
> -
> -    /**
> -     * Returns CalculatedDataElements which contain any of the given
> -     * DataElements
> -     *
> -     * @param dataElements Collection of DataElements which can be
> contained by
> -     *        the returned CalculatedDataElements
> -     * @return a collection of CalculatedDataElements which contain any of
> the
> -     *         given DataElements, or an empty collection if no
> -     *         CalculatedDataElements contain any of the DataElements.
> -     */
> -    Collection<CalculatedDataElement>
> getCalculatedDataElementsByDataElements( Collection<DataElement>
> dataElements );
> -
> -    /**
> -     * Returns all CalculatedDataElements
> -     *
> -     * @return a collection of all CalculatedDataElements, or an empty
> -     *         collection if there are no CalculcatedDataELements
> -     */
> -    Collection<CalculatedDataElement> getAllCalculatedDataElements();
> -
> -    /**
> -     * Returns a Map of factors for the DataElements in the given
> -     * CalculatedDataElement
> -     *
> -     * @param calculatedDataElement CalculatedDataElement to get factors
> for
> -     * @return a map of factors for the DataElements in the given
> -     *         CalculatedDataElement
> -     */
> -    Map<DataElement, Double> getDataElementFactors( CalculatedDataElement
> calculatedDataElement );
> -
> -    /**
> -     * Returns a Map of factors for the Operands in the given
> -     * CalculatedDataElement
> -     *
> -     * @param calculatedDataElement CalculatedDataElement to get factors
> for
> -     * @return a map of factors for the Operands in the given
> -     *         CalculatedDataElement
> -     */
> -    Map<String, Double> getOperandFactors( CalculatedDataElement
> calculatedDataElement );
> -
> -    /**
> -     * Returns a collection of OperandIds in the given
> CalculatedDataElement
> -     *
> -     * @param calculatedDataElement CalculatedDataElement to get operands
> for
> -     * @return a collection of operands (actually string) for the
> expression in
> -     *         the given CalculatedDataElement
> -     */
> -    Collection<String> getOperandIds( CalculatedDataElement
> calculatedDataElement );
> -
> -    /**
> -     *
> -     * @param identifiers
> -     * @return
> -     */
> -    Map<Integer, String> getCalculatedDataElementExpressionMap(
> Collection<Integer> identifiers );
> -
> -    //
> -------------------------------------------------------------------------
>     // DataElementGroup
>     //
> -------------------------------------------------------------------------
>
>
> === modified file
> 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java'
> ---
> dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java
>       2011-01-13 10:50:02 +0000
> +++
> dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java
>       2011-04-24 15:50:02 +0000
> @@ -247,40 +247,6 @@
>     int getDataElementCountByName( String name );
>
>     //
> -------------------------------------------------------------------------
> -    // Calculated Data Elements
> -    //
> -------------------------------------------------------------------------
> -
> -    /**
> -     * Returns a CalclulatedDataElement which contains a given dataElement
> -     *
> -     * @paran dataElement the DataElement which is contained by the
> -     *        CalculatedDataElement to return.
> -     * @return a CalculatedDataElement which contains the given
> DataElement, or
> -     *         null if the DataElement is not part of a
> CalculatedDataElement.
> -     */
> -    CalculatedDataElement getCalculatedDataElementByDataElement(
> DataElement dataElement );
> -
> -    /**
> -     * Returns CalculatedDataElements which contain any of the given
> -     * DataElements
> -     *
> -     * @param dataElements Collection of DataElements which can be
> contained by
> -     *        the returned CalculatedDataElements
> -     * @return a collection of CalculatedDataElements which contain any of
> the
> -     *         given DataElements, or an empty collection if no
> -     *         CalculatedDataElements contain any of the DataElements.
> -     */
> -    Collection<CalculatedDataElement>
> getCalculatedDataElementsByDataElements( Collection<DataElement>
> dataElements );
> -
> -    /**
> -     * Returns all CalculatedDataElements
> -     *
> -     * @return a collection of all CalculatedDataElements, or an empty
> -     *         collection if there are no CalculcatedDataELements
> -     */
> -    Collection<CalculatedDataElement> getAllCalculatedDataElements();
> -
> -    //
> -------------------------------------------------------------------------
>     // DataElementOperand
>     //
> -------------------------------------------------------------------------
>
>
> === 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
>       2011-04-22 21:04:14 +0000
> +++
> dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/ExpressionService.java
>       2011-04-24 15:50:02 +0000
> @@ -170,15 +170,6 @@
>     String getExpressionDescription( String expression );
>
>     /**
> -     * Looks for the existence of calculated dataelement in the give
> expression.
> -     * If exists, it will replace this CDE with its equivalent expression.
> -     *
> -     * @param expression The expression string
> -     * @return expression containing non CDE
> -     */
> -    String replaceCDEsWithTheirExpression( String expression );
> -
> -    /**
>      * Replaces references to data element totals with references to all
>      * category option combos in the category combo for that data element.
>      *
>
> === modified file
> 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java'
> ---
> dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java
>       2011-03-22 05:49:48 +0000
> +++
> dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java
>       2011-04-24 15:50:02 +0000
> @@ -39,8 +39,6 @@
>  import java.util.List;
>  import java.util.Map;
>  import java.util.Set;
> -import java.util.regex.Matcher;
> -import java.util.regex.Pattern;
>
>  import org.hisp.dhis.common.GenericIdentifiableObjectStore;
>  import org.hisp.dhis.common.comparator.CategoryComboSizeComparator;
> @@ -147,21 +145,6 @@
>         return i18n( i18nService, dataElementStore.getAllDataElements() );
>     }
>
> -    public Collection<DataElement> getNonCalculatedDataElements()
> -    {
> -        Collection<DataElement> dataElements = new
> ArrayList<DataElement>();
> -
> -        for ( DataElement dataElement : getAllDataElements() )
> -        {
> -            if ( !(dataElement instanceof CalculatedDataElement) )
> -            {
> -                dataElements.add( dataElement );
> -            }
> -        }
> -
> -        return dataElements;
> -    }
> -
>     public Collection<DataElement> getDataElements( final
> Collection<Integer> identifiers )
>     {
>         Collection<DataElement> dataElements = getAllDataElements();
> @@ -204,16 +187,6 @@
>         return dataElements;
>     }
>
> -    public Collection<DataElement> getNonCalculatedDataElements(
> Collection<Integer> identifiers )
> -    {
> -        if ( identifiers == null )
> -        {
> -            return getNonCalculatedDataElements();
> -        }
> -
> -        return getDataElements( identifiers );
> -    }
> -
>     public Collection<DataElement> getAggregateableDataElements()
>     {
>         return i18n( i18nService,
> dataElementStore.getAggregateableDataElements() );
> @@ -365,132 +338,6 @@
>         return dataElementStore.getDataElementCountByName( name );
>     }
>
> -    //
> -------------------------------------------------------------------------
> -    // CalculatedDataElement
> -    //
> -------------------------------------------------------------------------
> -
> -    public Collection<CalculatedDataElement>
> getAllCalculatedDataElements()
> -    {
> -        return i18n( i18nService,
> dataElementStore.getAllCalculatedDataElements() );
> -    }
> -
> -    public Collection<CalculatedDataElement> getCalculatedDataElements(
> final Collection<Integer> identifiers )
> -    {
> -        Collection<CalculatedDataElement> dataElements =
> getAllCalculatedDataElements();
> -
> -        return identifiers == null ? dataElements : FilterUtils.filter(
> dataElements,
> -            new Filter<CalculatedDataElement>()
> -            {
> -                public boolean retain( CalculatedDataElement dataElement )
> -                {
> -                    return identifiers.contains( dataElement.getId() );
> -                }
> -            } );
> -    }
> -
> -    public CalculatedDataElement getCalculatedDataElementByDataElement(
> DataElement dataElement )
> -    {
> -        return i18n( i18nService,
> dataElementStore.getCalculatedDataElementByDataElement( dataElement ) );
> -    }
> -
> -    public Collection<CalculatedDataElement>
> getCalculatedDataElementsByDataElements(
> -        Collection<DataElement> dataElements )
> -    {
> -        return i18n( i18nService,
> dataElementStore.getCalculatedDataElementsByDataElements( dataElements ) );
> -    }
> -
> -    public Map<DataElement, Double> getDataElementFactors(
> CalculatedDataElement calculatedDataElement )
> -    {
> -        Map<DataElement, Double> factorMap = new HashMap<DataElement,
> Double>();
> -
> -        Pattern pattern = Pattern.compile(
> "\\[(\\d+)\\]\\s*\\*\\s*(\\d+(\\.\\d)*)" );
> -
> -        //
> ---------------------------------------------------------------------
> -        // In readable form: \[(\d+)\]\s*\*\s*(\d+)
> -        // Meaning any expression on the form "[id] * factor"
> -        //
> ---------------------------------------------------------------------
> -
> -        Matcher matcher = pattern.matcher(
> calculatedDataElement.getExpression().getExpression() );
> -
> -        while ( matcher.find() )
> -        {
> -            //
> -----------------------------------------------------------------
> -            // Key: Datelementid
> -            // Value: Factor
> -            //
> -----------------------------------------------------------------
> -
> -            factorMap.put( getDataElement( Integer.parseInt(
> matcher.group( 1 ) ) ), Double.parseDouble( matcher
> -                .group( 2 ) ) );
> -        }
> -
> -        return factorMap;
> -    }
> -
> -    public Map<String, Double> getOperandFactors( CalculatedDataElement
> calculatedDataElement )
> -    {
> -        Map<String, Double> factorMap = new HashMap<String, Double>();
> -
> -        Pattern pattern = Pattern.compile(
> "\\[(\\d+\\.\\d+)\\]\\s*\\*\\s*(-?\\d+(\\.\\d)*)" );
> -
> -        //
> ---------------------------------------------------------------------
> -        // In readable form: \[(\d+)\]\s*\*\s*(\d+)
> -        // Meaning any expression on the form "[id] * factor"
> -        //
> ---------------------------------------------------------------------
> -
> -        Matcher matcher = pattern.matcher(
> calculatedDataElement.getExpression().getExpression() );
> -
> -        while ( matcher.find() )
> -        {
> -            //
> -----------------------------------------------------------------
> -            // Key: Datelementid.optioncomboid
> -            // Value: Factor
> -            //
> -----------------------------------------------------------------
> -
> -            factorMap.put( matcher.group( 1 ), Double.parseDouble(
> matcher.group( 2 ) ) );
> -        }
> -
> -        return factorMap;
> -    }
> -
> -    public Collection<String> getOperandIds( CalculatedDataElement
> calculatedDataElement )
> -    {
> -        Collection<String> operands = new ArrayList<String>();
> -
> -        Pattern pattern = Pattern.compile( "\\[(\\d+\\.\\d+)\\]" );
> -
> -        //
> ---------------------------------------------------------------------
> -        // In readable form: \[(\d+)\]\s*\*\s*(\d+)
> -        // Meaning any expression on the form "[id] * factor"
> -        //
> ---------------------------------------------------------------------
> -
> -        Matcher matcher = pattern.matcher(
> calculatedDataElement.getExpression().getExpression() );
> -
> -        while ( matcher.find() )
> -        {
> -            //
> -----------------------------------------------------------------
> -            // Datelementid.optioncomboid
> -            //
> -----------------------------------------------------------------
> -
> -            operands.add( matcher.group( 1 ) );
> -        }
> -
> -        return operands;
> -    }
> -
> -    public Map<Integer, String> getCalculatedDataElementExpressionMap(
> Collection<Integer> identifiers )
> -    {
> -        Collection<CalculatedDataElement> dataElements =
> getCalculatedDataElements( identifiers );
> -
> -        Map<Integer, String> map = new HashMap<Integer, String>();
> -
> -        for ( CalculatedDataElement element : dataElements )
> -        {
> -            map.put( element.getId(),
> element.getExpression().getExpression() );
> -        }
> -
> -        return map;
> -    }
> -
>     public Collection<DataElement> getDataElementsByDataSets(
> Collection<DataSet> dataSets )
>     {
>         return i18n( i18nService,
> dataElementStore.getDataElementsByDataSets( dataSets ) );
>
> === modified file
> 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java'
> ---
> dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java
>     2011-04-02 09:48:38 +0000
> +++
> dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java
>     2011-04-24 15:50:02 +0000
> @@ -40,7 +40,6 @@
>  import org.hibernate.Session;
>  import org.hibernate.criterion.Order;
>  import org.hibernate.criterion.Restrictions;
> -import org.hisp.dhis.dataelement.CalculatedDataElement;
>  import org.hisp.dhis.dataelement.DataElement;
>  import org.hisp.dhis.dataelement.DataElementCategoryCombo;
>  import org.hisp.dhis.dataelement.DataElementOperand;
> @@ -331,53 +330,6 @@
>             ConversionUtils.getIdentifiers( DataSet.class, dataSets )
> ).list();
>     }
>
> -    //
> -------------------------------------------------------------------------
> -    // CalculatedDataElement
> -    //
> -------------------------------------------------------------------------
> -
> -    @SuppressWarnings( "unchecked" )
> -    public Collection<CalculatedDataElement>
> getAllCalculatedDataElements()
> -    {
> -        Session session = sessionFactory.getCurrentSession();
> -
> -        Criteria criteria = session.createCriteria(
> CalculatedDataElement.class );
> -
> -        return criteria.list();
> -    }
> -
> -    public CalculatedDataElement getCalculatedDataElementByDataElement(
> DataElement dataElement )
> -    {
> -        Session session = sessionFactory.getCurrentSession();
> -
> -        Set<Integer> dataElementIds = new HashSet<Integer>();
> -        dataElementIds.add( dataElement.getId() );
> -
> -        Criteria criteria = session.createCriteria(
> CalculatedDataElement.class ).createCriteria( "expression" )
> -            .createCriteria( "dataElementsInExpression" ).add(
> Restrictions.in( "id", dataElementIds ) );
> -
> -        return (CalculatedDataElement) criteria.uniqueResult();
> -    }
> -
> -    @SuppressWarnings( "unchecked" )
> -    public Collection<CalculatedDataElement>
> getCalculatedDataElementsByDataElements(
> -        Collection<DataElement> dataElements )
> -    {
> -        Session session = sessionFactory.getCurrentSession();
> -
> -        Set<Integer> dataElementIds = new HashSet<Integer>();
> -
> -        for ( DataElement dataElement : dataElements )
> -        {
> -            dataElementIds.add( dataElement.getId() );
> -        }
> -
> -        Criteria criteria = session.createCriteria(
> CalculatedDataElement.class ).createCriteria( "expression" )
> -            .createCriteria( "dataElementsInExpression" ).add(
> Restrictions.in( "id", dataElementIds ) );
> -
> -        return new HashSet<CalculatedDataElement>( criteria.list() );
> -
> -    }
> -
>     public Collection<DataElement> getDataElementsLikeName( String name )
>     {
>         return getLikeName( name );
>
> === 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-04-22 21:04:14 +0000
> +++
> dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java
> 2011-04-24 15:50:02 +0000
> @@ -34,7 +34,6 @@
>
>  import java.util.Collection;
>  import java.util.HashSet;
> -import java.util.Iterator;
>  import java.util.Map;
>  import java.util.Set;
>  import java.util.regex.Matcher;
> @@ -44,7 +43,6 @@
>  import org.apache.commons.logging.LogFactory;
>  import org.hisp.dhis.aggregation.AggregatedDataValueService;
>  import org.hisp.dhis.common.GenericStore;
> -import org.hisp.dhis.dataelement.CalculatedDataElement;
>  import org.hisp.dhis.dataelement.DataElement;
>  import org.hisp.dhis.dataelement.DataElementCategoryCombo;
>  import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
> @@ -335,51 +333,6 @@
>         return buffer != null ? buffer.toString() : null;
>     }
>
> -    public String replaceCDEsWithTheirExpression( String expression )
> -    {
> -        StringBuffer buffer = null;
> -
> -        if ( expression != null )
> -        {
> -            buffer = new StringBuffer();
> -
> -            final Set<DataElement> caclulatedDataElementsInExpression =
> getDataElementsInExpression( expression );
> -
> -            final Iterator<DataElement> iterator =
> caclulatedDataElementsInExpression.iterator();
> -
> -            while ( iterator.hasNext() )
> -            {
> -                if ( !(iterator.next() instanceof CalculatedDataElement) )
> -                {
> -                    iterator.remove();
> -                }
> -            }
> -
> -            final Matcher matcher = FORMULA_PATTERN.matcher( expression );
> -
> -            while ( matcher.find() )
> -            {
> -                String replaceString = matcher.group();
> -
> -                for ( DataElement dataElement :
> caclulatedDataElementsInExpression )
> -                {
> -                    if ( replaceString.startsWith( EXP_OPEN +
> dataElement.getId() + SEPARATOR ) )
> -                    {
> -                        replaceString = ((CalculatedDataElement)
> dataElement).getExpression().getExpression();
> -
> -                        break;
> -                    }
> -                }
> -
> -                matcher.appendReplacement( buffer, replaceString );
> -            }
> -
> -            matcher.appendTail( buffer );
> -        }
> -
> -        return buffer != null ? buffer.toString() : null;
> -    }
> -
>     public String explodeExpression( String expression )
>     {
>         StringBuffer buffer = null;
>
> === modified file
> 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
> ---
> dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
>        2011-04-24 12:47:31 +0000
> +++
> dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
>        2011-04-24 15:50:02 +0000
> @@ -90,6 +90,7 @@
>         executeSql( "DROP TABLE dataelement_dataelementgroupsetmembers" );
>         executeSql( "DROP TABLE dashboardcontent_olapurls" );
>         executeSql( "DROP TABLE olapurl" );
> +        executeSql( "DROP TABLE calculateddataelement" );
>         executeSql( "ALTER TABLE dataelementcategoryoption drop column
> categoryid" );
>         executeSql( "ALTER TABLE reporttable DROP column dimension_type" );
>         executeSql( "ALTER TABLE reporttable DROP column dimensiontype" );
>
> === removed file
> 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/CalculatedDataElement.hbm.xml'
> ---
> dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/CalculatedDataElement.hbm.xml
> 2011-04-12 13:25:06 +0000
> +++
> dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/CalculatedDataElement.hbm.xml
> 1970-01-01 00:00:00 +0000
> @@ -1,18 +0,0 @@
> -<?xml version="1.0"?>
> -<!DOCTYPE hibernate-mapping PUBLIC
> -  "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
> -  "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd";>
> -
> -<hibernate-mapping>
> -  <joined-subclass name="org.hisp.dhis.dataelement.CalculatedDataElement"
> extends="org.hisp.dhis.dataelement.DataElement"
> -    table="calculateddataelement">
> -
> -    <key column="calculateddataelementid" />
> -
> -    <property name="saved" not-null="true" />
> -
> -    <many-to-one name="expression"
> class="org.hisp.dhis.expression.Expression" cascade="all"
> column="expressionid"
> -      foreign-key="fk_expression_expressionid" />
> -
> -  </joined-subclass>
> -</hibernate-mapping>
>
> === modified file
> 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementServiceTest.java'
> ---
> dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementServiceTest.java
>  2011-03-22 05:49:48 +0000
> +++
> dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementServiceTest.java
>  2011-04-24 15:50:02 +0000
> @@ -28,20 +28,18 @@
>  */
>
>
> +import static junit.framework.Assert.assertEquals;
> +import static junit.framework.Assert.assertNotNull;
> +import static junit.framework.Assert.assertNull;
> +import static junit.framework.Assert.assertTrue;
> +
>  import java.util.Collection;
>  import java.util.HashSet;
> -import java.util.Iterator;
> -import java.util.Map;
>  import java.util.Set;
>
>  import org.hisp.dhis.DhisSpringTest;
> -import org.hisp.dhis.expression.Expression;
> -import org.hisp.dhis.system.util.UUIdUtils;
> -import org.junit.Ignore;
>  import org.junit.Test;
>
> -import static junit.framework.Assert.*;
> -
>  /**
>  * @author Kristian Nordal
>  * @version $Id: DataElementServiceTest.java 5742 2008-09-26 11:37:35Z
> larshelg $
> @@ -61,23 +59,6 @@
>     {
>         dataElementService = (DataElementService) getBean(
> DataElementService.ID );
>     }
> -
> -    //
> -------------------------------------------------------------------------
> -    // Support methods
> -    //
> -------------------------------------------------------------------------
> -
> -    private DataElement setDataElementFields( DataElement dataElement,
> char uniqueCharacter )
> -    {
> -        dataElement.setUuid( UUIdUtils.getUUId() );
> -        dataElement.setName( "DataElement" + uniqueCharacter );
> -        dataElement.setAlternativeName( "DataElementAlternative" +
> uniqueCharacter );
> -        dataElement.setShortName( "DataElementShort" + uniqueCharacter );
> -        dataElement.setCode( "DataElementCode" + uniqueCharacter );
> -        dataElement.setDescription( "DataElementDescription" +
> uniqueCharacter );
> -        dataElement.setAggregationOperator(
> DataElement.AGGREGATION_OPERATOR_SUM );
> -        dataElement.setType( DataElement.VALUE_TYPE_INT );
> -        return dataElement;
> -    }
>
>     //
> -------------------------------------------------------------------------
>     // Tests
> @@ -430,93 +411,6 @@
>     }
>
>     //
> -------------------------------------------------------------------------
> -    // CalculatedDataElements
> -    //
> -------------------------------------------------------------------------
> -
> -    @Ignore //TODO
> -    @Test
> -    public void testCalculatedDataElements()
> -        throws Exception
> -    {
> -        DataElement deA = createDataElement('A');
> -        DataElement deB = createDataElement('B');
> -        DataElement deC = createDataElement('C');
> -        DataElement deD = createDataElement('D');
> -        DataElement deE = createDataElement('E');
> -
> -        int deIdA = dataElementService.addDataElement(deA);
> -        int deIdB = dataElementService.addDataElement(deB);
> -        int deIdC = dataElementService.addDataElement(deC);
> -        int deIdD = dataElementService.addDataElement(deD);
> -        dataElementService.addDataElement(deE);
> -
> -        CalculatedDataElement cdeX = (CalculatedDataElement)
> setDataElementFields( new CalculatedDataElement (), 'X' );
> -        CalculatedDataElement cdeY = (CalculatedDataElement)
> setDataElementFields( new CalculatedDataElement (), 'Y' );
> -
> -        Set<DataElement> dataElementsX = new HashSet<DataElement> ();
> -        dataElementsX.add(deA);
> -        dataElementsX.add(deB);
> -        Expression expressionX = new Expression ( "["+deIdA+"] * 2 +
> ["+deIdB+"] * 3", "foo", dataElementsX );
> -        cdeX.setExpression(expressionX);
> -        cdeX.setSaved(true);
> -        dataElementService.addDataElement(cdeX);
> -
> -        Set<DataElement> dataElementsY = new HashSet<DataElement> ();
> -        dataElementsY.add(deC);
> -        dataElementsY.add(deD);
> -        Expression expressionY = new Expression ( "["+deIdC+"] * 2 +
> ["+deIdD+"] * 3", "foo", dataElementsY );
> -        cdeY.setExpression(expressionY);
> -        cdeY.setSaved(true);
> -        dataElementService.addDataElement(cdeY);
> -
> -        Collection<CalculatedDataElement> cdes =
> dataElementService.getAllCalculatedDataElements();
> -        assertEquals( 2, cdes.size() );
> -
> -        //CalculatedDataElement cde;
> -        CalculatedDataElement cde =
> dataElementService.getCalculatedDataElementByDataElement( deA );
> -        assertNotNull(cde);
> -        assertEquals("DataElementX", cde.getName() );
> -
> -        cde = dataElementService.getCalculatedDataElementByDataElement(
> deE );
> -        assertNull(cde);
> -
> -        Set<DataElement> dataElements = new HashSet<DataElement> ();
> -        dataElements.add(deA);
> -        cdes = dataElementService.getCalculatedDataElementsByDataElements(
> dataElements );
> -        assertEquals( 1, cdes.size() );
> -        assertEquals("DataElementX", cdes.iterator().next().getName());
> -
> -        dataElements.add(deC);
> -        cdes = dataElementService.getCalculatedDataElementsByDataElements(
> dataElements );
> -        assertEquals( 2, cdes.size() );
> -
> -        Iterator<CalculatedDataElement> iterator = cdes.iterator();
> -        assertEquals( iterator.next().getName(), "DataElementX" );
> -        assertEquals( iterator.next().getName(), "DataElementY" );
> -
> -        //Make sure the results are unique
> -        dataElements.add(deB);
> -        cdes = dataElementService.getCalculatedDataElementsByDataElements(
> dataElements );
> -        assertEquals( 2, cdes.size() );
> -
> -        iterator = cdes.iterator();
> -        assertEquals( iterator.next().getName(), "DataElementX" );
> -        assertEquals( iterator.next().getName(), "DataElementY" );
> -
> -        //Check that no other data elements are returned
> -        dataElements.add(deE);
> -        cdes = dataElementService.getCalculatedDataElementsByDataElements(
> dataElements );
> -        assertEquals( 2, cdes.size() );
> -
> -        Map<DataElement,Double> factorMap =
> dataElementService.getDataElementFactors(cdeX);
> -        assertEquals( 2, factorMap.size() );
> -        assertTrue(factorMap.keySet().contains(deA));
> -        assertEquals( new Integer(2), factorMap.get(deA));
> -        assertTrue(factorMap.keySet().contains(deB));
> -        assertEquals( new Integer(3), factorMap.get(deB));
> -    }
> -
> -    //
> -------------------------------------------------------------------------
>     // DataElementGroup
>     //
> -------------------------------------------------------------------------
>
>
> === modified file
> 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementStoreTest.java'
> ---
> dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementStoreTest.java
>    2011-02-15 20:14:22 +0000
> +++
> dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementStoreTest.java
>    2011-04-24 15:50:02 +0000
> @@ -36,17 +36,13 @@
>  import java.util.Arrays;
>  import java.util.Collection;
>  import java.util.HashSet;
> -import java.util.Iterator;
>  import java.util.List;
> -import java.util.Set;
>
>  import org.hisp.dhis.DhisSpringTest;
>  import org.hisp.dhis.dataset.DataSet;
>  import org.hisp.dhis.dataset.DataSetService;
> -import org.hisp.dhis.expression.Expression;
>  import org.hisp.dhis.period.MonthlyPeriodType;
>  import org.hisp.dhis.system.util.UUIdUtils;
> -import org.junit.Ignore;
>  import org.junit.Test;
>
>  /**
> @@ -74,25 +70,6 @@
>
>         dataSetService = (DataSetService) getBean( DataSetService.ID );
>     }
> -
> -    //
> -------------------------------------------------------------------------
> -    // Support methods
> -    //
> -------------------------------------------------------------------------
> -
> -    private DataElement setDataElementFields( DataElement dataElement,
> char uniqueCharacter )
> -    {
> -        dataElement.setUuid( UUIdUtils.getUUId() );
> -        dataElement.setName( "DataElement" + uniqueCharacter );
> -        dataElement.setAlternativeName( "DataElementAlternative" +
> uniqueCharacter );
> -        dataElement.setShortName( "DataElementShort" + uniqueCharacter );
> -        dataElement.setCode( "DataElementCode" + uniqueCharacter );
> -        dataElement.setDescription( "DataElementDescription" +
> uniqueCharacter );
> -        dataElement.setAggregationOperator(
> DataElement.AGGREGATION_OPERATOR_SUM );
> -        dataElement.setType( DataElement.VALUE_TYPE_INT );
> -        dataElement.setDomainType( DataElement.DOMAIN_TYPE_AGGREGATE );
> -
> -        return dataElement;
> -    }
>
>     //
> -------------------------------------------------------------------------
>     // Tests
> @@ -527,83 +504,4 @@
>         assertTrue( dataElements.contains( dataElementD ) );
>         assertTrue( dataElements.contains( dataElementF ) );
>     }
> -
> -    //
> -------------------------------------------------------------------------
> -    // CalculatedDataElements
> -    //
> -------------------------------------------------------------------------
> -
> -    @Ignore //TODO
> -    @Test
> -    public void testCalculatedDataElements()
> -    {
> -        DataElement deA = createDataElement('A');
> -        DataElement deB = createDataElement('B');
> -        DataElement deC = createDataElement('C');
> -        DataElement deD = createDataElement('D');
> -        DataElement deE = createDataElement('E');
> -
> -        int deIdA = dataElementStore.addDataElement(deA);
> -        int deIdB = dataElementStore.addDataElement(deB);
> -        int deIdC = dataElementStore.addDataElement(deC);
> -        int deIdD = dataElementStore.addDataElement(deD);
> -        dataElementStore.addDataElement(deE);
> -
> -        CalculatedDataElement cdeX = (CalculatedDataElement)
> setDataElementFields( new CalculatedDataElement (), 'X' );
> -        CalculatedDataElement cdeY = (CalculatedDataElement)
> setDataElementFields( new CalculatedDataElement (), 'Y' );
> -
> -        Set<DataElement> dataElementsX = new HashSet<DataElement> ();
> -        dataElementsX.add(deA);
> -        dataElementsX.add(deB);
> -        Expression expressionX = new Expression ( "["+deIdA+"] * 2 +
> ["+deIdB+"] * 3", "foo", dataElementsX );
> -        cdeX.setExpression(expressionX);
> -        cdeX.setSaved(true);
> -        dataElementStore.addDataElement(cdeX);
> -
> -        Set<DataElement> dataElementsY = new HashSet<DataElement> ();
> -        dataElementsY.add(deC);
> -        dataElementsY.add(deD);
> -        Expression expressionY = new Expression ( "["+deIdC+"] * 2 +
> ["+deIdD+"] * 3", "foo", dataElementsY );
> -        cdeY.setExpression(expressionY);
> -        cdeY.setSaved(true);
> -        dataElementStore.addDataElement(cdeY);
> -
> -        Collection<CalculatedDataElement> cdes =
> dataElementStore.getAllCalculatedDataElements();
> -        assertEquals( 2, cdes.size() );
> -
> -        //CalculatedDataElement cde;
> -        CalculatedDataElement cde =
> dataElementStore.getCalculatedDataElementByDataElement( deA );
> -        assertNotNull(cde);
> -        assertEquals("DataElementX", cde.getName() );
> -
> -        cde = dataElementStore.getCalculatedDataElementByDataElement( deE
> );
> -        assertNull(cde);
> -
> -        Set<DataElement> dataElements = new HashSet<DataElement> ();
> -        dataElements.add(deA);
> -        cdes = dataElementStore.getCalculatedDataElementsByDataElements(
> dataElements );
> -        assertEquals( 1, cdes.size() );
> -        assertEquals("DataElementX", cdes.iterator().next().getName());
> -
> -        dataElements.add(deC);
> -        cdes = dataElementStore.getCalculatedDataElementsByDataElements(
> dataElements );
> -        assertEquals( 2, cdes.size() );
> -
> -        Iterator<CalculatedDataElement> iterator = cdes.iterator();
> -        assertEquals( iterator.next().getName(), "DataElementX" );
> -        assertEquals( iterator.next().getName(), "DataElementY" );
> -
> -        //Make sure the results are unique
> -        dataElements.add(deB);
> -        cdes = dataElementStore.getCalculatedDataElementsByDataElements(
> dataElements );
> -        assertEquals( 2, cdes.size() );
> -
> -        iterator = cdes.iterator();
> -        assertEquals( iterator.next().getName(), "DataElementX" );
> -        assertEquals( iterator.next().getName(), "DataElementY" );
> -
> -        //Check that no other data elements are returned
> -        dataElements.add(deE);
> -        cdes = dataElementStore.getCalculatedDataElementsByDataElements(
> dataElements );
> -        assertEquals( 2, cdes.size() );
> -    }
>  }
>
> === removed directory
> 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/calculateddataelement'
> === removed file
> 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/calculateddataelement/CalculatedDataElementDataMart.java'
> ---
> dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/calculateddataelement/CalculatedDataElementDataMart.java
>    2011-04-15 15:02:55 +0000
> +++
> dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/calculateddataelement/CalculatedDataElementDataMart.java
>    1970-01-01 00:00:00 +0000
> @@ -1,45 +0,0 @@
> -package org.hisp.dhis.datamart.calculateddataelement;
> -
> -/*
> - * Copyright (c) 2004-2010, University of Oslo
> - * All rights reserved.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions are
> met:
> - * * Redistributions of source code must retain the above copyright
> notice, this
> - *   list of conditions and the following disclaimer.
> - * * Redistributions in binary form must reproduce the above copyright
> notice,
> - *   this list of conditions and the following disclaimer in the
> documentation
> - *   and/or other materials provided with the distribution.
> - * * Neither the name of the HISP project nor the names of its
> contributors may
> - *   be used to endorse or promote products derived from this software
> without
> - *   specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
> IS" AND
> - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> IMPLIED
> - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
> LIABLE FOR
> - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> DAMAGES
> - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
> SERVICES;
> - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
> AND ON
> - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> OF THIS
> - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> - */
> -
> -import java.util.Collection;
> -
> -import org.hisp.dhis.dataelement.CalculatedDataElement;
> -import org.hisp.dhis.dataelement.DataElementOperand;
> -import org.hisp.dhis.organisationunit.OrganisationUnit;
> -import org.hisp.dhis.period.Period;
> -
> -/**
> - * @author Lars Helge Overland
> - * @version $Id$
> - */
> -public interface CalculatedDataElementDataMart
> -{
> -    int exportCalculatedDataElements( Collection<CalculatedDataElement>
> calculatedDataElements,
> -        Collection<Period> periods, Collection<OrganisationUnit>
> organisationUnits, Collection<DataElementOperand> operands, String key );
> -}
>
> === removed file
> 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/calculateddataelement/DefaultCalculatedDataElementDataMart.java'
> ---
> dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/calculateddataelement/DefaultCalculatedDataElementDataMart.java
>     2011-04-15 15:02:55 +0000
> +++
> dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/calculateddataelement/DefaultCalculatedDataElementDataMart.java
>     1970-01-01 00:00:00 +0000
> @@ -1,185 +0,0 @@
> -package org.hisp.dhis.datamart.calculateddataelement;
> -
> -/*
> - * Copyright (c) 2004-2010, University of Oslo
> - * All rights reserved.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions are
> met:
> - * * Redistributions of source code must retain the above copyright
> notice, this
> - *   list of conditions and the following disclaimer.
> - * * Redistributions in binary form must reproduce the above copyright
> notice,
> - *   this list of conditions and the following disclaimer in the
> documentation
> - *   and/or other materials provided with the distribution.
> - * * Neither the name of the HISP project nor the names of its
> contributors may
> - *   be used to endorse or promote products derived from this software
> without
> - *   specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
> IS" AND
> - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> IMPLIED
> - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
> LIABLE FOR
> - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> DAMAGES
> - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
> SERVICES;
> - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
> AND ON
> - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> OF THIS
> - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> - */
> -
> -import static org.hisp.dhis.datamart.util.ParserUtil.generateExpression;
> -import static org.hisp.dhis.system.util.MathUtils.calculateExpression;
> -import static org.hisp.dhis.system.util.MathUtils.getRounded;
> -
> -import java.util.Collection;
> -import java.util.HashMap;
> -import java.util.Map;
> -
> -import org.amplecode.quick.BatchHandler;
> -import org.amplecode.quick.BatchHandlerFactory;
> -import org.hisp.dhis.aggregation.AggregatedDataValue;
> -import org.hisp.dhis.dataelement.CalculatedDataElement;
> -import org.hisp.dhis.dataelement.DataElement;
> -import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
> -import org.hisp.dhis.dataelement.DataElementCategoryService;
> -import org.hisp.dhis.dataelement.DataElementOperand;
> -import org.hisp.dhis.datamart.aggregation.cache.AggregationCache;
> -import
> org.hisp.dhis.datamart.aggregation.dataelement.DataElementAggregator;
> -import org.hisp.dhis.jdbc.batchhandler.AggregatedDataValueBatchHandler;
> -import org.hisp.dhis.organisationunit.OrganisationUnit;
> -import org.hisp.dhis.organisationunit.OrganisationUnitHierarchy;
> -import org.hisp.dhis.organisationunit.OrganisationUnitService;
> -import org.hisp.dhis.period.Period;
> -import org.hisp.dhis.period.PeriodType;
> -
> -/**
> - * @author Lars Helge Overland
> - * @version $Id$
> - */
> -public class DefaultCalculatedDataElementDataMart
> -    implements CalculatedDataElementDataMart
> -{
> -    private static final int DECIMALS = 1;
> -
> -    //
> -------------------------------------------------------------------------
> -    // Dependencies
> -    //
> -------------------------------------------------------------------------
> -
> -    private OrganisationUnitService organisationUnitService;
> -
> -    public void setOrganisationUnitService( OrganisationUnitService
> organisationUnitService )
> -    {
> -        this.organisationUnitService = organisationUnitService;
> -    }
> -
> -    private DataElementAggregator sumIntAggregator;
> -
> -    public void setSumIntAggregator( DataElementAggregator
> sumIntAggregator )
> -    {
> -        this.sumIntAggregator = sumIntAggregator;
> -    }
> -
> -    private DataElementAggregator averageIntAggregator;
> -
> -    public void setAverageIntAggregator( DataElementAggregator
> averageIntDataElementAggregator )
> -    {
> -        this.averageIntAggregator = averageIntDataElementAggregator;
> -    }
> -
> -    private DataElementAggregator averageIntSingleValueAggregator;
> -
> -    public void setAverageIntSingleValueAggregator( DataElementAggregator
> averageIntSingleValueAggregator )
> -    {
> -        this.averageIntSingleValueAggregator =
> averageIntSingleValueAggregator;
> -    }
> -
> -    private DataElementCategoryService categoryService;
> -
> -    public void setCategoryService( DataElementCategoryService
> categoryService )
> -    {
> -        this.categoryService = categoryService;
> -    }
> -
> -    private AggregationCache aggregationCache;
> -
> -    public void setAggregationCache( AggregationCache aggregationCache )
> -    {
> -        this.aggregationCache = aggregationCache;
> -    }
> -
> -    private BatchHandlerFactory batchHandlerFactory;
> -
> -    public void setBatchHandlerFactory( BatchHandlerFactory
> batchHandlerFactory )
> -    {
> -        this.batchHandlerFactory = batchHandlerFactory;
> -    }
> -
> -    //
> -------------------------------------------------------------------------
> -    // CalculatedDataElementDataMart implementation
> -    //
> -------------------------------------------------------------------------
> -
> -    public int exportCalculatedDataElements( final
> Collection<CalculatedDataElement> calculatedDataElements, final
> Collection<Period> periods,
> -        final Collection<OrganisationUnit> organisationUnits, final
> Collection<DataElementOperand> operands, String key )
> -    {
> -        final DataElementCategoryOptionCombo categoryOptionCombo =
> categoryService.getDefaultDataElementCategoryOptionCombo();
> -
> -        final BatchHandler<AggregatedDataValue> batchHandler =
> batchHandlerFactory.createBatchHandler(
> AggregatedDataValueBatchHandler.class ).init();
> -
> -        final OrganisationUnitHierarchy hierarchy =
> organisationUnitService.getOrganisationUnitHierarchy().prepareChildren(
> organisationUnits );
> -
> -        int count = 0;
> -
> -        CalculatedDataElement calculatedDataElement = null;
> -
> -        double aggregatedValue = 0.0;
> -
> -        final AggregatedDataValue dataValue = new AggregatedDataValue();
> -
> -        for ( final Period period : periods )
> -        {
> -            final PeriodType periodType = period.getPeriodType();
> -
> -            final Collection<DataElementOperand> sumOperands =
> sumIntAggregator.filterOperands( operands, periodType );
> -            final Collection<DataElementOperand> averageOperands =
> averageIntAggregator.filterOperands( operands, periodType );
> -            final Collection<DataElementOperand>
> averageSingleValueOperands = averageIntSingleValueAggregator.filterOperands(
> operands, periodType );
> -
> -            for ( final OrganisationUnit unit : organisationUnits )
> -            {
> -                final int level =
> aggregationCache.getLevelOfOrganisationUnit( unit.getId() );
> -
> -                final Map<DataElementOperand, Double> sumIntValueMap =
> sumIntAggregator.getAggregatedValues( sumOperands, period, unit, level,
> hierarchy, key );
> -                final Map<DataElementOperand, Double> averageIntValueMap =
> averageIntAggregator.getAggregatedValues( averageOperands, period, unit,
> level, hierarchy, key );
> -                final Map<DataElementOperand, Double>
> averageIntSingleValueMap =
> averageIntSingleValueAggregator.getAggregatedValues(
> averageSingleValueOperands, period, unit, level, hierarchy, key );
> -
> -                final Map<DataElementOperand, Double> valueMap = new
> HashMap<DataElementOperand, Double>( sumIntValueMap );
> -                valueMap.putAll( averageIntValueMap );
> -                valueMap.putAll( averageIntSingleValueMap );
> -
> -                for ( final DataElement element : calculatedDataElements )
> -                {
> -                    calculatedDataElement = (CalculatedDataElement)
> element;
> -
> -                    aggregatedValue = calculateExpression(
> generateExpression( calculatedDataElement.getExpression().getExpression(),
> valueMap ) );
> -
> -                    dataValue.clear();
> -
> -                    dataValue.setDataElementId(
> calculatedDataElement.getId() );
> -                    dataValue.setCategoryOptionComboId(
> categoryOptionCombo.getId() );
> -                    dataValue.setPeriodId( period.getId() );
> -                    dataValue.setPeriodTypeId( periodType.getId() );
> -                    dataValue.setOrganisationUnitId( unit.getId() );
> -                    dataValue.setLevel( level );
> -                    dataValue.setValue( getRounded( aggregatedValue,
> DECIMALS ) );
> -
> -                    batchHandler.addObject( dataValue );
> -
> -                    count++;
> -                }
> -            }
> -        }
> -
> -        batchHandler.flush();
> -
> -        return count;
> -    }
> -}
>
> === modified file
> 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java'
> ---
> dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java
>   2011-04-15 15:02:55 +0000
> +++
> dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java
>   2011-04-24 15:50:02 +0000
> @@ -35,14 +35,12 @@
>  import org.apache.commons.logging.LogFactory;
>  import org.hisp.dhis.aggregation.AggregatedDataValueService;
>  import org.hisp.dhis.common.ProcessState;
> -import org.hisp.dhis.dataelement.CalculatedDataElement;
>  import org.hisp.dhis.dataelement.DataElement;
>  import org.hisp.dhis.dataelement.DataElementCategoryService;
>  import org.hisp.dhis.dataelement.DataElementOperand;
>  import org.hisp.dhis.dataelement.DataElementService;
>  import org.hisp.dhis.datamart.aggregation.cache.AggregationCache;
>  import
> org.hisp.dhis.datamart.aggregation.dataelement.DataElementAggregator;
> -import
> org.hisp.dhis.datamart.calculateddataelement.CalculatedDataElementDataMart;
>  import org.hisp.dhis.datamart.crosstab.CrossTabService;
>  import org.hisp.dhis.datamart.dataelement.DataElementDataMart;
>  import org.hisp.dhis.datamart.indicator.IndicatorDataMart;
> @@ -105,13 +103,6 @@
>         this.indicatorDataMart = indicatorDataMart;
>     }
>
> -    private CalculatedDataElementDataMart calculatedDataElementDataMart;
> -
> -    public void setCalculatedDataElementDataMart(
> CalculatedDataElementDataMart calculatedDataElementDataMart )
> -    {
> -        this.calculatedDataElementDataMart =
> calculatedDataElementDataMart;
> -    }
> -
>     private DataElementAggregator sumIntAggregator;
>
>     public void setSumIntAggregator( DataElementAggregator
> sumIntDataElementAggregator )
> @@ -208,9 +199,7 @@
>         Collection<Indicator> indicators = indicatorService.getIndicators(
> indicatorIds );
>         Collection<Period> periods = periodService.getPeriods( periodIds );
>         Collection<OrganisationUnit> organisationUnits =
> organisationUnitService.getOrganisationUnits( organisationUnitIds );
> -        Collection<CalculatedDataElement> calculatedDataElements =
> dataElementService.getCalculatedDataElements( dataElementIds );
> -        Collection<DataElement> nonCalculatedDataElements =
> dataElementService.getDataElements( dataElementIds );
> -        nonCalculatedDataElements.removeAll( calculatedDataElements );
> +        Collection<DataElement> dataElements =
> dataElementService.getDataElements( dataElementIds );
>
>         //
> ---------------------------------------------------------------------
>         // Explode indicator expressions
> @@ -226,14 +215,12 @@
>         // Get operands
>         //
> ---------------------------------------------------------------------
>
> -        Collection<DataElementOperand> nonCalculatedOperands =
> categoryService.getOperands( nonCalculatedDataElements );
> +        Collection<DataElementOperand> dataElementOperands =
> categoryService.getOperands( dataElements );
>         Collection<DataElementOperand> indicatorOperands =
> categoryService.populateOperands( getOperandsInIndicators( indicators ) );
> -        Collection<DataElementOperand> calculatedOperands =
> categoryService.populateOperands( getOperandsInCalculatedDataElements(
> calculatedDataElements ) );
>
>         Set<DataElementOperand> allOperands = new
> HashSet<DataElementOperand>();
> -        allOperands.addAll( nonCalculatedOperands );
> +        allOperands.addAll( dataElementOperands );
>         allOperands.addAll( indicatorOperands );
> -        allOperands.addAll( calculatedOperands );
>
>         log.info( "Filtered data elements, number of operands: " +
> allOperands.size() + ", " + TimeUtils.getHMS() );
>
> @@ -243,9 +230,8 @@
>
>         allOperands = new HashSet<DataElementOperand>(
> crossTabService.getOperandsWithData( allOperands ) );
>
> -        nonCalculatedOperands.retainAll( allOperands );
> +        dataElementOperands.retainAll( allOperands );
>         indicatorOperands.retainAll( allOperands );
> -        calculatedOperands.retainAll( allOperands );
>
>         log.info( "Number of operands with data: " + allOperands.size() +
> ", "+ TimeUtils.getHMS() );
>
> @@ -272,7 +258,6 @@
>         //
> ---------------------------------------------------------------------
>
>         boolean isIndicators = indicators != null && indicators.size() > 0;
> -        boolean isCalculatedDataElements = calculatedDataElements != null
> && calculatedDataElements.size() > 0;
>
>         aggregatedDataValueService.dropIndex( true, isIndicators );
>
> @@ -296,25 +281,25 @@
>
>         state.setMessage( "exporting_data_for_data_elements" );
>
> -        if ( nonCalculatedOperands.size() > 0 )
> +        if ( dataElementOperands.size() > 0 )
>         {
> -            count += dataElementDataMart.exportDataValues(
> nonCalculatedOperands, periods, organisationUnits, sumIntAggregator, key );
> +            count += dataElementDataMart.exportDataValues(
> dataElementOperands, periods, organisationUnits, sumIntAggregator, key );
>
>             log.info( "Exported values for data element operands with sum
> aggregation operator of type number: " + TimeUtils.getHMS() );
>
> -            count += dataElementDataMart.exportDataValues(
> nonCalculatedOperands, periods, organisationUnits, averageIntAggregator, key
> );
> +            count += dataElementDataMart.exportDataValues(
> dataElementOperands, periods, organisationUnits, averageIntAggregator, key
> );
>
>             log.info( "Exported values for data element operands with
> average aggregation operator of type number: " + TimeUtils.getHMS() );
>
> -            count += dataElementDataMart.exportDataValues(
> nonCalculatedOperands, periods, organisationUnits,
> averageIntSingleValueAggregator, key );
> +            count += dataElementDataMart.exportDataValues(
> dataElementOperands, periods, organisationUnits,
> averageIntSingleValueAggregator, key );
>
>             log.info( "Exported values for data element operands with
> average aggregation operator with single value of type number: " +
> TimeUtils.getHMS() );
>
> -            count += dataElementDataMart.exportDataValues(
> nonCalculatedOperands, periods, organisationUnits, sumBoolAggregator, key );
> +            count += dataElementDataMart.exportDataValues(
> dataElementOperands, periods, organisationUnits, sumBoolAggregator, key );
>
>             log.info( "Exported values for data element operands with sum
> aggregation operator of type yes/no: " + TimeUtils.getHMS() );
>
> -            count += dataElementDataMart.exportDataValues(
> nonCalculatedOperands, periods, organisationUnits, averageBoolAggregator,
> key );
> +            count += dataElementDataMart.exportDataValues(
> dataElementOperands, periods, organisationUnits, averageBoolAggregator, key
> );
>
>             log.info( "Exported values for data element operands with
> average aggregation operator of type yes/no: " + TimeUtils.getHMS() );
>         }
> @@ -333,19 +318,6 @@
>         }
>
>         //
> ---------------------------------------------------------------------
> -        // Calculated data element export
> -        //
> ---------------------------------------------------------------------
> -
> -        state.setMessage( "exporting_data_for_calculated_data_elements" );
> -
> -        if ( isCalculatedDataElements )
> -        {
> -            count +=
> calculatedDataElementDataMart.exportCalculatedDataElements(
> calculatedDataElements, periods, organisationUnits, calculatedOperands, key
> );
> -
> -            log.info( "Exported values for calculated data elements (" +
> calculatedDataElements.size() + "): " + TimeUtils.getHMS() );
> -        }
> -
> -        //
> ---------------------------------------------------------------------
>         // Drop crosstab tables
>         //
> ---------------------------------------------------------------------
>
> @@ -392,20 +364,4 @@
>
>         return operands;
>     }
> -
> -    private Set<DataElementOperand> getOperandsInCalculatedDataElements(
> final Collection<CalculatedDataElement> calculatedDataElements )
> -    {
> -        final Set<DataElementOperand> operands = new
> HashSet<DataElementOperand>();
> -
> -        for ( final CalculatedDataElement calculatedDataElement :
> calculatedDataElements )
> -        {
> -            if ( calculatedDataElement != null &&
> calculatedDataElement.getExpression() != null )
> -            {
> -                Set<DataElementOperand> temp =
> expressionService.getOperandsInExpression(
> calculatedDataElement.getExpression().getExpression() );
> -                operands.addAll( temp != null ? temp : new
> HashSet<DataElementOperand>() );
> -            }
> -        }
> -
> -        return operands;
> -    }
>  }
>
> === 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
>       2011-04-16 16:18:58 +0000
> +++
> dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/META-INF/dhis/beans.xml
>       2011-04-24 15:50:02 +0000
> @@ -40,8 +40,6 @@
>       ref="org.hisp.dhis.datamart.dataelement.DataElementDataMart"/>
>     <property name="indicatorDataMart"
>       ref="org.hisp.dhis.datamart.indicator.IndicatorDataMart"/>
> -    <property name="calculatedDataElementDataMart"
> -
>  ref="org.hisp.dhis.datamart.calculateddataelement.CalculatedDataElementDataMart"/>
>     <property name="sumIntAggregator"
>
> ref="org.hisp.dhis.datamart.aggregation.dataelement.SumIntAggregator"/>
>     <property name="averageIntAggregator"
> @@ -174,26 +172,7 @@
>       ref="org.hisp.dhis.options.SystemSettingManager"/>
>        <property name="batchHandlerFactory" ref="batchHandlerFactory"/>
>   </bean>
> -
> -  <!-- CalculatedDataElementDataMart -->
> -
> -  <bean
> id="org.hisp.dhis.datamart.calculateddataelement.CalculatedDataElementDataMart"
> -
>  class="org.hisp.dhis.datamart.calculateddataelement.DefaultCalculatedDataElementDataMart">
> -    <property name="organisationUnitService"
> -      ref="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
> -    <property name="sumIntAggregator"
> -
>  ref="org.hisp.dhis.datamart.aggregation.dataelement.SumIntAggregator"/>
> -    <property name="averageIntAggregator"
> -
>  ref="org.hisp.dhis.datamart.aggregation.dataelement.AverageIntAggregator"/>
> -       <property name="averageIntSingleValueAggregator"
> -
>  ref="org.hisp.dhis.datamart.aggregation.dataelement.AverageIntSingleValueAggregator"/>
> -    <property name="categoryService"
> -      ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>
> -    <property name="aggregationCache"
> -      ref="org.hisp.dhis.datamart.aggregation.cache.AggregationCache"/>
> -       <property name="batchHandlerFactory" ref="batchHandlerFactory"/>
> -  </bean>
> -
> +
>   <!-- DeletionHandler -->
>
>   <bean id="org.hisp.dhis.datamart.DataMartExportDeletionHandler"
>
> === modified file
> 'dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceTest.java'
> ---
> dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceTest.java
>    2010-08-31 05:47:11 +0000
> +++
> dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceTest.java
>    2011-04-24 15:50:02 +0000
> @@ -35,7 +35,6 @@
>
>  import org.hisp.dhis.DhisTest;
>  import org.hisp.dhis.aggregation.AggregatedDataValueService;
> -import org.hisp.dhis.dataelement.CalculatedDataElement;
>  import org.hisp.dhis.dataelement.DataElement;
>  import org.hisp.dhis.dataelement.DataElementCategoryCombo;
>  import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
> @@ -566,75 +565,4 @@
>         assertEquals( aggregatedDataValueService.getAggregatedValue(
> indicatorA, periodC, unitG ), 16.1, 0.5 );
>         assertEquals( aggregatedDataValueService.getAggregatedValue(
> indicatorA, periodC, unitH ), 412.1, 0.5 );
>     }
> -
> -    @Test
> -    public void testCalculatedDataElementDataMart()
> -    {
> -        //
> ---------------------------------------------------------------------
> -        // Setup DataElements
> -        //
> ---------------------------------------------------------------------
> -
> -        DataElement dataElementC = createDataElement( 'C',
> DataElement.VALUE_TYPE_INT, DataElement.AGGREGATION_OPERATOR_SUM,
> categoryCombo );
> -        DataElement dataElementD = createDataElement( 'D',
> DataElement.VALUE_TYPE_INT, DataElement.AGGREGATION_OPERATOR_SUM,
> categoryCombo );
> -
> -        int idC = dataElementService.addDataElement( dataElementC );
> -        int idD = dataElementService.addDataElement( dataElementD );
> -
> -        dataSet.getDataElements().add( dataElementC );
> -        dataSet.getDataElements().add( dataElementD );
> -        dataSetService.updateDataSet( dataSet );
> -        dataElementC.getDataSets().add( dataSet );
> -        dataElementD.getDataSets().add( dataSet );
> -        dataElementService.updateDataElement( dataElementC );
> -        dataElementService.updateDataElement( dataElementD );
> -
> -        //
> ---------------------------------------------------------------------
> -        // Setup DataValues
> -        //
> ---------------------------------------------------------------------
> -
> -        dataValueService.addDataValue( createDataValue( dataElementC,
> periodA, unitF, "40", categoryOptionCombo ) );
> -        dataValueService.addDataValue( createDataValue( dataElementC,
> periodA, unitG, "10", categoryOptionCombo ) );
> -        dataValueService.addDataValue( createDataValue( dataElementC,
> periodA, unitH, "75", categoryOptionCombo ) );
> -        dataValueService.addDataValue( createDataValue( dataElementC,
> periodB, unitF, "45", categoryOptionCombo ) );
> -        dataValueService.addDataValue( createDataValue( dataElementC,
> periodB, unitG, "10", categoryOptionCombo ) );
> -        dataValueService.addDataValue( createDataValue( dataElementC,
> periodB, unitH, "75", categoryOptionCombo ) );
> -        dataValueService.addDataValue( createDataValue( dataElementC,
> periodC, unitF, "40", categoryOptionCombo ) );
> -        dataValueService.addDataValue( createDataValue( dataElementC,
> periodC, unitG, "10", categoryOptionCombo ) );
> -        dataValueService.addDataValue( createDataValue( dataElementC,
> periodC, unitH, "70", categoryOptionCombo ) );
> -
> -        dataValueService.addDataValue( createDataValue( dataElementD,
> periodA, unitF, "65", categoryOptionCombo ) );
> -        dataValueService.addDataValue( createDataValue( dataElementD,
> periodA, unitG, "90", categoryOptionCombo ) );
> -        dataValueService.addDataValue( createDataValue( dataElementD,
> periodA, unitH, "25", categoryOptionCombo ) );
> -        dataValueService.addDataValue( createDataValue( dataElementD,
> periodB, unitF, "10", categoryOptionCombo ) );
> -        dataValueService.addDataValue( createDataValue( dataElementD,
> periodB, unitG, "55", categoryOptionCombo ) );
> -        dataValueService.addDataValue( createDataValue( dataElementD,
> periodB, unitH, "85", categoryOptionCombo ) );
> -        dataValueService.addDataValue( createDataValue( dataElementD,
> periodC, unitF, "45", categoryOptionCombo ) );
> -        dataValueService.addDataValue( createDataValue( dataElementD,
> periodC, unitG, "15", categoryOptionCombo ) );
> -        dataValueService.addDataValue( createDataValue( dataElementD,
> periodC, unitH, "25", categoryOptionCombo ) );
> -
> -        //
> ---------------------------------------------------------------------
> -        // Setup CalculatedDataElement
> -        //
> ---------------------------------------------------------------------
> -
> -        String suffix = Expression.SEPARATOR +
> categoryOptionCombo.getId();
> -
> -        Expression expression = createExpression( 'A', "(2*[" + idC +
> suffix + "])+(1*[" + idD + suffix + "])", null );
> -
> -        expressionService.addExpression( expression );
> -
> -        CalculatedDataElement calculated = createCalculatedDataElement(
> 'E', DataElement.VALUE_TYPE_INT, DataElement.AGGREGATION_OPERATOR_SUM,
> categoryCombo, expression );
> -
> -        dataElementIds.clear();
> -        dataElementIds.add( dataElementService.addDataElement( calculated
> ) );
> -
> -        dataMartService.export( dataElementIds, indicatorIds, periodIds,
> organisationUnitIds );
> -
> -        //
> ---------------------------------------------------------------------
> -        // Assert
> -        //
> ---------------------------------------------------------------------
> -
> -        assertEquals( 430.0,
> aggregatedDataValueService.getAggregatedValue( calculated,
> categoryOptionCombo, periodA, unitF ) );
> -        assertEquals( 110.0,
> aggregatedDataValueService.getAggregatedValue( calculated,
> categoryOptionCombo, periodA, unitG ) );
> -        assertEquals( 175.0,
> aggregatedDataValueService.getAggregatedValue( calculated,
> categoryOptionCombo, periodA, unitH ) );
> -    }
>  }
>
> === modified file
> 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ExportParams.java'
> ---
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ExportParams.java
>   2011-02-02 17:56:01 +0000
> +++
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ExportParams.java
>   2011-04-24 15:50:02 +0000
> @@ -61,8 +61,6 @@
>
>     private Collection<Integer> dataElements = new ArrayList<Integer>();
>
> -    private Collection<Integer> calculatedDataElements = new
> ArrayList<Integer>();
> -
>     private Collection<Integer> dataElementGroups = new
> ArrayList<Integer>();
>
>     private Collection<Integer> dataElementGroupSets = new
> ArrayList<Integer>();
> @@ -115,35 +113,6 @@
>     // Getters & setters
>     //
> -------------------------------------------------------------------------
>
> -    public Collection<Integer> getAllDataElements()
> -    {
> -        if ( dataElements == null && calculatedDataElements == null )
> -        {
> -            return null;
> -        }
> -        else if ( dataElements == null && calculatedDataElements != null )
> -        {
> -            return calculatedDataElements;
> -        }
> -        else if ( dataElements != null && calculatedDataElements == null )
> -        {
> -            return dataElements;
> -        }
> -        else
> -        {
> -            final Collection<Integer> elements = getDataElements();
> -
> -            elements.addAll( getCalculatedDataElements() );
> -
> -            return elements;
> -        }
> -
> -    }
> -
> -    //
> -------------------------------------------------------------------------
> -    // Getters & setters
> -    //
> -------------------------------------------------------------------------
> -
>     public boolean isIncludeDataValues()
>     {
>         return includeDataValues;
> @@ -264,16 +233,6 @@
>         this.dataElements = dataElements;
>     }
>
> -    public Collection<Integer> getCalculatedDataElements()
> -    {
> -        return calculatedDataElements;
> -    }
> -
> -    public void setCalculatedDataElements( Collection<Integer>
> calculatedDataElements )
> -    {
> -        this.calculatedDataElements = calculatedDataElements;
> -    }
> -
>     public Collection<Integer> getDataElementGroups()
>     {
>         return dataElementGroups;
>
> === modified file
> 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportObjectManager.java'
> ---
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportObjectManager.java
>    2011-04-24 12:47:31 +0000
> +++
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportObjectManager.java
>    2011-04-24 15:50:02 +0000
> @@ -47,8 +47,6 @@
>
>     void importDataElements();
>
> -    void importCalculatedDataElements();
> -
>     void importDataElementGroups();
>
>     void importDataElementGroupMembers();
>
> === modified file
> 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/util/Dhis14ParsingUtils.java'
> ---
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/util/Dhis14ParsingUtils.java
> 2010-04-12 21:23:33 +0000
> +++
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/util/Dhis14ParsingUtils.java
> 2011-04-24 15:50:02 +0000
> @@ -27,15 +27,6 @@
>  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>  */
>
> -import static org.hisp.dhis.expression.Expression.SEPARATOR;
> -
> -import java.util.HashMap;
> -import java.util.Map;
> -import java.util.regex.Matcher;
> -import java.util.regex.Pattern;
> -
> -import org.hisp.dhis.dataelement.CalculatedDataElement;
> -import org.hisp.dhis.dataelement.DataElementOperand;
>
>  /**
>  * @author Lars Helge Overland
> @@ -58,35 +49,5 @@
>         }
>
>         return string;
> -    }
> -
> -    /**
> -     * Gets the operands and corresponding factor from the calculated data
> element
> -     * expression.
> -     *
> -     * @param calculatedDataElement the calculated data element.
> -     * @return a map with operands and factors.
> -     */
> -    public static Map<DataElementOperand, Double> getOperandFactors(
> CalculatedDataElement calculatedDataElement )
> -    {
> -        Map<DataElementOperand, Double> factorMap = new
> HashMap<DataElementOperand, Double>();
> -
> -        Pattern pattern = Pattern.compile(
> "\\[(\\d+\\.\\d+)\\]\\s*\\*\\s*(-?\\d+)" ); // "[id] * factor"
> -
> -        Matcher matcher = pattern.matcher(
> calculatedDataElement.getExpression().getExpression() );
> -
> -        while ( matcher.find() )
> -        {
> -            final DataElementOperand operand = new DataElementOperand();
> -
> -            String operandString = matcher.group( 1 );
> -
> -            operand.setDataElementId( Integer.valueOf(
> operandString.substring( 0, operandString.indexOf( SEPARATOR ) ) ) );
> -            operand.setOptionComboId( Integer.valueOf(
> operandString.substring( operandString.indexOf( SEPARATOR ) + 1,
> operandString.length() ) ) );
> -
> -            factorMap.put( operand, Double.parseDouble( matcher.group( 2 )
> ) );
> -        }
> -
> -        return factorMap;
>     }
>  }
>
> === modified file
> 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataElementConverter.java'
> ---
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataElementConverter.java
>      2011-04-22 13:43:13 +0000
> +++
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataElementConverter.java
>      2011-04-24 15:50:02 +0000
> @@ -130,7 +130,7 @@
>
>     public void write( XMLWriter writer, ExportParams params )
>     {
> -        Collection<DataElement> elements =
> dataElementService.getDataElements( params.getAllDataElements() ); //
> Calculated elements handled together
> +        Collection<DataElement> elements =
> dataElementService.getDataElements( params.getDataElements() ); //
> Calculated elements handled together
>
>         if ( elements != null && elements.size() > 0 )
>         {
>
> === modified file
> 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataElementGroupMemberConverter.java'
> ---
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataElementGroupMemberConverter.java
>   2010-04-12 21:23:33 +0000
> +++
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataElementGroupMemberConverter.java
>   2011-04-24 15:50:02 +0000
> @@ -72,7 +72,7 @@
>     {
>         Collection<DataElementGroup> groups =
> dataElementService.getDataElementGroups( params.getDataElementGroups() );
>
> -        Collection<DataElement> elements =
> dataElementService.getDataElements( params.getAllDataElements() );
> +        Collection<DataElement> elements =
> dataElementService.getDataElements( params.getDataElements() );
>
>         if ( groups != null && groups.size() >  0 && elements != null &&
> elements.size() > 0 )
>         {
>
> === removed file
> 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/CalculatedDataElementConverter.java'
> ---
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/CalculatedDataElementConverter.java
>   2010-05-29 16:06:56 +0000
> +++
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/CalculatedDataElementConverter.java
>   1970-01-01 00:00:00 +0000
> @@ -1,180 +0,0 @@
> -package org.hisp.dhis.importexport.dxf.converter;
> -
> -/*
> - * Copyright (c) 2004-2010, University of Oslo
> - * All rights reserved.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions are
> met:
> - * * Redistributions of source code must retain the above copyright
> notice, this
> - *   list of conditions and the following disclaimer.
> - * * Redistributions in binary form must reproduce the above copyright
> notice,
> - *   this list of conditions and the following disclaimer in the
> documentation
> - *   and/or other materials provided with the distribution.
> - * * Neither the name of the HISP project nor the names of its
> contributors may
> - *   be used to endorse or promote products derived from this software
> without
> - *   specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
> IS" AND
> - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> IMPLIED
> - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
> LIABLE FOR
> - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> DAMAGES
> - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
> SERVICES;
> - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
> AND ON
> - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> OF THIS
> - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> - */
> -
> -import java.util.Collection;
> -import java.util.HashSet;
> -import java.util.Map;
> -
> -import org.amplecode.staxwax.reader.XMLReader;
> -import org.amplecode.staxwax.writer.XMLWriter;
> -import org.hisp.dhis.dataelement.CalculatedDataElement;
> -import org.hisp.dhis.dataelement.DataElement;
> -import org.hisp.dhis.dataelement.DataElementCategoryCombo;
> -import org.hisp.dhis.dataelement.DataElementService;
> -import org.hisp.dhis.expression.Expression;
> -import org.hisp.dhis.expression.ExpressionService;
> -import org.hisp.dhis.importexport.ExportParams;
> -import org.hisp.dhis.importexport.ImportObjectService;
> -import org.hisp.dhis.importexport.ImportParams;
> -import org.hisp.dhis.importexport.XMLConverter;
> -import org.hisp.dhis.importexport.importer.CalculatedDataElementImporter;
> -
> -/**
> - * @author Lars Helge Overland
> - * @version $Id$
> - */
> -public class CalculatedDataElementConverter
> -    extends CalculatedDataElementImporter implements XMLConverter
> -{
> -    public static final String COLLECTION_NAME = "calculatedDataElements";
> -    public static final String ELEMENT_NAME = "calculatedDataElement";
> -
> -    private static final String FIELD_ID = "id";
> -    private static final String FIELD_UUID = "uuid";
> -    private static final String FIELD_NAME = "name";
> -    private static final String FIELD_ALTERNATIVE_NAME =
> "alternativeName";
> -    private static final String FIELD_SHORT_NAME = "shortName";
> -    private static final String FIELD_CODE = "code";
> -    private static final String FIELD_DESCRIPTION = "description";
> -    private static final String FIELD_ACTIVE = "active";
> -    private static final String FIELD_TYPE = "type";
> -    private static final String FIELD_AGGREGATION_OPERATOR =
> "aggregationOperator";
> -    private static final String FIELD_CATEGORY_COMBO = "categoryCombo";
> -    private static final String FIELD_SAVED = "saved";
> -    private static final String FIELD_EXPRESSION = "expression";
> -
> -    private ExpressionService expressionService;
> -
> -    private Map<Object, Integer> dataElementMapping;
> -    private Map<Object, Integer> categoryComboMapping;
> -    private Map<Object, Integer> categoryOptionComboMapping;
> -
> -    //
> -------------------------------------------------------------------------
> -    // Constructor
> -    //
> -------------------------------------------------------------------------
> -
> -    /**
> -     * Constructor for write operations.
> -     */
> -    public CalculatedDataElementConverter( DataElementService
> dataElementService )
> -    {
> -        this.dataElementService = dataElementService;
> -    }
> -
> -    /**
> -     * Constructor for read operations.
> -     *
> -     * @param importObjectService the importObjectService to use.
> -     * @param dataElementService the dataElementService to use.
> -     * @param expressionService the expressionService to use.
> -     * @param categoryComboMapping the categoryComboMapping to use.
> -     * @param categoryOptionComboMapping the categoryOptionComboMapping to
> use.
> -     */
> -    public CalculatedDataElementConverter( ImportObjectService
> importObjectService,
> -        DataElementService dataElementService,
> -        ExpressionService expressionService,
> -        Map<Object, Integer> dataElementMapping,
> -        Map<Object, Integer> categoryComboMapping,
> -        Map<Object, Integer> categoryOptionComboMapping )
> -    {
> -        this.importObjectService = importObjectService;
> -        this.dataElementService = dataElementService;
> -        this.expressionService = expressionService;
> -        this.dataElementMapping = dataElementMapping;
> -        this.categoryComboMapping = categoryComboMapping;
> -        this.categoryOptionComboMapping = categoryOptionComboMapping;
> -    }
> -
> -    //
> -------------------------------------------------------------------------
> -    // XMLConverter implementation
> -    //
> -------------------------------------------------------------------------
> -
> -    public void write( XMLWriter writer, ExportParams params )
> -    {
> -        Collection<CalculatedDataElement> elements =
> dataElementService.getCalculatedDataElements(
> params.getCalculatedDataElements() );
> -
> -        if ( elements != null && elements.size() > 0 )
> -        {
> -            writer.openElement( COLLECTION_NAME );
> -
> -            for ( CalculatedDataElement element : elements )
> -            {
> -                writer.openElement( ELEMENT_NAME );
> -
> -                writer.writeElement( FIELD_ID, String.valueOf(
> element.getId() ) );
> -                writer.writeElement( FIELD_UUID, element.getUuid() );
> -                writer.writeElement( FIELD_NAME, element.getName() );
> -                writer.writeElement( FIELD_ALTERNATIVE_NAME,
> element.getAlternativeName() );
> -                writer.writeElement( FIELD_SHORT_NAME,
> element.getShortName() );
> -                writer.writeElement( FIELD_CODE, element.getCode() );
> -                writer.writeElement( FIELD_DESCRIPTION,
> element.getDescription() );
> -                writer.writeElement( FIELD_ACTIVE, String.valueOf(
> element.isActive() ) );
> -                writer.writeElement( FIELD_TYPE, element.getType() );
> -                writer.writeElement( FIELD_AGGREGATION_OPERATOR,
> element.getAggregationOperator() );
> -                writer.writeElement( FIELD_CATEGORY_COMBO, String.valueOf(
> element.getCategoryCombo().getId() ) );
> -                writer.writeElement( FIELD_SAVED, String.valueOf(
> element.isSaved() ) );
> -                writer.writeElement( FIELD_EXPRESSION,
> element.getExpression().getExpression() );
> -
> -                writer.closeElement();
> -            }
> -
> -            writer.closeElement();
> -        }
> -    }
> -
> -    public void read( XMLReader reader, ImportParams params )
> -    {
> -        while ( reader.moveToStartElement( ELEMENT_NAME, COLLECTION_NAME )
> )
> -        {
> -            final Map<String, String> values = reader.readElements(
> ELEMENT_NAME );
> -
> -            final CalculatedDataElement element = new
> CalculatedDataElement();
> -
> -            final DataElementCategoryCombo categoryCombo = new
> DataElementCategoryCombo();
> -            element.setCategoryCombo( categoryCombo );
> -
> -            element.setId( Integer.parseInt( values.get( FIELD_ID ) ) );
> -            element.setUuid( values.get( FIELD_UUID ) );
> -            element.setName( values.get( FIELD_NAME ) );
> -            element.setAlternativeName( values.get( FIELD_ALTERNATIVE_NAME
> ) );
> -            element.setShortName( values.get( FIELD_SHORT_NAME ) );
> -            element.setCode( values.get( FIELD_CODE ) );
> -            element.setDescription( values.get( FIELD_DESCRIPTION ) );
> -            element.setActive( Boolean.parseBoolean( values.get(
> FIELD_ACTIVE ) ) );
> -            element.setType( values.get( FIELD_TYPE ) );
> -            element.setAggregationOperator( values.get(
> FIELD_AGGREGATION_OPERATOR ) );
> -            element.getCategoryCombo().setId( categoryComboMapping.get(
> Integer.parseInt( values.get( FIELD_CATEGORY_COMBO ) ) ) );
> -            element.setSaved( Boolean.parseBoolean( values.get(
> FIELD_SAVED ) ) );
> -            String expression = expressionService.convertExpression(
> values.get( FIELD_EXPRESSION ), dataElementMapping,
> categoryOptionComboMapping );
> -            element.setExpression( new Expression( expression, null, new
> HashSet<DataElement>() ) );
> -
> -            importObject( element, params );
> -        }
> -    }
> -}
>
> === modified file
> 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DXFConverter.java'
> ---
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DXFConverter.java
>     2011-04-24 12:47:31 +0000
> +++
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DXFConverter.java
>     2011-04-24 15:50:02 +0000
> @@ -444,19 +444,6 @@
>
>                 log.info( "Imported DataElements" );
>             }
> -            else if ( reader.isStartElement(
> CalculatedDataElementConverter.COLLECTION_NAME ) )
> -            {
> -                state.setMessage( "importing_calculated_data_elements" );
> -
> -                XMLConverter converter = new
> CalculatedDataElementConverter( importObjectService, dataElementService,
> -                    expressionService,
> objectMappingGenerator.getDataElementMapping( params.skipMapping() ),
> -                    objectMappingGenerator.getCategoryComboMapping(
> params.skipMapping() ), objectMappingGenerator
> -                        .getCategoryOptionComboMapping(
> params.skipMapping() ) );
> -
> -                converterInvoker.invokeRead( converter, reader, params );
> -
> -                log.info( "Imported CalculatedDataElements" );
> -            }
>             else if ( reader.isStartElement(
> DataElementGroupConverter.COLLECTION_NAME ) )
>             {
>                 state.setMessage( "importing_data_element_groups" );
>
> === modified file
> 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataElementConverter.java'
> ---
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataElementConverter.java
>     2010-06-03 17:31:53 +0000
> +++
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataElementConverter.java
>     2011-04-24 15:50:02 +0000
> @@ -112,7 +112,7 @@
>
>     public void write( XMLWriter writer, ExportParams params )
>     {
> -        Collection<DataElement> elements =
> dataElementService.getNonCalculatedDataElements( params.getDataElements() );
> +        Collection<DataElement> elements =
> dataElementService.getDataElements( params.getDataElements() );
>
>         if ( elements != null && elements.size() > 0 )
>         {
>
> === modified file
> 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataElementGroupMemberConverter.java'
> ---
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataElementGroupMemberConverter.java
>  2010-05-29 16:06:56 +0000
> +++
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataElementGroupMemberConverter.java
>  2011-04-24 15:50:02 +0000
> @@ -103,7 +103,7 @@
>     {
>         Collection<DataElementGroup> groups =
> dataElementService.getDataElementGroups( params.getDataElementGroups() );
>
> -        Collection<DataElement> elements =
> dataElementService.getDataElements( params.getAllDataElements() );
> +        Collection<DataElement> elements =
> dataElementService.getDataElements( params.getDataElements() );
>
>         if ( groups != null && groups.size() > 0 && elements != null &&
> elements.size() > 0 )
>         {
>
> === modified file
> 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataElementGroupSetMemberConverter.java'
> ---
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataElementGroupSetMemberConverter.java
>       2010-05-29 16:06:56 +0000
> +++
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataElementGroupSetMemberConverter.java
>       2011-04-24 15:50:02 +0000
> @@ -104,7 +104,7 @@
>     {
>         Collection<DataElementGroupSet> groupSets =
> dataElementService.getDataElementGroupSets( params.getDataElementGroups() );
>
> -        Collection<DataElementGroup> groups =
> dataElementService.getDataElementGroups( params.getAllDataElements() );
> +        Collection<DataElementGroup> groups =
> dataElementService.getDataElementGroups( params.getDataElements() );
>
>         if ( groupSets != null && groupSets.size() > 0 && groups != null &&
> groups.size() > 0 )
>         {
>
> === modified file
> 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataSetMemberConverter.java'
> ---
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataSetMemberConverter.java
>   2010-05-29 16:06:56 +0000
> +++
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataSetMemberConverter.java
>   2011-04-24 15:50:02 +0000
> @@ -108,7 +108,7 @@
>     {
>         Collection<DataSet> dataSets = dataSetService.getDataSets(
> params.getDataSets() );
>
> -        Collection<DataElement> elements =
> dataElementService.getDataElements( params.getAllDataElements() );
> +        Collection<DataElement> elements =
> dataElementService.getDataElements( params.getDataElements() );
>
>         if ( dataSets != null && dataSets.size() > 0 && elements != null &&
> elements.size() > 0 )
>         {
>
> === modified file
> 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/exporter/DefaultDXFExportService.java'
> ---
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/exporter/DefaultDXFExportService.java
>   2011-04-24 12:47:31 +0000
> +++
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/exporter/DefaultDXFExportService.java
>   2011-04-24 15:50:02 +0000
> @@ -58,7 +58,6 @@
>  import org.hisp.dhis.importexport.ExportPipeThread;
>  import org.hisp.dhis.importexport.ExportService;
>  import
> org.hisp.dhis.importexport.dxf.converter.AggregatedDataValueConverter;
> -import
> org.hisp.dhis.importexport.dxf.converter.CalculatedDataElementConverter;
>  import
> org.hisp.dhis.importexport.dxf.converter.CategoryCategoryOptionAssociationConverter;
>  import
> org.hisp.dhis.importexport.dxf.converter.CategoryComboCategoryAssociationConverter;
>  import org.hisp.dhis.importexport.dxf.converter.ChartConverter;
> @@ -288,7 +287,6 @@
>             thread.registerXMLConverter( new
> CategoryComboCategoryAssociationConverter( categoryService ) );
>
>             thread.registerXMLConverter( new DataElementConverter(
> dataElementService ) );
> -            thread.registerXMLConverter( new
> CalculatedDataElementConverter( dataElementService ) );
>             thread.registerXMLConverter( new DataElementGroupConverter(
> dataElementService ) );
>             thread.registerXMLConverter( new
> DataElementGroupMemberConverter( dataElementService ) );
>             thread.registerXMLConverter( new DataElementGroupSetConverter(
> dataElementService ) );
>
> === removed file
> 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/importer/CalculatedDataElementImporter.java'
> ---
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/importer/CalculatedDataElementImporter.java
> 2010-06-01 07:57:57 +0000
> +++
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/importer/CalculatedDataElementImporter.java
> 1970-01-01 00:00:00 +0000
> @@ -1,169 +0,0 @@
> -package org.hisp.dhis.importexport.importer;
> -
> -/*
> - * Copyright (c) 2004-2010, University of Oslo
> - * All rights reserved.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions are
> met:
> - * * Redistributions of source code must retain the above copyright
> notice, this
> - *   list of conditions and the following disclaimer.
> - * * Redistributions in binary form must reproduce the above copyright
> notice,
> - *   this list of conditions and the following disclaimer in the
> documentation
> - *   and/or other materials provided with the distribution.
> - * * Neither the name of the HISP project nor the names of its
> contributors may
> - *   be used to endorse or promote products derived from this software
> without
> - *   specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
> IS" AND
> - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> IMPLIED
> - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
> LIABLE FOR
> - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> DAMAGES
> - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
> SERVICES;
> - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
> AND ON
> - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> OF THIS
> - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> - */
> -
> -import org.hisp.dhis.dataelement.CalculatedDataElement;
> -import org.hisp.dhis.dataelement.DataElement;
> -import org.hisp.dhis.dataelement.DataElementService;
> -import org.hisp.dhis.importexport.GroupMemberType;
> -import org.hisp.dhis.importexport.ImportParams;
> -import org.hisp.dhis.importexport.Importer;
> -import org.hisp.dhis.importexport.mapping.NameMappingUtil;
> -
> -/**
> - * @author Lars Helge Overland
> - * @version $Id$
> - */
> -public class CalculatedDataElementImporter
> -    extends AbstractImporter<CalculatedDataElement> implements
> Importer<CalculatedDataElement>
> -{
> -    protected DataElementService dataElementService;
> -
> -    public CalculatedDataElementImporter()
> -    {
> -    }
> -
> -    public CalculatedDataElementImporter( DataElementService
> dataElementService )
> -    {
> -        this.dataElementService = dataElementService;
> -    }
> -
> -    @Override
> -    public void importObject( CalculatedDataElement object, ImportParams
> params )
> -    {
> -        NameMappingUtil.addDataElementMapping( object.getId(),
> object.getName() );
> -        NameMappingUtil.addDataElementAggregationOperatorMapping(
> object.getId(), object.getAggregationOperator() );
> -
> -        read( object, GroupMemberType.NONE, params );
> -    }
> -
> -    @Override
> -    protected void importUnique( CalculatedDataElement object )
> -    {
> -        dataElementService.addDataElement( object );
> -    }
> -
> -    @Override
> -    protected void importMatching( CalculatedDataElement object,
> CalculatedDataElement match )
> -    {
> -        match.setUuid( object.getUuid() );
> -        match.setName( object.getName() );
> -        match.setShortName( object.getShortName() );
> -        match.setAlternativeName( object.getAlternativeName() );
> -        match.setCode( object.getCode() );
> -        match.setDescription( object.getDescription() );
> -        match.setActive( object.isActive() );
> -        match.setType( object.getType() );
> -        match.setAggregationOperator( object.getAggregationOperator() );
> -        match.setLastUpdated( object.getLastUpdated() );
> -        match.setSaved( object.isSaved() );
> -        match.setExpression( object.getExpression() );
> -
> -        dataElementService.updateDataElement( match );
> -    }
> -
> -    @Override
> -    protected CalculatedDataElement getMatching( CalculatedDataElement
> object )
> -    {
> -        DataElement match = dataElementService.getDataElementByName(
> object.getName() );
> -
> -        if ( match == null )
> -        {
> -            match = dataElementService.getDataElementByAlternativeName(
> object.getAlternativeName() );
> -        }
> -        if ( match == null )
> -        {
> -            match = dataElementService.getDataElementByShortName(
> object.getShortName() );
> -        }
> -
> -        CalculatedDataElement calculated = (CalculatedDataElement) match;
> -
> -        if ( calculated != null )
> -        {
> -            calculated.getExpression().getExpression(); // Load Expression
> in session
> -        }
> -
> -        return calculated;
> -    }
> -
> -    @Override
> -    protected boolean isIdentical( CalculatedDataElement object,
> CalculatedDataElement existing )
> -    {
> -        if ( !object.getName().equals( existing.getName() ) )
> -        {
> -            return false;
> -        }
> -        if ( !isSimiliar( object.getAlternativeName(),
> existing.getAlternativeName() ) || ( isNotNull( object.getAlternativeName(),
> existing.getAlternativeName() ) && !object.getAlternativeName().equals(
> existing.getAlternativeName() ) ) )
> -        {
> -            return false;
> -        }
> -        if ( !object.getShortName().equals( existing.getShortName() ) )
> -        {
> -            return false;
> -        }
> -        if ( !isSimiliar( object.getCode(), existing.getCode() ) || (
> isNotNull( object.getCode(), existing.getCode() ) &&
> !object.getCode().equals( existing.getCode() ) ) )
> -        {
> -            return false;
> -        }
> -        if ( !isSimiliar( object.getDescription(),
> existing.getDescription() ) || ( isNotNull( object.getDescription(),
> existing.getDescription() ) && !object.getDescription().equals(
> existing.getDescription() ) ) )
> -        {
> -            return false;
> -        }
> -        if ( object.isActive() != existing.isActive() )
> -        {
> -            return false;
> -        }
> -        if ( !object.getType().equals( existing.getType() ) )
> -        {
> -            return false;
> -        }
> -        if ( !object.getAggregationOperator().equals(
> existing.getAggregationOperator() ) )
> -        {
> -            return false;
> -        }
> -        if ( object.isSaved() != existing.isSaved() )
> -        {
> -            return false;
> -        }
> -
> -        return true;
> -    }
> -
> -    @Override
> -    protected boolean ignore( CalculatedDataElement object,
> CalculatedDataElement match )
> -    {
> -        boolean ignore = !(object instanceof CalculatedDataElement) &&
> match instanceof CalculatedDataElement;
> -
> -        if ( ignore )
> -        {
> -            log.warn( "Data element ignored because it matches with a
> calculated data element: " + object );
> -        }
> -
> -        return ignore;
> -    }
> -}
>
> === modified file
> 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/importer/DataElementImporter.java'
> ---
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/importer/DataElementImporter.java
>   2011-01-17 17:03:05 +0000
> +++
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/importer/DataElementImporter.java
>   2011-04-24 15:50:02 +0000
> @@ -28,7 +28,6 @@
>  */
>
>  import org.amplecode.quick.BatchHandler;
> -import org.hisp.dhis.dataelement.CalculatedDataElement;
>  import org.hisp.dhis.dataelement.DataElement;
>  import org.hisp.dhis.dataelement.DataElementService;
>  import org.hisp.dhis.importexport.GroupMemberType;
> @@ -142,17 +141,4 @@
>
>         return true;
>     }
> -
> -    @Override
> -    protected boolean ignore( DataElement object, DataElement match )
> -    {
> -        boolean ignore = object instanceof CalculatedDataElement && !(
> match instanceof Calculat
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>


-- 
Jason P. Pickering
email: jason.p.pickering@xxxxxxxxx
tel:+260974901293

Follow ups

References