Class InventoryApiImpl
- All Implemented Interfaces:
InventoryApi
-
Constructor Summary
ConstructorsConstructorDescriptionInventoryApiImpl(RestConnector restConnector, UrlProcessor urlProcessor, InventoryRepresentation inventoryRepresentation, int pageSize) -
Method Summary
Modifier and TypeMethodDescriptionReturns the count of managed objects from the platform based on specified filter.create(ManagedObjectRepresentation representation) Creates managed object in the platform.createBulk(ManagedObjectCollectionRepresentation managedObjects) Creates multiple managed objects (at most 50) in the platform with a single request.voidDeletes the Managed Object from the Cumulocity Server.voiddeleteCascade(GId id) Deletes the Managed Object and all child devices and child assets recursively from the Cumulocity Server.Returns the Managed Object of the Resource.get(GId id, QueryParam... params) Returns the Managed Object of the Resource.getManagedObject(GId globalId) Gets managed object resource by id.getManagedObjectApi(GId globalId) Gets managed object resource by id.Gets the all the managed object in the platformGets the managed objects from the platform based on specified filter.Deprecated.protected StringgetSupportedMeasurements(GId sourceId) Returns supported measurements of the Managed Object specified by its idgetSupportedSeries(GId sourceId) Returns supported series of the Managed Object specified by its idupdate(ManagedObjectRepresentation managedObjectRepresentation) This update the ManagedObject for the operationCollection.updateBulk(ManagedObjectCollectionRepresentation managedObjects) Updates multiple managed objects (at most 50) in the platform with a single request.
-
Constructor Details
-
InventoryApiImpl
public InventoryApiImpl(RestConnector restConnector, UrlProcessor urlProcessor, InventoryRepresentation inventoryRepresentation, int pageSize)
-
-
Method Details
-
create
public ManagedObjectRepresentation create(ManagedObjectRepresentation representation) throws SDKException Description copied from interface:InventoryApiCreates managed object in the platform. The id of the managed object must not be set, since it will be generated by the platform- Specified by:
createin interfaceInventoryApi- Parameters:
representation- the managed object to be created- Returns:
- the created managed object with the generated id
- Throws:
SDKException- if the managed object could not be created
-
createBulk
public ManagedObjectCollectionRepresentation createBulk(ManagedObjectCollectionRepresentation managedObjects) throws SDKException Description copied from interface:InventoryApiCreates multiple managed objects (at most 50) in the platform with a single request. The ids of the managed objects must not be set.If the request failed while writing, part of it may have been created. In this case
fragmentTypeidentifies the created managed objects. To complete the request without duplicates, look them up by this fragment type and send again only the managed objects that the lookup did not return. A failure without an error body, for example a gateway timeout, can also follow a partial write.For the limits, the validation rules, and the details of the recovery, see Create one or multiple managed objects in the API reference.
- Specified by:
createBulkin interfaceInventoryApi- Parameters:
managedObjects- the managed objects to be created- Returns:
- the created managed objects with their generated ids, in the order of the request
- Throws:
BulkRequestException- if the request failed for one of the managed objectsSDKException- if the managed objects could not be created
-
get
Description copied from interface:InventoryApiReturns the Managed Object of the Resource.- Specified by:
getin interfaceInventoryApi- Parameters:
id- Managed Object General Identifier- Returns:
- ManagedObjectRepresentation
- Throws:
SDKException- if query failed
-
get
Description copied from interface:InventoryApiReturns the Managed Object of the Resource. Using additional query params e.g. withChildren=false to optimize access time.- Specified by:
getin interfaceInventoryApi- Parameters:
id- Managed Object General Identifierparams- query parameters- Returns:
- ManagedObjectRepresentation
- Throws:
SDKException- if query failed
-
delete
Description copied from interface:InventoryApiDeletes the Managed Object from the Cumulocity Server.- Specified by:
deletein interfaceInventoryApi- Parameters:
id- Managed Object General Identifier- Throws:
SDKException- if the managed object could not be deleted
-
deleteCascade
Description copied from interface:InventoryApiDeletes the Managed Object and all child devices and child assets recursively from the Cumulocity Server.- Specified by:
deleteCascadein interfaceInventoryApi- Parameters:
id- Managed Object General Identifier- Throws:
SDKException- if the managed object could not be deleted
-
update
public ManagedObjectRepresentation update(ManagedObjectRepresentation managedObjectRepresentation) throws SDKException Description copied from interface:InventoryApiThis update the ManagedObject for the operationCollection. Cannot update the ID.- Specified by:
updatein interfaceInventoryApi- Parameters:
managedObjectRepresentation- managed object representation- Returns:
- ManagedObjectRepresentation updated ManagedObject.
- Throws:
SDKException- if the managed object could not be updated
-
updateBulk
public ManagedObjectCollectionRepresentation updateBulk(ManagedObjectCollectionRepresentation managedObjects) throws SDKException Description copied from interface:InventoryApiUpdates multiple managed objects (at most 50) in the platform with a single request. Every managed object must have its id set.If the request fails for one of the managed objects, a
BulkRequestExceptionis thrown. ItsfailedIndexis the position of that managed object in the request.For the limits and the validation rules, see Update multiple managed objects at once in the API reference.
- Specified by:
updateBulkin interfaceInventoryApi- Parameters:
managedObjects- the managed objects to be updated- Returns:
- the updated managed objects
- Throws:
BulkRequestException- if the request failed for one of the managed objectsSDKException- if the managed objects could not be updated
-
getManagedObject
Description copied from interface:InventoryApiGets managed object resource by id. To get the managed object representation you have to callget()on the returned resource.- Specified by:
getManagedObjectin interfaceInventoryApi- Parameters:
globalId- id of the managed object to search for- Returns:
- the managed object resource associated with the given id
- Throws:
SDKException- if the query failed
-
getManagedObjectApi
Description copied from interface:InventoryApiGets managed object resource by id. To get the managed object representation you have to callget()on the returned resource.- Specified by:
getManagedObjectApiin interfaceInventoryApi- Parameters:
globalId- id of the managed object to search for- Returns:
- the managed object resource associated with the given id
- Throws:
SDKException- if the query failed
-
getManagedObjects
Description copied from interface:InventoryApiGets the all the managed object in the platform- Specified by:
getManagedObjectsin interfaceInventoryApi- Returns:
- collection of managed objects with paging functionality
- Throws:
SDKException- if the query failed
-
getManagedObjectsByFilter
public ManagedObjectCollection getManagedObjectsByFilter(InventoryFilter filter) throws SDKException Description copied from interface:InventoryApiGets the managed objects from the platform based on specified filter. Query based ontypeandfragmentTypeis not supported.- Specified by:
getManagedObjectsByFilterin interfaceInventoryApi- Parameters:
filter- the filter criteria(s)- Returns:
- collection of managed objects matched by the filter with paging functionality
- Throws:
SDKException- if the query failed
-
countManagedObjectsByFilter
Description copied from interface:InventoryApiReturns the count of managed objects from the platform based on specified filter.- Specified by:
countManagedObjectsByFilterin interfaceInventoryApi- Parameters:
filter- the filter criteria(s)- Returns:
- count of managed objects matched by the filter
- Throws:
SDKException- if the query failed
-
getSupportedMeasurements
public SupportedMeasurementsRepresentation getSupportedMeasurements(GId sourceId) throws SDKException Description copied from interface:InventoryApiReturns supported measurements of the Managed Object specified by its id- Specified by:
getSupportedMeasurementsin interfaceInventoryApi- Parameters:
sourceId- id of the managed object to search for- Returns:
- SupportedMeasurementsRepresentation
- Throws:
SDKException- if managed object does not exists
-
getSupportedSeries
Description copied from interface:InventoryApiReturns supported series of the Managed Object specified by its id- Specified by:
getSupportedSeriesin interfaceInventoryApi- Parameters:
sourceId- id of the managed object to search for- Returns:
- SupportedSeriesRepresentation
- Throws:
SDKException- if managed object does not exists
-
getManagedObjectsByListOfIds
@Deprecated public ManagedObjectCollection getManagedObjectsByListOfIds(List<GId> ids) throws SDKException Deprecated.Description copied from interface:InventoryApiGets the managed objects from the platform based on the given ids- Specified by:
getManagedObjectsByListOfIdsin interfaceInventoryApi- Parameters:
ids- the list of ids of the managed objects to search for- Returns:
- collection of managed objects matched in order of the given ids
- Throws:
SDKException- if the query failed
-
getMOCollectionUrl
- Throws:
SDKException
-