← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7507: initial version of dxf2 import ui, needs more polish (but works)

 

------------------------------------------------------------
revno: 7507
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-07-04 22:16:23 +0200
message:
  initial version of dxf2 import ui, needs more polish (but works)
added:
  dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataImportAction.java
  dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/util/ImportMetaDataTask.java
  dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/importMetaData.js
modified:
  dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/StreamUtils.java
  dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/StreamUtilsTest.java
  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/dxf2/MetaDataImportFormAction.java
  dhis-2/dhis-web/dhis-web-importexport/src/main/resources/META-INF/dhis/beans.xml
  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/struts.xml
  dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/dxf2MetaDataImport.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-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java	2012-06-27 15:59:59 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java	2012-07-04 20:16:23 +0000
@@ -82,7 +82,7 @@
     @Override
     public ImportSummary importMetaData( MetaData metaData, TaskId taskId )
     {
-        return importMetaData( metaData, ImportOptions.getDefaultImportOptions(), null );
+        return importMetaData( metaData, ImportOptions.getDefaultImportOptions(), taskId );
     }
 
     @Override
@@ -129,8 +129,6 @@
                     {
                         String message = "Importing " + objects.size() + " " + StringUtils.capitalize( entry.getValue() );
 
-                        log.info( message );
-
                         if(taskId != null)
                         {
                             notifier.notify( taskId, TaskCategory.METADATA_IMPORT, message );
@@ -164,8 +162,6 @@
         cacheManager.clearCache();
         objectBridge.destroy();
 
-        log.info( "Import done at " + new Date() );
-
         if(taskId != null)
         {
             notifier.notify( taskId, TaskCategory.METADATA_IMPORT, NotificationLevel.INFO, "Import done", true ).

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/StreamUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/StreamUtils.java	2012-04-18 13:51:28 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/StreamUtils.java	2012-07-04 20:16:23 +0000
@@ -49,6 +49,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.zip.GZIPInputStream;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 import java.util.zip.ZipOutputStream;
@@ -398,13 +399,13 @@
     }
 
     /**
-     * Test for ZIP stream signature. Wraps the input stream in a
-     * BufferedInputStream. If ZIP test is true wraps again in ZipInputStream.
+     * Test for ZIP/GZIP stream signature. Wraps the input stream in a
+     * BufferedInputStream. If ZIP/GZIP test is true wraps again in ZipInputStream/GZIPInputStream.
      * 
      * @param in the InputStream.
      * @return the wrapped InputStream.
      */
-    public static InputStream wrapAndCheckZip( InputStream in )
+    public static InputStream wrapAndCheckCompressionFormat( InputStream in )
         throws IOException
     {
         BufferedInputStream bufferedIn = new BufferedInputStream( in );
@@ -415,6 +416,11 @@
             zipIn.getNextEntry();
             return zipIn;
         }
+        else if( isGZip( bufferedIn ) )
+        {
+            GZIPInputStream gzipIn = new GZIPInputStream( bufferedIn );
+            return gzipIn;
+        }
         
         return bufferedIn;
     }
@@ -548,7 +554,7 @@
     /**
      * Attempts to delete the File with the given path.
      * 
-     * @param file the File path.
+     * @param path the File path.
      * @return true if the operation succeeded, false otherwise.
      */
     public static boolean delete( String path )

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/StreamUtilsTest.java'
--- dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/StreamUtilsTest.java	2012-04-18 13:51:28 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/StreamUtilsTest.java	2012-07-04 20:16:23 +0000
@@ -97,7 +97,7 @@
     public void testWrapAndCheckZip()
         throws Exception
     {
-        Reader reader = new InputStreamReader( StreamUtils.wrapAndCheckZip( zipStream ) );
+        Reader reader = new InputStreamReader( StreamUtils.wrapAndCheckCompressionFormat( zipStream ) );
         
         assertEquals( '<', reader.read() );
         assertEquals( '?', reader.read() );

=== 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	2012-05-07 14:57:43 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ImportDataValueAction.java	2012-07-04 20:16:23 +0000
@@ -140,7 +140,7 @@
         
         InputStream in = new FileInputStream( upload );
         
-        in = StreamUtils.wrapAndCheckZip( in );
+        in = StreamUtils.wrapAndCheckCompressionFormat( in );
         
         Reader reader = FORMAT_CSV.equals( importFormat ) ? new BufferedReader( new InputStreamReader( in ) ) : null;
 

=== added file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataImportAction.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataImportAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataImportAction.java	2012-07-04 20:16:23 +0000
@@ -0,0 +1,116 @@
+package org.hisp.dhis.importexport.action.dxf2;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import com.opensymphony.xwork2.Action;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hisp.dhis.dxf2.metadata.ImportOptions;
+import org.hisp.dhis.dxf2.metadata.ImportService;
+import org.hisp.dhis.importexport.ImportStrategy;
+import org.hisp.dhis.importexport.action.util.ImportMetaDataTask;
+import org.hisp.dhis.scheduling.TaskCategory;
+import org.hisp.dhis.scheduling.TaskId;
+import org.hisp.dhis.system.scheduling.Scheduler;
+import org.hisp.dhis.system.util.StreamUtils;
+import org.hisp.dhis.user.CurrentUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class MetaDataImportAction
+    implements Action
+{
+    private static final Log log = LogFactory.getLog( MetaDataImportAction.class );
+
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    @Autowired
+    private ImportService importService;
+
+    @Autowired
+    private CurrentUserService currentUserService;
+
+    @Autowired
+    private Scheduler scheduler;
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    private File upload;
+
+    public void setUpload( File upload )
+    {
+        this.upload = upload;
+    }
+
+    private boolean dryRun;
+
+    public void setDryRun( boolean dryRun )
+    {
+        this.dryRun = dryRun;
+    }
+
+    private ImportStrategy strategy;
+
+    public void setStrategy( String strategy )
+    {
+        this.strategy = ImportStrategy.valueOf( strategy );
+    }
+
+    // -------------------------------------------------------------------------
+    // Action Implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute() throws Exception
+    {
+        strategy = strategy != null ? strategy : ImportStrategy.NEW_AND_UPDATES;
+
+        InputStream in = new FileInputStream( upload );
+        in = StreamUtils.wrapAndCheckCompressionFormat( in );
+
+        TaskId taskId = new TaskId( TaskCategory.METADATA_IMPORT, currentUserService.getCurrentUser() );
+
+        ImportOptions importOptions = new ImportOptions();
+        importOptions.setStrategy( strategy.toString() );
+        importOptions.setDryRun( dryRun );
+
+        scheduler.executeTask( new ImportMetaDataTask( importService, importOptions, in, taskId ) );
+
+        return SUCCESS;
+    }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataImportFormAction.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataImportFormAction.java	2012-06-06 17:55:16 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataImportFormAction.java	2012-07-04 20:16:23 +0000
@@ -35,6 +35,17 @@
 public class MetaDataImportFormAction
     implements Action
 {
+    private boolean running;
+
+    public boolean isRunning()
+    {
+        return running;
+    }
+    public void setRunning( boolean running )
+    {
+        this.running = running;
+    }
+
     @Override
     public String execute() throws Exception
     {

=== added file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/util/ImportMetaDataTask.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/util/ImportMetaDataTask.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/util/ImportMetaDataTask.java	2012-07-04 20:16:23 +0000
@@ -0,0 +1,82 @@
+package org.hisp.dhis.importexport.action.util;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hisp.dhis.dxf2.metadata.ImportOptions;
+import org.hisp.dhis.dxf2.metadata.ImportService;
+import org.hisp.dhis.dxf2.metadata.MetaData;
+import org.hisp.dhis.dxf2.utils.JacksonUtils;
+import org.hisp.dhis.scheduling.TaskId;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class ImportMetaDataTask
+    implements Runnable
+{
+    private static final Log log = LogFactory.getLog( ImportMetaDataTask.class );
+
+    private ImportService importService;
+
+    private ImportOptions importOptions;
+
+    private InputStream inputStream;
+
+    private TaskId taskId;
+
+    public ImportMetaDataTask( ImportService importService, ImportOptions importOptions, InputStream inputStream, TaskId taskId )
+    {
+        this.importService = importService;
+        this.importOptions = importOptions;
+        this.inputStream = inputStream;
+        this.taskId = taskId;
+    }
+
+    @Override
+    public void run()
+    {
+        MetaData metaData = null;
+
+        try
+        {
+            // TODO check for XML/JSON
+            metaData = JacksonUtils.fromXml( inputStream, MetaData.class );
+        } catch ( IOException e )
+        {
+            log.error( "(IOException) Unable to parse meta-data while reading input stream" );
+            return;
+        }
+
+        importService.importMetaData( metaData, importOptions, taskId );
+    }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/resources/META-INF/dhis/beans.xml	2012-06-06 17:55:16 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/resources/META-INF/dhis/beans.xml	2012-07-04 20:16:23 +0000
@@ -1,89 +1,104 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-  xsi:schemaLocation="
+    xsi:schemaLocation="
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd";>
 
   <!-- Data value import -->
 
-  <bean id="org.hisp.dhis.importexport.action.datavalue.ImportDataValueAction" class="org.hisp.dhis.importexport.action.datavalue.ImportDataValueAction"/>
+  <bean id="org.hisp.dhis.importexport.action.datavalue.ImportDataValueAction"
+      class="org.hisp.dhis.importexport.action.datavalue.ImportDataValueAction" />
 
-  <bean id="org.hisp.dhis.importexport.action.GetImportSummaryAction" class="org.hisp.dhis.importexport.action.GetImportSummaryAction">
-	<property name="category" value="DATAVALUE_IMPORT" />
+  <bean id="org.hisp.dhis.importexport.action.GetImportSummaryAction"
+      class="org.hisp.dhis.importexport.action.GetImportSummaryAction">
+    <property name="category" value="DATAVALUE_IMPORT" />
   </bean>
 
   <!-- Data value export -->
-  
-  <bean id="org.hisp.dhis.importexport.action.datavalue.ExportDataValueAction" class="org.hisp.dhis.importexport.action.datavalue.ExportDataValueAction"/>
+
+  <bean id="org.hisp.dhis.importexport.action.datavalue.ExportDataValueAction"
+      class="org.hisp.dhis.importexport.action.datavalue.ExportDataValueAction" />
 
   <!-- Import -->
 
-  <bean id="org.hisp.dhis.importexport.action.imp.ImportAction" class="org.hisp.dhis.importexport.action.imp.ImportAction"
-    scope="prototype">
+  <bean id="org.hisp.dhis.importexport.action.imp.ImportAction"
+      class="org.hisp.dhis.importexport.action.imp.ImportAction"
+      scope="prototype">
     <property name="processCoordinator" ref="processCoordinator" />
     <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
     <property name="configurationManager" ref="org.hisp.dhis.importexport.IbatisConfigurationManager" />
   </bean>
 
-  <bean id="org.hisp.dhis.importexport.action.imp.GetImportOptionsAction" class="org.hisp.dhis.importexport.action.imp.GetImportOptionsAction"
-    scope="prototype">
+  <bean id="org.hisp.dhis.importexport.action.imp.GetImportOptionsAction"
+      class="org.hisp.dhis.importexport.action.imp.GetImportOptionsAction"
+      scope="prototype">
     <property name="configurationManager" ref="org.hisp.dhis.importexport.IbatisConfigurationManager" />
   </bean>
 
-  <bean id="org.hisp.dhis.importexport.action.imp.GetImportStatusAction" class="org.hisp.dhis.importexport.action.imp.GetImportStatusAction"
-    scope="prototype">
+  <bean id="org.hisp.dhis.importexport.action.imp.GetImportStatusAction"
+      class="org.hisp.dhis.importexport.action.imp.GetImportStatusAction"
+      scope="prototype">
     <property name="processCoordinator" ref="processCoordinator" />
   </bean>
 
-  <bean id="org.hisp.dhis.importexport.action.imp.SetImportTypeAction" class="org.hisp.dhis.importexport.action.imp.SetImportTypeAction"
-    scope="prototype">
+  <bean id="org.hisp.dhis.importexport.action.imp.SetImportTypeAction"
+      class="org.hisp.dhis.importexport.action.imp.SetImportTypeAction"
+      scope="prototype">
     <property name="configurationManager" ref="org.hisp.dhis.importexport.IbatisConfigurationManager" />
   </bean>
 
-  <bean id="org.hisp.dhis.importexport.action.imp.GetImportAnalysisAction" class="org.hisp.dhis.importexport.action.imp.GetImportAnalysisAction"
-    scope="prototype">
+  <bean id="org.hisp.dhis.importexport.action.imp.GetImportAnalysisAction"
+      class="org.hisp.dhis.importexport.action.imp.GetImportAnalysisAction"
+      scope="prototype">
     <property name="processCoordinator" ref="processCoordinator" />
   </bean>
 
   <!-- Object Ajax -->
 
-  <bean id="org.hisp.dhis.importexport.action.object.MatchObjectAction" class="org.hisp.dhis.importexport.action.object.MatchObjectAction"
-    scope="prototype">
-    <property name="importObjectService" ref="org.hisp.dhis.importexport.ImportObjectService" />
-    <property name="configurationManager" ref="org.hisp.dhis.importexport.IbatisConfigurationManager" />
-  </bean>
-
-  <bean id="org.hisp.dhis.importexport.action.object.DiscardObjectAction" class="org.hisp.dhis.importexport.action.object.DiscardObjectAction"
-    scope="prototype">
-    <property name="importObjectService" ref="org.hisp.dhis.importexport.ImportObjectService" />
-    <property name="configurationManager" ref="org.hisp.dhis.importexport.IbatisConfigurationManager" />
-  </bean>
-
-  <bean id="org.hisp.dhis.importexport.action.object.DiscardObjectsOfTypeAction" class="org.hisp.dhis.importexport.action.object.DiscardObjectsOfTypeAction"
-    scope="prototype">
-    <property name="importObjectService" ref="org.hisp.dhis.importexport.ImportObjectService" />
-  </bean>
-
-  <bean id="org.hisp.dhis.importexport.action.object.DiscardAllObjectsAction" class="org.hisp.dhis.importexport.action.object.DiscardAllObjectsAction"
-    scope="prototype">
-    <property name="importObjectService" ref="org.hisp.dhis.importexport.ImportObjectService" />
-  </bean>
-
-  <bean id="org.hisp.dhis.importexport.action.object.ImportAllObjectsAction" class="org.hisp.dhis.importexport.action.object.ImportAllObjectsAction"
-    scope="prototype">
+  <bean id="org.hisp.dhis.importexport.action.object.MatchObjectAction"
+      class="org.hisp.dhis.importexport.action.object.MatchObjectAction"
+      scope="prototype">
+    <property name="importObjectService" ref="org.hisp.dhis.importexport.ImportObjectService" />
+    <property name="configurationManager" ref="org.hisp.dhis.importexport.IbatisConfigurationManager" />
+  </bean>
+
+  <bean id="org.hisp.dhis.importexport.action.object.DiscardObjectAction"
+      class="org.hisp.dhis.importexport.action.object.DiscardObjectAction"
+      scope="prototype">
+    <property name="importObjectService" ref="org.hisp.dhis.importexport.ImportObjectService" />
+    <property name="configurationManager" ref="org.hisp.dhis.importexport.IbatisConfigurationManager" />
+  </bean>
+
+  <bean id="org.hisp.dhis.importexport.action.object.DiscardObjectsOfTypeAction"
+      class="org.hisp.dhis.importexport.action.object.DiscardObjectsOfTypeAction"
+      scope="prototype">
+    <property name="importObjectService" ref="org.hisp.dhis.importexport.ImportObjectService" />
+  </bean>
+
+  <bean id="org.hisp.dhis.importexport.action.object.DiscardAllObjectsAction"
+      class="org.hisp.dhis.importexport.action.object.DiscardAllObjectsAction"
+      scope="prototype">
+    <property name="importObjectService" ref="org.hisp.dhis.importexport.ImportObjectService" />
+  </bean>
+
+  <bean id="org.hisp.dhis.importexport.action.object.ImportAllObjectsAction"
+      class="org.hisp.dhis.importexport.action.object.ImportAllObjectsAction"
+      scope="prototype">
     <property name="processCoordinator" ref="processCoordinator" />
     <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
   </bean>
 
   <!-- Preview -->
 
-  <bean id="org.hisp.dhis.importexport.action.imp.GetPreviewOptionsAction" class="org.hisp.dhis.importexport.action.imp.GetPreviewOptionsAction"
-    scope="prototype">
+  <bean id="org.hisp.dhis.importexport.action.imp.GetPreviewOptionsAction"
+      class="org.hisp.dhis.importexport.action.imp.GetPreviewOptionsAction"
+      scope="prototype">
     <property name="importObjectService" ref="org.hisp.dhis.importexport.ImportObjectService" />
     <property name="importDataValueService" ref="org.hisp.dhis.importexport.ImportDataValueService" />
   </bean>
 
-  <bean id="org.hisp.dhis.importexport.action.imp.GetMatchOptionsAction" class="org.hisp.dhis.importexport.action.imp.GetMatchOptionsAction"
-    scope="prototype">
+  <bean id="org.hisp.dhis.importexport.action.imp.GetMatchOptionsAction"
+      class="org.hisp.dhis.importexport.action.imp.GetMatchOptionsAction"
+      scope="prototype">
     <property name="importObjectService" ref="org.hisp.dhis.importexport.ImportObjectService" />
     <property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
     <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
@@ -98,21 +113,24 @@
     <property name="chartService" ref="org.hisp.dhis.chart.ChartService" />
   </bean>
 
-  <bean id="org.hisp.dhis.importexport.action.imp.GetCompareOptionsAction" class="org.hisp.dhis.importexport.action.imp.GetCompareOptionsAction"
-    scope="prototype">
+  <bean id="org.hisp.dhis.importexport.action.imp.GetCompareOptionsAction"
+      class="org.hisp.dhis.importexport.action.imp.GetCompareOptionsAction"
+      scope="prototype">
     <property name="importObjectService" ref="org.hisp.dhis.importexport.ImportObjectService" />
   </bean>
 
   <!-- Export -->
 
-  <bean id="org.hisp.dhis.importexport.action.exp.MetaDataExportAction" class="org.hisp.dhis.importexport.action.exp.MetaDataExportAction"
-    scope="prototype">
+  <bean id="org.hisp.dhis.importexport.action.exp.MetaDataExportAction"
+      class="org.hisp.dhis.importexport.action.exp.MetaDataExportAction"
+      scope="prototype">
     <property name="serviceProvider" ref="exportServiceProvider" />
     <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
   </bean>
 
-  <bean id="org.hisp.dhis.importexport.action.exp.DetailedMetaDataExportAction" class="org.hisp.dhis.importexport.action.exp.DetailedMetaDataExportAction"
-    scope="prototype">
+  <bean id="org.hisp.dhis.importexport.action.exp.DetailedMetaDataExportAction"
+      class="org.hisp.dhis.importexport.action.exp.DetailedMetaDataExportAction"
+      scope="prototype">
     <property name="serviceProvider" ref="exportServiceProvider" />
     <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
     <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
@@ -121,55 +139,71 @@
     <property name="importObjectService" ref="org.hisp.dhis.importexport.ImportObjectService" />
   </bean>
 
-  <bean id="org.hisp.dhis.importexport.action.exp.GetDetailedExportOptionsAction" class="org.hisp.dhis.importexport.action.exp.GetDetailedExportOptionsAction"
-    scope="prototype">
+  <bean id="org.hisp.dhis.importexport.action.exp.GetDetailedExportOptionsAction"
+      class="org.hisp.dhis.importexport.action.exp.GetDetailedExportOptionsAction"
+      scope="prototype">
   </bean>
 
-  <bean id="org.hisp.dhis.importexport.action.exp.GetDataElementListAction" class="org.hisp.dhis.importexport.action.exp.GetDataElementListAction"
-    scope="prototype">
+  <bean id="org.hisp.dhis.importexport.action.exp.GetDataElementListAction"
+      class="org.hisp.dhis.importexport.action.exp.GetDataElementListAction"
+      scope="prototype">
     <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
     <property name="dataDictionaryService" ref="org.hisp.dhis.datadictionary.DataDictionaryService" />
   </bean>
 
-  <bean id="org.hisp.dhis.importexport.action.exp.GetIndicatorListAction" class="org.hisp.dhis.importexport.action.exp.GetIndicatorListAction"
-    scope="prototype">
+  <bean id="org.hisp.dhis.importexport.action.exp.GetIndicatorListAction"
+      class="org.hisp.dhis.importexport.action.exp.GetIndicatorListAction"
+      scope="prototype">
     <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
     <property name="dataDictionaryService" ref="org.hisp.dhis.datadictionary.DataDictionaryService" />
   </bean>
 
-  <bean id="org.hisp.dhis.importexport.action.exp.ValidateAggregatedExportAction" class="org.hisp.dhis.importexport.action.exp.ValidateAggregatedExportAction"
-    scope="prototype">
+  <bean id="org.hisp.dhis.importexport.action.exp.ValidateAggregatedExportAction"
+      class="org.hisp.dhis.importexport.action.exp.ValidateAggregatedExportAction"
+      scope="prototype">
     <property name="dataIntegrityService" ref="org.hisp.dhis.dataintegrity.DataIntegrityService" />
   </bean>
 
   <!-- Dhis 1.4 Configuration -->
 
-  <bean id="org.hisp.dhis.importexport.action.dhis14.GetDhis14ConfigurationAction" class="org.hisp.dhis.importexport.action.dhis14.GetDhis14ConfigurationAction"
-    scope="prototype">
-    <property name="configurationManager" ref="org.hisp.dhis.importexport.IbatisConfigurationManager" />
-  </bean>
-
-  <bean id="org.hisp.dhis.importexport.action.dhis14.SetDhis14ConfigurationAction" class="org.hisp.dhis.importexport.action.dhis14.SetDhis14ConfigurationAction"
-    scope="prototype">
-    <property name="configurationManager" ref="org.hisp.dhis.importexport.IbatisConfigurationManager" />
-  </bean>
-
-  <bean id="org.hisp.dhis.importexport.action.dhis14.ValidateDhis14ConfigurationAction" class="org.hisp.dhis.importexport.action.dhis14.ValidateDhis14ConfigurationAction"
-    scope="prototype">
-    <property name="configurationManager" ref="org.hisp.dhis.importexport.IbatisConfigurationManager" />
-  </bean>
-
-  <bean id="org.hisp.dhis.importexport.action.integration.DisplayRoutesAction" class="org.hisp.dhis.importexport.action.integration.DisplayRoutesAction">
-    <property name="builtinCamelContext" ref="camel-builtin"/>    
-  </bean>
-
-  <bean id="org.hisp.dhis.importexport.action.integration.AddRouteAction" class="org.hisp.dhis.importexport.action.integration.AddRouteAction">
-    <property name="builtinCamelContext" ref="camel-builtin"/>    
+  <bean id="org.hisp.dhis.importexport.action.dhis14.GetDhis14ConfigurationAction"
+      class="org.hisp.dhis.importexport.action.dhis14.GetDhis14ConfigurationAction"
+      scope="prototype">
+    <property name="configurationManager" ref="org.hisp.dhis.importexport.IbatisConfigurationManager" />
+  </bean>
+
+  <bean id="org.hisp.dhis.importexport.action.dhis14.SetDhis14ConfigurationAction"
+      class="org.hisp.dhis.importexport.action.dhis14.SetDhis14ConfigurationAction"
+      scope="prototype">
+    <property name="configurationManager" ref="org.hisp.dhis.importexport.IbatisConfigurationManager" />
+  </bean>
+
+  <bean id="org.hisp.dhis.importexport.action.dhis14.ValidateDhis14ConfigurationAction"
+      class="org.hisp.dhis.importexport.action.dhis14.ValidateDhis14ConfigurationAction"
+      scope="prototype">
+    <property name="configurationManager" ref="org.hisp.dhis.importexport.IbatisConfigurationManager" />
+  </bean>
+
+  <bean id="org.hisp.dhis.importexport.action.integration.DisplayRoutesAction"
+      class="org.hisp.dhis.importexport.action.integration.DisplayRoutesAction">
+    <property name="builtinCamelContext" ref="camel-builtin" />
+  </bean>
+
+  <bean id="org.hisp.dhis.importexport.action.integration.AddRouteAction"
+      class="org.hisp.dhis.importexport.action.integration.AddRouteAction">
+    <property name="builtinCamelContext" ref="camel-builtin" />
   </bean>
 
   <!-- DXF2 MetaData import/export -->
 
-  <bean id="org.hisp.dhis.importexport.action.dxf2.MetaDataImportFormAction" class="org.hisp.dhis.importexport.action.dxf2.MetaDataImportFormAction" />
-  <bean id="org.hisp.dhis.importexport.action.dxf2.MetaDataExportFormAction" class="org.hisp.dhis.importexport.action.dxf2.MetaDataExportFormAction" />
+  <bean id="org.hisp.dhis.importexport.action.dxf2.MetaDataImportFormAction"
+      class="org.hisp.dhis.importexport.action.dxf2.MetaDataImportFormAction" scope="prototype" />
+  <bean id="org.hisp.dhis.importexport.action.dxf2.MetaDataExportFormAction"
+      class="org.hisp.dhis.importexport.action.dxf2.MetaDataExportFormAction" scope="prototype" />
+
+  <bean id="org.hisp.dhis.importexport.action.GetMetaDataImportSummaryAction"
+      class="org.hisp.dhis.importexport.action.GetImportSummaryAction" scope="prototype">
+    <property name="category" value="METADATA_IMPORT" />
+  </bean>
 
 </beans>

=== 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	2012-06-06 11:36:25 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties	2012-07-04 20:16:23 +0000
@@ -276,6 +276,7 @@
 new_only=New only
 updates_only=Updates only
 data_import=Data Import
+meta_data_import=Meta-Data Import
 import_summary=Import summary
 data_set_completed_on=Data set completed on
 import_count=Import count

=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/resources/struts.xml	2012-06-06 17:55:16 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/resources/struts.xml	2012-07-04 20:16:23 +0000
@@ -253,7 +253,7 @@
       <result name="success" type="velocity">/main.vm</result>
       <param name="menu">/dhis-web-importexport/mainMenu.vm</param>
       <param name="page">/dhis-web-importexport/dxf2MetaDataImport.vm</param>
-      <param name="javascripts" />
+      <param name="javascripts">javascript/importMetaData.js</param>
     </action>
 
     <action name="dxf2MetaDataExport" class="org.hisp.dhis.importexport.action.dxf2.MetaDataExportFormAction">
@@ -263,6 +263,16 @@
       <param name="javascripts" />
     </action>
 
+    <action name="importMetaData" class="org.hisp.dhis.importexport.action.dxf2.MetaDataImportAction">
+      <result name="success" type="redirect">dxf2MetaDataImport.action?running=true</result>
+      <interceptor-ref name="fileUploadStack" />
+    </action>
+
+    <action name="getMetaDataImportSummary" class="org.hisp.dhis.importexport.action.GetMetaDataImportSummaryAction">
+      <result name="success" type="velocity">/dhis-web-importexport/importSummary.vm</result>
+      <param name="onExceptionReturn">plainTextError</param>
+    </action>
+
   </package>
 
 </struts>

=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/dxf2MetaDataImport.vm'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/dxf2MetaDataImport.vm	2012-06-06 11:36:25 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/dxf2MetaDataImport.vm	2012-07-04 20:16:23 +0000
@@ -1,1 +1,54 @@
-Import is WIP!
+
+<h3>$i18n.getString( "meta_data_import" )</h3>
+
+<div id="inputCriteria" class="inputCriteria" style="height:144px">
+<form id="importForm" name="importForm" method="post" enctype="multipart/form-data" action="importMetaData.action">
+<table>
+<col width="140">
+<col>
+<tr>
+	<td>$i18n.getString( "file" )</td>
+	<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( "strategy" )</td>
+	<td><select id="strategy" name="strategy" style="width:190px">
+		<option value="NEW_AND_UPDATES">$i18n.getString( "new_and_updates" )</option>
+		<option value="NEW">$i18n.getString( "new_only" )</option>
+		<option value="UPDATES">$i18n.getString( "updates_only" )</option>
+    </select></td>
+</tr>
+<tr>
+	<td></td>
+	<td><input type="button" value="$i18n.getString( 'import' )" style="width:120px" onclick="importMetaData()"/></td>
+</tr>
+</table>
+</form>
+</div>
+
+#if( $running )
+
+<div id="notificationDiv">
+<table id="notificationTable" class="notificationTable" style="width:422px">
+<col width="120">
+<col width="380">
+</table>
+</div>
+
+<script type="text/javascript">
+$( document ).ready( function() {
+	$( "#notificationTable" ).empty();
+	pingNotificationsTimeout();
+} );
+</script>
+
+#end
+
+<div id="importSummaryDiv" class="page formSection" style="display:none; width:400px; padding-bottom:20px;"></div>
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/importMetaData.js'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/importMetaData.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/importMetaData.js	2012-07-04 20:16:23 +0000
@@ -0,0 +1,32 @@
+
+var pingTimeout = null;
+
+function importMetaData()
+{
+	if ( !$( "#upload" ).val() )
+	{
+		setHeaderDelayMessage( "Please select a file to upload" );
+		return false;
+	}
+	
+	$( "#importForm" ).submit();
+}
+
+function pingNotificationsTimeout()
+{
+	pingNotifications( 'METADATA_IMPORT', 'notificationTable', displaySummaryLink );
+	pingTimeout = setTimeout( "pingNotificationsTimeout()", 1500 );
+}
+
+function displaySummaryLink()
+{
+	window.clearTimeout( pingTimeout );
+	var html = '<tr><td></td><td><a href="javascript:displaySummary()">Display import summary</a></td></tr>';
+	$( '#notificationTable' ).prepend( html );
+}
+
+function displaySummary()
+{	
+	$( '#notificationDiv' ).hide();
+	$( '#importSummaryDiv' ).show( 'fast' ).load( 'getMetaDataImportSummary.action' );
+}
\ No newline at end of file