Class DeviceControlApiImpl
- java.lang.Object
-
- com.cumulocity.sdk.client.devicecontrol.DeviceControlApiImpl
-
- All Implemented Interfaces:
DeviceControlApi
public class DeviceControlApiImpl extends Object implements DeviceControlApi
-
-
Constructor Summary
Constructors Constructor Description DeviceControlApiImpl(PlatformParameters parameters, RestConnector restConnector, UrlProcessor urlProcessor, DeviceControlRepresentation deviceControlRepresentation, int pageSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OperationRepresentationcreate(OperationRepresentation operation)Creates operation in the platform.Subscriber<GId,OperationRepresentation>getNotificationsSubscriber()Gets the notifications subscriber, which allows to receive newly created operations for agent.OperationRepresentationgetOperation(GId gid)Gets operation by idOperationCollectiongetOperations()Gets the all the operation in the platformOperationCollectiongetOperationsByFilter(OperationFilter filter)Gets the operations from the platform based on specified filter.OperationRepresentationupdate(OperationRepresentation operation)Updates operation in the platform.FutureupdateAsync(OperationRepresentation operation)Updates operation in the platform.
-
-
-
Constructor Detail
-
DeviceControlApiImpl
public DeviceControlApiImpl(PlatformParameters parameters, RestConnector restConnector, UrlProcessor urlProcessor, DeviceControlRepresentation deviceControlRepresentation, int pageSize)
-
-
Method Detail
-
getOperation
public OperationRepresentation getOperation(GId gid) throws SDKException
Description copied from interface:DeviceControlApiGets operation by id- Specified by:
getOperationin interfaceDeviceControlApi- Parameters:
gid- id of the operation to search for- Returns:
- the operation with the given id
- Throws:
SDKException- if the operation is not found or if the query failed
-
getOperations
public OperationCollection getOperations() throws SDKException
Description copied from interface:DeviceControlApiGets the all the operation in the platform- Specified by:
getOperationsin interfaceDeviceControlApi- Returns:
- collection of operations with paging functionality
- Throws:
SDKException- if the query failed
-
create
public OperationRepresentation create(OperationRepresentation operation) throws SDKException
Description copied from interface:DeviceControlApiCreates operation in the platform. The id of the operation must not be set, since it will be generated by the platform- Specified by:
createin interfaceDeviceControlApi- Parameters:
operation- operation to be created- Returns:
- the created operation with the generated id
- Throws:
SDKException- if the operation could not be created
-
update
public OperationRepresentation update(OperationRepresentation operation) throws SDKException
Description copied from interface:DeviceControlApiUpdates operation in the platform. The operation to be updated is identified by the id within the given operation.- Specified by:
updatein interfaceDeviceControlApi- Parameters:
operation- to be updated- Returns:
- the updated operation
- Throws:
SDKException- if the operation could not be updated
-
updateAsync
public Future updateAsync(OperationRepresentation operation) throws SDKException
Description copied from interface:DeviceControlApiUpdates operation in the platform. Immediate response is available through the Future object. In case of lost connection, buffers data in persistence provider.- Specified by:
updateAsyncin interfaceDeviceControlApi- Parameters:
operation- to be updated- Returns:
- the updated operation
- Throws:
SDKException- if the operation could not be updated
-
getOperationsByFilter
public OperationCollection getOperationsByFilter(OperationFilter filter) throws SDKException
Description copied from interface:DeviceControlApiGets the operations from the platform based on specified filter. Queries based on [status,deviceId,agentId] and [deviceId,agentId] are not supported. currently not supported.- Specified by:
getOperationsByFilterin interfaceDeviceControlApi- Parameters:
filter- the filter criteria(s)- Returns:
- collection of operations matched by the filter with paging functionality
- Throws:
SDKException- if the query failed
-
getNotificationsSubscriber
public Subscriber<GId,OperationRepresentation> getNotificationsSubscriber() throws SDKException
Description copied from interface:DeviceControlApiGets the notifications subscriber, which allows to receive newly created operations for agent.Example: final GId agentId = ... Subscriber<GId, OperationRepresentation> subscriber = deviceControlApi.getNotificationsSubscriber(); subscriber.subscribe( agentId , new SubscriptionListener<GId, OperationRepresentation>() { @Override public void onNotification(Subscription<GId> subscription, OperationRepresentation operation) { //process operation } @Override public void onError(Subscription<GId> subscription, Throwable ex) { // handle subscribe operation error } });- Specified by:
getNotificationsSubscriberin interfaceDeviceControlApi- Returns:
- subscriber
- Throws:
SDKException- when subscriber creation fail
-
-