← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3845: local vn - Removed type="chain" DONE.

 

------------------------------------------------------------
revno: 3845
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-06-07 12:41:55 +0700
message:
  local vn - Removed type="chain" DONE.
removed:
  local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataCategoryExcelGroupAction.java
  local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataExcelOrganizationGroupAction.java
  local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataNormalExcelGroupAction.java
added:
  local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/ImportDataGeneric.java
  local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataCategoryAction.java
  local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataNormalAction.java
  local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataOrganizationGroupAction.java
  local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importitem/action/ShowUpdateImportItemFormAction.java
  local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importreport/action/ShowUpdateImportReportFormAction.java
  local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/jchart/action/PrepareDataForAddOrUpdateJChartAction.java
modified:
  local/vn/dhis-service-excel-reporting/src/main/resources/META-INF/dhis/beans.xml
  local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exporting/GenerateExcelReportGeneric.java
  local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/filemanager/action/ExcelTemplateListAction.java
  local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataFlowAction.java
  local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ViewDataCategoryAction.java
  local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ViewDataFlowAction.java
  local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ViewDataNormalAction.java
  local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ViewDataOrganizationGroupAction.java
  local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importreport/action/GetImportReportByIdAction.java
  local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/jchart/action/GetJChartAction.java
  local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/preview/action/ExportXMLAction.java
  local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/state/DefaultSelectionManager.java
  local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/state/SelectionManager.java
  local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/FileUtils.java
  local/vn/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml
  local/vn/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties
  local/vn/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties
  local/vn/dhis-web-excel-reporting/src/main/resources/struts.xml
  local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/importDataParams.vm
  local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/imports.js
  local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/responseExportReportPreview.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 'local/vn/dhis-service-excel-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- local/vn/dhis-service-excel-reporting/src/main/resources/META-INF/dhis/beans.xml	2011-05-26 05:00:59 +0000
+++ local/vn/dhis-service-excel-reporting/src/main/resources/META-INF/dhis/beans.xml	2011-06-07 05:41:55 +0000
@@ -34,8 +34,7 @@
 			ref="org.hisp.dhis.reportexcel.importitem.ImportItemStore" />
 		<property name="i18nService" ref="org.hisp.dhis.i18n.I18nService" />
 	</bean>
-
-
+	
 	<!-- DeletionHandlers -->
 
 	<bean id="org.hisp.dhis.reportexcel.ExportReportDeletionHandler"

=== modified file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exporting/GenerateExcelReportGeneric.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exporting/GenerateExcelReportGeneric.java	2011-05-24 07:48:23 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exporting/GenerateExcelReportGeneric.java	2011-06-07 05:41:55 +0000
@@ -125,8 +125,6 @@
     // Input & Output
     // -------------------------------------------------------------------------
 
-    protected String outputXLS;
-
     protected InputStream inputStream;
 
     // -------------------------------------------------------------------------
@@ -203,11 +201,6 @@
     // Getter & Setter
     // -------------------------------------------------------------------------
 
-    public String getOutputXLS()
-    {
-        return outputXLS;
-    }
-
     /**
      * @param i18n the i18n to set
      */

=== modified file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/filemanager/action/ExcelTemplateListAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/filemanager/action/ExcelTemplateListAction.java	2011-05-24 07:48:23 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/filemanager/action/ExcelTemplateListAction.java	2011-06-07 05:41:55 +0000
@@ -87,20 +87,34 @@
 
     private String mode;
 
+    private Integer id;
+
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
 
+    private ReportExcel exportReport;
+
     private String newFileUploadedOrRenamed;
 
+    private List<String> reportTypes = new ArrayList<String>();
+
     private Map<String, Boolean> mapTemplateFiles = new HashMap<String, Boolean>();
 
-    private List<String> reportTypes = new ArrayList<String>();
-
     // -------------------------------------------------------------------------
     // Getter && Setter
     // -------------------------------------------------------------------------
 
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    public ReportExcel getExportReport()
+    {
+        return exportReport;
+    }
+
     public Map<String, Boolean> getMapTemplateFiles()
     {
         return mapTemplateFiles;
@@ -149,6 +163,17 @@
     public String execute()
         throws Exception
     {
+        if ( id != null )
+        {
+            selectionManager.setSelectedReportId( id );
+
+            exportReport = exportReportService.getExportReport( id );
+        }
+        else
+        {
+            return ERROR;
+        }
+        
         File templateDirectory = reportLocationManager.getReportExcelTemplateDirectory();
 
         if ( templateDirectory == null || !templateDirectory.exists() )

=== added file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/ImportDataGeneric.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/ImportDataGeneric.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/ImportDataGeneric.java	2011-06-07 05:41:55 +0000
@@ -0,0 +1,171 @@
+package org.hisp.dhis.reportexcel.importing;
+
+/*
+ * Copyright (c) 2004-2011, 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 java.io.FileInputStream;
+
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.datavalue.DataValueService;
+import org.hisp.dhis.expression.ExpressionService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.reportexcel.action.ActionSupport;
+import org.hisp.dhis.reportexcel.importitem.ImportItemService;
+import org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager;
+import org.hisp.dhis.reportexcel.state.SelectionManager;
+import org.hisp.dhis.user.CurrentUserService;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+
+public abstract class ImportDataGeneric
+    extends ActionSupport
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    protected CurrentUserService currentUserService;
+
+    public void setCurrentUserService( CurrentUserService currentUserService )
+    {
+        this.currentUserService = currentUserService;
+    }
+
+    protected DataElementService dataElementService;
+
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
+
+    protected DataElementCategoryService categoryService;
+
+    public void setCategoryService( DataElementCategoryService categoryService )
+    {
+        this.categoryService = categoryService;
+    }
+
+    protected DataValueService dataValueService;
+
+    public void setDataValueService( DataValueService dataValueService )
+    {
+        this.dataValueService = dataValueService;
+    }
+
+    protected ExpressionService expressionService;
+
+    public void setExpressionService( ExpressionService expressionService )
+    {
+        this.expressionService = expressionService;
+    }
+
+    protected ImportItemService importItemService;
+
+    public void setImportItemService( ImportItemService importItemService )
+    {
+        this.importItemService = importItemService;
+    }
+
+    protected OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
+    protected OrganisationUnitSelectionManager organisationUnitSelectionManager;
+
+    public void setOrganisationUnitSelectionManager( OrganisationUnitSelectionManager organisationUnitSelectionManager )
+    {
+        this.organisationUnitSelectionManager = organisationUnitSelectionManager;
+    }
+
+    protected PeriodGenericManager periodGenericManager;
+
+    public void setPeriodGenericManager( PeriodGenericManager periodGenericManager )
+    {
+        this.periodGenericManager = periodGenericManager;
+    }
+
+    protected SelectionManager selectionManager;
+
+    public void setSelectionManager( SelectionManager selectionManager )
+    {
+        this.selectionManager = selectionManager;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        String[] importItemIds = selectionManager.getListObject();
+
+        if ( importItemIds == null )
+        {
+            message = i18n.getString( "choose_import_item" );
+
+            return ERROR;
+        }
+
+        OrganisationUnit organisationUnit = organisationUnitSelectionManager.getSelectedOrganisationUnit();
+
+        if ( organisationUnit != null )
+        {
+            FileInputStream inputStream = new FileInputStream( selectionManager.getUploadFilePath() );
+
+            Workbook wb = new HSSFWorkbook( inputStream );
+
+            Period period = periodGenericManager.getSelectedPeriod();
+
+            executeToImport( organisationUnit, period, importItemIds, wb );
+        }
+
+        message = i18n.getString( "import_successfully" );
+
+        return SUCCESS;
+    }
+
+    // -------------------------------------------------------------------------
+    // Abstract method
+    // -------------------------------------------------------------------------
+
+    public abstract void executeToImport( OrganisationUnit organisationUnit, Period period, String[] importItemIds,
+        Workbook wb );
+
+}

=== added file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataCategoryAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataCategoryAction.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataCategoryAction.java	2011-06-07 05:41:55 +0000
@@ -0,0 +1,104 @@
+package org.hisp.dhis.reportexcel.importing.action;
+
+/*
+ * Copyright (c) 2004-2011, 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 java.util.Date;
+
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementOperand;
+import org.hisp.dhis.datavalue.DataValue;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.reportexcel.importing.ImportDataGeneric;
+import org.hisp.dhis.reportexcel.importitem.ExcelItem;
+import org.hisp.dhis.reportexcel.utils.ExcelUtils;
+
+/**
+ * @author Chau Thu Tran
+ * @version $Id$
+ */
+
+public class ImportDataCategoryAction
+    extends ImportDataGeneric
+{
+    // -------------------------------------------------------------------------
+    // Override the abstract method
+    // -------------------------------------------------------------------------
+
+    public void executeToImport( OrganisationUnit organisationUnit, Period period, String[] importItemIds, Workbook wb )
+    {
+        for ( int i = 0; i < importItemIds.length; i++ )
+        {
+            int importItemId = Integer.parseInt( importItemIds[i].split( "-" )[0] );
+
+            int rowIndex = Integer.parseInt( importItemIds[i].split( "-" )[1] );
+
+            String expression = importItemIds[i].split( "-" )[2];
+
+            ExcelItem importItem = importItemService.getImportItem( importItemId );
+
+            Sheet sheet = wb.getSheetAt( importItem.getSheetNo() - 1 );
+
+            String value = ExcelUtils.readValueImportingByPOI( rowIndex, importItem.getColumn(), sheet );
+
+            addDataValue( expression, value, organisationUnit, period );
+        }
+    }
+
+    private void addDataValue( String expression, String value, OrganisationUnit organisationUnit, Period period )
+    {
+        DataElementOperand operand = expressionService.getOperandsInExpression( expression ).iterator().next();
+
+        DataElement dataElement = dataElementService.getDataElement( operand.getDataElementId() );
+
+        DataElementCategoryOptionCombo optionCombo = categoryService.getDataElementCategoryOptionCombo( operand
+            .getOptionComboId() );
+
+        String storedBy = currentUserService.getCurrentUsername();
+
+        DataValue dataValue = dataValueService.getDataValue( organisationUnit, dataElement, period, optionCombo );
+
+        if ( dataValue == null )
+        {
+            dataValue = new DataValue( dataElement, period, organisationUnit, value + "", storedBy, new Date(), null,
+                optionCombo );
+            dataValueService.addDataValue( dataValue );
+        }
+        else
+        {
+            dataValue.setValue( value + "" );
+            dataValue.setTimestamp( new Date() );
+            dataValue.setStoredBy( storedBy );
+
+            dataValueService.updateDataValue( dataValue );
+        }
+    }
+}
\ No newline at end of file

=== removed file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataCategoryExcelGroupAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataCategoryExcelGroupAction.java	2011-05-24 07:48:23 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataCategoryExcelGroupAction.java	1970-01-01 00:00:00 +0000
@@ -1,216 +0,0 @@
-package org.hisp.dhis.reportexcel.importing.action;
-
-/*
- * Copyright (c) 2004-2010, 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 java.io.FileInputStream;
-import java.util.Date;
-
-import org.apache.poi.hssf.usermodel.HSSFSheet;
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
-import org.hisp.dhis.dataelement.DataElementOperand;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.datavalue.DataValue;
-import org.hisp.dhis.datavalue.DataValueService;
-import org.hisp.dhis.expression.ExpressionService;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.reportexcel.action.ActionSupport;
-import org.hisp.dhis.reportexcel.importitem.ExcelItem;
-import org.hisp.dhis.reportexcel.importitem.ImportItemService;
-import org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager;
-import org.hisp.dhis.reportexcel.state.SelectionManager;
-import org.hisp.dhis.reportexcel.utils.ExcelUtils;
-import org.hisp.dhis.user.CurrentUserService;
-
-/**
- * @author Chau Thu Tran
- * @version $Id$
- */
-
-public class ImportDataCategoryExcelGroupAction
-    extends ActionSupport
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private CurrentUserService currentUserService;
-
-    public void setCurrentUserService( CurrentUserService currentUserService )
-    {
-        this.currentUserService = currentUserService;
-    }
-
-    private DataElementService dataElementService;
-
-    public void setDataElementService( DataElementService dataElementService )
-    {
-        this.dataElementService = dataElementService;
-    }
-
-    private DataValueService dataValueService;
-
-    public void setDataValueService( DataValueService dataValueService )
-    {
-        this.dataValueService = dataValueService;
-    }
-
-    private DataElementCategoryService categoryService;
-
-    public void setCategoryService( DataElementCategoryService categoryService )
-    {
-        this.categoryService = categoryService;
-    }
-
-    private ExpressionService expressionService;
-
-    public void setExpressionService( ExpressionService expressionService )
-    {
-        this.expressionService = expressionService;
-    }
-
-    private ImportItemService importItemService;
-
-    public void setImportItemService( ImportItemService importItemService )
-    {
-        this.importItemService = importItemService;
-    }
-
-    private OrganisationUnitSelectionManager organisationUnitSelectionManager;
-
-    public void setOrganisationUnitSelectionManager( OrganisationUnitSelectionManager organisationUnitSelectionManager )
-    {
-        this.organisationUnitSelectionManager = organisationUnitSelectionManager;
-    }
-
-    private PeriodGenericManager periodGenericManager;
-
-    public void setPeriodGenericManager( PeriodGenericManager periodGenericManager )
-    {
-        this.periodGenericManager = periodGenericManager;
-    }
-
-    private SelectionManager selectionManager;
-
-    public void setSelectionManager( SelectionManager selectionManager )
-    {
-        this.selectionManager = selectionManager;
-    }
-
-    // -------------------------------------------------------------------------
-    // Inputs && Outputs
-    // -------------------------------------------------------------------------
-
-    public String[] importItemIds;
-
-    public void setExcelItemIds( String[] importItemIds )
-    {
-        this.importItemIds = importItemIds;
-    }
-
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    public String execute()
-        throws Exception
-    {
-        OrganisationUnit organisationUnit = organisationUnitSelectionManager.getSelectedOrganisationUnit();
-
-        if ( importItemIds == null )
-        {
-            message = i18n.getString( "choose_excelItem" );
-
-            return ERROR;
-        }
-
-        if ( organisationUnit != null )
-        {
-            FileInputStream upload = new FileInputStream( selectionManager.getUploadFilePath() );
-
-            HSSFWorkbook wb = new HSSFWorkbook( upload );
-
-            Period period = periodGenericManager.getSelectedPeriod();
-
-            for ( int i = 0; i < importItemIds.length; i++ )
-            {
-                int importItemId = Integer.parseInt( importItemIds[i].split( "-" )[0] );
-
-                int rowIndex = Integer.parseInt( importItemIds[i].split( "-" )[1] );
-
-                String expression = importItemIds[i].split( "-" )[2];
-
-                ExcelItem importItem = importItemService.getImportItem( importItemId );
-
-                HSSFSheet sheet = wb.getSheetAt( importItem.getSheetNo() - 1 );
-
-                String value = ExcelUtils.readValueImportingByPOI( rowIndex, importItem.getColumn(), sheet );
-
-                addDataValue( expression, value, organisationUnit, period );
-            }
-
-        }// end if (organisationUnit ...
-
-        message = i18n.getString( "success" );
-
-        return SUCCESS;
-    }
-
-    private void addDataValue( String expression, String value, OrganisationUnit organisationUnit, Period period )
-    {
-        DataElementOperand operand = expressionService.getOperandsInExpression( expression ).iterator().next();
-
-        DataElement dataElement = dataElementService.getDataElement( operand.getDataElementId() );
-
-        DataElementCategoryOptionCombo optionCombo = categoryService.getDataElementCategoryOptionCombo( operand
-            .getOptionComboId() );
-
-        String storedBy = currentUserService.getCurrentUsername();
-
-        DataValue dataValue = dataValueService.getDataValue( organisationUnit, dataElement, period, optionCombo );
-
-        if ( dataValue == null )
-        {
-            dataValue = new DataValue( dataElement, period, organisationUnit, value + "", storedBy, new Date(), null,
-                optionCombo );
-            dataValueService.addDataValue( dataValue );
-        }
-        else
-        {
-            dataValue.setValue( value + "" );
-            dataValue.setTimestamp( new Date() );
-            dataValue.setStoredBy( storedBy );
-
-            dataValueService.updateDataValue( dataValue );
-        }
-    }
-}
\ No newline at end of file

=== removed file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataExcelOrganizationGroupAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataExcelOrganizationGroupAction.java	2011-05-24 07:48:23 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataExcelOrganizationGroupAction.java	1970-01-01 00:00:00 +0000
@@ -1,234 +0,0 @@
-package org.hisp.dhis.reportexcel.importing.action;
-
-/*
- * Copyright (c) 2004-2010, 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 java.io.FileInputStream;
-import java.util.Date;
-
-import org.apache.poi.hssf.usermodel.HSSFSheet;
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
-import org.hisp.dhis.dataelement.DataElementOperand;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.datavalue.DataValue;
-import org.hisp.dhis.datavalue.DataValueService;
-import org.hisp.dhis.expression.ExpressionService;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.reportexcel.action.ActionSupport;
-import org.hisp.dhis.reportexcel.importitem.ExcelItem;
-import org.hisp.dhis.reportexcel.importitem.ImportItemService;
-import org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager;
-import org.hisp.dhis.reportexcel.state.SelectionManager;
-import org.hisp.dhis.reportexcel.utils.ExcelUtils;
-import org.hisp.dhis.user.CurrentUserService;
-
-/**
- * @author Chau Thu Tran
- * @version $Id$
- */
-
-public class ImportDataExcelOrganizationGroupAction
-    extends ActionSupport
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private CurrentUserService currentUserService;
-
-    public void setCurrentUserService( CurrentUserService currentUserService )
-    {
-        this.currentUserService = currentUserService;
-    }
-
-    private DataElementService dataElementService;
-
-    public void setDataElementService( DataElementService dataElementService )
-    {
-        this.dataElementService = dataElementService;
-    }
-
-    private DataElementCategoryService categoryService;
-
-    public void setCategoryService( DataElementCategoryService categoryService )
-    {
-        this.categoryService = categoryService;
-    }
-
-    private DataValueService dataValueService;
-
-    public void setDataValueService( DataValueService dataValueService )
-    {
-        this.dataValueService = dataValueService;
-    }
-
-    private ExpressionService expressionService;
-
-    public void setExpressionService( ExpressionService expressionService )
-    {
-        this.expressionService = expressionService;
-    }
-
-    private ImportItemService importItemService;
-
-    public void setImportItemService( ImportItemService importItemService )
-    {
-        this.importItemService = importItemService;
-    }
-
-    private OrganisationUnitService organisationUnitService;
-
-    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
-    {
-        this.organisationUnitService = organisationUnitService;
-    }
-
-    private OrganisationUnitSelectionManager organisationUnitSelectionManager;
-
-    public void setOrganisationUnitSelectionManager( OrganisationUnitSelectionManager organisationUnitSelectionManager )
-    {
-        this.organisationUnitSelectionManager = organisationUnitSelectionManager;
-    }
-
-    private PeriodGenericManager periodGenericManager;
-
-    public void setPeriodGenericManager( PeriodGenericManager periodGenericManager )
-    {
-        this.periodGenericManager = periodGenericManager;
-    }
-
-    private SelectionManager selectionManager;
-
-    public void setSelectionManager( SelectionManager selectionManager )
-    {
-        this.selectionManager = selectionManager;
-    }
-
-    // -------------------------------------------------------------------------
-    // Inputs && Outputs
-    // -------------------------------------------------------------------------
-
-    public String[] importItemIds;
-
-    public void setExcelItemIds( String[] importItemIds )
-    {
-        this.importItemIds = importItemIds;
-    }
-
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    public String execute()
-        throws Exception
-    {
-        OrganisationUnit organisationUnit = organisationUnitSelectionManager.getSelectedOrganisationUnit();
-
-        if ( importItemIds == null )
-        {
-            message = i18n.getString( "choose_import_item" );
-
-            return ERROR;
-        }
-
-        if ( organisationUnit != null )
-        {
-            FileInputStream inputStream = new FileInputStream( selectionManager.getUploadFilePath() );
-
-            HSSFWorkbook wb = new HSSFWorkbook( inputStream );
-
-            Period period = periodGenericManager.getSelectedPeriod();
-
-            for ( int i = 0; i < importItemIds.length; i++ )
-            {
-                int orgunitId = Integer.parseInt( importItemIds[i].split( "-" )[0] );
-
-                OrganisationUnit o = organisationUnitService.getOrganisationUnit( orgunitId );
-
-                int row = Integer.parseInt( importItemIds[i].split( "-" )[1] );
-
-                int importItemId = Integer.parseInt( importItemIds[i].split( "-" )[2] );
-
-                ExcelItem importItem = importItemService.getImportItem( importItemId );
-
-                if ( importItem.getId() == importItemId )
-                {
-                    writeDataValue( importItem, wb, row, o, period );
-                }// end if( importItem ...
-
-            }// end for (int i ...
-
-        }// end if (organisationUnit ...
-
-        message = i18n.getString( "success" );
-
-        return SUCCESS;
-    }
-
-    private void writeDataValue( ExcelItem importItem, HSSFWorkbook wb, int row, OrganisationUnit o, Period period )
-    {
-        HSSFSheet sheet = wb.getSheetAt( importItem.getSheetNo() - 1 );
-
-        String value = ExcelUtils.readValueImportingByPOI( importItem.getRow() + row, importItem.getColumn(), sheet );
-
-        if ( value.length() > 0 )
-        {
-            DataElementOperand operand = expressionService.getOperandsInExpression( importItem.getExpression() )
-                .iterator().next();
-
-            DataElement dataElement = dataElementService.getDataElement( operand.getDataElementId() );
-
-            DataElementCategoryOptionCombo optionCombo = categoryService.getDataElementCategoryOptionCombo( operand
-                .getOptionComboId() );
-
-            String storedBy = currentUserService.getCurrentUsername();
-
-            DataValue dataValue = dataValueService.getDataValue( o, dataElement, period, optionCombo );
-
-            if ( dataValue == null )
-            {
-                dataValue = new DataValue( dataElement, period, o, value + "", storedBy, new Date(), null, optionCombo );
-                dataValueService.addDataValue( dataValue );
-            }
-            else
-            {
-                dataValue.setValue( value + "" );
-                dataValue.setTimestamp( new Date() );
-                dataValue.setStoredBy( storedBy );
-
-                dataValueService.updateDataValue( dataValue );
-            }
-        }
-    }
-
-}

=== modified file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataFlowAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataFlowAction.java	2011-05-24 07:48:23 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataFlowAction.java	2011-06-07 05:41:55 +0000
@@ -30,6 +30,7 @@
 import org.hisp.dhis.reportexcel.importitem.ExcelItemGroup;
 import org.hisp.dhis.reportexcel.importitem.ImportItemService;
 import org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager;
+import org.hisp.dhis.reportexcel.state.SelectionManager;
 
 import com.opensymphony.xwork2.Action;
 
@@ -58,6 +59,13 @@
         this.periodGenericManager = periodGenericManager;
     }
 
+    private SelectionManager selectionManager;
+
+    public void setSelectionManager( SelectionManager selectionManager )
+    {
+        this.selectionManager = selectionManager;
+    }
+
     // -------------------------------------------------------------------------
     // Input & Output
     // -------------------------------------------------------------------------
@@ -70,10 +78,17 @@
 
     private Integer orgunitGroupId;
 
+    public String[] importItemIds;
+
     // -------------------------------------------------------------------------
     // Getter & Setter
     // -------------------------------------------------------------------------
 
+    public Integer getImportReportId()
+    {
+        return importReportId;
+    }
+
     public void setImportReportId( Integer importReportId )
     {
         this.importReportId = importReportId;
@@ -104,6 +119,11 @@
         this.orgunitGroupId = orgunitGroupId;
     }
 
+    public void setImportItemIds( String[] importItemIds )
+    {
+        this.importItemIds = importItemIds;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -113,6 +133,8 @@
     {
         periodGenericManager.setSelectedPeriodIndex( periodId );
 
+        selectionManager.setListObject( importItemIds );
+
         ExcelItemGroup importReport = importItemService.getImportReport( importReportId );
 
         return importReport.getType();

=== added file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataNormalAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataNormalAction.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataNormalAction.java	2011-06-07 05:41:55 +0000
@@ -0,0 +1,122 @@
+package org.hisp.dhis.reportexcel.importing.action;
+
+/*
+ * Copyright (c) 2004-2011, 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 java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementOperand;
+import org.hisp.dhis.datavalue.DataValue;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.reportexcel.importing.ImportDataGeneric;
+import org.hisp.dhis.reportexcel.importitem.ExcelItem;
+import org.hisp.dhis.reportexcel.utils.ExcelUtils;
+
+/**
+ * @author Chau Thu Tran
+ * @version $Id$
+ */
+
+public class ImportDataNormalAction
+    extends ImportDataGeneric
+{
+    // -------------------------------------------------------------------------
+    // Inputs && Outputs
+    // -------------------------------------------------------------------------
+
+    private Integer importReportId;
+
+    public void setImportReportId( Integer importReportId )
+    {
+        this.importReportId = importReportId;
+    }
+
+    // -------------------------------------------------------------------------
+    // Override the abstract method
+    // -------------------------------------------------------------------------
+
+    public void executeToImport( OrganisationUnit organisationUnit, Period period, String[] importItemIds, Workbook wb )
+    {
+        Collection<ExcelItem> importItems = new ArrayList<ExcelItem>();
+
+        if ( importItemIds != null )
+        {
+            for ( int i = 0; i < importItemIds.length; i++ )
+            {
+                importItems.add( importItemService.getImportItem( importItemIds[i] ) );
+            }
+        }
+        else
+        {
+            importItems = importItemService.getImportReport( importReportId ).getExcelItems();
+        }
+
+        for ( ExcelItem importItem : importItems )
+        {
+            Sheet sheet = wb.getSheetAt( importItem.getSheetNo() - 1 );
+
+            String value = ExcelUtils.readValueImportingByPOI( importItem.getRow(), importItem.getColumn(), sheet );
+
+            if ( value.length() > 0 )
+            {
+                DataElementOperand operand = expressionService.getOperandsInExpression( importItem.getExpression() )
+                    .iterator().next();
+
+                DataElement dataElement = dataElementService.getDataElement( operand.getDataElementId() );
+
+                DataElementCategoryOptionCombo optionCombo = categoryService.getDataElementCategoryOptionCombo( operand
+                    .getOptionComboId() );
+
+                String storedBy = currentUserService.getCurrentUsername();
+
+                DataValue dataValue = dataValueService
+                    .getDataValue( organisationUnit, dataElement, period, optionCombo );
+
+                if ( dataValue == null )
+                {
+                    dataValue = new DataValue( dataElement, period, organisationUnit, value + "", storedBy, new Date(),
+                        null, optionCombo );
+                    dataValueService.addDataValue( dataValue );
+                }
+                else
+                {
+                    dataValue.setValue( value + "" );
+                    dataValue.setTimestamp( new Date() );
+                    dataValue.setStoredBy( storedBy );
+                    dataValueService.updateDataValue( dataValue );
+                }
+            }
+        }
+    }
+}
\ No newline at end of file

=== removed file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataNormalExcelGroupAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataNormalExcelGroupAction.java	2011-05-24 07:48:23 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataNormalExcelGroupAction.java	1970-01-01 00:00:00 +0000
@@ -1,238 +0,0 @@
-package org.hisp.dhis.reportexcel.importing.action;
-
-/*
- * Copyright (c) 2004-2010, 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 java.io.FileInputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-
-import org.apache.poi.hssf.usermodel.HSSFSheet;
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
-import org.hisp.dhis.dataelement.DataElementOperand;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.datavalue.DataValue;
-import org.hisp.dhis.datavalue.DataValueService;
-import org.hisp.dhis.expression.ExpressionService;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.reportexcel.action.ActionSupport;
-import org.hisp.dhis.reportexcel.importitem.ExcelItem;
-import org.hisp.dhis.reportexcel.importitem.ExcelItemGroup;
-import org.hisp.dhis.reportexcel.importitem.ImportItemService;
-import org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager;
-import org.hisp.dhis.reportexcel.state.SelectionManager;
-import org.hisp.dhis.reportexcel.utils.ExcelUtils;
-import org.hisp.dhis.user.CurrentUserService;
-
-/**
- * @author Chau Thu Tran
- * @version $Id$
- */
-
-public class ImportDataNormalExcelGroupAction
-    extends ActionSupport
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private DataValueService dataValueService;
-
-    private OrganisationUnitSelectionManager organisationUnitSelectionManager;
-
-    private ExpressionService expressionService;
-
-    private DataElementService dataElementService;
-
-    private DataElementCategoryService categoryService;
-
-    private CurrentUserService currentUserService;
-
-    private ImportItemService importItemService;
-
-    private SelectionManager selectionManager;
-
-    private PeriodGenericManager periodGenericManager;
-
-    // -------------------------------------------------------------------------
-    // Inputs && Outputs
-    // -------------------------------------------------------------------------
-
-    private Integer importReportId;
-
-    public Integer[] importItemIds;
-
-    // -------------------------------------------------------------------------
-    // Getters and Setters
-    // -------------------------------------------------------------------------
-
-    public void setOrganisationUnitSelectionManager( OrganisationUnitSelectionManager organisationUnitSelectionManager )
-    {
-        this.organisationUnitSelectionManager = organisationUnitSelectionManager;
-    }
-
-    public void setSelectionManager( SelectionManager selectionManager )
-    {
-        this.selectionManager = selectionManager;
-    }
-
-    public void setPeriodGenericManager( PeriodGenericManager periodGenericManager )
-    {
-        this.periodGenericManager = periodGenericManager;
-    }
-
-    public void setExpressionService( ExpressionService expressionService )
-    {
-        this.expressionService = expressionService;
-    }
-
-    public void setCategoryService( DataElementCategoryService categoryService )
-    {
-        this.categoryService = categoryService;
-    }
-
-    public void setCurrentUserService( CurrentUserService currentUserService )
-    {
-        this.currentUserService = currentUserService;
-    }
-
-    public void setImportItemService( ImportItemService importItemService )
-    {
-        this.importItemService = importItemService;
-    }
-
-    public void setDataValueService( DataValueService dataValueService )
-    {
-        this.dataValueService = dataValueService;
-    }
-
-    public void setImportReportId( Integer importReportId )
-    {
-        this.importReportId = importReportId;
-    }
-
-    public void setExcelItemIds( Integer[] importItemIds )
-    {
-        this.importItemIds = importItemIds;
-    }
-
-    public void setDataElementService( DataElementService dataElementService )
-    {
-        this.dataElementService = dataElementService;
-    }
-
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    public String execute()
-        throws Exception
-    {
-        ExcelItemGroup importItemGroup = importItemService.getImportReport( importReportId.intValue() );
-
-        OrganisationUnit organisationUnit = organisationUnitSelectionManager.getSelectedOrganisationUnit();
-
-        if ( importItemIds == null )
-        {
-            message = i18n.getString( "choose_importItem" );
-
-            return ERROR;
-        }
-
-        if ( organisationUnit != null )
-        {
-            FileInputStream upload = new FileInputStream( selectionManager.getUploadFilePath() );
-
-            HSSFWorkbook wb = new HSSFWorkbook( upload );
-
-            Collection<ExcelItem> importItems = new ArrayList<ExcelItem>();
-            
-            if ( importItemIds != null )
-            {
-                for ( int i = 0; i < importItemIds.length; i++ )
-                {
-                    importItems.add( importItemService.getImportItem( importItemIds[i] ) );
-                }
-            }
-            else
-            {
-                importItems = importItemGroup.getExcelItems();
-            }
-
-            Period period = periodGenericManager.getSelectedPeriod();
-
-            for ( ExcelItem importItem : importItems )
-            {
-                HSSFSheet sheet = wb.getSheetAt( importItem.getSheetNo() - 1 );
-                
-                String value = ExcelUtils.readValueImportingByPOI( importItem.getRow(), importItem.getColumn(), sheet );
-                
-                if ( value.length() > 0 )
-                {
-                    DataElementOperand operand = expressionService.getOperandsInExpression( importItem.getExpression() ).iterator()
-                        .next();
-
-                    DataElement dataElement = dataElementService.getDataElement( operand.getDataElementId() );
-
-                    DataElementCategoryOptionCombo optionCombo = categoryService
-                        .getDataElementCategoryOptionCombo( operand.getOptionComboId() );
-
-                    String storedBy = currentUserService.getCurrentUsername();
-
-                    DataValue dataValue = dataValueService.getDataValue( organisationUnit, dataElement, period,
-                        optionCombo );
-
-                    if ( dataValue == null )
-                    {
-                        dataValue = new DataValue( dataElement, period, organisationUnit, value + "", storedBy,
-                            new Date(), null, optionCombo );
-                        dataValueService.addDataValue( dataValue );
-                    }
-                    else
-                    {
-                        dataValue.setValue( value + "" );
-                        dataValue.setTimestamp( new Date() );
-                        dataValue.setStoredBy( storedBy );
-                        dataValueService.updateDataValue( dataValue );
-                    }
-                }
-            }// end for (ImportItem ...
-
-        }// end if (organisationUnit ...
-
-        message = i18n.getString( "success" );
-
-        return SUCCESS;
-    }
-
-}
\ No newline at end of file

=== added file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataOrganizationGroupAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataOrganizationGroupAction.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ImportDataOrganizationGroupAction.java	2011-06-07 05:41:55 +0000
@@ -0,0 +1,113 @@
+package org.hisp.dhis.reportexcel.importing.action;
+
+/*
+ * Copyright (c) 2004-2011, 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 java.util.Date;
+
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementOperand;
+import org.hisp.dhis.datavalue.DataValue;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.reportexcel.importing.ImportDataGeneric;
+import org.hisp.dhis.reportexcel.importitem.ExcelItem;
+import org.hisp.dhis.reportexcel.utils.ExcelUtils;
+
+/**
+ * @author Chau Thu Tran
+ * @version $Id$
+ */
+
+public class ImportDataOrganizationGroupAction
+    extends ImportDataGeneric
+{
+    // -------------------------------------------------------------------------
+    // Override the abstract method
+    // -------------------------------------------------------------------------
+
+    @Override
+    public void executeToImport( OrganisationUnit organisationUnit, Period period, String[] importItemIds, Workbook wb )
+    {
+        for ( int i = 0; i < importItemIds.length; i++ )
+        {
+            int orgunitId = Integer.parseInt( importItemIds[i].split( "-" )[0] );
+
+            OrganisationUnit o = organisationUnitService.getOrganisationUnit( orgunitId );
+
+            int row = Integer.parseInt( importItemIds[i].split( "-" )[1] );
+
+            int importItemId = Integer.parseInt( importItemIds[i].split( "-" )[2] );
+
+            ExcelItem importItem = importItemService.getImportItem( importItemId );
+
+            if ( importItem.getId() == importItemId )
+            {
+                writeDataValue( importItem, wb, row, o, period );
+            }
+        }
+    }
+
+    private void writeDataValue( ExcelItem importItem, Workbook wb, int row, OrganisationUnit o, Period period )
+    {
+        Sheet sheet = wb.getSheetAt( importItem.getSheetNo() - 1 );
+
+        String value = ExcelUtils.readValueImportingByPOI( importItem.getRow() + row, importItem.getColumn(), sheet );
+
+        if ( value.length() > 0 )
+        {
+            DataElementOperand operand = expressionService.getOperandsInExpression( importItem.getExpression() )
+                .iterator().next();
+
+            DataElement dataElement = dataElementService.getDataElement( operand.getDataElementId() );
+
+            DataElementCategoryOptionCombo optionCombo = categoryService.getDataElementCategoryOptionCombo( operand
+                .getOptionComboId() );
+
+            String storedBy = currentUserService.getCurrentUsername();
+
+            DataValue dataValue = dataValueService.getDataValue( o, dataElement, period, optionCombo );
+
+            if ( dataValue == null )
+            {
+                dataValue = new DataValue( dataElement, period, o, value + "", storedBy, new Date(), null, optionCombo );
+                dataValueService.addDataValue( dataValue );
+            }
+            else
+            {
+                dataValue.setValue( value + "" );
+                dataValue.setTimestamp( new Date() );
+                dataValue.setStoredBy( storedBy );
+
+                dataValueService.updateDataValue( dataValue );
+            }
+        }
+    }
+}

=== modified file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ViewDataCategoryAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ViewDataCategoryAction.java	2011-05-24 07:48:23 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ViewDataCategoryAction.java	2011-06-07 05:41:55 +0000
@@ -1,7 +1,7 @@
 package org.hisp.dhis.reportexcel.importing.action;
 
 /*
- * Copyright (c) 2004-2010, University of Oslo
+ * Copyright (c) 2004-2011, University of Oslo
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -31,15 +31,20 @@
 import java.io.FileInputStream;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.List;
 
-import org.apache.poi.hssf.usermodel.HSSFSheet;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
 import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.reportexcel.DataElementGroupOrder;
 import org.hisp.dhis.reportexcel.importing.ImportItemValue;
 import org.hisp.dhis.reportexcel.importitem.ExcelItem;
 import org.hisp.dhis.reportexcel.importitem.ExcelItemGroup;
+import org.hisp.dhis.reportexcel.importitem.ImportItemService;
 import org.hisp.dhis.reportexcel.importitem.comparator.ImportItemComparator;
+import org.hisp.dhis.reportexcel.state.SelectionManager;
 import org.hisp.dhis.reportexcel.utils.ExcelUtils;
 
 import com.opensymphony.xwork2.Action;
@@ -53,41 +58,52 @@
     implements Action
 {
     // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private ImportItemService importItemService;
+
+    public void setImportItemService( ImportItemService importItemService )
+    {
+        this.importItemService = importItemService;
+    }
+
+    private SelectionManager selectionManager;
+
+    public void setSelectionManager( SelectionManager selectionManager )
+    {
+        this.selectionManager = selectionManager;
+    }
+
+    // -------------------------------------------------------------------------
     // Inputs && Outputs
     // -------------------------------------------------------------------------
 
-    private ExcelItemGroup importReport;
-
-    private ArrayList<ImportItemValue> importItemValues;
-
-    private File upload;
-
-    public String[] importItemIds;
+    private List<ImportItemValue> importItemValues = new ArrayList<ImportItemValue>();
+
+    private String message;
+
+    private I18n i18n;
 
     // -------------------------------------------------------------------------
     // Getters and Setters
     // -------------------------------------------------------------------------
 
-    public void setUpload( File upload )
-    {
-        this.upload = upload;
-    }
-
-    public void setImportReport( ExcelItemGroup importReport )
-    {
-        this.importReport = importReport;
-    }
-
-    public void setImportItemIds( String[] importItemIds )
-    {
-        this.importItemIds = importItemIds;
-    }
-
-    public ArrayList<ImportItemValue> getImportItemValues()
+    public List<ImportItemValue> getImportItemValues()
     {
         return importItemValues;
     }
 
+    public String getMessage()
+    {
+        return message;
+    }
+
+    public void setI18n( I18n i18n )
+    {
+        this.i18n = i18n;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -96,19 +112,26 @@
     {
         try
         {
-            FileInputStream inputStream = new FileInputStream( upload );
-
-            HSSFWorkbook wb = new HSSFWorkbook( inputStream );
-
-            ArrayList<ExcelItem> importItems = new ArrayList<ExcelItem>( importReport.getExcelItems() );
+            FileInputStream inputStream = new FileInputStream( new File( selectionManager.getUploadFilePath() ) );
+
+            Workbook wb = new HSSFWorkbook( inputStream );
+
+            ExcelItemGroup importReport = importItemService.getImportReport( selectionManager.getSelectedReportId() );
+
+            List<ExcelItem> importItems = new ArrayList<ExcelItem>( importReport.getExcelItems() );
+
+            if ( importItems == null || importItems.isEmpty() )
+            {
+                message = i18n.getString( "import_excel_items_cannot_be_empty" );
+
+                return ERROR;
+            }
 
             Collections.sort( importItems, new ImportItemComparator() );
 
-            importItemValues = new ArrayList<ImportItemValue>();
-
             for ( ExcelItem importItem : importItems )
             {
-                HSSFSheet sheet = wb.getSheetAt( importItem.getSheetNo() - 1 );
+                Sheet sheet = wb.getSheetAt( importItem.getSheetNo() - 1 );
 
                 int rowBegin = importItem.getRow();
 

=== modified file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ViewDataFlowAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ViewDataFlowAction.java	2011-05-24 07:48:23 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ViewDataFlowAction.java	2011-06-07 05:41:55 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2010, University of Oslo
+ * Copyright (c) 2004-2011, University of Oslo
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -26,14 +26,8 @@
  */
 package org.hisp.dhis.reportexcel.importing.action;
 
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collections;
-
-import org.hisp.dhis.reportexcel.importitem.ExcelItem;
 import org.hisp.dhis.reportexcel.importitem.ExcelItemGroup;
 import org.hisp.dhis.reportexcel.importitem.ImportItemService;
-import org.hisp.dhis.reportexcel.importitem.comparator.ImportItemComparator;
 import org.hisp.dhis.reportexcel.state.SelectionManager;
 
 import com.opensymphony.xwork2.Action;
@@ -70,36 +64,11 @@
 
     private Integer importReportId;
 
-    private ExcelItemGroup importReport;
-
-    private ArrayList<ExcelItem> importItems;
-
-    private File upload;
-
-    // -------------------------------------------------------------------------
-    // Getters and Setters
-    // -------------------------------------------------------------------------
-
-    public File getUpload()
-    {
-        return upload;
-    }
-
-    public ExcelItemGroup getImportReport()
-    {
-        return importReport;
-    }
-
     public void setImportReportId( Integer importReportId )
     {
         this.importReportId = importReportId;
     }
 
-    public ArrayList<ExcelItem> getImportItems()
-    {
-        return importItems;
-    }
-
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -108,12 +77,9 @@
     public String execute()
         throws Exception
     {
-        upload = new File( selectionManager.getUploadFilePath() );
-
-        importReport = importItemService.getImportReport( importReportId );
-        importItems = new ArrayList<ExcelItem>( importReport.getExcelItems() );
-
-        Collections.sort( importItems, new ImportItemComparator() );
+        selectionManager.setSelectedReportId( importReportId );
+
+        ExcelItemGroup importReport = importItemService.getImportReport( importReportId );
 
         return importReport.getType();
     }

=== modified file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ViewDataNormalAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ViewDataNormalAction.java	2011-05-24 07:48:23 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ViewDataNormalAction.java	2011-06-07 05:41:55 +0000
@@ -1,7 +1,7 @@
 package org.hisp.dhis.reportexcel.importing.action;
 
 /*
- * Copyright (c) 2004-2010, University of Oslo
+ * Copyright (c) 2004-2011, University of Oslo
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -30,6 +30,7 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
@@ -38,6 +39,10 @@
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.reportexcel.importing.ImportItemValue;
 import org.hisp.dhis.reportexcel.importitem.ExcelItem;
+import org.hisp.dhis.reportexcel.importitem.ExcelItemGroup;
+import org.hisp.dhis.reportexcel.importitem.ImportItemService;
+import org.hisp.dhis.reportexcel.importitem.comparator.ImportItemComparator;
+import org.hisp.dhis.reportexcel.state.SelectionManager;
 import org.hisp.dhis.reportexcel.utils.ExcelUtils;
 
 import com.opensymphony.xwork2.Action;
@@ -52,33 +57,37 @@
     implements Action
 {
     // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private ImportItemService importItemService;
+
+    public void setImportItemService( ImportItemService importItemService )
+    {
+        this.importItemService = importItemService;
+    }
+
+    private SelectionManager selectionManager;
+
+    public void setSelectionManager( SelectionManager selectionManager )
+    {
+        this.selectionManager = selectionManager;
+    }
+
+    // -------------------------------------------------------------------------
     // Inputs && Outputs
     // -------------------------------------------------------------------------
 
-    private File upload;
-
-    private List<ImportItemValue> importItemValues;
-
-    private ArrayList<ExcelItem> importItems;
-    
+    private List<ImportItemValue> importItemValues = new ArrayList<ImportItemValue>();
+
     private String message;
-    
+
     private I18n i18n;
 
     // -------------------------------------------------------------------------
     // Getters and Setters
     // -------------------------------------------------------------------------
 
-    public void setUpload( File upload )
-    {
-        this.upload = upload;
-    }
-
-    public void setImportItems( ArrayList<ExcelItem> importItems )
-    {
-        this.importItems = importItems;
-    }
-
     public List<ImportItemValue> getImportItemValues()
     {
         return importItemValues;
@@ -93,7 +102,7 @@
     {
         this.i18n = i18n;
     }
-    
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -102,18 +111,22 @@
     {
         try
         {
-            FileInputStream inputStream = new FileInputStream( upload );
+            FileInputStream inputStream = new FileInputStream( new File( selectionManager.getUploadFilePath() ) );
 
             Workbook wb = new HSSFWorkbook( inputStream );
 
-            importItemValues = new ArrayList<ImportItemValue>();
+            ExcelItemGroup importReport = importItemService.getImportReport( selectionManager.getSelectedReportId() );
+
+            List<ExcelItem> importItems = new ArrayList<ExcelItem>( importReport.getExcelItems() );
 
             if ( importItems == null || importItems.isEmpty() )
             {
                 message = i18n.getString( "import_excel_items_cannot_be_empty" );
-                
+
                 return ERROR;
             }
+
+            Collections.sort( importItems, new ImportItemComparator() );
             
             for ( ExcelItem importItem : importItems )
             {
@@ -131,7 +144,7 @@
         }
         catch ( Exception ex )
         {
-            throw new RuntimeException("Error while previewing the imported value", ex);
+            throw new RuntimeException( "Error while previewing the imported value", ex );
         }
     }
 }

=== modified file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ViewDataOrganizationGroupAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ViewDataOrganizationGroupAction.java	2011-05-24 07:48:23 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importing/action/ViewDataOrganizationGroupAction.java	2011-06-07 05:41:55 +0000
@@ -1,7 +1,7 @@
 package org.hisp.dhis.reportexcel.importing.action;
 
 /*
- * Copyright (c) 2004-2010, University of Oslo
+ * Copyright (c) 2004-2011, University of Oslo
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -34,8 +34,10 @@
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.poi.hssf.usermodel.HSSFSheet;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
 import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
@@ -44,6 +46,9 @@
 import org.hisp.dhis.reportexcel.importing.ImportItemValueByOrganisationUnit;
 import org.hisp.dhis.reportexcel.importitem.ExcelItem;
 import org.hisp.dhis.reportexcel.importitem.ExcelItemGroup;
+import org.hisp.dhis.reportexcel.importitem.ImportItemService;
+import org.hisp.dhis.reportexcel.importitem.comparator.ImportItemComparator;
+import org.hisp.dhis.reportexcel.state.SelectionManager;
 import org.hisp.dhis.reportexcel.utils.ExcelUtils;
 
 import com.opensymphony.xwork2.Action;
@@ -56,10 +61,23 @@
 public class ViewDataOrganizationGroupAction
     implements Action
 {
-
-    // --------------------------------------------------------------------
+    // -------------------------------------------------------------------------
     // Dependency
-    // --------------------------------------------------------------------
+    // -------------------------------------------------------------------------
+
+    private ImportItemService importItemService;
+
+    public void setImportItemService( ImportItemService importItemService )
+    {
+        this.importItemService = importItemService;
+    }
+
+    private SelectionManager selectionManager;
+
+    public void setSelectionManager( SelectionManager selectionManager )
+    {
+        this.selectionManager = selectionManager;
+    }
 
     private OrganisationUnitSelectionManager organisationUnitSelectionManager;
 
@@ -68,64 +86,71 @@
         this.organisationUnitSelectionManager = organisationUnitSelectionManager;
     }
 
-    // --------------------------------------------------------------------
+    // -------------------------------------------------------------------------
     // Inputs && Outputs
-    // --------------------------------------------------------------------
-
-    private File upload;
+    // -------------------------------------------------------------------------
 
     private List<ImportItemValueByOrganisationUnit> importItemValueByOrgUnits;
 
-    private ArrayList<ExcelItem> importItems;
-
-    private ExcelItemGroup importReport;
-
-    // --------------------------------------------------------------------
+    private String message;
+
+    private I18n i18n;
+
+    // -------------------------------------------------------------------------
     // Getters and Setters
-    // --------------------------------------------------------------------
-
-    public void setUpload( File upload )
-    {
-        this.upload = upload;
-    }
-
-    public void setImportReport( ExcelItemGroup importReport )
-    {
-        this.importReport = importReport;
-    }
-
-    public void setImportItems( ArrayList<ExcelItem> importItems )
-    {
-        this.importItems = importItems;
-    }
+    // -------------------------------------------------------------------------
 
     public List<ImportItemValueByOrganisationUnit> getImportItemValueByOrgUnits()
     {
         return importItemValueByOrgUnits;
     }
 
-    // --------------------------------------------------------------------
+    public String getMessage()
+    {
+        return message;
+    }
+
+    public void setI18n( I18n i18n )
+    {
+        this.i18n = i18n;
+    }
+
+    // -------------------------------------------------------------------------
     // Action implementation
-    // --------------------------------------------------------------------
+    // -------------------------------------------------------------------------
 
     public String execute()
     {
         try
         {
-            OrganisationUnit organisationUnit = organisationUnitSelectionManager.getSelectedOrganisationUnit();
-
-            FileInputStream inputStream = new FileInputStream( upload );
-
-            HSSFWorkbook wb = new HSSFWorkbook( inputStream );
-
-            importItemValueByOrgUnits = new ArrayList<ImportItemValueByOrganisationUnit>();
-
-            if ( organisationUnit != null )
+            OrganisationUnit unit = organisationUnitSelectionManager.getSelectedOrganisationUnit();
+
+            if ( unit != null )
             {
+                FileInputStream inputStream = new FileInputStream( new File( selectionManager.getUploadFilePath() ) );
+
+                Workbook wb = new HSSFWorkbook( inputStream );
+
+                ExcelItemGroup importReport = importItemService
+                    .getImportReport( selectionManager.getSelectedReportId() );
+
+                List<ExcelItem> importItems = new ArrayList<ExcelItem>( importReport.getExcelItems() );
+
+                if ( importItems == null || importItems.isEmpty() )
+                {
+                    message = i18n.getString( "import_excel_items_cannot_be_empty" );
+
+                    return ERROR;
+                }
+
+                Collections.sort( importItems, new ImportItemComparator() );
+
+                importItemValueByOrgUnits = new ArrayList<ImportItemValueByOrganisationUnit>();
+
                 for ( OrganisationUnitGroup organisationUnitGroup : importReport.getOrganisationUnitGroups() )
                 {
                     List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>( getOrganisationUnits(
-                        organisationUnitGroup, organisationUnit ) );
+                        organisationUnitGroup, unit ) );
 
                     Collections.sort( organisationUnits, new OrganisationUnitNameComparator() );
 
@@ -135,11 +160,11 @@
                     {
                         ImportItemValueByOrganisationUnit importItemValueByOrgUnit = new ImportItemValueByOrganisationUnit(
                             o );
-                        ArrayList<ImportItemValue> importItemValues = new ArrayList<ImportItemValue>();
+                        List<ImportItemValue> importItemValues = new ArrayList<ImportItemValue>();
 
                         for ( ExcelItem importItem : importItems )
                         {
-                            HSSFSheet sheet = wb.getSheetAt( importItem.getSheetNo() - 1 );
+                            Sheet sheet = wb.getSheetAt( importItem.getSheetNo() - 1 );
 
                             String value = ExcelUtils.readValueImportingByPOI( importItem.getRow() + row, importItem
                                 .getColumn(), sheet );

=== added file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importitem/action/ShowUpdateImportItemFormAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importitem/action/ShowUpdateImportItemFormAction.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importitem/action/ShowUpdateImportItemFormAction.java	2011-06-07 05:41:55 +0000
@@ -0,0 +1,126 @@
+package org.hisp.dhis.reportexcel.importitem.action;
+
+/*
+ * Copyright (c) 2004-2011, 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 java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.dataelement.DataElementGroup;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataelement.comparator.DataElementGroupNameComparator;
+import org.hisp.dhis.reportexcel.importitem.ExcelItem;
+import org.hisp.dhis.reportexcel.importitem.ExcelItemGroup;
+import org.hisp.dhis.reportexcel.importitem.ImportItemService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+
+public class ShowUpdateImportItemFormAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private ImportItemService importItemService;
+
+    public void setImportItemService( ImportItemService importItemService )
+    {
+        this.importItemService = importItemService;
+    }
+
+    private DataElementService dataElementService;
+
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input && Output
+    // -------------------------------------------------------------------------
+
+    private Integer importReportId;
+
+    public void setImportReportId( Integer importReportId )
+    {
+        this.importReportId = importReportId;
+    }
+
+    private Integer importItemId;
+
+    public void setImportItemId( Integer importItemId )
+    {
+        this.importItemId = importItemId;
+    }
+
+    public ExcelItemGroup importReport;
+
+    public ExcelItemGroup getImportReport()
+    {
+        return importReport;
+    }
+
+    private ExcelItem importItem;
+
+    public ExcelItem getImportItem()
+    {
+        return importItem;
+    }
+
+    private List<DataElementGroup> dataElementGroups;
+
+    public List<DataElementGroup> getDataElementGroups()
+    {
+        return dataElementGroups;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        importReport = importItemService.getImportReport( importReportId );
+
+        importItem = importItemService.getImportItem( importItemId );
+
+        dataElementGroups = new ArrayList<DataElementGroup>( dataElementService.getAllDataElementGroups() );
+
+        Collections.sort( dataElementGroups, new DataElementGroupNameComparator() );
+
+        return SUCCESS;
+    }
+}

=== modified file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importreport/action/GetImportReportByIdAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importreport/action/GetImportReportByIdAction.java	2011-05-24 07:48:23 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importreport/action/GetImportReportByIdAction.java	2011-06-07 05:41:55 +0000
@@ -1,7 +1,7 @@
 package org.hisp.dhis.reportexcel.importreport.action;
 
 /*
- * Copyright (c) 2004-2010, University of Oslo
+ * Copyright (c) 2004-2011, University of Oslo
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

=== added file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importreport/action/ShowUpdateImportReportFormAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importreport/action/ShowUpdateImportReportFormAction.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/importreport/action/ShowUpdateImportReportFormAction.java	2011-06-07 05:41:55 +0000
@@ -0,0 +1,103 @@
+package org.hisp.dhis.reportexcel.importreport.action;
+
+/*
+ * Copyright (c) 2004-2011, 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 java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.reportexcel.importitem.ExcelItemGroup;
+import org.hisp.dhis.reportexcel.importitem.ImportItemService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class ShowUpdateImportReportFormAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependency
+    // -------------------------------------------------------------------------
+
+    private ImportItemService importItemService;
+
+    public void setImportItemService( ImportItemService importItemService )
+    {
+        this.importItemService = importItemService;
+    }
+
+    private PeriodService periodService;
+
+    public void setPeriodService( PeriodService periodService )
+    {
+        this.periodService = periodService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input && Output
+    // -------------------------------------------------------------------------
+
+    private int id;
+
+    public void setId( int id )
+    {
+        this.id = id;
+    }
+
+    private ExcelItemGroup importReport;
+
+    public ExcelItemGroup getImportReport()
+    {
+        return importReport;
+    }
+
+    private List<PeriodType> periodTypes;
+
+    public List<PeriodType> getPeriodTypes()
+    {
+        return periodTypes;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        importReport = importItemService.getImportReport( id );
+        
+        periodTypes = new ArrayList<PeriodType>( periodService.getAllPeriodTypes() );
+
+        return SUCCESS;
+    }
+}

=== modified file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/jchart/action/GetJChartAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/jchart/action/GetJChartAction.java	2010-09-30 09:37:41 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/jchart/action/GetJChartAction.java	2011-06-07 05:41:55 +0000
@@ -38,9 +38,9 @@
 public class GetJChartAction
     implements Action
 {
-    // -------------------------------------------
+    // -------------------------------------------------------------------------
     // Dependency
-    // -------------------------------------------
+    // -------------------------------------------------------------------------
 
     private JChartSevice jchartService;
 
@@ -49,9 +49,9 @@
         this.jchartService = jchartService;
     }
 
-    // -------------------------------------------
+    // -------------------------------------------------------------------------
     // Input & Output
-    // -------------------------------------------
+    // -------------------------------------------------------------------------
 
     private Integer id;
 
@@ -67,7 +67,10 @@
         return jchart;
     }
 
-    @Override
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+    
     public String execute()
         throws Exception
     {

=== added file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/jchart/action/PrepareDataForAddOrUpdateJChartAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/jchart/action/PrepareDataForAddOrUpdateJChartAction.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/jchart/action/PrepareDataForAddOrUpdateJChartAction.java	2011-06-07 05:41:55 +0000
@@ -0,0 +1,126 @@
+package org.hisp.dhis.reportexcel.jchart.action;
+
+/*
+ * Copyright (c) 2004-2010, 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 static org.apache.commons.lang.StringUtils.isNotBlank;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.indicator.IndicatorGroup;
+import org.hisp.dhis.indicator.IndicatorService;
+import org.hisp.dhis.jchart.JChart;
+import org.hisp.dhis.jchart.JChartSevice;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ */
+public class PrepareDataForAddOrUpdateJChartAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependency
+    // -------------------------------------------------------------------------
+
+    private JChartSevice jchartService;
+
+    public void setJchartService( JChartSevice jchartService )
+    {
+        this.jchartService = jchartService;
+    }
+
+    private PeriodService periodService;
+
+    public void setPeriodService( PeriodService periodService )
+    {
+        this.periodService = periodService;
+    }
+
+    private IndicatorService indicatorService;
+
+    public void setIndicatorService( IndicatorService indicatorService )
+    {
+        this.indicatorService = indicatorService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    private JChart jchart;
+
+    public JChart getJchart()
+    {
+        return jchart;
+    }
+
+    private List<PeriodType> periodTypes;
+
+    public List<PeriodType> getPeriodTypes()
+    {
+        return periodTypes;
+    }
+
+    private List<IndicatorGroup> indicatorGroups;
+
+    public List<IndicatorGroup> getIndicatorGroups()
+    {
+        return indicatorGroups;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        if ( isNotBlank( String.valueOf( id ) ) )
+        {
+            jchart = jchartService.getJChart( id );
+        }
+        
+        periodTypes = new ArrayList<PeriodType>( periodService.getAllPeriodTypes() );
+
+        indicatorGroups = new ArrayList<IndicatorGroup>( indicatorService.getAllIndicatorGroups() );
+
+        return SUCCESS;
+    }
+
+}

=== modified file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/preview/action/ExportXMLAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/preview/action/ExportXMLAction.java	2011-05-24 07:48:23 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/preview/action/ExportXMLAction.java	2011-06-07 05:41:55 +0000
@@ -49,9 +49,9 @@
 
     private static final String ENCODING = "UTF8";
 
-    // -------------------------------------------
+    // -------------------------------------------------------------------------
     // Dependency
-    // -------------------------------------------
+    // -------------------------------------------------------------------------
 
     private ExportReportService exportReportService;
 
@@ -67,30 +67,18 @@
         this.selectionManager = selectionManager;
     }
 
-    // -------------------------------------------
+    // -------------------------------------------------------------------------
     // Input && Output
-    // -------------------------------------------
-
-    private String outputXLS;
-
+    // -------------------------------------------------------------------------
+    
     private String xmlStructureResponse;
 
     private File FILE_XLS;
 
-    // -------------------------------------------
+    // -------------------------------------------------------------------------
     // Getter & Setter
     // -------------------------------------------
 
-    public String getOutputXLS()
-    {
-        return outputXLS;
-    }
-
-    public void setOutputXLS( String outputXLS )
-    {
-        this.outputXLS = outputXLS;
-    }
-
     public String getXmlStructureResponse()
     {
         return xmlStructureResponse;
@@ -134,5 +122,4 @@
 
         // inputStream.close();
     }
-
 }

=== modified file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/state/DefaultSelectionManager.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/state/DefaultSelectionManager.java	2010-07-13 15:50:08 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/state/DefaultSelectionManager.java	2011-06-07 05:41:55 +0000
@@ -46,6 +46,8 @@
     private static final String SESSION_KEY_SELECTED_REPORT_ID = "SESSION_KEY_SELECTED_REPORT_ID";
     
     private static final String SESSION_KEY_BOOKMARK_TYPE = "SESSION_KEY_BOOKMARK_TYPE";
+    
+    private static final String SESSION_KEY_LIST_OBJECT = "SESSION_KEY_LIST_OBJECT";
 
     @Override
     public String getDownloadFilePath()
@@ -112,10 +114,21 @@
     }
 
     @SuppressWarnings( "unchecked" )
-    @Override
     public void setBookmarkType( String type )
     {
         getSession().put( SESSION_KEY_BOOKMARK_TYPE, type );
     }
 
+    @Override
+    public String[] getListObject()
+    {
+        return (String[]) getSession().get( SESSION_KEY_LIST_OBJECT );
+    }
+
+    @SuppressWarnings("unchecked")
+    public void setListObject( String[] objects )
+    {
+        getSession().put( SESSION_KEY_LIST_OBJECT, objects );
+    }
+
 }

=== modified file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/state/SelectionManager.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/state/SelectionManager.java	2010-07-13 15:50:08 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/state/SelectionManager.java	2011-06-07 05:41:55 +0000
@@ -51,5 +51,9 @@
     public void setBookmarkType( String type );
     
     public String getBookmarkType();
+    
+    public String[] getListObject();
+    
+    public void setListObject( String[] objects );
 
 }

=== modified file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/FileUtils.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/FileUtils.java	2011-03-25 09:11:30 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/FileUtils.java	2011-06-07 05:41:55 +0000
@@ -49,9 +49,7 @@
         {
             for ( File f : directory.listFiles() )
             {
-
                 result.add( f.getName() );
-
             }
         }
 

=== modified file 'local/vn/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- local/vn/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml	2011-05-26 05:23:56 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml	2011-06-07 05:41:55 +0000
@@ -858,6 +858,15 @@
 			ref="org.hisp.dhis.reportexcel.importitem.ImportItemService" />
 		<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
 	</bean>
+	
+	<bean
+		id="org.hisp.dhis.reportexcel.importreport.action.ShowUpdateImportReportFormAction"
+		class="org.hisp.dhis.reportexcel.importreport.action.ShowUpdateImportReportFormAction"
+		scope="prototype">
+		<property name="importItemService"
+			ref="org.hisp.dhis.reportexcel.importitem.ImportItemService" />
+		<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
+	</bean>
 
 	<bean
 		id="org.hisp.dhis.reportexcel.importreport.action.ValidateImportReportAction"
@@ -978,7 +987,8 @@
 		id="org.hisp.dhis.reportexcel.importitem.action.SetupImportItemFormAction"
 		class="org.hisp.dhis.reportexcel.importitem.action.SetupImportItemFormAction"
 		scope="prototype">
-		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+		<property name="dataElementService"
+			ref="org.hisp.dhis.dataelement.DataElementService" />
 		<property name="importItemService"
 			ref="org.hisp.dhis.reportexcel.importitem.ImportItemService" />
 	</bean>
@@ -1028,7 +1038,17 @@
 		<property name="importItemService"
 			ref="org.hisp.dhis.reportexcel.importitem.ImportItemService" />
 	</bean>
-
+	
+	<bean
+		id="org.hisp.dhis.reportexcel.importitem.action.ShowUpdateImportItemFormAction"
+		class="org.hisp.dhis.reportexcel.importitem.action.ShowUpdateImportItemFormAction"
+		scope="prototype">
+		<property name="dataElementService"
+			ref="org.hisp.dhis.dataelement.DataElementService" />
+		<property name="importItemService"
+			ref="org.hisp.dhis.reportexcel.importitem.ImportItemService" />
+	</bean>
+	
 	<bean
 		id="org.hisp.dhis.reportexcel.importitem.action.ValidateImportItemAction"
 		class="org.hisp.dhis.reportexcel.importitem.action.ValidateImportItemAction"
@@ -1101,18 +1121,44 @@
 		<property name="selectionManager"
 			ref="org.hisp.dhis.reportexcel.state.SelectionManager" />
 	</bean>
+	
+	<!--  function - Prewiew Data - NORMAL  -->
+	<bean 
+		id="org.hisp.dhis.reportexcel.importing.action.ViewDataNormalAction"
+		class="org.hisp.dhis.reportexcel.importing.action.ViewDataNormalAction"
+		scope="prototype">
+		<property name="importItemService"
+			ref="org.hisp.dhis.reportexcel.importitem.ImportItemService" />
+		<property name="selectionManager"
+			ref="org.hisp.dhis.reportexcel.state.SelectionManager" />
+	</bean>
+
+	<!--  function - Prewiew Data - CATEGORY  -->
+	<bean 
+		id="org.hisp.dhis.reportexcel.importing.action.ViewDataCategoryAction"
+		class="org.hisp.dhis.reportexcel.importing.action.ViewDataCategoryAction"
+		scope="prototype">
+		<property name="importItemService"
+			ref="org.hisp.dhis.reportexcel.importitem.ImportItemService" />
+		<property name="selectionManager"
+			ref="org.hisp.dhis.reportexcel.state.SelectionManager" />
+	</bean>
 
 	<!--  function - Prewiew Data - ORGANISATION GROUP  -->
 	<bean
 		id="org.hisp.dhis.reportexcel.importing.action.ViewDataOrganizationGroupAction"
 		class="org.hisp.dhis.reportexcel.importing.action.ViewDataOrganizationGroupAction"
 		scope="prototype">
+		<property name="importItemService"
+			ref="org.hisp.dhis.reportexcel.importitem.ImportItemService" />
+		<property name="selectionManager"
+			ref="org.hisp.dhis.reportexcel.state.SelectionManager" />
 		<property name="organisationUnitSelectionManager"
 			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
 	</bean>
 
 	<!--  function - Import data flow -->
-
+	
 	<bean id="org.hisp.dhis.reportexcel.importing.action.ImportDataFlowAction"
 		class="org.hisp.dhis.reportexcel.importing.action.ImportDataFlowAction"
 		scope="prototype">
@@ -1120,24 +1166,56 @@
 			ref="org.hisp.dhis.reportexcel.importitem.ImportItemService" />
 		<property name="periodGenericManager"
 			ref="org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager" />
-
+		<property name="selectionManager"
+			ref="org.hisp.dhis.reportexcel.state.SelectionManager" />
 	</bean>
 
 	<!--  function - Import data - NORMAL  -->
-	<bean
-		id="org.hisp.dhis.reportexcel.importing.action.ImportDataNormalExcelGroupAction"
-		class="org.hisp.dhis.reportexcel.importing.action.ImportDataNormalExcelGroupAction"
-		scope="prototype">
-		<property name="importItemService"
-			ref="org.hisp.dhis.reportexcel.importitem.ImportItemService" />
-		<property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
-		<property name="organisationUnitSelectionManager"
-			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
-		<property name="expressionService" ref="org.hisp.dhis.expression.ExpressionService" />
-		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
-		<property name="categoryService"
-			ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
-		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+	<bean id="org.hisp.dhis.reportexcel.importing.action.ImportDataNormalAction"
+		class="org.hisp.dhis.reportexcel.importing.action.ImportDataNormalAction"
+		scope="prototype">
+		<property name="importItemService"
+			ref="org.hisp.dhis.reportexcel.importitem.ImportItemService" />
+		<property name="dataValueService"
+			ref="org.hisp.dhis.datavalue.DataValueService" />
+		<property name="dataElementService"
+			ref="org.hisp.dhis.dataelement.DataElementService" />
+		<property name="categoryService"
+			ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
+		<property name="expressionService"
+			ref="org.hisp.dhis.expression.ExpressionService" />
+		<property name="organisationUnitService"
+			ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+		<property name="organisationUnitSelectionManager"
+			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
+		<property name="currentUserService"
+			ref="org.hisp.dhis.user.CurrentUserService" />
+		<property name="periodGenericManager"
+			ref="org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager" />
+		<property name="selectionManager"
+			ref="org.hisp.dhis.reportexcel.state.SelectionManager" />
+	</bean>
+	
+	<!--  function - Import data - CATEGORY  -->
+	<bean id="org.hisp.dhis.reportexcel.importing.action.ImportDataCategoryAction"
+		class="org.hisp.dhis.reportexcel.importing.action.ImportDataCategoryAction"
+		scope="prototype">
+		<property name="importItemService"
+			ref="org.hisp.dhis.reportexcel.importitem.ImportItemService" />
+		<property name="dataValueService"
+			ref="org.hisp.dhis.datavalue.DataValueService" />
+		<property name="dataElementService"
+			ref="org.hisp.dhis.dataelement.DataElementService" />
+		<property name="categoryService"
+			ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
+		<property name="expressionService"
+			ref="org.hisp.dhis.expression.ExpressionService" />
+		<property name="organisationUnitService"
+			ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+		<property name="organisationUnitSelectionManager"
+			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
+		<property name="currentUserService"
+			ref="org.hisp.dhis.user.CurrentUserService" />
 		<property name="periodGenericManager"
 			ref="org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager" />
 		<property name="selectionManager"
@@ -1145,45 +1223,27 @@
 	</bean>
 
 	<!--  function - Import data - ORGANISATION UNIT  -->
-	<bean
-		id="org.hisp.dhis.reportexcel.importing.action.ImportDataExcelOrganizationGroupAction"
-		class="org.hisp.dhis.reportexcel.importing.action.ImportDataExcelOrganizationGroupAction"
+	<bean id="org.hisp.dhis.reportexcel.importing.action.ImportDataOrganizationGroupAction"
+		class="org.hisp.dhis.reportexcel.importing.action.ImportDataOrganizationGroupAction"
 		scope="prototype">
 		<property name="importItemService"
 			ref="org.hisp.dhis.reportexcel.importitem.ImportItemService" />
-		<property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
-		<property name="organisationUnitSelectionManager"
-			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
-		<property name="expressionService" ref="org.hisp.dhis.expression.ExpressionService" />
-		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+		<property name="dataValueService"
+			ref="org.hisp.dhis.datavalue.DataValueService" />
+		<property name="dataElementService"
+			ref="org.hisp.dhis.dataelement.DataElementService" />
 		<property name="categoryService"
 			ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
-		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
-		<property name="periodGenericManager"
-			ref="org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager" />
+		<property name="expressionService"
+			ref="org.hisp.dhis.expression.ExpressionService" />
 		<property name="organisationUnitService"
 			ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
-		<property name="selectionManager"
-			ref="org.hisp.dhis.reportexcel.state.SelectionManager" />
-	</bean>
-
-	<!--  function - Import data - CATEGORY  -->
-	<bean
-		id="org.hisp.dhis.reportexcel.importing.action.ImportDataCategoryExcelGroupAction"
-		class="org.hisp.dhis.reportexcel.importing.action.ImportDataCategoryExcelGroupAction"
-		scope="prototype">
-		<property name="importItemService"
-			ref="org.hisp.dhis.reportexcel.importitem.ImportItemService" />
-		<property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
 		<property name="organisationUnitSelectionManager"
 			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
-		<property name="expressionService" ref="org.hisp.dhis.expression.ExpressionService" />
-		<property name="categoryService"
-			ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
-		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+		<property name="currentUserService"
+			ref="org.hisp.dhis.user.CurrentUserService" />
 		<property name="periodGenericManager"
 			ref="org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager" />
-		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
 		<property name="selectionManager"
 			ref="org.hisp.dhis.reportexcel.state.SelectionManager" />
 	</bean>
@@ -1233,7 +1293,8 @@
 		id="org.hisp.dhis.reportexcel.filemanager.action.ExcelTemplateListAction"
 		class="org.hisp.dhis.reportexcel.filemanager.action.ExcelTemplateListAction"
 		scope="prototype">
-		<property name="exportReportService" ref="org.hisp.dhis.reportexcel.ExportReportService" />
+		<property name="exportReportService"
+			ref="org.hisp.dhis.reportexcel.ExportReportService" />
 		<property name="reportLocationManager"
 			ref="org.hisp.dhis.reportexcel.ReportLocationManager" />
 		<property name="selectionManager"
@@ -1384,6 +1445,14 @@
 		class="org.hisp.dhis.reportexcel.jchart.action.GetJChartAction" scope="prototype">
 		<property name="jchartService" ref="org.hisp.dhis.jchart.JChartService" />
 	</bean>
+	
+	<bean id="org.hisp.dhis.reportexcel.jchart.action.PrepareDataForAddOrUpdateJChartAction"
+		class="org.hisp.dhis.reportexcel.jchart.action.PrepareDataForAddOrUpdateJChartAction"
+		scope="prototype">
+		<property name="jchartService" ref="org.hisp.dhis.jchart.JChartService" />
+		<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
+		<property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
+	</bean>
 
 	<bean id="org.hisp.dhis.reportexcel.jchart.action.UpdateJChartAction"
 		class="org.hisp.dhis.reportexcel.jchart.action.UpdateJChartAction"

=== modified file 'local/vn/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties'
--- local/vn/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties	2011-05-27 04:45:31 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties	2011-06-07 05:41:55 +0000
@@ -132,7 +132,7 @@
 import_item					= Excel items
 associations				= Associations
 sheetNo						= Sheet
-choose_import_tem			= Please choose import items
+choose_import_item			= Please choose import items
 copy_items_duplicated       = Warning! Cannot copy the duplicated item(s)
 copy_successful             = Copy successful \!
 copy_selected_item_to_import_item = Copy export item to import item
@@ -145,13 +145,13 @@
 enddate_null				= Please enter end date
 select_report               = [Select report]
 not_null					= not null
-choose_orgUnit				= Not choose organisation yet
+choose_org_unit				= Not choose organisation yet
 choose_period				= Not choose period yet
 choose_dataelement			= Not choose dataelement yet
 i18n_name_is_null 			= Please enter name!
 input_sheet_no				= Not input sheet yet
-choose_report 				= Not choose report yet
-choose_excel_group 			= Not choose excel group yet
+choose_export_report 		= Not choose export report yet
+choose_import_report		= Not choose import report yet
 choose_dataelement			= Not choose dataelement yet
 warning_upload_is_null      = Please choose your excel file to upload \!
 list_of_import_items        = List of import items
@@ -275,4 +275,7 @@
 there_is_no_import_report	= There is no Import Report/Import Item in system
 export_reports				= Export Reports
 generate_export_report		= Generate export report
-set_organisationunit_group_level = Set up Organisation unit group level
\ No newline at end of file
+set_organisationunit_group_level = Set up Organisation unit group level
+import_unsuccessfully		= Import unsuccessfully
+import_successfully			= Import successfully
+period_listing_importing_not_support = Sorry! Period Listing Importing is not supported.
\ No newline at end of file

=== modified file 'local/vn/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties'
--- local/vn/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties	2011-05-27 04:45:31 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties	2011-06-07 05:41:55 +0000
@@ -161,8 +161,8 @@
 value_rounded               = Gi\u00e1 tr\u1ecb n\u00e0y c\u00f3 th\u1ec3 \u0111\u00e3 \u0111\u01b0\u1ee3c l\u00e0m tr\u00f2n
 no_item						= Kh\u00f4ng c\u00f3 ph\u1ea7n t\u1eed \u0111\u01b0\u1ee3c ch\u1ecdn
 input_sheet_no				= Ch\u01b0a nh\u1eadp sheet
-choose_excel_group          = Ch\u01b0a ch\u1ecdn nh\u00f3m
-choose_report               = Ch\u01b0a ch\u1ecdn b\u00e1o c\u00e1o
+choose_import_report        = Ch\u01b0a ch\u1ecdn b\u00e1o c\u00e1o Nh\u1eadp
+choose_export_report        = Ch\u01b0a ch\u1ecdn b\u00e1o c\u00e1o Xu\u1ea5t
 excel_template_management   = Qu\u1ea3n l\u00fd c\u00e1c t\u1eadp tin excel m\u1eabu
 confirm_override            = B\u1ea1n c\u00f3 mu\u1ed1n ghi \u0111\u00e8 l\u00ean t\u1eadp tin \u0111\u00e3 c\u00f3\?
 file_exists                 = T\u1eadp tin excel n\u00e0y \u0111ang t\u1ed3n t\u1ea1i \!
@@ -269,4 +269,7 @@
 there_is_no_import_report	= Ch\u01b0a c\u00f3 nh\u00f3m ph\u1ea7n t\u1eed import d\u1eef li\u1ec7u n\u00e0o \u0111\u01b0\u1ee3c t\u1ea1o trong h\u1ec7 th\u1ed1ng
 export_reports				= B\u00e1o c\u00e1o Xu\u1ea5t
 generate_export_report		= Xu\u1ea5t b\u00e1o c\u00e1o
-set_organisationunit_group_level = Thi\u1ebft l\u1eadp c\u1ea5p hi\u1ec3n th\u1ecb cho nh\u00f3m \u0111\u01a1n v\u1ecb
\ No newline at end of file
+set_organisationunit_group_level = Thi\u1ebft l\u1eadp c\u1ea5p hi\u1ec3n th\u1ecb cho nh\u00f3m \u0111\u01a1n v\u1ecb
+import_unsuccessfully		= Import kh\u00f4ng th\u00e0nh c\u00f4ng
+import_successfully			= Import kh\u00f4ng th\u00e0nh c\u00f4ng
+period_listing_importing_not_support = R\u1ea5t ti\u1ebfc, hi\u00ean t\u1ea1i h\u1ec7 th\u1ed1ng ch\u01b0a h\u1ed7 tr\u1ee3 import d\u1eef li\u1ec7u d\u1ea1ng danh s\u00e1ch theo th\u1eddi gian.
\ No newline at end of file

=== modified file 'local/vn/dhis-web-excel-reporting/src/main/resources/struts.xml'
--- local/vn/dhis-web-excel-reporting/src/main/resources/struts.xml	2011-05-27 04:45:31 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/resources/struts.xml	2011-06-07 05:41:55 +0000
@@ -154,15 +154,9 @@
 		</action>
 
 		<action name="updateExportReportForm"
-			class="org.hisp.dhis.reportexcel.exportreport.action.GetExportReportAction">
-			<result name="success" type="chain">updateExportReportFormChain
-			</result>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
-		</action>
-
-		<action name="updateExportReportFormChain"
 			class="org.hisp.dhis.reportexcel.filemanager.action.ExcelTemplateListAction">
 			<result name="success" type="velocity">/main.vm</result>
+			<result name="error" type="redirect">listAllExportReport.action</result>
 			<param name="page">/dhis-web-excel-reporting/report/updateExportReportForm.vm</param>
 			<param name="javascripts">javascript/exportReports.js</param>			
 			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
@@ -445,18 +439,14 @@
 
 		<action name="generateExportReport"
 			class="org.hisp.dhis.reportexcel.exporting.action.GenerateExcelReportFlowAction">
-			<result name="CATEGORY" type="chain">
-				generateReportCategory
-			</result>
-			<result name="NORMAL" type="chain">
-				generateReportNormal
-			</result>
-			<result name="ORGANIZATION_GROUP_LISTING" type="chain">
-				generateReportOrgGroupListing
-			</result>
-			<result name="PERIOD_COLUMN_LISTING" type="chain">
-				generateReportPeriodColumnListing
-			</result>
+			<result name="CATEGORY" type="redirect">
+				generateReportCategory.action</result>
+			<result name="NORMAL" type="redirect">
+				generateReportNormal.action</result>
+			<result name="ORGANIZATION_GROUP_LISTING" type="redirect">
+				generateReportOrgGroupListing.action</result>
+			<result name="PERIOD_COLUMN_LISTING" type="redirect">
+				generateReportPeriodColumnListing.action</result>
 		</action>
 
 		<action name="generateReportCategory"
@@ -592,45 +582,41 @@
 
 		<action name="previewExportReport"
 			class="org.hisp.dhis.reportexcel.exporting.action.GenerateExcelReportFlowAction">
-			<result name="CATEGORY" type="chain">
-				generatePreviewCategory
-			</result>
-			<result name="NORMAL" type="chain">
-				generatePreviewNormal
-			</result>
-			<result name="ORGANIZATION_GROUP_LISTING" type="chain">
-				generatePreviewOrgGroupListing
-			</result>
-			<result name="PERIOD_COLUMN_LISTING" type="chain">
-				generatePreviewPeriodColumnListing
-			</result>
+			<result name="CATEGORY" type="redirect">
+				generatePreviewCategory.action</result>
+			<result name="NORMAL" type="redirect">
+				generatePreviewNormal.action</result>
+			<result name="ORGANIZATION_GROUP_LISTING" type="redirect">
+				generatePreviewOrgGroupListing.action</result>
+			<result name="PERIOD_COLUMN_LISTING" type="redirect">
+				generatePreviewPeriodColumnListing.action</result>
 		</action>
 
 		<action name="generatePreviewCategory"
 			class="org.hisp.dhis.reportexcel.exporting.action.GenerateReportCategoryAction">
-			<result name="success" type="chain">exportXMLChain
+			<result name="success" type="redirect">exportXML.action
 			</result>
 		</action>
 
 		<action name="generatePreviewNormal"
 			class="org.hisp.dhis.reportexcel.exporting.action.GenerateReportNormalAction">
-			<result name="success" type="chain">exportXMLChain
+			<result name="success" type="redirect">exportXML.action
 			</result>
 		</action>
 
 		<action name="generatePreviewOrgGroupListing"
 			class="org.hisp.dhis.reportexcel.exporting.action.GenerateReportOrgGroupListingAction">
-			<result name="success" type="chain">exportXMLChain
+			<result name="success" type="redirect">exportXML.action
 			</result>
 		</action>
 
 		<action name="generatePreviewPeriodColumnListing"
 			class="org.hisp.dhis.reportexcel.exporting.action.GenerateReportPeriodColumnListingAction">
-			<result name="success" type="chain">exportXMLChain
+			<result name="success" type="redirect">exportXML.action
 			</result>
 		</action>
 
-		<action name="exportXMLChain"
+		<action name="exportXML"
 			class="org.hisp.dhis.reportexcel.preview.action.ExportXMLAction">
 			<result name="success" type="velocity-xml">
 				/dhis-web-excel-reporting/responseExportReportPreview.vm</result>			
@@ -662,15 +648,14 @@
 
 		<action name="generateAdvancedExportReport"
 			class="org.hisp.dhis.reportexcel.exporting.action.GenerateExcelReportFlowAction">
-			<result name="CATEGORY" type="chain">
-				generateAdvancedReportCategory
-			</result>
-			<result name="NORMAL" type="chain">generateAdvancedReportNormal
-			</result>
-			<result name="ORGANIZATION_GROUP_LISTING" type="chain">
-				generateAdvancedReportOrganizationGroupListing</result>
-			<result name="PERIOD_COLUMN_LISTING" type="chain">
-				generateAdvancedReportPeriodColumnListingAction</result>
+			<result name="CATEGORY" type="redirect">
+				generateAdvancedReportCategory.action</result>
+			<result name="NORMAL" type="redirect">
+				generateAdvancedReportNormal.action</result>
+			<result name="ORGANIZATION_GROUP_LISTING" type="redirect">
+				generateAdvancedReportOrganizationGroupListing.action</result>
+			<result name="PERIOD_COLUMN_LISTING" type="redirect">
+				generateAdvancedReportPeriodColumnListing.action</result>
 		</action>
 
 		<action name="generateAdvancedReportNormal"
@@ -685,7 +670,7 @@
 				/dhis-web-commons/ajax/xmlResponseSuccess.vm</result>
 		</action>
 
-		<action name="generateAdvancedReportPeriodColumnListingAction"
+		<action name="generateAdvancedReportPeriodColumnListing"
 			class="org.hisp.dhis.reportexcel.exporting.advance.action.GenerateAdvancedReportPeriodColumnListingAction">
 			<result name="success" type="velocity-xml">
 				/dhis-web-commons/ajax/xmlResponseSuccess.vm</result>
@@ -701,41 +686,37 @@
 
 		<action name="previewAdvancedExportReport"
 			class="org.hisp.dhis.reportexcel.exporting.action.GenerateExcelReportFlowAction">
-			<result name="CATEGORY" type="chain">
-				generatePreviewAdvancedCategory
-			</result>
-			<result name="NORMAL" type="chain">
-				generatePreviewAdvancedNormal
-			</result>
-			<result name="ORGANIZATION_GROUP_LISTING" type="chain">
-				generatePreviewAdvancedOrgGroupListing
-			</result>
-			<result name="PERIOD_COLUMN_LISTING" type="chain">
-				generatePreviewAdvancedPeriodColumnListing
-			</result>
+			<result name="CATEGORY" type="redirect">
+				generatePreviewAdvancedCategory.action</result>
+			<result name="NORMAL" type="redirect">
+				generatePreviewAdvancedNormal.action</result>
+			<result name="ORGANIZATION_GROUP_LISTING" type="redirect">
+				generatePreviewAdvancedOrgGroupListing.action</result>
+			<result name="PERIOD_COLUMN_LISTING" type="redirect">
+				generatePreviewAdvancedPeriodColumnListing.action</result>
 		</action>
 
 		<action name="generatePreviewAdvancedCategory"
 			class="org.hisp.dhis.reportexcel.exporting.advance.action.GenerateAdvancedReportCategoryAction">
-			<result name="success" type="chain">exportXMLChain
+			<result name="success" type="redirect">exportXML.action
 			</result>
 		</action>
 
 		<action name="generatePreviewAdvancedNormal"
 			class="org.hisp.dhis.reportexcel.exporting.advance.action.GenerateAdvancedReportNormalAction">
-			<result name="success" type="chain">exportXMLChain
+			<result name="success" type="redirect">exportXML.action
 			</result>
 		</action>
 
 		<action name="generatePreviewAdvancedOrgGroupListing"
 			class="org.hisp.dhis.reportexcel.exporting.advance.action.GenerateAdvancedReportOrgGroupListingAction">
-			<result name="success" type="chain">exportXMLChain
+			<result name="success" type="redirect">exportXML.action
 			</result>
 		</action>
 
 		<action name="generatePreviewAdvancedPeriodColumnListing"
 			class="org.hisp.dhis.reportexcel.exporting.advance.action.GenerateAdvancedReportPeriodColumnListingAction">
-			<result name="success" type="chain">exportXMLChain
+			<result name="success" type="redirect">exportXML.action
 			</result>
 		</action>
 
@@ -787,14 +768,7 @@
 		</action>
 
 		<action name="updateImportReportForm"
-			class="org.hisp.dhis.commons.action.GetPeriodTypesAction">
-			<result name="success" type="chain">updateImportReportFormChain
-			</result>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
-		</action>
-
-		<action name="updateImportReportFormChain"
-			class="org.hisp.dhis.reportexcel.importreport.action.GetImportReportByIdAction">
+			class="org.hisp.dhis.reportexcel.importreport.action.ShowUpdateImportReportFormAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-excel-reporting/import/updateImportReport.vm</param>
 			<param name="javascripts">javascript/importReports.js</param>
@@ -803,9 +777,7 @@
 
 		<action name="updateImportReport"
 			class="org.hisp.dhis.reportexcel.importreport.action.UpdateImportReportAction">
-			<result name="success" type="redirect">
-				listAllImportReport.action
-			</result>
+			<result name="success" type="redirect">listAllImportReport.action</result>
 		</action>
 
 		<action name="validateImportReport"
@@ -959,13 +931,7 @@
 		</action>
 
 		<action name="updateImportItemForm"
-			class="org.hisp.dhis.reportexcel.importitem.action.SetupImportItemFormAction">
-			<result name="success" type="chain">updateImportItemChainForm
-			</result>
-		</action>
-
-		<action name="updateImportItemChainForm"
-			class="org.hisp.dhis.reportexcel.importitem.action.GetImportItemByIdAction">
+			class="org.hisp.dhis.reportexcel.importitem.action.ShowUpdateImportItemFormAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-excel-reporting/import/updateImportItem.vm</param>
 			<param name="javascripts">javascript/importItems.js</param>
@@ -1063,18 +1029,14 @@
 
 		<action name="previewDataFlow"
 			class="org.hisp.dhis.reportexcel.importing.action.ViewDataFlowAction">
-			<result name="CATEGORY" type="chain">
-				previewDataCategory
-			</result>
-			<result name="NORMAL" type="chain">
-				previewDataNormal
-			</result>
-			<result name="ORGANIZATION_GROUP_LISTING" type="chain">
-				previewDataOrganizationGroup
-			</result>
-			<result name="PERIOD_COLUMN_LISTING" type="chain">
-				previewDataNormal
-			</result>
+			<result name="CATEGORY" type="redirect">
+				previewDataCategory.action</result>
+			<result name="NORMAL" type="redirect">
+				previewDataNormal.action</result>
+			<result name="ORGANIZATION_GROUP_LISTING" type="redirect">
+				previewDataOrganizationGroup.action</result>
+			<result name="PERIOD_COLUMN_LISTING" type="redirect">
+				previewDataNormal.action</result>
 		</action>
 
 		<!--  function - Prewiew Data - NORMAL -->
@@ -1086,6 +1048,16 @@
 				/dhis-web-commons/ajax/xmlResponseError.vm</result>		
 		</action>
 
+		<!--  function - Prewiew Data - CATEGORY GROUP  -->
+		<action name="previewDataCategory"
+			class="org.hisp.dhis.reportexcel.importing.action.ViewDataCategoryAction">
+			<result name="success" type="velocity">
+				/dhis-web-excel-reporting/responseImportItemValuesByCategory.vm
+			</result>
+			<result name="error" type="velocity-xml">
+				/dhis-web-commons/ajax/xmlResponseError.vm</result>
+		</action>
+		
 		<!--  function - Prewiew Data - ORGANISATION GROUP  -->
 		<action name="previewDataOrganizationGroup"
 			class="org.hisp.dhis.reportexcel.importing.action.ViewDataOrganizationGroupAction">
@@ -1096,58 +1068,43 @@
 				/dhis-web-commons/ajax/xmlResponseError.vm</result>		
 		</action>
 
-		<!--  function - Prewiew Data - CATEGORY GROUP  -->
-		
-		<action name="previewDataCategory"
-			class="org.hisp.dhis.reportexcel.importing.action.ViewDataCategoryAction">
-			<result name="success" type="velocity">
-				/dhis-web-excel-reporting/responseImportItemValuesByCategory.vm
-			</result>
-			<result name="error" type="velocity-xml">
-				/dhis-web-commons/ajax/xmlResponseError.vm</result>
-		</action>
-
-
+		<!--WORKING HERE-->
 		<action name="importData"
 			class="org.hisp.dhis.reportexcel.importing.action.ImportDataFlowAction">
-			<result name="CATEGORY" type="chain">
-				importDataCategoryExcelGroup
-			</result>
-			<result name="NORMAL" type="chain">
-				importDataNormalExcelGroup
-			</result>
-			<result name="ORGANIZATION_GROUP_LISTING" type="chain">
-				importDataExcelOrganizationGroup
-			</result>
-			<result name="PERIOD_COLUMN_LISTING" type="chain">
-				generateExportReportPeriodColumnListingAjax
-			</result>
-		</action>
-
-		<action name="importDataNormalExcelGroup"
-			class="org.hisp.dhis.reportexcel.importing.action.ImportDataNormalExcelGroupAction">
-			<result name="success" type="velocity-xml">
-				/dhis-web-commons/ajax/xmlResponseSuccess.vm</result>
-			<result name="error" type="velocity-xml">
-				/dhis-web-commons/ajax/xmlResponseError.vm</result>
-		</action>
-
-		<action name="importDataExcelOrganizationGroup"
-			class="org.hisp.dhis.reportexcel.importing.action.ImportDataExcelOrganizationGroupAction">
-			<result name="success" type="velocity-xml">
-				/dhis-web-commons/ajax/xmlResponseSuccess.vm</result>
-			<result name="error" type="velocity-xml">
-				/dhis-web-commons/ajax/xmlResponseError.vm</result>
-		</action>
-
-		<action name="importDataCategoryExcelGroup"
-			class="org.hisp.dhis.reportexcel.importing.action.ImportDataCategoryExcelGroupAction">
-			<result name="success" type="velocity-xml">
-				/dhis-web-commons/ajax/xmlResponseSuccess.vm</result>
-			<result name="error" type="velocity-xml">
-				/dhis-web-commons/ajax/xmlResponseError.vm</result>
-		</action>
-
+			<result name="NORMAL" type="redirect">
+				importDataNormal?importReportId=${importReportId}</result>
+			<result name="CATEGORY" type="redirect">
+				importDataCategory</result>
+			<result name="ORGANIZATION_GROUP_LISTING" type="redirect">
+				importDataOrganizationGroup</result>
+			<result name="PERIOD_COLUMN_LISTING" type="redirect">
+				generateExportReportPeriodColumnListingAjax</result>
+		</action>
+
+		<action name="importDataNormal"
+			class="org.hisp.dhis.reportexcel.importing.action.ImportDataNormalAction">
+			<result name="success" type="velocity-xml">
+				/dhis-web-commons/ajax/xmlResponseSuccess.vm</result>
+			<result name="error" type="velocity-xml">
+				/dhis-web-commons/ajax/xmlResponseError.vm</result>
+		</action>
+
+		<action name="importDataCategory"
+			class="org.hisp.dhis.reportexcel.importing.action.ImportDataCategoryAction">
+			<result name="success" type="velocity-xml">
+				/dhis-web-commons/ajax/xmlResponseSuccess.vm</result>
+			<result name="error" type="velocity-xml">
+				/dhis-web-commons/ajax/xmlResponseError.vm</result>
+		</action>
+		
+		<action name="importDataOrganizationGroup"
+			class="org.hisp.dhis.reportexcel.importing.action.ImportDataOrganizationGroupAction">
+			<result name="success" type="velocity-xml">
+				/dhis-web-commons/ajax/xmlResponseSuccess.vm</result>
+			<result name="error" type="velocity-xml">
+				/dhis-web-commons/ajax/xmlResponseError.vm</result>
+		</action>
+		
 		<!-- Period Column -->
 
 		<action name="periodColumns"
@@ -1159,8 +1116,8 @@
 
 		<action name="savePeriodColumn"
 			class="org.hisp.dhis.reportexcel.periodcolumn.action.SavePeriodColumnAction">
-			<result name="success" type="redirect">periodColumns.action?id=${exportReportId}
-			</result>
+			<result name="success" type="redirect">
+				periodColumns.action?id=${exportReportId}</result>
 		</action>
 
 		<action name="updatePeriodColumn"
@@ -1251,17 +1208,7 @@
 		</action>	
 		
 		<action name="addJChartForm"
-			class="org.hisp.dhis.commons.action.GetPeriodTypesAction">
-			<result name="success" type="chain">addJChartFormChain1</result>								
-		</action>
-		
-		<action name="addJChartFormChain1"
-			class="org.hisp.dhis.commons.action.GetIndicatorGroupsAction">
-			<result name="success" type="chain">addJChartFormChain2</result>						
-		</action>	
-		
-		<action name="addJChartFormChain2"
-			class="org.hisp.dhis.reportexcel.action.NoAction">
+			class="org.hisp.dhis.reportexcel.jchart.action.PrepareDataForAddOrUpdateJChartAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-excel-reporting/chart/addJChart.vm</param>
 			<param name="menu">/dhis-web-excel-reporting/menu.vm</param>
@@ -1281,17 +1228,7 @@
 		</action>
 		
 		<action name="updateJChartForm"
-			class="org.hisp.dhis.commons.action.GetPeriodTypesAction">
-			<result name="success" type="chain">updateJChartFormChain1</result>								
-		</action>
-		
-		<action name="updateJChartFormChain1"
-			class="org.hisp.dhis.commons.action.GetIndicatorGroupsAction">
-			<result name="success" type="chain">updateJChartFormChain2</result>						
-		</action>	
-		
-		<action name="updateJChartFormChain2"
-			class="org.hisp.dhis.reportexcel.jchart.action.GetJChartAction">
+			class="org.hisp.dhis.reportexcel.jchart.action.PrepareDataForAddOrUpdateJChartAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-excel-reporting/chart/updateJChart.vm</param>
 			<param name="menu">/dhis-web-excel-reporting/menu.vm</param>

=== modified file 'local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/importDataParams.vm'
--- local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/importDataParams.vm	2011-05-24 07:48:23 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/importDataParams.vm	2011-06-07 05:41:55 +0000
@@ -46,8 +46,8 @@
 					</select>
 				</td>
 				<td>
-					<input type="button" value="<<" id="lastYear" name="lastYear" onclick="lastPeriod();"  #if(!$!fileExcel || !$!organisationUnit) disabled #end/>
-					<input type="button" value=">>" id="nextYear" name="nextYear" onclick="nextPeriod()" #if(!$!fileExcel || !$!organisationUnit) disabled #end />
+					<input type="button" value="&lt;&lt;" id="lastYear" name="lastYear" onclick="lastPeriod();"  #if(!$!fileExcel || !$!organisationUnit) disabled #end/>
+					<input type="button" value="&gt;&gt;" id="nextYear" name="nextYear" onclick="nextPeriod()" #if(!$!fileExcel || !$!organisationUnit) disabled #end />
 					<input type="button" onClick="javascript: importData();" style="width:100px" value="$i18n.getString('import')" #if(!$!fileExcel || !$!organisationUnit) disabled #end>
 				</td>
 			</tr>

=== modified file 'local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/imports.js'
--- local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/imports.js	2011-05-24 07:48:23 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/imports.js	2011-06-07 05:41:55 +0000
@@ -28,15 +28,15 @@
 				params +='&importItemIds=' + importItems[i].value;
 			}
 		}
-	}	
+	}
 	params += '&periodId='+ periodId;
 	request.sendAsPost(params);
 	request.send('importData.action'); 
 }
 
-function importDataCompleted( xmlObject ){
-	
-	setMessage(xmlObject.firstChild.nodeValue);	
+function importDataCompleted( xmlObject )
+{
+	setMessage(xmlObject.firstChild.nodeValue);
 }
 
 // -----------------------------------------------------------------------------

=== modified file 'local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/responseExportReportPreview.vm'
--- local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/responseExportReportPreview.vm	2011-05-18 09:23:52 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/responseExportReportPreview.vm	2011-06-07 05:41:55 +0000
@@ -1,6 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <reportXML>
-	
 	$!xmlStructureResponse
-	
 </reportXML>
\ No newline at end of file