← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18219: CSV import, added support for option set for data elements

 

------------------------------------------------------------
revno: 18219
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-02-10 19:54:50 +0100
message:
  CSV import, added support for option set for data elements
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/csv/DefaultCsvImportService.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-dxf2/src/main/java/org/hisp/dhis/dxf2/csv/DefaultCsvImportService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/csv/DefaultCsvImportService.java	2015-01-20 10:08:08 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/csv/DefaultCsvImportService.java	2015-02-10 18:54:50 +0000
@@ -197,6 +197,8 @@
                 String categoryComboUid = getSafe( values, 11, null, 11 );
                 object.setUrl( getSafe( values, 12, null, 255 ) );
                 object.setZeroIsSignificant( Boolean.valueOf( getSafe( values, 13, "false", null ) ) );
+                String optionSetUid = getSafe( values, 13, null, 11 );
+                String commentOptionSetUid = getSafe( values, 14, null, 11 );
 
                 if ( categoryComboUid != null )
                 {
@@ -209,6 +211,20 @@
                     object.setCategoryCombo( categoryCombo );
                 }
                 
+                if ( optionSetUid != null )
+                {
+                    OptionSet optionSet = new OptionSet();
+                    optionSet.setUid( optionSetUid );
+                    object.setOptionSet( optionSet );
+                }
+
+                if ( commentOptionSetUid != null )
+                {
+                    OptionSet optionSet = new OptionSet();
+                    optionSet.setUid( commentOptionSetUid );
+                    object.setCommentOptionSet( optionSet );
+                }
+                
                 list.add( object );
             }
         }