Class CollectionWithPagingInfo<T>
java.lang.Object
org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo<T>
- All Implemented Interfaces:
SerializablePagedCollection
A wrapper around Collection that supports paging information.
CollectionWithPagingInfo is immutable and collections are unmodifiable. Use the asPaged methods to construct it.
collection - The collection
hasMoreItems - Indicates the total number of items available. Can be greater than the number of items returned in the list.
totalItems - Indicates the total number of items available. Can be greater than the number of items returned in the list.
- Author:
- Gethin James.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
CollectionWithPagingInfo
(Collection<T> collection, Paging paging, boolean hasMoreItems, Integer totalItems, Object sourceEntity, SearchContext context) Constructs a new CollectionWithPagingInfo. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> CollectionWithPagingInfo<T>
asPaged
(Paging paging, Collection<T> aCollection) Constructs a new CollectionWithPagingInfo.static <T> CollectionWithPagingInfo<T>
asPaged
(Paging paging, Collection<T> aCollection, boolean hasMoreItems, Integer totalItems) Constructs a new CollectionWithPagingInfo.static <T> CollectionWithPagingInfo<T>
asPaged
(Paging paging, Collection<T> aCollection, boolean hasMoreItems, Integer totalItems, Object sourceEntity) Constructs a new CollectionWithPagingInfo.static <T> CollectionWithPagingInfo<T>
asPaged
(Paging paging, Collection<T> aCollection, boolean hasMoreItems, Integer totalItems, Object sourceEntity, SearchContext context) Constructs a new CollectionWithPagingInfo.static <T> CollectionWithPagingInfo<T>
asPagedCollection
(T... entity) Constructs a new CollectionWithPagingInfo using a number of entity values.Returns the Collection objectThe search context for the collectionThe requested paging parameters set by the clientThe parent/source entity responsible for the collectionIndicates the total number of items available.boolean
Indicates if the returned collection has more items after the current returned list.
-
Constructor Details
-
CollectionWithPagingInfo
protected CollectionWithPagingInfo(Collection<T> collection, Paging paging, boolean hasMoreItems, Integer totalItems, Object sourceEntity, SearchContext context) Constructs a new CollectionWithPagingInfo.- Parameters:
collection
- - the collection that needs to be paged.paging
- - Paging request infohasMoreItems
- - Are there more items after this Collection?totalItems
- - The total number of items available.
-
-
Method Details
-
asPaged
Constructs a new CollectionWithPagingInfo. It automatically sets the total items based on the collection size and sets the hasMoreItems variable to false.- Parameters:
paging
- - Paging request infoaCollection
- - the collection that needs to be paged.- Returns:
- CollectionWithPagingInfo
-
asPagedCollection
Constructs a new CollectionWithPagingInfo using a number of entity values. It automatically creates a Collection, sets the total items and sets the hasMoreItems variable to false. Paging is set to the default values.- Parameters:
entity
- - the entities to turn into a collection- Returns:
- CollectionWithPagingInfo
-
asPaged
public static <T> CollectionWithPagingInfo<T> asPaged(Paging paging, Collection<T> aCollection, boolean hasMoreItems, Integer totalItems) Constructs a new CollectionWithPagingInfo.- Parameters:
paging
- - Paging request infoaCollection
- - the collection that needs to be paged.hasMoreItems
- - Are there more items after this Collection?totalItems
- - The total number of items available.- Returns:
- CollectionWithPagingInfo
-
asPaged
public static <T> CollectionWithPagingInfo<T> asPaged(Paging paging, Collection<T> aCollection, boolean hasMoreItems, Integer totalItems, Object sourceEntity) Constructs a new CollectionWithPagingInfo. Not for public use.- Parameters:
paging
- - Paging request infoaCollection
- - the collection that needs to be paged.hasMoreItems
- - Are there more items after this Collection?totalItems
- - The total number of items available.sourceEntity
- - The parent/source entity responsible for the collection- Returns:
- CollectionWithPagingInfo
-
asPaged
public static <T> CollectionWithPagingInfo<T> asPaged(Paging paging, Collection<T> aCollection, boolean hasMoreItems, Integer totalItems, Object sourceEntity, SearchContext context) Constructs a new CollectionWithPagingInfo. Not for public use.- Parameters:
paging
- - Paging request infoaCollection
- - the collection that needs to be paged.hasMoreItems
- - Are there more items after this Collection?totalItems
- - The total number of items available.sourceEntity
- - The parent/source entity responsible for the collectioncontext
- - The search context- Returns:
- CollectionWithPagingInfo
-
getCollection
Returns the Collection object- Specified by:
getCollection
in interfaceSerializablePagedCollection<T>
- Returns:
- Collection
-
hasMoreItems
public boolean hasMoreItems()Indicates if the returned collection has more items after the current returned list.- Specified by:
hasMoreItems
in interfaceSerializablePagedCollection<T>
-
getTotalItems
Indicates the total number of items available. Can be greater than the number of items returned in the list.- Specified by:
getTotalItems
in interfaceSerializablePagedCollection<T>
-
getSourceEntity
The parent/source entity responsible for the collection- Specified by:
getSourceEntity
in interfaceSerializablePagedCollection<T>
-
getPaging
The requested paging parameters set by the client- Specified by:
getPaging
in interfaceSerializablePagedCollection<T>
-
getContext
Description copied from interface:SerializablePagedCollection
The search context for the collection- Specified by:
getContext
in interfaceSerializablePagedCollection<T>
-