← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21325: NPE check in data export action for id schemes

 

------------------------------------------------------------
revno: 21325
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-12-04 11:58:54 +0100
message:
  NPE check in data export action for id schemes
modified:
  dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ExportDataValueAction.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-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ExportDataValueAction.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ExportDataValueAction.java	2015-12-04 05:41:43 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ExportDataValueAction.java	2015-12-04 10:58:54 +0000
@@ -1,9 +1,10 @@
 package org.hisp.dhis.importexport.action.datavalue;
 
 import com.opensymphony.xwork2.Action;
+
+import org.apache.commons.lang.StringUtils;
 import org.apache.struts2.ServletActionContext;
 import org.hisp.dhis.common.IdentifiableObjectUtils;
-import org.hisp.dhis.common.IdentifiableProperty;
 import org.hisp.dhis.common.IdSchemes;
 import org.hisp.dhis.dxf2.datavalueset.DataExportParams;
 import org.hisp.dhis.dxf2.datavalueset.DataValueSetService;
@@ -103,23 +104,23 @@
         this.exportFormat = exportFormat;
     }
 
-    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;
     }
 
-    private IdentifiableProperty categoryOptionComboIdScheme;
+    private String categoryOptionComboIdScheme;
 
-    public void setCategoryOptionComboIdScheme( IdentifiableProperty categoryOptionComboIdScheme )
+    public void setCategoryOptionComboIdScheme( String categoryOptionComboIdScheme )
     {
         this.categoryOptionComboIdScheme = categoryOptionComboIdScheme;
     }
@@ -135,9 +136,9 @@
         //TODO re-implement using Web API
 
         IdSchemes idSchemes = new IdSchemes();
-        idSchemes.setDataElementIdScheme( dataElementIdScheme.toString() );
-        idSchemes.setOrgUnitIdScheme( orgUnitIdScheme.toString() );
-        idSchemes.setCategoryOptionComboIdScheme( categoryOptionComboIdScheme.toString() );
+        idSchemes.setDataElementIdScheme( StringUtils.trimToNull( dataElementIdScheme ) );
+        idSchemes.setOrgUnitIdScheme( StringUtils.trimToNull( orgUnitIdScheme ) );
+        idSchemes.setCategoryOptionComboIdScheme( StringUtils.trimToNull( categoryOptionComboIdScheme ) );
 
         Set<String> orgUnits = new HashSet<>( IdentifiableObjectUtils.getUids( selectionTreeManager.getSelectedOrganisationUnits() ) );