← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17442: Data import. Addded UI for JSON data import. Combining all import formats into the same screen.

 

------------------------------------------------------------
revno: 17442
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-11-11 21:22:58 +0100
message:
  Data import. Addded UI for JSON data import. Combining all import formats into the same screen.
modified:
  dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/util/ImportDataValueTask.java
  dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties
  dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/eventImportForm.vm
  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/index.vm
  dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/mainMenu.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/util/ImportDataValueTask.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/util/ImportDataValueTask.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/util/ImportDataValueTask.java	2014-11-11 20:22:58 +0000
@@ -42,8 +42,9 @@
 public class ImportDataValueTask
     implements Runnable
 {
+    public static final String FORMAT_XML = "xml";
+    public static final String FORMAT_JSON = "json";
     public static final String FORMAT_CSV = "csv";
-
     public static final String FORMAT_PDF = "pdf";
 
     private DataValueSetService dataValueSetService;
@@ -73,7 +74,11 @@
     {
         SecurityContextHolder.getContext().setAuthentication( authentication );
 
-        if ( FORMAT_CSV.equals( format ) )
+        if ( FORMAT_JSON.equals( format ) )
+        {
+            dataValueSetService.saveDataValueSetJson( inputStream, options, taskId );
+        }
+        else if ( FORMAT_CSV.equals( format ) )
         {
             dataValueSetService.saveDataValueSetCsv( inputStream, options, taskId );
         }
@@ -81,7 +86,7 @@
         {
             dataValueSetService.saveDataValueSetPdf( inputStream, options, taskId );
         }
-        else
+        else // FORMAT_XML
         {
             dataValueSetService.saveDataValueSet( inputStream, options, taskId );
         }

=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties	2014-11-11 20:00:28 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties	2014-11-11 20:22:58 +0000
@@ -269,7 +269,7 @@
 intro_DHIS14_data_export=Do an export of data values or facts. DHIS 1.4 is the predecessor of DHIS 2.
 intro_pdf_metadata_export=Portable Document Format (PDF) is a commonly used file format for document exchange.
 intro_xls_metadata_export=Excel Spreadsheet (XLS) is a commonly used spreadsheet file format from Microsoft.
-intro_xml_data_import=Import data values on the DXF 2 XML format which is used for data exchange by DHIS 2 and other software.
+intro_data_import=Import data values on the DXF 2 XML, JSON, CSV and PDF formats. DXF 2 is the standard exchange format for DHIS 2.
 intro_csv_data_import=Import data values on the CSV format which is used for data exchange by DHIS 2 and other third-party software.
 intro_pdf_data_import=Import data from a PDF data entry form. PDF forms can be generated from the data set module.
 intro_event_data_import=Import events for programs, stages and persons on the DXF 2 format.
@@ -282,7 +282,7 @@
 intro_event_data_export=Export event data for programs, stages and persons on the DXF 2 format.
 intro_xml_metadata_import=Import meta-data like data elements and organisation units using the standard DHIS 2 exchange format called DXF 2.
 intro_csv_metadata_import=Import meta-data using CSV format. Currently only import of data elements is supported.
-intro_gml_import=Import geographic data for organisation units using GML format.
+intro_gml_import=Import geographic data for organisation units using GML format. GML is an XML grammar for expressing geographical features.
 gml_import_info_text=Note: Only import of GML data for existing organisation units is supported.
 no_item_to_match=There is no selected item to match
 dry_run=Dry run

=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/eventImportForm.vm'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/eventImportForm.vm	2014-11-11 20:00:28 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/eventImportForm.vm	2014-11-11 20:22:58 +0000
@@ -21,13 +21,6 @@
 	<td><input type="file" id="upload" name="upload" style="margin-left:0px"></td>
 </tr>
 <tr>
-	<td>$i18n.getString( "dry_run" )</td>
-	<td><select id="dryRun" name="dryRun" style="width:190px">
-		<option value="false">$i18n.getString( "no" )</option>
-		<option value="true">$i18n.getString( "yes" )</option>
-    </select></td>
-</tr>
-<tr>
     <td>$i18n.getString( "format" )</td>
     <td>
         <select id="payloadFormat" name="payloadFormat" style="width: 190px;">
@@ -37,6 +30,13 @@
         </select>
     </td>
 </tr>
+<tr>
+	<td>$i18n.getString( "dry_run" )</td>
+	<td><select id="dryRun" name="dryRun" style="width:190px">
+		<option value="false">$i18n.getString( "no" )</option>
+		<option value="true">$i18n.getString( "yes" )</option>
+    </select></td>
+</tr>
 <tr id="trSkipFirst" style="display: none;">
     <td>$i18n.getString( "skip_first" )</td>
     <td>

=== 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	2014-09-12 15:26:18 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importDataValue.vm	2014-11-11 20:22:58 +0000
@@ -1,8 +1,8 @@
 
-<h3>$!i18n.getString( $importFormat ) $i18n.getString( "data_import" )</h3>
+<h3>$i18n.getString( "data_import" )</h3>
 
 <div id="inputCriteria" class="inputCriteria" style="width: 380px">
-<form id="importForm" name="importForm" method="post" enctype="multipart/form-data" action="importDataValue.action?importFormat=$!{importFormat}">
+<form id="importForm" name="importForm" method="post" enctype="multipart/form-data" action="importDataValue.action">
 <table>
 <col width="140">
 <col>
@@ -11,6 +11,17 @@
 	<td><input type="file" id="upload" name="upload" style="margin-left:0px"></td>
 </tr>
 <tr>
+    <td>$i18n.getString( "format" )</td>
+    <td>
+        <select id="importFormat" name="importFormat" style="width: 190px;">
+            <option value="xml">XML</option>
+            <option value="json">JSON</option>
+            <option value="csv">CSV</option>
+            <option value="pdf">PDF</option>
+        </select>
+    </td>
+</tr>
+<tr>
 	<td>$i18n.getString( "dry_run" )</td>
 	<td><select id="dryRun" name="dryRun" style="width:190px">
 		<option value="false">$i18n.getString( "no" )</option>

=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/index.vm'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/index.vm	2014-10-09 23:57:47 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/index.vm	2014-11-11 20:22:58 +0000
@@ -3,15 +3,12 @@
 <ul class="introList">
     #introListImgItem( "dxf2MetaDataImport.action?importFormat=xml" "xml_metadata_import" "import" )
     #introListImgItem( "dxf2MetaDataImport.action?importFormat=csv" "csv_metadata_import" "import" )
-    #introListImgItem( "displayImportDataValueForm.action?importFormat=xml" "xml_data_import" "import" )
-    #introListImgItem( "displayImportDataValueForm.action?importFormat=csv" "csv_data_import" "import" )
-    #introListImgItem( "displayImportDataValueForm.action?importFormat=pdf" "pdf_data_import" "import" )
+    #introListImgItem( "displayImportDataValueForm.action" "data_import" "import" )
     #introListImgItem( "displayEventImportForm.action" "event_data_import" "import" )
     #introListImgItem( "gmlImport.action" "gml_import" "import" )
     #introListImgItem( "displayExternalImportMenu.action" "dhis14_import" "import" )
 
     #introListImgItem( "dxf2MetaDataExport.action" "metadata_export" "export" )
-##  @author Ovidiu Rosu <rosu.ovi@xxxxxxxxx>
     #introListImgItem( "dxf2FilteredMetaDataExport.action" "filtered_metadata_export" "export")
     #introListImgItem( "displayDataValueExportForm.action" "data_export" "export" )
     #introListImgItem( "displayEventExportForm.action" "event_data_export" "export" )

=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/mainMenu.vm'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/mainMenu.vm	2014-10-10 11:19:52 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/mainMenu.vm	2014-11-11 20:22:58 +0000
@@ -4,9 +4,7 @@
 <ul>
   <li><a href="dxf2MetaDataImport.action?importFormat=xml">$i18n.getString( "xml_metadata_import" )&nbsp;</a></li>
   <li><a href="dxf2MetaDataImport.action?importFormat=csv">$i18n.getString( "csv_metadata_import" )&nbsp;</a></li>
-  <li><a href="displayImportDataValueForm.action?importFormat=xml">$i18n.getString( "xml_data_import" )&nbsp;</a></li>
-  <li><a href="displayImportDataValueForm.action?importFormat=csv">$i18n.getString( "csv_data_import" )&nbsp;</a></li>
-  <li><a href="displayImportDataValueForm.action?importFormat=pdf">$i18n.getString( "pdf_data_import" )&nbsp;</a></li>
+  <li><a href="displayImportDataValueForm.action?importFormat=xml">$i18n.getString( "data_import" )&nbsp;</a></li>
   <li><a href="gmlImport.action">$i18n.getString( "gml_import" )&nbsp;</a></li>
   <li><a href="displayEventImportForm.action">$i18n.getString( "event_data_import" )&nbsp;</a></li>
   <li><a href="displayExternalImportMenu.action">$i18n.getString( "dhis14_import" )&nbsp;</a></li>