← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5032: Added domain type to dxf

 

------------------------------------------------------------
revno: 5032
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-10-25 20:25:34 +0200
message:
  Added domain type to dxf
modified:
  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/importer/DataElementImporter.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/dxf/converter/DataElementConverter.java'
--- 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
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataElementConverter.java	2011-10-25 18:25:34 +0000
@@ -63,6 +63,7 @@
     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_DOMAIN_TYPE = "domainType";
     private static final String FIELD_AGGREGATION_OPERATOR = "aggregationOperator";
     private static final String FIELD_CATEGORY_COMBO = "categoryCombo";
     private static final String FIELD_LAST_UPDATED = "lastUpdated";
@@ -131,6 +132,7 @@
                 writer.writeElement( FIELD_DESCRIPTION, element.getDescription() );
                 writer.writeElement( FIELD_ACTIVE, String.valueOf( element.isActive() ) );
                 writer.writeElement( FIELD_TYPE, element.getType() );
+                writer.writeElement( FIELD_DOMAIN_TYPE, element.getDomainType() );
                 writer.writeElement( FIELD_AGGREGATION_OPERATOR, element.getAggregationOperator() );
                 writer.writeElement( FIELD_CATEGORY_COMBO, String.valueOf( element.getCategoryCombo().getId() ) );
                 writer.writeElement( FIELD_LAST_UPDATED, DateUtils.getMediumDateString( element.getLastUpdated(), EMPTY ) );
@@ -162,6 +164,7 @@
             element.setDescription( values.get( FIELD_DESCRIPTION ) );
             element.setActive( Boolean.parseBoolean( values.get( FIELD_ACTIVE ) ) );
             element.setType( values.get( FIELD_TYPE ) );
+            element.setDomainType( values.get( FIELD_DOMAIN_TYPE ) );
             element.setAggregationOperator( values.get( FIELD_AGGREGATION_OPERATOR ) );
             element.getCategoryCombo().setId( categoryComboMapping.get( Integer.parseInt( values.get( FIELD_CATEGORY_COMBO ) ) ) );
             element.setLastUpdated( DateUtils.getMediumDate( values.get( FIELD_LAST_UPDATED ) ) );            

=== 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-10-05 11:50:05 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/importer/DataElementImporter.java	2011-10-25 18:25:34 +0000
@@ -80,6 +80,7 @@
         match.setDescription( object.getDescription() );
         match.setActive( object.isActive() );
         match.setType( object.getType() );
+        match.setDomainType( object.getDomainType() );
         match.setAggregationOperator( object.getAggregationOperator() );
         match.setLastUpdated( object.getLastUpdated() );
 
@@ -138,6 +139,10 @@
         {
             return false;
         }
+        if ( !isSimiliar( object.getDomainType(), existing.getDomainType() ) || ( isNotNull( object.getDomainType(), existing.getDomainType() ) && !object.getDomainType().equals( existing.getDomainType() ) ) )
+        {
+            return false;
+        }
         if ( !object.getAggregationOperator().equals( existing.getAggregationOperator() ) )
         {
             return false;