Class InventoryApiImpl
- java.lang.Object
-
- com.cumulocity.sdk.client.inventory.InventoryApiImpl
-
- All Implemented Interfaces:
InventoryApi
public class InventoryApiImpl extends Object implements InventoryApi
-
-
Constructor Summary
Constructors Constructor Description InventoryApiImpl(RestConnector restConnector, UrlProcessor urlProcessor, InventoryRepresentation inventoryRepresentation, int pageSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Integer
countManagedObjectsByFilter(InventoryFilter filter)
Returns the count of managed objects from the platform based on specified filter.ManagedObjectRepresentation
create(ManagedObjectRepresentation representation)
Creates managed object in the platform.void
delete(GId id)
Deletes the Managed Object from the Cumulocity Server.void
deleteCascade(GId id)
Deletes the Managed Object and all child devices and child assets recursively from the Cumulocity Server.ManagedObjectRepresentation
get(GId id)
Returns the Managed Object of the Resource.ManagedObjectRepresentation
get(GId id, QueryParam... params)
Returns the Managed Object of the Resource.ManagedObject
getManagedObject(GId globalId)
Gets managed object resource by id.ManagedObject
getManagedObjectApi(GId globalId)
Gets managed object resource by id.ManagedObjectCollection
getManagedObjects()
Gets the all the managed object in the platformManagedObjectCollection
getManagedObjectsByFilter(InventoryFilter filter)
Gets the managed objects from the platform based on specified filter.ManagedObjectCollection
getManagedObjectsByListOfIds(List<GId> ids)
Deprecated.protected String
getMOCollectionUrl()
SupportedMeasurementsRepresentation
getSupportedMeasurements(GId sourceId)
Returns supported measurements of the Managed Object specified by its idSupportedSeriesRepresentation
getSupportedSeries(GId sourceId)
Returns supported series of the Managed Object specified by its idManagedObjectRepresentation
update(ManagedObjectRepresentation managedObjectRepresentation)
This update the ManagedObject for the operationCollection.
-
-
-
Constructor Detail
-
InventoryApiImpl
public InventoryApiImpl(RestConnector restConnector, UrlProcessor urlProcessor, InventoryRepresentation inventoryRepresentation, int pageSize)
-
-
Method Detail
-
create
public ManagedObjectRepresentation create(ManagedObjectRepresentation representation) throws SDKException
Description copied from interface:InventoryApi
Creates 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:
create
in 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
-
get
public ManagedObjectRepresentation get(GId id) throws SDKException
Description copied from interface:InventoryApi
Returns the Managed Object of the Resource.- Specified by:
get
in interfaceInventoryApi
- Parameters:
id
- Managed Object General Identifier- Returns:
- ManagedObjectRepresentation
- Throws:
SDKException
- if query failed
-
get
public ManagedObjectRepresentation get(GId id, QueryParam... params) throws SDKException
Description copied from interface:InventoryApi
Returns the Managed Object of the Resource. Using additional query params e.g. withChildren=false to optimize access time.- Specified by:
get
in interfaceInventoryApi
- Parameters:
id
- Managed Object General Identifierparams
- query parameters- Returns:
- ManagedObjectRepresentation
- Throws:
SDKException
- if query failed
-
delete
public void delete(GId id) throws SDKException
Description copied from interface:InventoryApi
Deletes the Managed Object from the Cumulocity Server.- Specified by:
delete
in interfaceInventoryApi
- Parameters:
id
- Managed Object General Identifier- Throws:
SDKException
- if the managed object could not be deleted
-
deleteCascade
public void deleteCascade(GId id) throws SDKException
Description copied from interface:InventoryApi
Deletes the Managed Object and all child devices and child assets recursively from the Cumulocity Server.- Specified by:
deleteCascade
in 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:InventoryApi
This update the ManagedObject for the operationCollection. Cannot update the ID.- Specified by:
update
in interfaceInventoryApi
- Parameters:
managedObjectRepresentation
- managed object representation- Returns:
- ManagedObjectRepresentation updated ManagedObject.
- Throws:
SDKException
- if the managed object could not be updated
-
getManagedObject
public ManagedObject getManagedObject(GId globalId) throws SDKException
Description copied from interface:InventoryApi
Gets managed object resource by id. To get the managed object representation you have to callget()
on the returned resource.- Specified by:
getManagedObject
in 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
public ManagedObject getManagedObjectApi(GId globalId) throws SDKException
Description copied from interface:InventoryApi
Gets managed object resource by id. To get the managed object representation you have to callget()
on the returned resource.- Specified by:
getManagedObjectApi
in 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
public ManagedObjectCollection getManagedObjects() throws SDKException
Description copied from interface:InventoryApi
Gets the all the managed object in the platform- Specified by:
getManagedObjects
in 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:InventoryApi
Gets the managed objects from the platform based on specified filter. Query based ontype
andfragmentType
is not supported.- Specified by:
getManagedObjectsByFilter
in 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
public Integer countManagedObjectsByFilter(InventoryFilter filter) throws SDKException
Description copied from interface:InventoryApi
Returns the count of managed objects from the platform based on specified filter.- Specified by:
countManagedObjectsByFilter
in 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:InventoryApi
Returns supported measurements of the Managed Object specified by its id- Specified by:
getSupportedMeasurements
in interfaceInventoryApi
- Parameters:
sourceId
- id of the managed object to search for- Returns:
- SupportedMeasurementsRepresentation
- Throws:
SDKException
- if managed object does not exists
-
getSupportedSeries
public SupportedSeriesRepresentation getSupportedSeries(GId sourceId) throws SDKException
Description copied from interface:InventoryApi
Returns supported series of the Managed Object specified by its id- Specified by:
getSupportedSeries
in 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:InventoryApi
Gets the managed objects from the platform based on the given ids- Specified by:
getManagedObjectsByListOfIds
in 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
protected String getMOCollectionUrl() throws SDKException
- Throws:
SDKException
-
-