← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21323: Data value import, fix for NPE for id schemes

 

------------------------------------------------------------
revno: 21323
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-12-04 11:44:33 +0100
message:
  Data value import, fix for NPE for id schemes
modified:
  dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ImportDataValueAction.java
  dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importDataValue.vm


--
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-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ImportDataValueAction.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ImportDataValueAction.java	2015-12-03 07:12:19 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ImportDataValueAction.java	2015-12-04 10:44:33 +0000
@@ -29,9 +29,10 @@
  */
 
 import com.opensymphony.xwork2.Action;
+
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.common.IdentifiableProperty;
 import org.hisp.dhis.commons.util.StreamUtils;
 import org.hisp.dhis.dxf2.adx.AdxDataService;
 import org.hisp.dhis.dxf2.common.ImportOptions;
@@ -97,23 +98,23 @@
         this.strategy = ImportStrategy.valueOf( stgy );
     }
 
-    private IdentifiableProperty idScheme;
+    private String idScheme;
 
-    public void setIdScheme( IdentifiableProperty idScheme )
+    public void setIdScheme( String idScheme )
     {
         this.idScheme = idScheme;
     }
 
-    private IdentifiableProperty dataElementIdScheme;
+    private String dataElementIdScheme;
 
-    public void setDataElementIdScheme( IdentifiableProperty dataElementIdScheme )
+    public void setDataElementIdScheme( String dataElementIdScheme )
     {
         this.dataElementIdScheme = dataElementIdScheme;
     }
 
-    private IdentifiableProperty orgUnitIdScheme;
+    private String orgUnitIdScheme;
 
-    public void setOrgUnitIdScheme( IdentifiableProperty orgUnitIdScheme )
+    public void setOrgUnitIdScheme( String orgUnitIdScheme )
     {
         this.orgUnitIdScheme = orgUnitIdScheme;
     }
@@ -159,9 +160,9 @@
 
         ImportOptions options = new ImportOptions().setDryRun( dryRun )
             .setPreheatCache( preheatCache ).setStrategy( strategy ).setSkipExistingCheck( skipExistingCheck )
-            .setIdScheme( idScheme.toString() )
-            .setDataElementIdScheme( dataElementIdScheme.toString() )
-            .setOrgUnitIdScheme( orgUnitIdScheme.toString() );
+            .setIdScheme( StringUtils.trimToNull( idScheme ) )
+            .setDataElementIdScheme( StringUtils.trimToNull( dataElementIdScheme ) )
+            .setOrgUnitIdScheme( StringUtils.trimToNull( orgUnitIdScheme ) );
 
         log.info( options );
 

=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importDataValue.vm'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importDataValue.vm	2015-11-02 18:56:53 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importDataValue.vm	2015-12-04 10:44:33 +0000
@@ -44,7 +44,7 @@
 <tr class="moreOptions" style="display:none">
 	<td>$i18n.getString( "data_element_id_scheme" )</td>	
 	<td><select id="dataElementIdScheme" name="dataElementIdScheme" style="width:190px">
-		<option>[ $i18n.getString( "select" ) ]</option>
+		<option value="">[ $i18n.getString( "select" ) ]</option>
 		<option value="UID">$i18n.getString( "uid" )</option>
 		<option value="CODE">$i18n.getString( "code" )</option>
 		<option value="NAME">$i18n.getString( "name" )</option>
@@ -53,7 +53,7 @@
 <tr class="moreOptions" style="display:none">
 	<td>$i18n.getString( "org_unit_id_scheme" )</td>	
 	<td><select id="orgUnitIdScheme" name="orgUnitIdScheme" style="width:190px">
-		<option>[ $i18n.getString( "select" ) ]</option>
+		<option value="">[ $i18n.getString( "select" ) ]</option>
 		<option value="UID">$i18n.getString( "uid" )</option>
 		<option value="CODE">$i18n.getString( "code" )</option>
 		<option value="NAME">$i18n.getString( "name" )</option>
@@ -62,7 +62,7 @@
 <tr class="moreOptions" style="display:none">
 	<td>$i18n.getString( "id_scheme" ) ($i18n.getString( "all_objects" ))</td>	
 	<td><select id="idScheme" name="idScheme" style="width:190px">
-		<option>[ $i18n.getString( "select" ) ]</option>
+		<option value="">[ $i18n.getString( "select" ) ]</option>
 		<option value="UID">$i18n.getString( "uid" )</option>
 		<option value="CODE">$i18n.getString( "code" )</option>
     </select></td>