← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1967: r2035 from 2.0.5. Fixed bug: Not using existing table name when displaying report table in HTML

 

------------------------------------------------------------
revno: 1967
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2010-10-29 16:37:54 +0200
message:
  r2035 from 2.0.5. Fixed bug: Not using existing table name when displaying report table in HTML
removed:
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/statement/GetReportTableStatement.java
modified:
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/JDBCReportTableManager.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/ReportTableManager.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/statement/DisplayReportTableStatement.java


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

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java	2010-09-03 12:44:40 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java	2010-10-29 14:37:54 +0000
@@ -253,7 +253,7 @@
         reportTableManager.createReportTable( reportTable );
 
         // ---------------------------------------------------------------------
-        // Updating existingt table name after deleting the database table
+        // Updating existing table name after deleting the database table
         // ---------------------------------------------------------------------
         
         reportTable.updateExistingTableName();

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/JDBCReportTableManager.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/JDBCReportTableManager.java	2010-10-29 12:19:15 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/JDBCReportTableManager.java	2010-10-29 14:37:54 +0000
@@ -30,7 +30,6 @@
 import static org.hisp.dhis.reporttable.ReportTable.SEPARATOR;
 
 import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.SortedMap;
@@ -51,7 +50,6 @@
 import org.hisp.dhis.reporttable.statement.CreateReportTableStatement;
 import org.hisp.dhis.reporttable.statement.DisplayReportTableStatement;
 import org.hisp.dhis.reporttable.statement.GetReportTableDataStatement;
-import org.hisp.dhis.reporttable.statement.GetReportTableStatement;
 import org.hisp.dhis.reporttable.statement.RemoveReportTableStatement;
 import org.hisp.dhis.reporttable.statement.ReportTableStatement;
 
@@ -136,7 +134,7 @@
     {
         try
         {
-            statementManager.getHolder().getStatement().executeQuery( "SELECT count(*) FROM " + reportTable.getTableName() );
+            statementManager.getHolder().getStatement().executeQuery( "SELECT count(*) FROM " + reportTable.getExistingTableName() );
             
             return true;
         }
@@ -276,73 +274,4 @@
         
         return data;
     }
-    
-    public ReportTableData getReportTableData( ReportTable reportTable )
-    {
-        ReportTableData data = new ReportTableData();
-        
-        // ---------------------------------------------------------------------
-        // Set name
-        // ---------------------------------------------------------------------
-
-        data.setName( reportTable.getName() );
-
-        ReportTableStatement statement = new GetReportTableStatement( reportTable );
-        
-        StatementHolder holder = statementManager.getHolder();
-
-        try
-        {
-            log.debug( "Get report table data statement: " + statement.getStatement() );
-            
-            ResultSet resultSet = holder.getStatement().executeQuery( statement.getStatement() );
-            
-            ResultSetMetaData metaData = resultSet.getMetaData();
-            
-            int columnCount = metaData.getColumnCount();
-
-            // -----------------------------------------------------------------
-            // Set columns
-            // -----------------------------------------------------------------
-
-            for ( int i = 0; i < columnCount; i++ )
-            {
-                final int index = i + 1;
-                
-                data.getColumns().put( index, metaData.getColumnName( index ) );
-                
-                data.getPrettyPrintColumns().add( reportTable.prettyPrintColumn( metaData.getColumnName( index ) ) );                        
-            }
-
-            // -----------------------------------------------------------------
-            // Set data
-            // -----------------------------------------------------------------
-
-            while ( resultSet.next() )
-            {
-                SortedMap<Integer, String> row = new TreeMap<Integer, String>();
-                
-                for ( int i = 0; i < columnCount; i++ )
-                {
-                    final int index = i + 1;
-                                
-                    row.put( index, String.valueOf( resultSet.getObject( index ) ) );
-                }
-                
-                data.getRows().add( row );
-            }
-            
-            log.debug( "Number of rows: " + data.getRows().size() );
-        }
-        catch ( Exception ex )
-        {
-            throw new RuntimeException( "Failed to get report table data", ex );
-        }
-        finally
-        {
-            holder.close();
-        }
-        
-        return data;
-    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/ReportTableManager.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/ReportTableManager.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/ReportTableManager.java	2010-10-29 14:37:54 +0000
@@ -87,12 +87,4 @@
      * @return a ReportTableData object.
      */
     ReportTableData getDisplayReportTableData( ReportTable reportTable );
-    
-    /**
-     * Returns a ReportTableData object for the given ReportTable.
-     * 
-     * @param reportTable the ReportTable.
-     * @return a ReportTableData object.
-     */
-    ReportTableData getReportTableData( ReportTable reportTable );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/statement/DisplayReportTableStatement.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/statement/DisplayReportTableStatement.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/statement/DisplayReportTableStatement.java	2010-10-29 14:37:54 +0000
@@ -66,7 +66,7 @@
             buffer.append( column.getName() + ( columns.hasNext() ? SEPARATOR : SPACE ) );
         }
         
-        buffer.append( "FROM " + reportTable.getTableName() );
+        buffer.append( "FROM " + reportTable.getExistingTableName() );
         
         statement = buffer.toString();
     }

=== removed file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/statement/GetReportTableStatement.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/statement/GetReportTableStatement.java	2009-05-14 08:51:28 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/statement/GetReportTableStatement.java	1970-01-01 00:00:00 +0000
@@ -1,26 +0,0 @@
-package org.hisp.dhis.reporttable.statement;
-
-import org.hisp.dhis.reporttable.ReportTable;
-
-public class GetReportTableStatement
-    extends ReportTableStatement
-{
-    // -------------------------------------------------------------------------
-    // Constructor
-    // -------------------------------------------------------------------------
-
-    public GetReportTableStatement( ReportTable reportTable )
-    {
-        super( reportTable );
-    }
-
-    // -------------------------------------------------------------------------
-    // ReportTableStatement implementation
-    // -------------------------------------------------------------------------
-
-    @Override
-    protected void init( ReportTable reportTable )
-    {
-        statement = "SELECT * FROM " + reportTable.getTableName();
-    }
-}