Package com.cumulocity.sdk.client
Class PagedCollectionResourceImpl<T,C extends BaseCollectionRepresentation<T>,I extends C>
- java.lang.Object
-
- com.cumulocity.sdk.client.PagedCollectionResourceImpl<T,C,I>
-
- All Implemented Interfaces:
PagedCollectionResource<T,I>
- Direct Known Subclasses:
AlarmCollectionImpl,AuditRecordCollectionImpl,EventCollectionImpl,ExternalIDCollectionImpl,ManagedObjectCollectionImpl,ManagedObjectReferenceCollectionImpl,MeasurementCollectionImpl,NotificationSubscriptionCollectionImpl,OperationCollectionImpl,TenantOptionCollectionImpl
public abstract class PagedCollectionResourceImpl<T,C extends BaseCollectionRepresentation<T>,I extends C> extends Object implements PagedCollectionResource<T,I>
-
-
Field Summary
Fields Modifier and Type Field Description protected intpageSizeprotected RestConnectorrestConnector-
Fields inherited from interface com.cumulocity.sdk.client.PagedCollectionResource
PAGE_NUMBER_KEY, PAGE_SIZE_KEY
-
-
Constructor Summary
Constructors Constructor Description PagedCollectionResourceImpl(RestConnector restConnector, String url, int pageSize)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)Iget(int pageSize, QueryParam... queryParams)The method returns the first page.Iget(QueryParam... queryParams)The method returns the first page.protected Iget(Map<String,String> params)protected IgetCollection(String url)protected abstract CumulocityMediaTypegetMediaType()IgetNextPage(BaseCollectionRepresentation collectionRepresentation)The method returns the next page from the collection.IgetPage(BaseCollectionRepresentation collectionRepresentation, int pageNumber)The method returns the specified page number.IgetPage(BaseCollectionRepresentation collectionRepresentation, int pageNumber, int pageSize)The method returns the specified page number.IgetPreviousPage(BaseCollectionRepresentation collectionRepresentation)This method returns the previous page in the collection.protected abstract Class<C>getResponseClass()inthashCode()protected Map<String,String>prepareGetParams(int pageSize)protected abstract Iwrap(C collection)
-
-
-
Field Detail
-
pageSize
protected int pageSize
-
restConnector
protected final RestConnector restConnector
-
-
Constructor Detail
-
PagedCollectionResourceImpl
public PagedCollectionResourceImpl(RestConnector restConnector, String url, int pageSize)
-
-
Method Detail
-
getMediaType
protected abstract CumulocityMediaType getMediaType()
-
getPage
public I getPage(BaseCollectionRepresentation collectionRepresentation, int pageNumber) throws SDKException
Description copied from interface:PagedCollectionResourceThe method returns the specified page number.- Specified by:
getPagein interfacePagedCollectionResource<T,C extends BaseCollectionRepresentation<T>>- Parameters:
collectionRepresentation- It uses the BaseCollectionRepresentation.getSelf() URL to find the collection.pageNumber- - page number- Returns:
- BaseCollectionRepresentation type of BaseCollectionRepresentation.
- Throws:
SDKException- if the query failed
-
getPage
public I getPage(BaseCollectionRepresentation collectionRepresentation, int pageNumber, int pageSize) throws SDKException
Description copied from interface:PagedCollectionResourceThe method returns the specified page number.- Specified by:
getPagein interfacePagedCollectionResource<T,C extends BaseCollectionRepresentation<T>>- Parameters:
collectionRepresentation- It uses the BaseCollectionRepresentation.getSelf() URL to find the collection.pageNumber- - page numberpageSize- - page size- Returns:
- BaseCollectionRepresentation type of BaseCollectionRepresentation.
- Throws:
SDKException- if the query failed
-
getCollection
protected I getCollection(String url) throws SDKException
- Throws:
SDKException
-
getNextPage
public I getNextPage(BaseCollectionRepresentation collectionRepresentation) throws SDKException
Description copied from interface:PagedCollectionResourceThe method returns the next page from the collection.- Specified by:
getNextPagein interfacePagedCollectionResource<T,C extends BaseCollectionRepresentation<T>>- Parameters:
collectionRepresentation- It uses the BaseCollectionRepresentation.getNext() URL to find the collection.- Returns:
- collectionRepresentation type of BaseCollectionRepresentation.
- Throws:
SDKException- if the query failed
-
getPreviousPage
public I getPreviousPage(BaseCollectionRepresentation collectionRepresentation) throws SDKException
Description copied from interface:PagedCollectionResourceThis method returns the previous page in the collection.- Specified by:
getPreviousPagein interfacePagedCollectionResource<T,C extends BaseCollectionRepresentation<T>>- Parameters:
collectionRepresentation- - It uses the BaseCollectionRepresentation.getPrevious() URL to find the collection.- Returns:
- BaseCollectionRepresentation type of BaseCollectionRepresentation.
- Throws:
SDKException- if the query failed
-
get
public I get(QueryParam... queryParams) throws SDKException
Description copied from interface:PagedCollectionResourceThe method returns the first page.- Specified by:
getin interfacePagedCollectionResource<T,C extends BaseCollectionRepresentation<T>>- Parameters:
queryParams- query parameters- Returns:
- BaseCollectionRepresentation type of BaseCollectionRepresentation.
- Throws:
SDKException- if the query failed
-
get
public I get(int pageSize, QueryParam... queryParams) throws SDKException
Description copied from interface:PagedCollectionResourceThe method returns the first page.- Specified by:
getin interfacePagedCollectionResource<T,C extends BaseCollectionRepresentation<T>>- Parameters:
pageSize- - page sizequeryParams- query parameters- Returns:
- BaseCollectionRepresentation type of BaseCollectionRepresentation.
- Throws:
SDKException- if the query failed
-
get
protected I get(Map<String,String> params) throws SDKException
- Throws:
SDKException
-
-