mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged 5.2.N (5.2.1) to HEAD (5.2)
129196 mmuller: Merged RETURN-OF-THE-API (5.2.0) to 5.2.N (5.2.1) 129052 adavis: REPO-232,REPO-883 V1 REST API: Sites Live Search (/queries/live-search-sites) - As part of code review: Added generics to listPage method and moved it inside AbstractQuery. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@129370 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -610,26 +610,25 @@ public class QueriesImpl implements Queries, InitializingBean
|
||||
}
|
||||
return nodeRefs;
|
||||
}
|
||||
}
|
||||
|
||||
// note: see also AbstractNodeRelation
|
||||
protected static CollectionWithPagingInfo listPage(List result, Paging paging)
|
||||
protected static <T> CollectionWithPagingInfo<T> listPage(List<T> result, Paging paging)
|
||||
{
|
||||
// return 'page' of results (based on full result set)
|
||||
int skipCount = paging.getSkipCount();
|
||||
int pageSize = paging.getMaxItems();
|
||||
int pageEnd = skipCount + pageSize;
|
||||
|
||||
final List page = new ArrayList<>(pageSize);
|
||||
final List<T> page = new ArrayList<>(pageSize);
|
||||
if (result == null)
|
||||
{
|
||||
result = Collections.emptyList();
|
||||
}
|
||||
|
||||
Iterator it = result.iterator();
|
||||
Iterator<T> it = result.iterator();
|
||||
for (int counter = 0; counter < pageEnd && it.hasNext(); counter++)
|
||||
{
|
||||
Object element = it.next();
|
||||
T element = it.next();
|
||||
if (counter < skipCount)
|
||||
{
|
||||
continue;
|
||||
@@ -646,4 +645,5 @@ public class QueriesImpl implements Queries, InitializingBean
|
||||
|
||||
return CollectionWithPagingInfo.asPaged(paging, page, hasMoreItems, totalCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user