← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9862: Analytics, some sort of handling for situations where non-existing partitions are requested

 

------------------------------------------------------------
revno: 9862
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-02-21 15:37:09 +0100
message:
  Analytics, some sort of handling for situations where non-existing partitions are requested
modified:
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/document/impl/DefaultDocumentService.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-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.java	2013-02-01 14:57:34 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.java	2013-02-21 14:37:09 +0000
@@ -59,6 +59,7 @@
 import org.hisp.dhis.system.util.SqlHelper;
 import org.hisp.dhis.system.util.TextUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.BadSqlGrammarException;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.support.rowset.SqlRowSet;
 import org.springframework.scheduling.annotation.Async;
@@ -140,11 +141,22 @@
         sql += "group by " + getCommaDelimitedString( queryDimensions );
     
         log.info( sql );
-        
-        SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );
-        
+
         Map<String, Double> map = new HashMap<String, Double>();
         
+        SqlRowSet rowSet = null;
+        
+        try
+        {
+            rowSet = jdbcTemplate.queryForRowSet( sql );
+        }
+        catch ( BadSqlGrammarException ex )
+        {
+            log.info( "Query failed, likely because the requested analytics table does not exist", ex );
+            
+            return new AsyncResult<Map<String, Double>>( map );
+        }
+        
         while ( rowSet.next() )
         {
             Double value = rowSet.getDouble( VALUE_ID );

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/document/impl/DefaultDocumentService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/document/impl/DefaultDocumentService.java	2013-02-08 05:10:24 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/document/impl/DefaultDocumentService.java	2013-02-21 14:37:09 +0000
@@ -27,14 +27,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.List;
+
 import org.hisp.dhis.common.GenericIdentifiableObjectStore;
 import org.hisp.dhis.document.Document;
 import org.hisp.dhis.document.DocumentService;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.Collection;
-import java.util.List;
-
 /**
  * @author Lars Helge Overland
  * @version $Id$