Java Code Examples for org.alfresco.service.cmr.search.SearchParameters#getMaxItems()

The following examples show how to use org.alfresco.service.cmr.search.SearchParameters#getMaxItems() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ACLEntryAfterInvocationProvider.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Get the max size from the search parameters.
 * The max size is the maximum number of elements to be returned, It is computed considering various
 * parameters in the searchParameters : maxSize, limitBy and skipCount.
 *
 * @param searchParameters
 * @return
 */
private Integer getMaxSize(SearchParameters searchParameters)
{
    Integer maxSize = null;
    if (searchParameters.getMaxItems() >= 0)
    {
        maxSize = searchParameters.getMaxItems() + searchParameters.getSkipCount();
    }
    else if (searchParameters.getLimitBy() == LimitBy.FINAL_SIZE)
    {
        maxSize = searchParameters.getLimit() + searchParameters.getSkipCount();
    }

    return maxSize;
}
 
Example 2
Source File: DBResultSet.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
public DBResultSet(SearchParameters searchParameters, List<Long> dbids, NodeDAO nodeDao,  NodeService nodeService, TenantService tenantService, int maximumResultsFromUnlimitedQuery)
{
    this.nodeDao = nodeDao;
    this.dbids = dbids;
    this.nodeService = nodeService;
    this.tenantService = tenantService;
    this.prefetch = new BitSet(dbids.size());
    nodeRefs= new NodeRef[(dbids.size())];
    
    final LimitBy limitBy;
    int maxResults = -1;
    if (searchParameters.getMaxItems() >= 0)
    {
        maxResults = searchParameters.getMaxItems();
        limitBy = LimitBy.FINAL_SIZE;
    }
    else if(searchParameters.getLimitBy() == LimitBy.FINAL_SIZE && searchParameters.getLimit() >= 0)
    {
        maxResults = searchParameters.getLimit();
        limitBy = LimitBy.FINAL_SIZE;
    }
    else
    {
        maxResults = searchParameters.getMaxPermissionChecks();
        if (maxResults < 0)
        {
            maxResults = maximumResultsFromUnlimitedQuery;
        }
        limitBy = LimitBy.NUMBER_OF_PERMISSION_EVALUATIONS;
    }
    
    this.resultSetMetaData = new SimpleResultSetMetaData(
            maxResults > 0 && dbids.size() < maxResults ? LimitBy.UNLIMITED : limitBy,
            PermissionEvaluationMode.EAGER, searchParameters);
}