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 int
pageSize
protected RestConnector
restConnector
-
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 boolean
equals(Object obj)
I
get(int pageSize, QueryParam... queryParams)
The method returns the first page.I
get(QueryParam... queryParams)
The method returns the first page.protected I
get(Map<String,String> params)
protected I
getCollection(String url)
protected abstract CumulocityMediaType
getMediaType()
I
getNextPage(BaseCollectionRepresentation collectionRepresentation)
The method returns the next page from the collection.I
getPage(BaseCollectionRepresentation collectionRepresentation, int pageNumber)
The method returns the specified page number.I
getPage(BaseCollectionRepresentation collectionRepresentation, int pageNumber, int pageSize)
The method returns the specified page number.I
getPreviousPage(BaseCollectionRepresentation collectionRepresentation)
This method returns the previous page in the collection.protected abstract Class<C>
getResponseClass()
int
hashCode()
protected Map<String,String>
prepareGetParams(int pageSize)
protected abstract I
wrap(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:PagedCollectionResource
The method returns the specified page number.- Specified by:
getPage
in 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:PagedCollectionResource
The method returns the specified page number.- Specified by:
getPage
in 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:PagedCollectionResource
The method returns the next page from the collection.- Specified by:
getNextPage
in 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:PagedCollectionResource
This method returns the previous page in the collection.- Specified by:
getPreviousPage
in 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:PagedCollectionResource
The method returns the first page.- Specified by:
get
in 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:PagedCollectionResource
The method returns the first page.- Specified by:
get
in 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
-
-