use of io.apiman.manager.api.jdbc.handlers.ClientUsagePerApiHandler in project apiman by apiman.
the class JdbcMetricsAccessor method getClientUsagePerApi.
/**
* @see io.apiman.manager.api.core.IMetricsAccessor#getClientUsagePerApi(java.lang.String, java.lang.String, java.lang.String, org.joda.time.DateTime, org.joda.time.DateTime)
*/
@Override
public ClientUsagePerApiBean getClientUsagePerApi(String organizationId, String clientId, String version, DateTime from, DateTime to) {
try {
QueryRunner run = new QueryRunner(ds);
// $NON-NLS-1$
String sql = "SELECT api_id, count(*) FROM gw_requests WHERE client_org_id = ? AND client_id = ? AND client_version = ? AND rstart >= ? AND rstart < ? GROUP BY api_id";
ResultSetHandler<ClientUsagePerApiBean> handler = new ClientUsagePerApiHandler();
return run.query(sql, handler, organizationId, clientId, version, from.getMillis(), to.getMillis());
} catch (SQLException e) {
e.printStackTrace();
return new ClientUsagePerApiBean();
}
}
Aggregations