icegem-core/src/main/java/com/googlecode/icegem/query/pagination/PaginatedQuery.java
@SuppressWarnings({ "unchecked" })
	private void prepareResultData(boolean force) throws QueryException {
		if (this.infoLoaded && !force) {
			return;
		}

		PageKey pageKey = newKey(PAGE_NUMBER_FOR_GENERAL_INFO);

		List<Object> queryInfo = null;
		if (!force) {
			queryInfo = paginatedQueryInfoRegion.get(pageKey);
		}

		if (queryInfo == null) {
			Query query = queryService.newQuery(this.queryString);
			SelectResults<Object> results = null;
			try {
				results = (SelectResults<Object>) query.execute(pageKey
						.getQueryParameters());
			} catch (FunctionDomainException e) {
				handleException(e);
			} catch (TypeMismatchException e) {
				handleException(e);
			} catch (NameResolutionException e) {
				handleException(e);
			} catch (QueryInvocationTargetException e) {
				handleException(e);
			}

			if (results.size() > queryLimit) {
				this.limitExceeded = true;
				this.totalNumberOfEntries = queryLimit;
				String msg = "Size of query results has exceeded limit ("
						+ queryLimit + "). Truncated.";
				logger.warn(msg);
			} else {
				limitExceeded = false;
				this.totalNumberOfEntries = results.size();
			}

			queryInfo = Arrays.asList(new Object[] { results.size(),
					limitExceeded });
			storePage(PAGE_NUMBER_FOR_GENERAL_INFO, queryInfo);

			List<Object> keys = extractKeys(results);
			storeResults(keys);
		} else {
			this.totalNumberOfEntries = (Integer) queryInfo.get(0);
			this.limitExceeded = (Boolean) queryInfo.get(1);
		}
		this.infoLoaded = true;
	}
@SuppressWarnings({ "unchecked" })
	private void prepareResultData(boolean force) throws QueryException {
		if (this.infoLoaded && !force) {
			return;
		}

		PageKey pageKey = newKey(PAGE_NUMBER_FOR_GENERAL_INFO);

		List<Object> queryInfo = null;
		if (!force) {
			queryInfo = paginatedQueryInfoRegion.get(pageKey);
		}

		if (queryInfo == null) {
			Query query = queryService.newQuery(this.queryString);
			SelectResults<Object> results = null;
			try {
				results = (SelectResults<Object>) query.execute(pageKey
						.getQueryParameters());
			} catch (FunctionDomainException e) {
				handleException(e);
			} catch (TypeMismatchException e) {
				handleException(e);
			} catch (NameResolutionException e) {
				handleException(e);
			} catch (QueryInvocationTargetException e) {
				handleException(e);
			}

			if (results.size() > queryLimit) {
				this.limitExceeded = true;
				this.totalNumberOfEntries = queryLimit;
				String msg = "Size of query results has exceeded limit ("
						+ queryLimit + "). Truncated.";
				logger.warn(msg);
			} else {
				limitExceeded = false;
				this.totalNumberOfEntries = results.size();
			}

			queryInfo = Arrays.asList(new Object[] { results.size(),
					limitExceeded });
			storePage(PAGE_NUMBER_FOR_GENERAL_INFO, queryInfo);

			List<Object> keys = extractKeys(results);
			storeResults(keys);
		} else {
			this.totalNumberOfEntries = (Integer) queryInfo.get(0);
			this.limitExceeded = (Boolean) queryInfo.get(1);
		}
		this.infoLoaded = true;
	}
@ SuppressWarnings ( { "unchecked" } ) private void prepareResultData ( boolean force ) throws QueryException { if ( this . infoLoaded && ! force ) { return ; } PageKey pageKey = newKey ( PAGE_NUMBER_FOR_GENERAL_INFO ) ; List < Object > queryInfo = null ; if ( ! force ) { queryInfo = paginatedQueryInfoRegion . get ( pageKey ) ; } if ( queryInfo == null ) { Query query = queryService . newQuery ( this . queryString ) ; SelectResults < Object > results = null ; try { results = ( SelectResults < Object > ) query . execute ( pageKey . getQueryParameters ( ) ) ; } catch ( FunctionDomainException e ) { handleException ( e ) ; } catch ( TypeMismatchException e ) { handleException ( e ) ; } catch ( NameResolutionException e ) { handleException ( e ) ; } catch ( QueryInvocationTargetException e ) { handleException ( e ) ; } if ( results . size ( ) > queryLimit ) { this . limitExceeded = true ; this . totalNumberOfEntries = queryLimit ; String msg = "Size of query results has exceeded limit (" + queryLimit + "). Truncated." ; logger . warn ( msg ) ; } else { limitExceeded = false ; this . totalNumberOfEntries = results . size ( ) ; } queryInfo = Arrays . asList ( new Object [ ] { results . size ( ) , limitExceeded } ) ; storePage ( PAGE_NUMBER_FOR_GENERAL_INFO , queryInfo ) ; List < Object > keys = extractKeys ( results ) ; storeResults ( keys ) ; } else { this . totalNumberOfEntries = ( Integer ) queryInfo . get ( 0 ) ; this . limitExceeded = ( Boolean ) queryInfo . get ( 1 ) ; } this . infoLoaded = true ; }
Stores paginated query info if it has not been stored yet.

@param force

@throws com.gemstone.gemfire.cache.query.QueryException
during query execution
Stores paginated query info if it has not been stored yet .