Java Code Examples for org.alfresco.service.cmr.search.ResultSet#hasMore()

The following examples show how to use org.alfresco.service.cmr.search.ResultSet#hasMore() . 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: CMISResultSet.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
public boolean hasMore()
{
    for (ResultSet resultSet : wrapped.values())
    {
        if (resultSet.hasMore())
        {
            return true;
        }
    }
    return false;
}
 
Example 2
Source File: VirtualQueryImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
private PagingResults<Reference> asPagingResults(ActualEnvironment environment, PagingRequest pagingRequest,
            ResultSet result, Reference parentReference) throws ActualEnvironmentException
{
    final List<Reference> page = new LinkedList<Reference>();

    for (ResultSetRow row : result)
    {
        page.add(NodeProtocol.newReference(row.getNodeRef(),
                                           parentReference));
    }

    final boolean hasMore = result.hasMore();
    final int totalFirst = (int) result.getNumberFound();
    int start;
    try
    {
        start = result.getStart();
    }
    catch (UnsupportedOperationException e)
    {
        if (logger.isDebugEnabled())
        {
            logger.debug("Unsupported ResultSet.getStart() when trying to create query paging result");
        }
        if (pagingRequest != null)
        {
            start = pagingRequest.getSkipCount();
        }
        else
        {
            start = 0;
        }
    }
    final int totlaSecond = !hasMore ? (int) result.getNumberFound() : (int) (start + result.getNumberFound() + 1);
    final Pair<Integer, Integer> total = new Pair<Integer, Integer>(totalFirst,
                                                                    totlaSecond);
    return new PagingResults<Reference>()
    {

        @Override
        public List<Reference> getPage()
        {
            return page;
        }

        @Override
        public boolean hasMoreItems()
        {
            return hasMore;
        }

        @Override
        public Pair<Integer, Integer> getTotalResultCount()
        {

            return total;
        }

        @Override
        public String getQueryExecutionId()
        {
            return null;
        }

    };
}