Class CannedQueryParameters


  • public class CannedQueryParameters
    extends Object
    Parameters defining the named query to execute.

    The implementations of the underlying queries may be vastly different depending on seemingly-minor variations in the parameters; only set the parameters that are required.

    Since:
    4.0
    Author:
    Derek Hulley
    • Field Detail

      • DEFAULT_TOTAL_COUNT_MAX

        public static final int DEFAULT_TOTAL_COUNT_MAX
        See Also:
        Constant Field Values
    • Constructor Detail

      • CannedQueryParameters

        public CannedQueryParameters​(Object parameterBean)
        • pageDetails: null
        • sortDetails: null
        • totalResultCountMax: 0
        • queryExecutionId: null
      • CannedQueryParameters

        public CannedQueryParameters​(Object parameterBean,
                                     int skipResults,
                                     int pageSize,
                                     String queryExecutionId)
        Defaults:
        • pageDetails.pageNumber: 1
        • pageDetails.pageCount: 1
        • totalResultCountMax: 0
      • CannedQueryParameters

        public CannedQueryParameters​(Object parameterBean,
                                     CannedQuerySortDetails sortDetails,
                                     PagingRequest pagingRequest)
        Construct all the parameters for executing a named query, using values from the PagingRequest.
        Parameters:
        parameterBean - the values that the query will be based on or null if not relevant to the query
        sortDetails - the type of sorting to be applied or null for none
        pagingRequest - the type of paging to be applied or null for none
      • CannedQueryParameters

        public CannedQueryParameters​(Object parameterBean,
                                     CannedQueryPageDetails pageDetails,
                                     CannedQuerySortDetails sortDetails,
                                     int totalResultCountMax,
                                     String queryExecutionId)
        Construct all the parameters for executing a named query. Note that the allowable values for the arguments depend on the specific query being executed.
        Parameters:
        parameterBean - the values that the query will be based on or null if not relevant to the query
        pageDetails - the type of paging to be applied or null for none
        sortDetails - the type of sorting to be applied or null for none
        totalResultCountMax - greater than zero if the query should not only return the required rows but should also return the total number of possible rows up to the given maximum.
        queryExecutionId - ID of a previously-executed query to be used during follow-up page requests - null if not available
    • Method Detail

      • getQueryExecutionId

        public String getQueryExecutionId()
      • getPageDetails

        public CannedQueryPageDetails getPageDetails()
        Returns:
        the query paging details (never null)
      • getTotalResultCountMax

        public int getTotalResultCountMax()
        Returns:
        if > 0 then the query should not only return the required rows but should also return the total count (number of possible rows) up to the given max if 0 then query does not need to return the total count
      • getResultsRequired

        public int getResultsRequired()
        Helper method to get the total number of query results that need to be obtained in order to satisfy the paging requirements, the maximum result count ... and an extra to provide 'hasMore' functionality.
        Returns:
        the minimum number of results required before pages can be created
      • getParameterBean

        public Object getParameterBean()
        Returns:
        parameterBean the values that the query will be based on or null if not relevant to the query