dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #29085
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14627: Event analytics, minor performance improvement
------------------------------------------------------------
revno: 14627
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-04-03 10:36:50 +0200
message:
Event analytics, minor performance improvement
modified:
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.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/event/data/JdbcEventAnalyticsManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java 2014-03-27 11:39:40 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java 2014-04-03 08:36:50 +0000
@@ -52,7 +52,6 @@
import org.hisp.dhis.jdbc.StatementBuilder;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.program.Program;
-import org.hisp.dhis.system.grid.ListGrid;
import org.hisp.dhis.system.util.TextUtils;
import org.hisp.dhis.system.util.Timer;
import org.springframework.beans.factory.annotation.Autowired;
@@ -133,7 +132,7 @@
try
{
- grid.addRows( getAggregatedEventData( params, sql ) );
+ getAggregatedEventData( grid, params, sql );
}
catch ( BadSqlGrammarException ex )
{
@@ -143,12 +142,10 @@
return grid;
}
- private Grid getAggregatedEventData( EventQueryParams params, String sql )
+ private void getAggregatedEventData( Grid grid, EventQueryParams params, String sql )
{
Timer t = new Timer().start();
-
- Grid grid = new ListGrid();
-
+
SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );
t.getTime( "Analytics event aggregate SQL: " + sql );
@@ -173,8 +170,6 @@
grid.addValue( value );
}
-
- return grid;
}
public Grid getEvents( EventQueryParams params, Grid grid )
@@ -225,26 +220,24 @@
// Grid
// ---------------------------------------------------------------------
+ try
+ {
+ getEvents( grid, params, sql );
+ }
+ catch ( BadSqlGrammarException ex )
+ {
+ log.info( QUERY_ERR_MSG, ex );
+ }
+
+ return grid;
+ }
+
+ private void getEvents( Grid grid, EventQueryParams params, String sql )
+ {
+ Timer t = new Timer().start();
+
int rowLength = grid.getHeaders().size();
- try
- {
- grid.addRows( getEvents( params, sql, rowLength ) );
- }
- catch ( BadSqlGrammarException ex )
- {
- log.info( QUERY_ERR_MSG, ex );
- }
-
- return grid;
- }
-
- private Grid getEvents( EventQueryParams params, String sql, int rowLength )
- {
- Timer t = new Timer().start();
-
- Grid grid = new ListGrid();
-
SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );
t.getTime( "Analytics event query SQL: " + sql );
@@ -260,8 +253,6 @@
grid.addValue( rowSet.getString( index ) );
}
}
-
- return grid;
}
public int getEventCount( EventQueryParams params )