public abstract class AbstractCannedQuery<R> extends Object implements CannedQuery<R>
Modifier | Constructor and Description |
---|---|
protected |
AbstractCannedQuery(CannedQueryParameters parameters)
Construct the canned query given the original parameters applied.
|
Modifier and Type | Method and Description |
---|---|
protected List<List<R>> |
applyPostQueryPaging(List<R> results,
CannedQueryPageDetails pageDetails)
Called after the
sorting phase to pull out results specific
to the required pages. |
protected List<R> |
applyPostQueryPermissions(List<R> results,
int requestedCount)
Called after the query to filter out results based on permissions.
|
protected List<R> |
applyPostQuerySorting(List<R> results,
CannedQuerySortDetails sortDetails)
Called before
applyPostQueryPermissions(List, int) to allow the results to be sorted prior to permission checks. |
CannedQueryResults<R> |
execute()
Execute the named query, which was provided to support the
parameters originally provided. |
CannedQueryParameters |
getParameters()
Get the original parameters used to generate the query.
|
protected Pair<Integer,Integer> |
getTotalResultCount(List<R> results)
Get the total number of available results after querying, filtering, sorting and permission checking.
|
protected boolean |
isApplyPostQueryPaging()
Override to get post-query calls to do pull out paged results.
|
protected boolean |
isApplyPostQueryPermissions()
Override to get post-query calls to apply permission filters.
|
protected boolean |
isApplyPostQuerySorting()
Override to get post-query calls to do sorting.
|
protected abstract List<R> |
queryAndFilter(CannedQueryParameters parameters)
Implement the basic query, returning either filtered or all results.
|
String |
toString() |
protected AbstractCannedQuery(CannedQueryParameters parameters)
parameters
- the original query parameterspublic CannedQueryParameters getParameters()
CannedQuery
getParameters
in interface CannedQuery<R>
public final CannedQueryResults<R> execute()
CannedQuery
parameters
originally provided.
Note: This method can only be used once; to requery, get a new
instance from the factory
.execute
in interface CannedQuery<R>
protected abstract List<R> queryAndFilter(CannedQueryParameters parameters)
applyPostQuerySorting(List, CannedQuerySortDetails)
,
applyPostQueryPermissions(List, int)
and
applyPostQueryPaging(List, CannedQueryPageDetails)
) can
be used to trim the results as required.parameters
- the full parameters to be used for executionprotected boolean isApplyPostQuerySorting()
protected List<R> applyPostQuerySorting(List<R> results, CannedQuerySortDetails sortDetails)
applyPostQueryPermissions(List, int)
to allow the results to be sorted prior to permission checks.
Note that the query implementation may optimally sort results during retrieval, in which case this method does not need to be implemented.results
- the results to sortsortDetails
- details of the sorting requirementsprotected boolean isApplyPostQueryPermissions()
protected List<R> applyPostQueryPermissions(List<R> results, int requestedCount)
results
- the results to apply permissions torequestedCount
- the minimum number of results to pass the permission checks
in order to fully satisfy the paging requirementsprotected Pair<Integer,Integer> getTotalResultCount(List<R> results)
results
- the results after filtering and sorting, but before pagingCannedQueryParameters.getTotalResultCountMax()
protected boolean isApplyPostQueryPaging()
protected List<List<R>> applyPostQueryPaging(List<R> results, CannedQueryPageDetails pageDetails)
sorting phase
to pull out results specific
to the required pages. Note that the query implementation may optimally
create page-specific results, in which case this method does not need to be implemented.
The base implementation assumes that results are not paged and that the current results
are all the available results i.e. that paging still needs to be applied.results
- full results (all or excess pages)pageDetails
- details of the paging requirementsCopyright © 2005–2019 Alfresco Software. All rights reserved.