use of org.hisp.dhis.analytics.Rectangle in project dhis2-core by dhis2.
the class JdbcEventAnalyticsManager method getRectangle.
@Override
public Rectangle getRectangle(EventQueryParams params) {
String clusterField = params.getCoordinateField();
String sql = "select count(psi) as " + COL_COUNT + ", ST_Extent(" + clusterField + ") as " + COL_EXTENT + " ";
sql += getFromWhereClause(params, Lists.newArrayList("psi", clusterField));
log.debug(String.format("Analytics event count and extent SQL: %s", sql));
Rectangle rectangle = new Rectangle();
SqlRowSet rowSet = jdbcTemplate.queryForRowSet(sql);
if (rowSet.next()) {
Object extent = rowSet.getObject(COL_EXTENT);
rectangle.setCount(rowSet.getLong(COL_COUNT));
rectangle.setExtent(extent != null ? String.valueOf(rowSet.getObject(COL_EXTENT)) : null);
}
return rectangle;
}
Aggregations