dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #05881
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1849: Simplification
------------------------------------------------------------
revno: 1849
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Thu 2010-05-13 12:55:34 +0200
message:
Simplification
modified:
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataElementConverter.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/xml/converter/DataElementConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataElementConverter.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/DataElementConverter.java 2010-05-13 10:55:34 +0000
@@ -207,47 +207,32 @@
DataElementCategoryCombo proxyCategoryCombo = new DataElementCategoryCombo();
proxyCategoryCombo.setId( categoryCombo.getId() );
+ DataElement element = null;
+
if ( calculated )
{
- final CalculatedDataElement element = new CalculatedDataElement();
-
- element.setCategoryCombo( proxyCategoryCombo );
-
- element.setId( Integer.valueOf( values.get( FIELD_ID ) ) );
- element.setName( values.get( FIELD_NAME ) );
- element.setShortName( values.get( FIELD_SHORT_NAME ) );
- element.setDescription( Dhis14ParsingUtils.removeNewLine( values.get( FIELD_DESCRIPTION ) ) );
- element.setActive( true );
- element.setType( Dhis14ObjectMappingUtil.getDataElementTypeMap().get( Integer.parseInt( values.get( FIELD_DATA_TYPE ) ) ) );
- element.setAggregationOperator( convertAggregationOperatorFromDhis14( values.get( FIELD_AGGREGATION_OPERATOR ) ) );
- element.setSortOrder( parseInt( values.get( FIELD_SORT_ORDER ) ) );
- element.setLastUpdated( Dhis14DateUtil.getDate( values.get( FIELD_LAST_UPDATED ) ) );
- element.setSaved( convertBooleanFromDhis14( values.get( FIELD_SAVE_CALCULATED ) ) );
- element.setExpression( new Expression( expressionMap.get( element.getId() ), null, new HashSet<DataElement>() ) );
-
- NameMappingUtil.addDataElementAggregationOperatorMapping( element.getId(), element.getAggregationOperator() );
-
- read( element, GroupMemberType.NONE, params );
+ 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
{
- final DataElement element = new DataElement();
+ element = new DataElement();
+ }
- element.setCategoryCombo( proxyCategoryCombo );
-
- element.setId( Integer.valueOf( values.get( FIELD_ID ) ) );
- element.setName( values.get( FIELD_NAME ) );
- element.setShortName( values.get( FIELD_SHORT_NAME ) );
- element.setDescription( Dhis14ParsingUtils.removeNewLine( values.get( FIELD_DESCRIPTION ) ) );
- element.setActive( true );
- element.setType( Dhis14ObjectMappingUtil.getDataElementTypeMap().get( Integer.parseInt( values.get( FIELD_DATA_TYPE ) ) ) );
- element.setAggregationOperator( convertAggregationOperatorFromDhis14( values.get( FIELD_AGGREGATION_OPERATOR ) ) );
- element.setSortOrder( parseInt( values.get( FIELD_SORT_ORDER ) ) );
- element.setLastUpdated( Dhis14DateUtil.getDate( values.get( FIELD_LAST_UPDATED ) ) );
-
- NameMappingUtil.addDataElementAggregationOperatorMapping( element.getId(), element.getAggregationOperator() );
-
- read( element, GroupMemberType.NONE, params );
- }
+ element.setCategoryCombo( proxyCategoryCombo );
+ element.setId( Integer.valueOf( values.get( FIELD_ID ) ) );
+ element.setName( values.get( FIELD_NAME ) );
+ element.setShortName( values.get( FIELD_SHORT_NAME ) );
+ element.setDescription( Dhis14ParsingUtils.removeNewLine( values.get( FIELD_DESCRIPTION ) ) );
+ element.setActive( true );
+ element.setType( Dhis14ObjectMappingUtil.getDataElementTypeMap().get( Integer.parseInt( values.get( FIELD_DATA_TYPE ) ) ) );
+ element.setAggregationOperator( convertAggregationOperatorFromDhis14( values.get( FIELD_AGGREGATION_OPERATOR ) ) );
+ element.setSortOrder( parseInt( values.get( FIELD_SORT_ORDER ) ) );
+ element.setLastUpdated( Dhis14DateUtil.getDate( values.get( FIELD_LAST_UPDATED ) ) );
+
+ NameMappingUtil.addDataElementAggregationOperatorMapping( element.getId(), element.getAggregationOperator() );
+
+ read( element, GroupMemberType.NONE, params );
}
}