boolean isMaxResultsLimitBlocking;
IDataStore dataStore;
JDBCDataSet dataSet;
JSONDataWriter dataSetWriter;
Query query;
IStatement statement;
Integer resultNumber;
JSONObject gridDataFeed = new JSONObject();
Monitor totalTimeMonitor = null;
Monitor errorHitsMonitor;
logger.debug("IN");
try {
super.service(request, response);
totalTimeMonitor = MonitorFactory.start("QbeEngine.executeQueryAction.totalTime");
start = getAttributeAsInteger( START );
logger.debug("Parameter [" + START + "] is equals to [" + start + "]");
limit = getAttributeAsInteger( LIMIT );
logger.debug("Parameter [" + LIMIT + "] is equals to [" + limit + "]");
filters = getAttributeAsJSONArray( FILTERS );
logger.debug("Parameter [" + FILTERS + "] is equals to [" + filters + "]");
Assert.assertNotNull(filters, "Parameter [" + FILTERS + "] cannot be null");
Assert.assertTrue(filters.length() > 0, "GroupBy fileds list cannot be empty");
maxSize = QbeEngineConfig.getInstance().getResultLimit();
logger.debug("Configuration setting [" + "QBE.QBE-SQL-RESULT-LIMIT.value" + "] is equals to [" + (maxSize != null? maxSize: "none") + "]");
isMaxResultsLimitBlocking = QbeEngineConfig.getInstance().isMaxResultLimitBlocking();
logger.debug("Configuration setting [" + "QBE.QBE-SQL-RESULT-LIMIT.isBlocking" + "] is equals to [" + isMaxResultsLimitBlocking + "]");
Assert.assertNotNull(getEngineInstance(), "It's not possible to execute " + this.getActionName() + " service before having properly created an instance of EngineInstance class");
// STEP 1: modify the query according to the input that come from the form
query = getEngineInstance().getQueryCatalogue().getFirstQuery();
// ... query transformation goes here
logger.debug("Making a deep copy of the original query...");
String store = ((JSONObject)SerializerFactory.getSerializer("application/json").serialize(query, getEngineInstance().getDataSource(), getLocale())).toString();
Query copy = SerializerFactory.getDeserializer("application/json").deserializeQuery(store, getEngineInstance().getDataSource());
logger.debug("Deep copy of the original query produced");
String jsonEncodedFormState = getAttributeAsString( FORM_STATE );
logger.debug("Form state retrieved as a string: " + jsonEncodedFormState);
JSONObject formState = new JSONObject(jsonEncodedFormState);