← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1978: Added xslt parameters to sdmx importer

 

------------------------------------------------------------
revno: 1978
committer: Bob Jolliffe bobjolliffe@xxxxxxxxx
branch nick: trunk
timestamp: Wed 2010-06-09 09:01:43 +0100
message:
  Added xslt parameters to sdmx importer
  Made constant strings final
modified:
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/zip/ExcelXImporter.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/zip/SdmxImporter.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/zip/ExcelXImporter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/zip/ExcelXImporter.java	2010-06-04 17:44:41 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/zip/ExcelXImporter.java	2010-06-09 08:01:43 +0000
@@ -51,9 +51,9 @@
 
     private final static Log log = LogFactory.getLog( ExcelXImporter.class );
 
-    private static String WORKBOOK = "xl/workbook.xml";
-    private static String WORKSHEET2 = "xl/worksheets/sheet2.xml";
-    private static String TITLESHEET = "xl/worksheets/sheet1.xml";
+    public static final String WORKBOOK = "xl/workbook.xml";
+    public static final String WORKSHEET2 = "xl/worksheets/sheet2.xml";
+    public static final String TITLESHEET = "xl/worksheets/sheet1.xml";
 
     private static String SHARED_STRINGS = "xl/sharedStrings.xml";
 

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/zip/SdmxImporter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/zip/SdmxImporter.java	2010-06-08 08:14:55 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/zip/SdmxImporter.java	2010-06-09 08:01:43 +0000
@@ -2,6 +2,9 @@
 
 
 import java.io.InputStream;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.zip.ZipEntry;
@@ -49,13 +52,18 @@
     @Autowired
     protected XMLPreConverter preConverter;
 
-
     @Autowired
     protected DXFConverter converter;
 
-    public static String CROSS_SECTIONAL_DATA = "Data_CROSS.xml";
-
-    public static String SDMX_CSD_XSLT_TAG = "SDMX_CSD";
+    public static final String CROSS_SECTIONAL_DATA = "Data_CROSS.xml";
+
+    public static final String SDMX_CSD_XSLT_TAG = "SDMX_CSD";
+
+    public static final String TIMESTAMP = "timestamp";
+
+    public static final String METADATA_PARAM = "dxf_url";
+
+    public static final String METADATA = "metadata/Export.xml";
 
     @Override
     protected String getTransformerTag(ZipFile zipFile) throws Exception
@@ -66,7 +74,13 @@
     @Override
     protected Map<String, String> getXsltParams() throws Exception
     {
-         return new HashMap<String,String>();
+         HashMap<String,String> xsltParams = new HashMap<String,String>();
+         Date now = new Date();
+         DateFormat dfm = new SimpleDateFormat("yyyy-MM-dd");
+         xsltParams.put( TIMESTAMP, dfm.format( now ));
+         xsltParams.put( METADATA_PARAM, METADATA );
+
+         return xsltParams;
     }
 
     @Override
@@ -77,7 +91,6 @@
         InputStream stream = zipFile.getInputStream( entry );
 
         return stream;
-
     }
 
     @Override