← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 690: update excel reporting module

 

------------------------------------------------------------
revno: 690
committer: Tran Thanh Tri <Tran Thanh Tri@compaq>
branch nick: trunk
timestamp: Mon 2009-09-14 12:20:54 +0700
message:
  update excel reporting module
added:
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/ReportLocationManager.java
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/category/action/DeleteDataElementGroupOrderAction.java
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/configuration/
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/configuration/action/
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/configuration/action/GetReportConfigurationAction.java
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/configuration/action/SetReportConfigurationAction.java
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/FileUtils.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/ReportExcelService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/ReportExcelStore.java
  dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/DefaultReportExcelService.java
  dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/hibernate/HibernateReportExcelStore.java
  dhis-2/dhis-web/dhis-web-excel-reporting/pom.xml
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/category/action/SaveDataElementGroupOrderAction.java
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/category/action/UpdateDataElementGroupOrderAction.java
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription.
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/ReportExcelService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/ReportExcelService.java	2009-09-14 03:19:36 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/ReportExcelService.java	2009-09-14 05:20:54 +0000
@@ -93,6 +93,8 @@
     public DataElementGroupOrder getDataElementGroupOrder( Integer id );
 
     public void updateDataElementGroupOrder( DataElementGroupOrder dataElementGroupOrder );
+    
+    public void deleteDataElementGroupOrder( Integer id );
 
     // --------------------------------------
     // Data Entry Status
@@ -102,14 +104,16 @@
 
     public DataEntryStatus getDataEntryStatus( int id );
 
-    public void deleteDataEntryStatus( int id );   
+    public void deleteDataEntryStatus( int id );
 
     public Collection<DataEntryStatus> getALLDataEntryStatus();
 
-    public Collection<DataEntryStatus> getDataEntryStatusDefault();    
+    public Collection<DataEntryStatus> getDataEntryStatusDefault();
 
     Collection<DataEntryStatus> getDataEntryStatusDefaultByDataSets( Collection<DataSet> dataSets );
 
     public int countDataValueOfDataSet( DataSet dataSet, OrganisationUnit organisationUnit, Period period );
 
+   
+
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/ReportExcelStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/ReportExcelStore.java	2009-09-14 03:19:36 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/ReportExcelStore.java	2009-09-14 05:20:54 +0000
@@ -90,6 +90,8 @@
     public DataElementGroupOrder getDataElementGroupOrder( Integer id );
 
     public void updateDataElementGroupOrder( DataElementGroupOrder dataElementGroupOrder );
+    
+    public void deleteDataElementGroupOrder( Integer id );
 
     // --------------------------------------
     // Data Entry Status

=== modified file 'dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/DefaultReportExcelService.java'
--- dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/DefaultReportExcelService.java	2009-09-14 03:19:36 +0000
+++ dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/DefaultReportExcelService.java	2009-09-14 05:20:54 +0000
@@ -199,6 +199,11 @@
         reportStore.updateDataElementGroupOrder( dataElementGroupOrder );
     }
 
+    public void deleteDataElementGroupOrder( Integer id )
+    {
+        reportStore.deleteDataElementGroupOrder( id );
+    }
+
     // -------------------------------------------------
     // Data Entry Status
     // -------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/hibernate/HibernateReportExcelStore.java'
--- dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/hibernate/HibernateReportExcelStore.java	2009-09-14 03:19:36 +0000
+++ dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/hibernate/HibernateReportExcelStore.java	2009-09-14 05:20:54 +0000
@@ -45,7 +45,6 @@
 import org.hisp.dhis.reportexcel.ReportExcelStore;
 import org.hisp.dhis.reportexcel.status.DataEntryStatus;
 
-
 /**
  * @author Tran Thanh Tri
  * @version $Id$
@@ -213,8 +212,8 @@
     public Collection<ReportExcelItem> getReportExcelItem( int sheetNo, Integer reportId )
     {
         Session session = sessionFactory.getCurrentSession();
-        SQLQuery sqlQuery = session.createSQLQuery( "SELECT * from reportexcelitems where reportexcelitems.sheetno=" + sheetNo
-            + " and reportexcelitems.reportexcelid=" + reportId.intValue() );
+        SQLQuery sqlQuery = session.createSQLQuery( "SELECT * from reportexcelitems where reportexcelitems.sheetno="
+            + sheetNo + " and reportexcelitems.reportexcelid=" + reportId.intValue() );
         sqlQuery.addEntity( ReportExcelItem.class );
         return sqlQuery.list();
     }
@@ -247,6 +246,12 @@
         session.update( dataElementGroupOrder );
     }
 
+    public void deleteDataElementGroupOrder( Integer id )
+    {
+        Session session = sessionFactory.getCurrentSession();
+        session.delete( this.getDataElementGroupOrder( id ) );
+    }
+
     // -------------------------------------------------
     // Data Entry Status
     // -------------------------------------------------
@@ -311,7 +316,7 @@
         return (Integer) session.save( arg0 );
     }
 
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings( "unchecked" )
     public Collection<DataEntryStatus> getDataEntryStatusDefaultByDataSets( Collection<DataSet> dataSets )
     {
         Collection<DataEntryStatus> result = new HashSet<DataEntryStatus>();

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/pom.xml'
--- dhis-2/dhis-web/dhis-web-excel-reporting/pom.xml	2009-09-14 03:19:36 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/pom.xml	2009-09-14 05:20:54 +0000
@@ -10,7 +10,7 @@
   </parent>
   
   <artifactId>dhis-web-excel-reporting</artifactId>
-  <packaging>war</packaging>
+  <packaging>jar</packaging>
   <name>DHIS Web Excel Reporting</name>
   
   <build>

=== added file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/ReportLocationManager.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/ReportLocationManager.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/ReportLocationManager.java	2009-09-14 05:20:54 +0000
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2004-2007, 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.
+ */
+package org.hisp.dhis.reportexcel;
+
+import java.io.File;
+import java.util.List;
+
+import org.hisp.dhis.external.location.LocationManager;
+import org.hisp.dhis.external.location.LocationManagerException;
+import org.hisp.dhis.options.SystemSettingManager;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.reportexcel.utils.FileUtils;
+
+/**
+ * @author Tran Thanh Tri
+ * @version $Id$
+ */
+public class ReportLocationManager
+{
+    static final String REPORT_DIR = "report_vn";
+
+    static final String REPORT_TEMP_DIR = "temp";
+
+    private LocationManager locationManager;
+
+    private SystemSettingManager systemSettingManager;
+
+    private File REPORT;
+
+    private File REPORT_TEMP;
+
+    public void setLocationManager( LocationManager locationManager )
+    {
+        this.locationManager = locationManager;
+    }
+
+    public void setSystemSettingManager( SystemSettingManager systemSettingManager )
+    {
+        this.systemSettingManager = systemSettingManager;
+    }
+
+    void init()
+    {
+        try
+        {
+            REPORT = new File( locationManager.getExternalDirectory(), REPORT_DIR );
+            REPORT.mkdir();
+            REPORT_TEMP = new File( REPORT, REPORT_TEMP_DIR );
+            REPORT_TEMP.mkdir();
+
+        }
+        catch ( LocationManagerException e )
+        {
+            e.printStackTrace();
+        }
+
+    }
+
+    public File getReportTempDirectory()
+    {
+        return this.REPORT_TEMP;
+    }
+
+    public String getReportTemplateDirectory()
+    {
+        return (String) systemSettingManager.getSystemSetting( SystemSettingManager.KEY_REPORT_TEMPLATE_DIRECTORY );
+    }
+
+    public File getDirectory( OrganisationUnit organisationUnit )
+    {
+        File dir = new File( REPORT, String.valueOf( organisationUnit.getId() ) );
+        if ( !dir.exists() )
+        {
+            dir.mkdir();
+        }
+        return dir;
+    }
+
+    public List<File> getListFile( OrganisationUnit organisationUnit )
+    {
+        return FileUtils.getListFile( getDirectory( organisationUnit ) );
+    }
+
+}

=== added file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/category/action/DeleteDataElementGroupOrderAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/category/action/DeleteDataElementGroupOrderAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/category/action/DeleteDataElementGroupOrderAction.java	2009-09-14 05:20:54 +0000
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2004-2007, 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.
+ */
+
+package org.hisp.dhis.reportexcel.category.action;
+
+import org.hisp.dhis.reportexcel.ReportExcelService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Tran Thanh Tri
+ * @version $Id$
+ */
+public class DeleteDataElementGroupOrderAction
+    implements Action
+{
+
+    // -------------------------------------------
+    // Dependency
+    // -------------------------------------------
+
+    private ReportExcelService reportService;
+
+    // -------------------------------------------
+    // Input & Ouput
+    // -------------------------------------------
+
+    private Integer id;
+
+    // -------------------------------------------
+    // Getter & Setter
+    // -------------------------------------------
+
+    public void setReportService( ReportExcelService reportService )
+    {
+        this.reportService = reportService;
+    }
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    public String execute()
+        throws Exception
+    {
+        reportService.deleteDataElementGroupOrder( id );
+        
+        return SUCCESS;
+    }
+
+}

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/category/action/SaveDataElementGroupOrderAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/category/action/SaveDataElementGroupOrderAction.java	2009-09-14 03:19:36 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/category/action/SaveDataElementGroupOrderAction.java	2009-09-14 05:20:54 +0000
@@ -87,9 +87,20 @@
         this.dataElementIds = dataElementIds;
     }
 
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    public Integer getId()
+    {
+        return id;
+    }
+
     public String execute()
         throws Exception
     {
+
         ReportExcelCategory reportExcelCategory = (ReportExcelCategory) reportService.getReportExcel( id );
 
         DataElementGroupOrder dataElementGroupOrder = new DataElementGroupOrder();

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/category/action/UpdateDataElementGroupOrderAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/category/action/UpdateDataElementGroupOrderAction.java	2009-09-14 03:19:36 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/category/action/UpdateDataElementGroupOrderAction.java	2009-09-14 05:20:54 +0000
@@ -85,6 +85,16 @@
         this.dataElementIds = dataElementIds;
     }
 
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    public Integer getId()
+    {
+        return id;
+    }
+
     public String execute()
         throws Exception
     {
@@ -95,14 +105,14 @@
         for ( String id : dataElementIds )
         {
 
-            DataElement dataElement = dataElementService.getDataElement( Integer.parseInt( id ) );          
+            DataElement dataElement = dataElementService.getDataElement( Integer.parseInt( id ) );
 
             dataElements.add( dataElement );
 
         }
-        
-        dataElementGroupOrder.setDataElements( dataElements );       
-        
+
+        dataElementGroupOrder.setDataElements( dataElements );
+
         dataElementGroupOrder.setName( name );
 
         reportService.updateDataElementGroupOrder( dataElementGroupOrder );

=== added directory 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/configuration'
=== added directory 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/configuration/action'
=== added file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/configuration/action/GetReportConfigurationAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/configuration/action/GetReportConfigurationAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/configuration/action/GetReportConfigurationAction.java	2009-09-14 05:20:54 +0000
@@ -0,0 +1,42 @@
+package org.hisp.dhis.reportexcel.configuration.action;
+
+import org.hisp.dhis.options.SystemSettingManager;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetReportConfigurationAction
+    implements Action
+{   
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private SystemSettingManager systemSettingManager;
+
+    public void setSystemSettingManager( SystemSettingManager systemSettingManager )
+    {
+        this.systemSettingManager = systemSettingManager;
+    }
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+    
+    private String templateDirectory;   
+    
+    public String getTemplateDirectory()
+    {
+        return templateDirectory;
+    }
+
+
+
+    public String execute()
+        throws Exception
+    {
+        templateDirectory = (String) systemSettingManager.getSystemSetting( SystemSettingManager.KEY_REPORT_TEMPLATE_DIRECTORY );
+        
+        return SUCCESS;
+    }
+
+}

=== added file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/configuration/action/SetReportConfigurationAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/configuration/action/SetReportConfigurationAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/configuration/action/SetReportConfigurationAction.java	2009-09-14 05:20:54 +0000
@@ -0,0 +1,39 @@
+package org.hisp.dhis.reportexcel.configuration.action;
+
+import org.hisp.dhis.options.SystemSettingManager;
+
+import com.opensymphony.xwork2.Action;
+
+public class SetReportConfigurationAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private SystemSettingManager systemSettingManager;
+
+    public void setSystemSettingManager( SystemSettingManager systemSettingManager )
+    {
+        this.systemSettingManager = systemSettingManager;
+    }
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private String templateDirectory;
+
+    public void setTemplateDirectory( String templateDirectory )
+    {
+        this.templateDirectory = templateDirectory;
+    }
+
+    public String execute()
+        throws Exception
+    {
+        systemSettingManager.saveSystemSetting( SystemSettingManager.KEY_REPORT_TEMPLATE_DIRECTORY, templateDirectory );
+
+        return SUCCESS;
+    }
+}

=== added directory 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils'
=== added file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/FileUtils.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/FileUtils.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/FileUtils.java	2009-09-14 05:20:54 +0000
@@ -0,0 +1,154 @@
+package org.hisp.dhis.reportexcel.utils;
+
+/*
+ * Copyright (c) 2004-2007, 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.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.*;
+
+/**
+ * @author Tran Thanh Tri
+ * @version $Id: Feature.java 28-04-2008 16:06:00 $
+ */
+public class FileUtils
+{
+
+    public static List<String> getListFileName( File directory )
+    {
+        List<String> result = new ArrayList<String>();
+
+        if ( directory != null )
+        {
+            for ( File f : directory.listFiles() )
+            {
+                result.add( f.getName() );
+
+            }
+        }
+
+        return result;
+    }
+
+    public static List<File> getListFile( File directory )
+    {
+        List<File> result = new ArrayList<File>();
+
+        if ( directory != null )
+        {
+            result = Arrays.asList( directory.listFiles() );
+        }
+        
+        Collections.sort( result, new Comparator<File>(){         
+
+            public int compare( File o1, File o2 )
+            {                
+                return (int) (o1.lastModified() - o2.lastModified());
+            }} );
+        
+        return result;
+    }
+
+    public static boolean copyFile( String input, String output )
+    {
+        File inputFile = new File( input );
+        File outputFile = new File( output );
+
+        try
+        {
+            FileReader in = new FileReader( inputFile );
+            FileWriter out = new FileWriter( outputFile );
+
+            int c;
+
+            while ( (c = in.read()) != -1 )
+                out.write( c );
+
+            in.close();
+            out.close();
+
+        }
+        catch ( IOException e )
+        {
+            e.printStackTrace();
+            return false;
+        }
+
+        return true;
+
+    }
+
+    public static boolean copyFile( File input, File output )
+    {
+
+        try
+        {
+            FileReader in = new FileReader( input );
+            FileWriter out = new FileWriter( output );
+
+            int c;
+
+            while ( (c = in.read()) != -1 )
+                out.write( c );
+
+            in.close();
+            out.close();
+
+        }
+        catch ( IOException e )
+        {
+            e.printStackTrace();
+            return false;
+        }
+
+        return true;
+
+    }
+
+    public static boolean delete( String path )
+    {
+        new File( path ).delete();
+        return true;
+    }
+
+    public static boolean isExist( String fileName )
+    {
+        try
+        {
+            new FileReader( fileName );
+            return true;
+        }
+        catch ( FileNotFoundException e )
+        {
+            // TODO Auto-generated catch block
+            return false;
+        }
+    }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml	2009-09-14 03:19:36 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml	2009-09-14 05:20:54 +0000
@@ -4,6 +4,31 @@
 	xsi:schemaLocation="
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";>
 
+	<!-- SERVICE BEAN -->
+
+	<bean id="org.hisp.dhis.reportexcel.ReportLocationManager" class="org.hisp.dhis.reportexcel.ReportLocationManager"
+		init-method="init" scope="singleton">
+		<property name="locationManager"
+			ref="org.hisp.dhis.external.location.LocationManager" />
+		<property name="systemSettingManager" ref="org.hisp.dhis.options.SystemSettingManager" />
+	</bean>
+
+	<!-- SYSTEM CONFIGURATION BEAN -->
+
+	<bean
+		id="org.hisp.dhis.reportexcel.configuration.action.GetReportConfigurationAction"
+		class="org.hisp.dhis.reportexcel.configuration.action.GetReportConfigurationAction"
+		scope="prototype">
+		<property name="systemSettingManager" ref="org.hisp.dhis.options.SystemSettingManager" />
+	</bean>
+
+	<bean
+		id="org.hisp.dhis.reportexcel.configuration.action.SetReportConfigurationAction"
+		class="org.hisp.dhis.reportexcel.configuration.action.SetReportConfigurationAction"
+		scope="prototype">
+		<property name="systemSettingManager" ref="org.hisp.dhis.options.SystemSettingManager" />
+	</bean>
+
 	<!-- REPORT EXCEL CORE BEAN -->
 
 	<bean id="org.hisp.dhis.reportexcel.action.AddReportExcelAction"
@@ -23,7 +48,8 @@
 	</bean>
 
 	<bean id="org.hisp.dhis.reportexcel.action.GetReportExcelGroupsAction"
-		class="org.hisp.dhis.reportexcel.action.GetReportExcelGroupsAction" scope="prototype">
+		class="org.hisp.dhis.reportexcel.action.GetReportExcelGroupsAction"
+		scope="prototype">
 		<property name="reportService" ref="org.hisp.dhis.reportexcel.ReportExcelService" />
 	</bean>
 
@@ -33,7 +59,8 @@
 	</bean>
 
 	<bean id="org.hisp.dhis.reportexcel.action.UpdateReportExcelAction"
-		class="org.hisp.dhis.reportexcel.action.UpdateReportExcelAction" scope="prototype">
+		class="org.hisp.dhis.reportexcel.action.UpdateReportExcelAction"
+		scope="prototype">
 		<property name="reportService" ref="org.hisp.dhis.reportexcel.ReportExcelService" />
 	</bean>
 
@@ -42,41 +69,61 @@
 		scope="prototype">
 		<property name="reportService" ref="org.hisp.dhis.reportexcel.ReportExcelService" />
 	</bean>
-	
-	<bean id="org.hisp.dhis.reportexcel.action.ValidateUpdateReportExcelAction"
+
+	<bean
+		id="org.hisp.dhis.reportexcel.action.ValidateUpdateReportExcelAction"
 		class="org.hisp.dhis.reportexcel.action.ValidateUpdateReportExcelAction"
 		scope="prototype">
 		<property name="reportService" ref="org.hisp.dhis.reportexcel.ReportExcelService" />
 	</bean>
-	
+
 	<!-- REPORT EXCEL CATEGORY BEAN -->
-	
-	<bean id="org.hisp.dhis.reportexcel.category.action.GetAllDataElementGroupsAction"
+
+	<bean
+		id="org.hisp.dhis.reportexcel.category.action.GetAllDataElementGroupsAction"
 		class="org.hisp.dhis.reportexcel.category.action.GetAllDataElementGroupsAction"
-		scope="prototype">		
-		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />		
-	</bean>
-	
-	<bean id="org.hisp.dhis.reportexcel.category.action.UpdateDataElementGroupOrderAction"
+		scope="prototype">
+		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+	</bean>
+
+	<bean
+		id="org.hisp.dhis.reportexcel.category.action.SaveDataElementGroupOrderAction"
+		class="org.hisp.dhis.reportexcel.category.action.SaveDataElementGroupOrderAction"
+		scope="prototype">
+		<property name="reportService" ref="org.hisp.dhis.reportexcel.ReportExcelService" />
+		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+	</bean>
+
+	<bean
+		id="org.hisp.dhis.reportexcel.category.action.UpdateDataElementGroupOrderAction"
 		class="org.hisp.dhis.reportexcel.category.action.UpdateDataElementGroupOrderAction"
 		scope="prototype">
 		<property name="reportService" ref="org.hisp.dhis.reportexcel.ReportExcelService" />
-		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />		
-	</bean>
-	
-	<bean id="org.hisp.dhis.reportexcel.category.action.UpdateSortDataElementAction"
+		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+	</bean>
+
+	<bean
+		id="org.hisp.dhis.reportexcel.category.action.DeleteDataElementGroupOrderAction"
+		class="org.hisp.dhis.reportexcel.category.action.DeleteDataElementGroupOrderAction"
+		scope="prototype">
+		<property name="reportService" ref="org.hisp.dhis.reportexcel.ReportExcelService" />
+	</bean>
+
+	<bean
+		id="org.hisp.dhis.reportexcel.category.action.UpdateSortDataElementAction"
 		class="org.hisp.dhis.reportexcel.category.action.UpdateSortDataElementAction"
 		scope="prototype">
 		<property name="reportService" ref="org.hisp.dhis.reportexcel.ReportExcelService" />
 	</bean>
-	
-	<bean id="org.hisp.dhis.reportexcel.category.action.GetDataElementOrderAction"
+
+	<bean
+		id="org.hisp.dhis.reportexcel.category.action.GetDataElementOrderAction"
 		class="org.hisp.dhis.reportexcel.category.action.GetDataElementOrderAction"
 		scope="prototype">
 		<property name="reportService" ref="org.hisp.dhis.reportexcel.ReportExcelService" />
 	</bean>
-	
-	
+
+
 
 
 

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml	2009-09-14 03:19:36 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml	2009-09-14 05:20:54 +0000
@@ -9,6 +9,29 @@
 	<package name="dhis-web-excel-reporting" extends="dhis-web-commons"
 		namespace="/dhis-web-excel-reporting">
 		
+		<action name="administration" class="org.hisp.dhis.reportexcel.action.NoAction">
+			<result name="success" type="velocity">/main.vm</result>
+			<param name="page">/dhis-web-excel-reporting/viewAdministrator.vm</param>
+			<param name="menu">/dhis-web-excel-reporting/menu.vm</param>
+			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+		</action>
+		
+		<!-- SYSTEM CONFIGURATION ACTION -->
+		
+		<action name="getConfiguration"
+			class="org.hisp.dhis.reportexcel.configuration.action.GetReportConfigurationAction">
+			<result name="success" type="velocity">/main.vm</result>
+			<param name="page">/dhis-web-excel-reporting/configuration.vm</param>
+			<param name="menu">/dhis-web-excel-reporting/menu.vm</param>
+			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+		</action>
+
+		<action name="setConfiguration"
+			class="org.hisp.dhis.reportexcel.configuration.action.SetReportConfigurationAction">
+			<result name="success" type="redirect">administration.action</result>
+			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+		</action>
+		
 		<!-- REPORT EXCEL CORE ACTION -->
 		
 		<action name="index" class="org.hisp.dhis.reportexcel.action.NoAction">
@@ -79,11 +102,20 @@
 			<result name="success" type="velocity-xml">/dhis-web-excel-reporting/responseDataElementGroups.vm</result>
 		</action>
 		
+		<action name="addDataElementGroupOrder"
+			class="org.hisp.dhis.reportexcel.category.action.SaveDataElementGroupOrderAction">
+			<result name="success" type="redirect">listDataElementGroupOrder.action?id=${id}</result>
+		</action>
+		
 		<action name="updateDataElementGroupOrder"
 			class="org.hisp.dhis.reportexcel.category.action.UpdateDataElementGroupOrderAction">
-			<result name="success" type="redirect">listReportExcel.action</result>
+			<result name="success" type="redirect">listDataElementGroupOrder.action?id=${id}</result>
 		</action>
 		
+		
+		
+		
+		
 		<action name="openSortDataElement"
 			class="org.hisp.dhis.reportexcel.action.GetReportExcelAction">
 			<result name="success" type="velocity">/main.vm</result>
@@ -102,6 +134,8 @@
 			class="org.hisp.dhis.reportexcel.category.action.GetDataElementOrderAction">
 			<result name="success" type="velocity-xml">/dhis-web-excel-reporting/responseDataElementOrder.vm</result>
 		</action>
+		
+		
 
 	</package>
 </struts>