dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #11783
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3446: Removed support for DHIS 1.4 calculated data elements
------------------------------------------------------------
revno: 3446
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-04-22 15:43:13 +0200
message:
Removed support for DHIS 1.4 calculated data elements
removed:
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/CalculatedDataElementRowHandler.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/CalculatedDataElementAssociationConverter.java
dhis-2/dhis-services/dhis-service-importexport/src/main/resources/sqlmap/calculatedDataElement.sqlmap.xml
dhis-2/dhis-services/dhis-service-importexport/src/main/resources/sqlmap/calculatedDataElementEntry.sqlmap.xml
modified:
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/importer/DefaultDhis14FileImportService.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/OrganisationUnitConverter.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/exporter/DefaultDhis14XMLExportService.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/importer/DefaultDhis14XMLImportService.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/importer/DefaultDhis14FileImportService.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/importer/DefaultDhis14FileImportService.java 2010-11-15 14:01:36 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/importer/DefaultDhis14FileImportService.java 2011-04-22 13:43:13 +0000
@@ -27,13 +27,9 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.expression.Expression.SEPARATOR;
-
import java.io.InputStream;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import org.amplecode.quick.BatchHandler;
@@ -62,7 +58,6 @@
import org.hisp.dhis.importexport.analysis.DefaultImportAnalyser;
import org.hisp.dhis.importexport.analysis.ImportAnalyser;
import org.hisp.dhis.importexport.dhis14.file.query.QueryManager;
-import org.hisp.dhis.importexport.dhis14.file.rowhandler.CalculatedDataElementRowHandler;
import org.hisp.dhis.importexport.dhis14.file.rowhandler.DataElementGroupMemberRowHandler;
import org.hisp.dhis.importexport.dhis14.file.rowhandler.DataElementGroupRowHandler;
import org.hisp.dhis.importexport.dhis14.file.rowhandler.DataElementRowHandler;
@@ -83,7 +78,6 @@
import org.hisp.dhis.importexport.dhis14.file.rowhandler.PeriodRowHandler;
import org.hisp.dhis.importexport.dhis14.file.rowhandler.RoutineDataValueRowHandler;
import org.hisp.dhis.importexport.dhis14.file.rowhandler.SemiPermanentDataValueRowHandler;
-import org.hisp.dhis.importexport.dhis14.object.Dhis14CalculatedDataElementEntry;
import org.hisp.dhis.importexport.dhis14.util.Dhis14PeriodUtil;
import org.hisp.dhis.importexport.mapping.NameMappingUtil;
import org.hisp.dhis.importexport.mapping.ObjectMappingGenerator;
@@ -118,7 +112,6 @@
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.source.Source;
-import org.hisp.dhis.system.util.AppendingHashMap;
import com.ibatis.sqlmap.client.event.RowHandler;
@@ -275,7 +268,6 @@
}
importDataElements( params, state );
- importCalculatedDataElements( params, state, createCalculatedDataElementEntryMap() );
importIndicatorTypes( params, state );
importIndicators( params, state );
importDataElementGroups( params, state );
@@ -349,28 +341,6 @@
log.info( "Imported DataElements" );
}
-
- private void importCalculatedDataElements( ImportParams params, ProcessState state, Map<Integer, String> calculatedEntryMap )
- {
- state.setMessage( "importing_data_elements" );
-
- DataElementCategoryCombo categoryCombo = categoryService.
- getDataElementCategoryComboByName( DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME );
-
- RowHandler rowHandler = new CalculatedDataElementRowHandler( importObjectService,
- dataElementService,
- params,
- categoryCombo,
- importAnalyser,
- expressionService,
- calculatedEntryMap,
- objectMappingGenerator.getDataElementMapping( params.skipMapping() ),
- getCategoryOptionComboMapping() );
-
- queryManager.queryWithRowhandler( "getCalculatedDataElements", rowHandler );
-
- log.info( "Imported CalculatedDataElements" );
- }
private void importIndicatorTypes( ImportParams params, ProcessState state )
{
@@ -803,37 +773,6 @@
// -------------------------------------------------------------------------
/**
- * Creates a map where key is the calculated data element identifier and the
- * value if the formula.
- */
- private Map<Integer, String> createCalculatedDataElementEntryMap()
- {
- int categoryOptionComboId = categoryService.getDefaultDataElementCategoryOptionCombo().getId();
-
- List<?> calculatedDataElements = queryManager.queryForList( "getCalculatedDataElementEntries", null );
-
- Map<Integer, String> map = new AppendingHashMap<Integer, String>(); // Calculated data element id, formula
-
- //TODO factor should be double
-
- for ( Object element : calculatedDataElements )
- {
- Dhis14CalculatedDataElementEntry calculated = (Dhis14CalculatedDataElementEntry) element;
-
- String formula = "([" + calculated.getDataElementId() + SEPARATOR + categoryOptionComboId + "]*" + calculated.getFactor() + ")";
-
- if ( map.containsKey( calculated.getCalculatedDataElementId() ) )
- {
- formula = "+" + formula;
- }
-
- map.put( calculated.getCalculatedDataElementId(), formula );
- }
-
- return map;
- }
-
- /**
* Returns a list of distinct period identifiers from the RoutineDataValue table,
* ie. periods which have registered data. Could be used to avoid importing
* periods without data.
@@ -851,22 +790,7 @@
return identifiers;
}
-
- /**
- * Returns a mapping for category option combo. Since DHIS 1.4 does not have
- * this it will always be default.
- */
- private Map<Object, Integer> getCategoryOptionComboMapping()
- {
- Integer categoryOptionComboId = categoryService.getDefaultDataElementCategoryOptionCombo().getId();
-
- Map<Object, Integer> mapping = new HashMap<Object, Integer>();
-
- mapping.put( categoryOptionComboId, categoryOptionComboId );
-
- return mapping;
- }
-
+
/**
* Verifies that the import file is valid by checking for routine and semi
* permanent data values out of range.
=== removed file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/CalculatedDataElementRowHandler.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/CalculatedDataElementRowHandler.java 2010-05-29 16:06:56 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/CalculatedDataElementRowHandler.java 1970-01-01 00:00:00 +0000
@@ -1,116 +0,0 @@
-package org.hisp.dhis.importexport.dhis14.file.rowhandler;
-
-/*
- * 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.HashSet;
-import java.util.Map;
-
-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.ImportObjectService;
-import org.hisp.dhis.importexport.ImportParams;
-import org.hisp.dhis.importexport.analysis.ImportAnalyser;
-import org.hisp.dhis.importexport.importer.CalculatedDataElementImporter;
-import org.hisp.dhis.system.util.UUIdUtils;
-
-import com.ibatis.sqlmap.client.event.RowHandler;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class CalculatedDataElementRowHandler
- extends CalculatedDataElementImporter implements RowHandler
-{
- private ImportParams params;
-
- private DataElementCategoryCombo categoryCombo;
-
- private ExpressionService expressionService;
-
- private Map<Integer, String> calculatedEntryMap;
-
- private Map<Object, Integer> dataElementMapping;
-
- private Map<Object, Integer> categoryOptionComboMapping;
-
- // -------------------------------------------------------------------------
- // Constructor
- // -------------------------------------------------------------------------
-
- public CalculatedDataElementRowHandler( ImportObjectService importObjectService,
- DataElementService dataElementService,
- ImportParams params,
- DataElementCategoryCombo categoryCombo,
- ImportAnalyser importAnalyser,
- ExpressionService expressionService,
- Map<Integer, String> calculatedEntryMap,
- Map<Object, Integer> dataElementMapping,
- Map<Object, Integer> categoryOptionComboMapping )
- {
- this.importObjectService = importObjectService;
- this.dataElementService = dataElementService;
- this.params = params;
- this.categoryCombo = categoryCombo;
- this.importAnalyser = importAnalyser;
- this.expressionService = expressionService;
- this.calculatedEntryMap = calculatedEntryMap;
- this.dataElementMapping = dataElementMapping;
- this.categoryOptionComboMapping = categoryOptionComboMapping;
- }
-
- // -------------------------------------------------------------------------
- // RowHandler implementation
- // -------------------------------------------------------------------------
-
- public void handleRow( Object object )
- {
- final CalculatedDataElement dataElement = (CalculatedDataElement) object;
-
- dataElement.setUuid( UUIdUtils.getUUId() );
- dataElement.setActive( true );
-
- if ( dataElement.getCode() != null && dataElement.getCode().trim().length() == 0 )
- {
- dataElement.setCode( null );
- }
-
- dataElement.setCategoryCombo( categoryCombo );
-
- String expression = calculatedEntryMap.get( dataElement.getId() );
-
- expression = expressionService.convertExpression( expression, dataElementMapping, categoryOptionComboMapping );
- dataElement.setExpression( new Expression( expression, null, new HashSet<DataElement>() ) );
-
- importObject( dataElement, params );
- }
-}
=== removed file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/CalculatedDataElementAssociationConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/CalculatedDataElementAssociationConverter.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/CalculatedDataElementAssociationConverter.java 1970-01-01 00:00:00 +0000
@@ -1,128 +0,0 @@
-package org.hisp.dhis.importexport.dhis14.xml.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 static org.hisp.dhis.expression.Expression.SEPARATOR;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.amplecode.staxwax.reader.XMLReader;
-import org.amplecode.staxwax.writer.XMLWriter;
-import org.hisp.dhis.dataelement.CalculatedDataElement;
-import org.hisp.dhis.dataelement.DataElementOperand;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.importexport.ExportParams;
-import org.hisp.dhis.importexport.ImportParams;
-import org.hisp.dhis.importexport.XMLConverter;
-import org.hisp.dhis.importexport.dhis14.util.Dhis14ParsingUtils;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class CalculatedDataElementAssociationConverter
- implements XMLConverter
-{
- public static final String ELEMENT_NAME = "DataElementCalculated";
-
- private static final String FIELD_ID = "DataElementCalculatedID";
- private static final String FIELD_DATAELEMENT = "DataElementID";
- private static final String FIELD_FACTOR = "DataElementFactor";
-
- private DataElementService dataElementService;
-
- private Map<Integer, String> expressionMap;
-
- // -------------------------------------------------------------------------
- // Constructor
- // -------------------------------------------------------------------------
-
- /**
- * Constructor for write operations.
- */
- public CalculatedDataElementAssociationConverter( DataElementService dataElementService )
- {
- this.dataElementService = dataElementService;
- }
-
- /**
- * Constructor for read operations.
- */
- public CalculatedDataElementAssociationConverter( Map<Integer, String> expressionMap )
- {
- this.expressionMap = expressionMap;
- }
-
- // -------------------------------------------------------------------------
- // XMLConverter implementation
- // -------------------------------------------------------------------------
-
- public void write( XMLWriter writer, ExportParams params )
- {
- Collection<CalculatedDataElement> elements = dataElementService.getCalculatedDataElements( params.getCalculatedDataElements() );
-
- if ( elements != null && elements.size() > 0 )
- {
- for ( CalculatedDataElement element : elements )
- {
- Map<DataElementOperand, Double> factorMap = Dhis14ParsingUtils.getOperandFactors( element );
-
- for ( Entry<DataElementOperand, Double> entry : factorMap.entrySet() )
- {
- writer.openElement( ELEMENT_NAME );
-
- writer.writeElement( FIELD_ID, String.valueOf( element.getId() ) );
- writer.writeElement( FIELD_DATAELEMENT, String.valueOf( entry.getKey().getDataElementId() ) );
- writer.writeElement( FIELD_FACTOR, String.valueOf( entry.getValue() ) );
-
- writer.closeElement();
- }
- }
- }
- }
-
- public void read( XMLReader reader, ImportParams params )
- {
- final Map<String, String> values = reader.readElements( ELEMENT_NAME );
-
- final Integer calculatedDataElementId = Integer.parseInt( values.get( FIELD_ID ) );
- final Integer dataElementId = Integer.parseInt( values.get( FIELD_DATAELEMENT ) );
- final Double factor = Double.parseDouble( values.get( FIELD_FACTOR ) );
-
- String formula = "([" + dataElementId + SEPARATOR + 1 + "]*" + factor + ")";
-
- if ( expressionMap.containsKey( calculatedDataElementId ) )
- {
- formula = "+" + formula;
- }
-
- expressionMap.put( calculatedDataElementId, formula );
- }
-}
=== 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-02-17 09:51:48 +0000
+++ 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
@@ -30,23 +30,19 @@
import static org.hisp.dhis.dataelement.DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME;
import static org.hisp.dhis.importexport.dhis14.util.Dhis14TypeHandler.convertAggregationOperatorFromDhis14;
import static org.hisp.dhis.importexport.dhis14.util.Dhis14TypeHandler.convertAggregationOperatorToDhis14;
-import static org.hisp.dhis.importexport.dhis14.util.Dhis14TypeHandler.convertBooleanFromDhis14;
import static org.hisp.dhis.importexport.dhis14.util.Dhis14TypeHandler.convertBooleanToDhis14;
import static org.hisp.dhis.importexport.dhis14.util.Dhis14TypeHandler.convertTypeToDhis14;
import static org.hisp.dhis.system.util.ConversionUtils.parseInt;
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.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.expression.Expression;
import org.hisp.dhis.importexport.ExportParams;
import org.hisp.dhis.importexport.ImportObjectService;
import org.hisp.dhis.importexport.ImportParams;
@@ -99,8 +95,6 @@
private DataElementCategoryService categoryService;
- private Map<Integer, String> expressionMap;
-
// -------------------------------------------------------------------------
// Constructor
// -------------------------------------------------------------------------
@@ -122,33 +116,13 @@
public DataElementConverter( ImportObjectService importObjectService,
DataElementService dataElementService,
DataElementCategoryService categoryService,
- Map<Integer, String> expressionMap,
ImportAnalyser importAnalyser )
{
this.importObjectService = importObjectService;
this.dataElementService = dataElementService;
this.categoryService = categoryService;
- this.expressionMap = expressionMap;
this.importAnalyser = importAnalyser;
}
-
- // -------------------------------------------------------------------------
- // AbstractDataElementConverter implementation
- // -------------------------------------------------------------------------
-
- @Override
- protected DataElement getMatching( DataElement object )
- {
- DataElement element = super.getMatching( object );
-
- if ( element instanceof CalculatedDataElement )
- {
- ((CalculatedDataElement)element).isSaved(); // Loading saved property into memory
- ((CalculatedDataElement)element).getExpression().getExpression(); // Loading expression into memory
- }
-
- return element;
- }
// -------------------------------------------------------------------------
// XMLConverter implementation
@@ -163,11 +137,6 @@
int i = 0;
for ( DataElement object : elements )
{
- final boolean calculated = object instanceof CalculatedDataElement;
- final boolean saveCalculated = calculated ? ((CalculatedDataElement)object).isSaved() : false;
-
- i++;
-
writer.openElement( ELEMENT_NAME );
writer.writeElement( FIELD_ID, String.valueOf( object.getId() ) );
@@ -184,8 +153,8 @@
writer.writeElement( FIELD_VALID_TO, String.valueOf( VALID_TO ) );
writer.writeElement( FIELD_DESCRIPTION, object.getDescription() );
writer.writeElement( FIELD_COMMENT, "" );
- writer.writeElement( FIELD_CALCULATED, convertBooleanToDhis14( calculated ) );
- writer.writeElement( FIELD_SAVE_CALCULATED, convertBooleanToDhis14( saveCalculated ) );
+ writer.writeElement( FIELD_CALCULATED, convertBooleanToDhis14( false ) );
+ writer.writeElement( FIELD_SAVE_CALCULATED, convertBooleanToDhis14( false ) );
writer.writeElement( FIELD_AGGREGATION_START_LEVEL, String.valueOf( AGG_START_LEVEL ) );
writer.writeElement( FIELD_AGGREGATION_OPERATOR, convertAggregationOperatorToDhis14( object.getAggregationOperator() ) );
writer.writeElement( FIELD_SELECTED, String.valueOf( 0 ) );
@@ -203,25 +172,12 @@
{
Map<String, String> values = reader.readElements( ELEMENT_NAME );
- boolean calculated = convertBooleanFromDhis14( values.get( FIELD_CALCULATED ) );
-
DataElementCategoryCombo categoryCombo = categoryService.getDataElementCategoryComboByName( DEFAULT_CATEGORY_COMBO_NAME );
DataElementCategoryCombo proxyCategoryCombo = new DataElementCategoryCombo();
proxyCategoryCombo.setId( categoryCombo.getId() );
- DataElement element = null;
+ DataElement element = new DataElement();
- if ( calculated )
- {
- element = new CalculatedDataElement();
- ((CalculatedDataElement)element).setSaved( convertBooleanFromDhis14( values.get( FIELD_SAVE_CALCULATED ) ) );
- ((CalculatedDataElement)element).setExpression( new Expression( expressionMap.get( element.getId() ), null, new HashSet<DataElement>() ) );
- }
- else
- {
- element = new DataElement();
- }
-
element.setCategoryCombo( proxyCategoryCombo );
element.setId( Integer.valueOf( values.get( FIELD_ID ) ) );
element.setName( values.get( FIELD_NAME ) );
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/OrganisationUnitConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/OrganisationUnitConverter.java 2011-04-21 15:24:52 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/OrganisationUnitConverter.java 2011-04-22 13:43:13 +0000
@@ -67,7 +67,6 @@
private static final String FIELD_SELECTED = "Selected";
private static final String FIELD_LAST_USER = "LastUserID";
private static final String FIELD_LAST_UPDATED = "LastUpdated";
- private static final String FIELD_ALT_NAME = "OrgUnitNameAlt1"; //1.4 has multiple alternative names. Support the first.
private static final int VALID_FROM = 34335;
private static final int VALID_TO = 2958465;
@@ -148,7 +147,6 @@
unit.setActive( convertBooleanFromDhis14(values.get( FIELD_ACTIVE ) ) ) ;
unit.setComment( values.get( FIELD_COMMENT ) );
unit.setLastUpdated( Dhis14DateUtil.getDate( values.get( FIELD_LAST_UPDATED ) ) );
- //unit.setAlternativeName( values.get( FIELD_ALT_NAME ));
importObject( unit, params );
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/exporter/DefaultDhis14XMLExportService.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/exporter/DefaultDhis14XMLExportService.java 2011-02-22 23:17:50 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/exporter/DefaultDhis14XMLExportService.java 2011-04-22 13:43:13 +0000
@@ -44,7 +44,6 @@
import org.hisp.dhis.importexport.ExportParams;
import org.hisp.dhis.importexport.ExportPipeThread;
import org.hisp.dhis.importexport.ExportService;
-import org.hisp.dhis.importexport.dhis14.xml.converter.CalculatedDataElementAssociationConverter;
import org.hisp.dhis.importexport.dhis14.xml.converter.DataElementConverter;
import org.hisp.dhis.importexport.dhis14.xml.converter.DataTypeConverter;
import org.hisp.dhis.importexport.dhis14.xml.converter.DataValueConverter;
@@ -186,9 +185,7 @@
thread.registerXSDConverter( new UserRoleXSDConverter() );
thread.registerXMLConverter( new DataElementConverter( dataElementService ) );
- thread.registerXMLConverter( new CalculatedDataElementAssociationConverter( dataElementService ) );
thread.registerXMLConverter( new PeriodTypeConverter() );
- thread.registerXMLConverter( new CalculatedDataElementAssociationConverter( dataElementService ) );
thread.registerXMLConverter( new PeriodTypeConverter() );
thread.registerXMLConverter( new OrganisationUnitConverter( organisationUnitService ) );
//thread.registerXMLConverter( new OrganisationUnitGroupConverter( organisationUnitGroupService ) );
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/importer/DefaultDhis14XMLImportService.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/importer/DefaultDhis14XMLImportService.java 2010-11-15 14:01:36 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/importer/DefaultDhis14XMLImportService.java 2011-04-22 13:43:13 +0000
@@ -30,7 +30,6 @@
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
-import java.util.Map;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@@ -54,7 +53,6 @@
import org.hisp.dhis.importexport.XMLConverter;
import org.hisp.dhis.importexport.analysis.DefaultImportAnalyser;
import org.hisp.dhis.importexport.analysis.ImportAnalyser;
-import org.hisp.dhis.importexport.dhis14.xml.converter.CalculatedDataElementAssociationConverter;
import org.hisp.dhis.importexport.dhis14.xml.converter.DataElementCategoryComboConverter;
import org.hisp.dhis.importexport.dhis14.xml.converter.DataElementCategoryConverter;
import org.hisp.dhis.importexport.dhis14.xml.converter.DataElementCategoryOptionComboConverter;
@@ -74,7 +72,6 @@
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.system.process.OutputHolderState;
-import org.hisp.dhis.system.util.AppendingHashMap;
import org.hisp.dhis.system.util.StreamUtils;
/**
@@ -225,8 +222,6 @@
// are later used during import of calculated dataelements
// -------------------------------------------------------------
- Map<Integer, String> expressionMap = new AppendingHashMap<Integer, String>();
-
state.setMessage( "importing_meta_data" );
log.info( "Importing meta data" );
@@ -235,10 +230,8 @@
XMLConverter categoryOptionConverter = new DataElementCategoryOptionConverter( importObjectService, categoryService );
XMLConverter categoryConverter = new DataElementCategoryConverter( importObjectService, categoryService );
XMLConverter categoryComboConverter = new DataElementCategoryComboConverter( importObjectService, categoryService );
- XMLConverter categoryOptionComboConverter = new DataElementCategoryOptionComboConverter( importObjectService, categoryService );
- XMLConverter calculatedDataElementAssociationConverter = new CalculatedDataElementAssociationConverter( expressionMap );
- XMLConverter dataElementConverter = new DataElementConverter(
- importObjectService, dataElementService, categoryService, expressionMap, importAnalyser );
+ XMLConverter categoryOptionComboConverter = new DataElementCategoryOptionComboConverter( importObjectService, categoryService );
+ XMLConverter dataElementConverter = new DataElementConverter( importObjectService, dataElementService, categoryService, importAnalyser );
XMLConverter indicatorTypeConverter = new IndicatorTypeConverter( importObjectService, indicatorService );
XMLConverter indicatorConverter = new IndicatorConverter( importObjectService, indicatorService, importAnalyser, defaultCategoryOptionCombo );
XMLConverter organisationUnitConverter = new OrganisationUnitConverter( importObjectService, organisationUnitService, importAnalyser );
@@ -252,11 +245,7 @@
while ( reader.next() )
{
- if ( reader.isStartElement( CalculatedDataElementAssociationConverter.ELEMENT_NAME ) )
- {
- converterInvoker.invokeRead( calculatedDataElementAssociationConverter, reader, params );
- }
- else if ( reader.isStartElement( DataElementConverter.ELEMENT_NAME ) )
+ if ( reader.isStartElement( DataElementConverter.ELEMENT_NAME ) )
{
converterInvoker.invokeRead( dataElementConverter, reader, params );
}
=== removed file 'dhis-2/dhis-services/dhis-service-importexport/src/main/resources/sqlmap/calculatedDataElement.sqlmap.xml'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/resources/sqlmap/calculatedDataElement.sqlmap.xml 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/resources/sqlmap/calculatedDataElement.sqlmap.xml 1970-01-01 00:00:00 +0000
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<!DOCTYPE sqlMap
- PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
- "http://ibatis.apache.org/dtd/sql-map-2.dtd">
-
-<sqlMap namespace="calculatedDataElement">
-
- <!-- TypeAlias -->
-
- <typeAlias alias="calculatedDataElement" type="org.hisp.dhis.dataelement.CalculatedDataElement"/>
- <typeAlias alias="aggregationOperatorTypeHandler" type="org.hisp.dhis.importexport.dhis14.file.typehandler.AggregationOperatorTypeHandler"/>
- <typeAlias alias="dataElementTypeTypeHandler" type="org.hisp.dhis.importexport.dhis14.file.typehandler.DataElementTypeTypeHandler"/>
- <typeAlias alias="booleanTypeHandler" type="org.hisp.dhis.importexport.dhis14.file.typehandler.BooleanTypeHandler"/>
-
- <!-- ResultMap -->
-
- <resultMap class="calculatedDataElement" id="calculatedDataElementResultMap">
- <result property="id" column="DataElementID"/>
- <result property="name" column="DataElementName"/>
- <result property="shortName" column="DataElementShort"/>
- <result property="code" column="DataElementCode"/>
- <result property="description" column="DataElementDescription"/>
- <result property="type" column="DataTypeID" typeHandler="dataElementTypeTypeHandler"/>
- <result property="aggregationOperator" column="AggregateOperator" typeHandler="aggregationOperatorTypeHandler"/>
- <result property="saved" column="SaveCalculated" typeHandler="booleanTypeHandler"/>
- </resultMap>
-
- <!-- Statement -->
-
- <select id="getCalculatedDataElements" resultMap="calculatedDataElementResultMap">
- SELECT * FROM DataElement WHERE Calculated = 1
- </select>
-
-</sqlMap>
=== removed file 'dhis-2/dhis-services/dhis-service-importexport/src/main/resources/sqlmap/calculatedDataElementEntry.sqlmap.xml'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/resources/sqlmap/calculatedDataElementEntry.sqlmap.xml 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/resources/sqlmap/calculatedDataElementEntry.sqlmap.xml 1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<!DOCTYPE sqlMap
- PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
- "http://ibatis.apache.org/dtd/sql-map-2.dtd">
-
-<sqlMap namespace="calculatedDataElementEntry">
-
- <!-- TypeAlias -->
-
- <typeAlias alias="calculatedDataElementEntry" type="org.hisp.dhis.importexport.dhis14.object.Dhis14CalculatedDataElementEntry"/>
-
- <!-- ResultMap -->
-
- <resultMap class="calculatedDataElementEntry" id="calculatedDataElementEntryResultMap">
- <result property="calculatedDataElementId" column="DataElementCalculatedID"/>
- <result property="dataElementId" column="DataElementID"/>
- <result property="factor" column="DataElementFactor"/>
- </resultMap>
-
- <!-- Statement -->
-
- <select id="getCalculatedDataElementEntries" resultMap="calculatedDataElementEntryResultMap">
- SELECT * FROM DataElementCalculated
- </select>
-
-</sqlMap>