dataSet.setQuery(sqlQuery);
dataSet.loadData(start, limit, -1);
dataStore = dataSet.getDataStore();
} catch (Exception e) {
logger.debug("Query execution aborted because of an internal exceptian");
SpagoBIEngineServiceException exception;
String message;
message = "An error occurred in " + getActionName() + " service while executing query: [" + statement.getQueryString() + "]";
exception = new SpagoBIEngineServiceException(getActionName(), message, e);
exception.addHint("Check if the query is properly formed: [" + statement.getQueryString() + "]");
exception.addHint("Check connection configuration");
exception.addHint("Check the qbe jar file");
throw exception;
}
logger.debug("Query executed succesfully");
//dataStore.getMetaData().setProperty("resultNumber", new Integer( (int)dataStore.getRecordsCount() ));
resultNumber = (Integer)dataStore.getMetaData().getProperty("resultNumber");
Assert.assertNotNull(resultNumber, "property [resultNumber] of the dataStore returned by loadData method of the class [" + dataSet.getClass().getName()+ "] cannot be null");
logger.debug("Total records: " + resultNumber);
boolean overflow = maxSize != null && resultNumber >= maxSize;
if (overflow) {
logger.warn("Query results number [" + resultNumber + "] exceeds max result limit that is [" + maxSize + "]");
auditlogger.info("[" + userProfile.getUserId() + "]:: max result limit [" + maxSize + "] exceeded with SQL: " + sqlQuery);
}
dataSetWriter = new JSONDataWriter();
gridDataFeed = (JSONObject)dataSetWriter.write(dataStore);
try {
writeBackToClient( new JSONSuccess(gridDataFeed) );
} catch (IOException e) {
String message = "Impossible to write back the responce to the client";
throw new SpagoBIEngineServiceException(getActionName(), message, e);
}
} catch(Throwable t) {
errorHitsMonitor = MonitorFactory.start("QbeEngine.errorHits");
errorHitsMonitor.stop();