dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #16599
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6345: Mapping DHIS 1.4 Long name/Prompt to DHIS2 Alternative name.
------------------------------------------------------------
revno: 6345
committer: Jason P. Pickering <jason.p.pickering@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-03-22 15:09:53 +0200
message:
Mapping DHIS 1.4 Long name/Prompt to DHIS2 Alternative name.
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 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataElementConverter.java 2012-03-22 13:09:53 +0000
@@ -27,16 +27,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-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.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.Map;
-
import org.amplecode.staxwax.reader.XMLReader;
import org.amplecode.staxwax.writer.XMLWriter;
import org.hisp.dhis.dataelement.DataElement;
@@ -54,6 +44,13 @@
import org.hisp.dhis.importexport.importer.DataElementImporter;
import org.hisp.dhis.importexport.mapping.NameMappingUtil;
+import java.util.Collection;
+import java.util.Map;
+
+import static org.hisp.dhis.dataelement.DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME;
+import static org.hisp.dhis.importexport.dhis14.util.Dhis14TypeHandler.*;
+import static org.hisp.dhis.system.util.ConversionUtils.parseInt;
+
/**
* @author Lars Helge Overland
* @version $Id: DataElementConverter.java 6455 2008-11-24 08:59:37Z larshelg $
@@ -145,7 +142,7 @@
writer.writeElement( FIELD_NAME, object.getName() );
writer.writeElement( FIELD_SHORT_NAME, object.getShortName() );
writer.writeElement( FIELD_DOS, object.getShortName().replaceAll( "[^a-zA-Z0-9]", "" ) );
- writer.writeElement( FIELD_PROMPT, object.getName() );
+ writer.writeElement( FIELD_PROMPT, object.getAlternativeName() );
writer.writeElement( FIELD_META, String.valueOf( 0 ) );
writer.writeElement( FIELD_DATA_TYPE, convertTypeToDhis14( object.getType() ) );
writer.writeElement( FIELD_PERIOD_TYPE, String.valueOf( 1 ) );
@@ -183,6 +180,7 @@
element.setName( values.get( FIELD_NAME ) );
element.setShortName( values.get( FIELD_SHORT_NAME ) );
element.setDescription( Dhis14ParsingUtils.removeNewLine( values.get( FIELD_DESCRIPTION ) ) );
+ element.setAlternativeName(values.get(FIELD_PROMPT));
element.setActive( true );
element.setType( Dhis14ObjectMappingUtil.getDataElementTypeMap().get( Integer.parseInt( values.get( FIELD_DATA_TYPE ) ) ) );
element.setAggregationOperator( convertAggregationOperatorFromDhis14( values.get( FIELD_AGGREGATION_OPERATOR ) ) );