← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1547: Made error handling of internal processes a bit more abstract by moving it to AbstractStatementIn...

 

------------------------------------------------------------
revno: 1547
committer: Lars Helge Oeverland <larshelge@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-03-04 12:55:58 +0100
message:
  Made error handling of internal processes a bit more abstract by moving it to AbstractStatementInternalProcess
modified:
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/DataMartInternalProcess.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportInternalProcess.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportPreviewInternalProcess.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportService.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/importer/DefaultDhis14FileImportService.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/importer/DefaultDhis14XMLImportService.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ixf/importer/DefaultIXFImportService.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/xml/importer/DefaultXMLImportService.java
  dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dhis14/Dhis14XmlImportServiceTest.java
  dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/DXFImportServiceTest.java
  dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/ixf/IXFImportServiceTest.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessInternalProcess.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/ReportTableInternalProcess.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/process/AbstractStatementInternalProcess.java
  dhis-2/dhis-web/dhis-web-datamart/src/main/resources/org/hisp/dhis/datamart/i18n_module.properties
  dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties
  dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties


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

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription.
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/DataMartInternalProcess.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/DataMartInternalProcess.java	2009-11-26 10:38:53 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/DataMartInternalProcess.java	2010-03-04 11:55:58 +0000
@@ -120,10 +120,12 @@
     protected void executeStatements()
         throws Exception
     {
-        getState().setMessage( "export_process_started" );
-        
         dataMartEngine.export( dataElementIds, indicatorIds, periodIds, organisationUnitIds, getState() );
-        
-        getState().setMessage( "export_process_finished" );
+    }
+    
+    @Override
+    protected String getErrorMessage()
+    {
+        return "export_process_failed";
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java	2009-11-26 10:38:53 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java	2010-03-04 11:55:58 +0000
@@ -185,7 +185,9 @@
         Collection<Integer> periodIds, Collection<Integer> organisationUnitIds, ProcessState state )
     {   
         int count = 0;
-             
+        
+        state.setMessage( "export_process_started" );
+        
         log.info( "Export process started" );
         
         TimeUtils.start();

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportInternalProcess.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportInternalProcess.java	2010-02-19 18:38:02 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportInternalProcess.java	2010-03-04 11:55:58 +0000
@@ -93,7 +93,14 @@
         log.info( "Import process started" );
         
         importService.importData( params, inputStream, getState() );
-        
-        log.info( "Import process completed" );
+
+        getState().setMessage( "import_process_done" );        
+        log.info( "Import process done" );
+    }
+    
+    @Override
+    protected String getErrorMessage()
+    {
+        return "import_process_failed";
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportPreviewInternalProcess.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportPreviewInternalProcess.java	2010-02-19 18:38:02 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportPreviewInternalProcess.java	2010-03-04 11:55:58 +0000
@@ -74,7 +74,12 @@
         
         importObjectService.importAll();        
 
-        // getState().setMessage( "import_process_done" );
         log.info( "Preview process completed" );        
     }
+    
+    @Override
+    public String getErrorMessage()
+    {
+        return "import_process_failed";
+    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportService.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportService.java	2009-11-26 10:38:53 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportService.java	2010-03-04 11:55:58 +0000
@@ -37,7 +37,9 @@
  */
 public interface ImportService
 {
-    void importData( ImportParams params, InputStream inputStream );
+    void importData( ImportParams params, InputStream inputStream )
+        throws Exception;
     
-    void importData( ImportParams params, InputStream inputStream, ProcessState state );
+    void importData( ImportParams params, InputStream inputStream, ProcessState state )
+        throws Exception;
 }

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/importer/DefaultDhis14FileImportService.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/importer/DefaultDhis14FileImportService.java	2009-11-26 14:38:03 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/importer/DefaultDhis14FileImportService.java	2010-03-04 11:55:58 +0000
@@ -312,11 +312,8 @@
         if ( params.isAnalysis() )
         {
             state.setOutput( importAnalyser.getImportAnalysis() );
-            System.out.println( "AN " + importAnalyser.getImportAnalysis() );
         }
-        
-        state.setMessage( "import_process_done" );
-        
+                
         Dhis14PeriodUtil.clear();
 
         NameMappingUtil.clearMapping();

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/importer/DefaultDhis14XMLImportService.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/importer/DefaultDhis14XMLImportService.java	2010-02-15 10:47:13 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/importer/DefaultDhis14XMLImportService.java	2010-03-04 11:55:58 +0000
@@ -317,9 +317,6 @@
             state.setOutput( importAnalyser.getImportAnalysis() );
         }
 
-        state.setMessage( "import_process_done" );        
-        log.info( "Import process done" );
-        
         StreamUtils.closeInputStream( zipIn );
 
         NameMappingUtil.clearMapping();

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ixf/importer/DefaultIXFImportService.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ixf/importer/DefaultIXFImportService.java	2009-11-26 10:38:53 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ixf/importer/DefaultIXFImportService.java	2010-03-04 11:55:58 +0000
@@ -258,8 +258,6 @@
             }
         }
         
-        state.setMessage( "import_process_done" );
-        
         StreamUtils.closeInputStream( zipIn );
         
         reader.closeReader();

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/xml/importer/DefaultXMLImportService.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/xml/importer/DefaultXMLImportService.java	2010-02-22 15:25:35 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/xml/importer/DefaultXMLImportService.java	2010-03-04 11:55:58 +0000
@@ -101,6 +101,7 @@
 
     @Override
     public void importData( ImportParams params, InputStream inputStream )
+        throws Exception
     {
         importData( params, inputStream, new OutputHolderState() );
     }
@@ -111,106 +112,97 @@
 
     @Override
     public void importData( ImportParams params, InputStream inputStream, ProcessState state )
+        throws Exception
     {
         XMLReader dxfReader;
 
-        try
-        {
-            log.info( "Transform importData()" );
-            state.setMessage( "Transform importData()" );
-
-            // the InputStream carrying the XML to be imported
-            InputStream xmlInStream;
-
-            // Importing of data from xml source is a three phase process
-            // Phase 1: Get the XML stream
-            // this could potentially be from a zip, a gzip or uncompressed
-            // dsource
-            BufferedInputStream bufin = new BufferedInputStream( inputStream );
-
-            if ( StreamUtils.isZip( bufin ) )
-            {
-                // TODO: need a smart zip archive analyzer
-                xmlInStream = new ZipInputStream( bufin );
-                StreamUtils.getNextZipEntry( (ZipInputStream) xmlInStream );
-            }
-            else
-            {
-                if ( StreamUtils.isGZip( bufin ) )
-                {
-                    xmlInStream = new GZIPInputStream( bufin );
-                }
-                else
-                {
-                    // assume uncompressed xml
-                    xmlInStream = bufin;
-                }
-            }
-
-            // Phase 2: get a STaX eventreader for the stream
-            // On the basis of QName of root element perform additional
-            // transformation(s)
-            XMLInputFactory2 factory = (XMLInputFactory2) XMLInputFactory.newInstance();
-            XMLStreamReader2 streamReader = (XMLStreamReader2) factory.createXMLStreamReader( xmlInStream );
-            XMLEventReader2 eventReader = (XMLEventReader2) factory.createXMLEventReader( streamReader );
-
-            // look for the document root element but don't pluck it from the
-            // stream
-            while ( !eventReader.peek().isStartElement() )
-            {
-                eventReader.nextEvent();
-            }
-
-            StartElement root = eventReader.peek().asStartElement();
-            QName rootName = root.getName();
-
-            log.info( "Importing " + rootName.getLocalPart() + " from " + root.getNamespaceURI( rootName.getPrefix() ) );
-
-            if ( rootName.getLocalPart().equals( DXF_ROOT ) )
-            {
-                // native dxf stream - no transform required
-                dxfReader = XMLFactory.getXMLReader( streamReader );
-            }
-            else
-            {
-                InputStream sheetStream = getStyleSheetForRoot( root );
-                if ( sheetStream == null )
-                {
-                    throw new Exception( "no stylesheet for " + rootName );
-                }
-
-                Source sheet = new StreamSource( sheetStream );
-                // rewind stream to reclaim root element
-                bufin.reset();
-                Source source = new StreamSource( bufin );
-                TransformerTask tt = new TransformerTask( sheet, null );
-
-                // make a pipe to capture output of transform
-                XMLPipe pipe = new XMLPipe();
-                XMLEventWriter pipeinput = pipe.getInput();
-                XMLEventReader2 pipeoutput = pipe.getOutput();
-
-                // set result of transform to input of pipe
-                StAXResult result = new StAXResult( pipeinput );
-                tt.transform( source, result, dhisResolver );
-                log.info( "transform successful - importing dxf" );
-
-                // set dxfReader to output of pipe
-                dxfReader = new DefaultXMLEventReader( (XMLEventReader2) pipeoutput );
-            }
-            
-            // Phase 3: pass through to dxf convertor
-            converter.read( dxfReader, params, state );
-            dxfReader.closeReader();
-            StreamUtils.closeInputStream( xmlInStream );
-            state.setMessage( "import_process_done" );
-
-        }
-        catch ( Exception ex )
-        {
-            log.error( "XML import error: " + ex );
-            state.setMessage( "import_process_failed" ); // see log for details
-        }
+        log.info( "Transform importData()" );
+        state.setMessage( "Transform importData()" );
+
+        // the InputStream carrying the XML to be imported
+        InputStream xmlInStream;
+
+        // Importing of data from xml source is a three phase process
+        // Phase 1: Get the XML stream
+        // this could potentially be from a zip, a gzip or uncompressed
+        // dsource
+        BufferedInputStream bufin = new BufferedInputStream( inputStream );
+
+        if ( StreamUtils.isZip( bufin ) )
+        {
+            // TODO: need a smart zip archive analyzer
+            xmlInStream = new ZipInputStream( bufin );
+            StreamUtils.getNextZipEntry( (ZipInputStream) xmlInStream );
+        }
+        else
+        {
+            if ( StreamUtils.isGZip( bufin ) )
+            {
+                xmlInStream = new GZIPInputStream( bufin );
+            }
+            else
+            {
+                // assume uncompressed xml
+                xmlInStream = bufin;
+            }
+        }
+
+        // Phase 2: get a STaX eventreader for the stream
+        // On the basis of QName of root element perform additional
+        // transformation(s)
+        XMLInputFactory2 factory = (XMLInputFactory2) XMLInputFactory.newInstance();
+        XMLStreamReader2 streamReader = (XMLStreamReader2) factory.createXMLStreamReader( xmlInStream );
+        XMLEventReader2 eventReader = (XMLEventReader2) factory.createXMLEventReader( streamReader );
+
+        // look for the document root element but don't pluck it from the
+        // stream
+        while ( !eventReader.peek().isStartElement() )
+        {
+            eventReader.nextEvent();
+        }
+
+        StartElement root = eventReader.peek().asStartElement();
+        QName rootName = root.getName();
+
+        log.info( "Importing " + rootName.getLocalPart() + " from " + root.getNamespaceURI( rootName.getPrefix() ) );
+
+        if ( rootName.getLocalPart().equals( DXF_ROOT ) )
+        {
+            // native dxf stream - no transform required
+            dxfReader = XMLFactory.getXMLReader( streamReader );
+        }
+        else
+        {
+            InputStream sheetStream = getStyleSheetForRoot( root );
+            if ( sheetStream == null )
+            {
+                throw new Exception( "no stylesheet for " + rootName );
+            }
+
+            Source sheet = new StreamSource( sheetStream );
+            // rewind stream to reclaim root element
+            bufin.reset();
+            Source source = new StreamSource( bufin );
+            TransformerTask tt = new TransformerTask( sheet, null );
+
+            // make a pipe to capture output of transform
+            XMLPipe pipe = new XMLPipe();
+            XMLEventWriter pipeinput = pipe.getInput();
+            XMLEventReader2 pipeoutput = pipe.getOutput();
+
+            // set result of transform to input of pipe
+            StAXResult result = new StAXResult( pipeinput );
+            tt.transform( source, result, dhisResolver );
+            log.info( "transform successful - importing dxf" );
+
+            // set dxfReader to output of pipe
+            dxfReader = new DefaultXMLEventReader( (XMLEventReader2) pipeoutput );
+        }
+        
+        // Phase 3: pass through to dxf convertor
+        converter.read( dxfReader, params, state );
+        dxfReader.closeReader();
+        StreamUtils.closeInputStream( xmlInStream );
     }
 
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dhis14/Dhis14XmlImportServiceTest.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dhis14/Dhis14XmlImportServiceTest.java	2009-06-10 22:25:07 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dhis14/Dhis14XmlImportServiceTest.java	2010-03-04 11:55:58 +0000
@@ -34,7 +34,7 @@
     // -------------------------------------------------------------------------
 
     @Test
-    public void testImport()
+    public void testImport() throws Exception
     {
         ImportParams params = new ImportParams();
 

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/DXFImportServiceTest.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/DXFImportServiceTest.java	2010-02-22 15:25:35 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/DXFImportServiceTest.java	2010-03-04 11:55:58 +0000
@@ -242,9 +242,8 @@
     // -------------------------------------------------------------------------
     // TODO Improve test on duplicate GroupMemberAssociations
     @Test
-    public void testSimpleImportWithTransform()
+    public void testSimpleImportWithTransform() throws Exception
     {
-
         ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, false, false, false );
 
         importService.importData( importParams, inputStreamH );
@@ -254,7 +253,7 @@
 
     @Ignore
     @Test
-    public void testSDMXImportWithTransform()
+    public void testSDMXImportWithTransform() throws Exception
     {
         ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, false, false, false );
 
@@ -268,7 +267,7 @@
     }
 
     @Test
-    public void testImportMetaData()
+    public void testImportMetaData() throws Exception
     {
         ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, false, false, false );
 
@@ -278,7 +277,7 @@
     }
 
     @Test
-    public void testImportMetaDataFromXML()
+    public void testImportMetaDataFromXML() throws Exception
     {
         ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, false, false, false );
 
@@ -288,7 +287,7 @@
     }
 
     @Test
-    public void testImportMetaDataFromGzip()
+    public void testImportMetaDataFromGzip() throws Exception
     {
         ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, false, false, false );
 
@@ -298,7 +297,7 @@
     }
 
     @Test
-    public void testImportMetaDataWithPreview()
+    public void testImportMetaDataWithPreview() throws Exception
     {
         ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, true, false, false );
 
@@ -310,7 +309,7 @@
     }
 
     @Test
-    public void testImportMetaDataWithPreviewAndDuplicates()
+    public void testImportMetaDataWithPreviewAndDuplicates() throws Exception
     {
         ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, false, false, false );
 
@@ -330,7 +329,7 @@
     }
 
     @Test
-    public void testImportMetaDataWithPreviewAndUpdates()
+    public void testImportMetaDataWithPreviewAndUpdates() throws Exception
     {
         ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, false, false, false );
 
@@ -350,7 +349,7 @@
     }
 
     @Test
-    public void testImportDataValues()
+    public void testImportDataValues() throws Exception
     {
         ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, false, true, false );
 
@@ -364,7 +363,7 @@
     }
 
     @Test
-    public void testImportDataValuesWithUpdates()
+    public void testImportDataValuesWithUpdates() throws Exception
     {
         ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, false, true, false );
 
@@ -390,7 +389,7 @@
     }
 
     @Test
-    public void testImportDataValuesWithPreview()
+    public void testImportDataValuesWithPreview() throws Exception
     {
         ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, true, true, false );
 
@@ -404,7 +403,7 @@
     }
 
     @Test
-    public void testImportDataValuesWithPreviewAndDuplicates()
+    public void testImportDataValuesWithPreviewAndDuplicates() throws Exception
     {
         ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, false, true, false );
 
@@ -428,7 +427,7 @@
     }
 
     @Test
-    public void testImportDataValuesWithPreviewAndUpdates()
+    public void testImportDataValuesWithPreviewAndUpdates() throws Exception
     {
         ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, false, true, false );
 

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/ixf/IXFImportServiceTest.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/ixf/IXFImportServiceTest.java	2009-06-10 22:25:07 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/ixf/IXFImportServiceTest.java	2010-03-04 11:55:58 +0000
@@ -68,7 +68,7 @@
     // -------------------------------------------------------------------------
 
     @Test
-    public void testImport()
+    public void testImport() throws Exception
     {
         ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, false, true, false );
         

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessInternalProcess.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessInternalProcess.java	2009-06-10 22:25:07 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessInternalProcess.java	2010-03-04 11:55:58 +0000
@@ -104,4 +104,10 @@
     {
         completenessService.exportDataSetCompleteness( dataSetIds, periodIds, organisationUnitIds, reportTableId );
     }
+    
+    @Override
+    public String getErrorMessage()
+    {
+        return "export_process_failed";
+    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/ReportTableInternalProcess.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/ReportTableInternalProcess.java	2009-06-10 22:25:07 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/ReportTableInternalProcess.java	2010-03-04 11:55:58 +0000
@@ -113,8 +113,15 @@
     // AbstractStatementInternalProcess implementation
     // -------------------------------------------------------------------------
     
+    @Override
     public void executeStatements()
     {
         reportTableService.createReportTables( id, mode, reportingPeriod, parentOrganisationUnitId, organisationUnitId, format );
     }
+    
+    @Override
+    public String getErrorMessage()
+    {
+        return "report_table_process_failed";
+    }
 }

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/process/AbstractStatementInternalProcess.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/process/AbstractStatementInternalProcess.java	2009-11-26 10:38:53 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/process/AbstractStatementInternalProcess.java	2010-03-04 11:55:58 +0000
@@ -29,6 +29,8 @@
 
 import org.amplecode.cave.process.Process;
 import org.amplecode.quick.StatementManager;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * @author Lars Helge Overland
@@ -36,7 +38,9 @@
  */
 public abstract class AbstractStatementInternalProcess
     implements Process<OutputHolderState> 
-{    
+{
+    private static final Log log = LogFactory.getLog( AbstractStatementInternalProcess.class );
+    
     private OutputHolderState state;
 
     protected OutputHolderState getState()
@@ -78,6 +82,14 @@
         {
             executeStatements();
         }
+        catch ( Exception ex )
+        {
+            getState().setMessage( getErrorMessage() );
+            
+            log.error( ex );
+            
+            ex.printStackTrace();
+        }
         finally
         {
             statementManager.destroy();
@@ -89,4 +101,9 @@
      */
     protected abstract void executeStatements()
         throws Exception;
+    
+    /**
+     * Returns a user friendly error message.
+     */
+    protected abstract String getErrorMessage();
 }

=== modified file 'dhis-2/dhis-web/dhis-web-datamart/src/main/resources/org/hisp/dhis/datamart/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-datamart/src/main/resources/org/hisp/dhis/datamart/i18n_module.properties	2009-07-06 17:30:19 +0000
+++ dhis-2/dhis-web/dhis-web-datamart/src/main/resources/org/hisp/dhis/datamart/i18n_module.properties	2010-03-04 11:55:58 +0000
@@ -71,3 +71,4 @@
 remove = Remove
 show_details = Show details
 edit = Edit
+export_process_failed = Export process failed - See log for details

=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties	2010-02-19 18:38:02 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties	2010-03-04 11:55:58 +0000
@@ -272,7 +272,7 @@
 data_element_concepts = Data element concepts
 configure_dhis14_import = Configure DHIS 1.4 import
 import_process_done = Import successful
-import_process_failed = Import failed - see log for details
+import_process_failed = Import process failed - See log for details
 importing_data_element_category_options = Importing data element category options
 importing_data_element_categories = Importing data element categories
 importing_data_element_category_combos = Importing data element category combos

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties	2010-02-02 13:21:02 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties	2010-03-04 11:55:58 +0000
@@ -278,6 +278,8 @@
 configuration = Configuration
 based_on_subjective = Based on complete data set registrations
 based_on_objective = Based on compulsory data elements
+report_table_process_failed = Report table process failed - See log for details
+export_process_failed = Export process failed - See log for details
 intro_standard_report = View and add standard reports. These reports can be based on report tables and can be designed in BIRT or JasperReports.
 intro_dataset_report = View data set reports. These reports are based on data entry screens and will produce a report with aggregated data.
 intro_static_report = View and add static reports. These reports can be uploaded documents or URLs on the web.