Class BaseQuery<T>

    • Field Detail

      • queryString

        protected final String queryString
      • projection

        protected final String[] projection
      • startOffset

        protected int startOffset
      • maxResults

        protected int maxResults
      • local

        protected boolean local
      • timeout

        protected long timeout
        Optional timeout in nanoseconds.
    • Constructor Detail

      • BaseQuery

        protected BaseQuery​(QueryFactory queryFactory,
                            String queryString,
                            Map<String,​Object> namedParameters,
                            String[] projection,
                            long startOffset,
                            int maxResults,
                            boolean local)
    • Method Detail

      • getQueryString

        public String getQueryString()
        Returns the Ickle query string.
        Specified by:
        getQueryString in interface Query<T>
        Returns:
        the Ickle query string
      • setParameter

        public Query<T> setParameter​(String paramName,
                                     Object paramValue)
        Description copied from interface: Query
        Sets the value of a named parameter.
        Specified by:
        setParameter in interface ParameterContext<T>
        Specified by:
        setParameter in interface Query<T>
        Parameters:
        paramName - the parameters name (non-empty and not null)
        paramValue - a non-null value
        Returns:
        itself
      • setParameters

        public Query<T> setParameters​(Map<String,​Object> paramValues)
        Description copied from interface: Query
        Sets multiple named parameters at once. Parameters names cannot be empty or null. Parameter values must not be null.
        Specified by:
        setParameters in interface ParameterContext<T>
        Specified by:
        setParameters in interface Query<T>
        Parameters:
        paramValues - a Map of parameters
        Returns:
        itself
      • resetQuery

        public abstract void resetQuery()
        Reset internal state after pagination or query parameters are modified. This is needed to ensure the next execution of the query uses the new values.
      • validateNamedParameters

        public void validateNamedParameters()
        Ensure all named parameters have non-null values.
      • getProjection

        public String[] getProjection()
        Specified by:
        getProjection in interface Query<T>
        Returns:
        the values for query projections or null if the query does not have projections.
      • hasProjections

        public boolean hasProjections()
        Description copied from interface: Query
        Indicates if the parsed query has projections (a SELECT clause) and consequently the returned results will actually be Object[] containing the projected values rather than the target entity.
        Specified by:
        hasProjections in interface Query<T>
        Returns:
        true if it has projections, false otherwise.
      • getStartOffset

        public long getStartOffset()
        Specified by:
        getStartOffset in interface Query<T>
      • getMaxResults

        public int getMaxResults()
        Specified by:
        getMaxResults in interface Query<T>
      • local

        public Query<T> local​(boolean local)
        Description copied from interface: Query
        Set the query execution scope
        Specified by:
        local in interface Query<T>
        Parameters:
        local - if true, query will be restricted to the data present in the local node, ignoring the other members of the clusters
      • isLocal

        public boolean isLocal()
      • timeout

        public Query<T> timeout​(long timeout,
                                TimeUnit timeUnit)
        Description copied from interface: Query
        Set the timeout for this query. If the query hasn't finished processing before the timeout, a SearchTimeoutException will be thrown. For queries that use the index, the timeout is handled on a best effort basis, and the supplied time is rounded to the nearest millisecond.
        Specified by:
        timeout in interface Query<T>
      • entryIterator

        public <K> org.infinispan.commons.util.CloseableIterator<Map.Entry<K,​T>> entryIterator()
        Description copied from interface: Query
        Returns a CloseableIterator over the results, including both key and value. Please close the iterator when you are done with processing the results. The query cannot use projections.
        Specified by:
        entryIterator in interface Query<T>
        Returns:
        the results of the query as an iterator.
      • executeStatement

        public int executeStatement()
        Description copied from interface: Query
        Executes a data modifying statement (typically a DELETE) that does not return results; instead it returns an affected entries count. This method cannot be used to execute a SELECT.

        NOTE: Paging params (firstResult/maxResults) are NOT allowed.

        Specified by:
        executeStatement in interface Query<T>
        Returns:
        the number of affected (deleted) entries