private JSONObject getQueryResultsJson() throws SQLException, ClassNotFoundException, FileNotFoundException, JSONException, IOException, ParseException {
JSONObject resultsObject = new JSONObject();
JSONObject statusObj = getStatusObject(FetchMethod.QUERY_RESULTS);
if (statusObj == null && queryResultsResults.length() == 0 && !dbHelper.lastFetchSuccesful(endpointId, type)) {
//no error or exception. just try fetching our stuff!
AutocompletionFetcher fetcher = null;
if (type == FetchType.PROPERTIES) {
fetcher = new PropertiesFetcher(endpoint, dbHelper);
} else {
fetcher = new ClassesFetcher(endpoint, dbHelper);
}
try {
fetcher.fetch();
} catch (Exception e) {
statusObj = generateStatusObject("failed", "Exception message: " + e.getMessage(), AutocompletionStatusLevel.ERROR);
}
fetchCompletions(FetchMethod.QUERY_RESULTS);
}