@ -185,11 +185,7 @@ public class TelemetryController extends BaseController {
public DeferredResult < ResponseEntity > getAttributeKeys (
public DeferredResult < ResponseEntity > getAttributeKeys (
@ApiParam ( value = ENTITY_TYPE_PARAM_DESCRIPTION , required = true , defaultValue = "DEVICE" ) @PathVariable ( "entityType" ) String entityType ,
@ApiParam ( value = ENTITY_TYPE_PARAM_DESCRIPTION , required = true , defaultValue = "DEVICE" ) @PathVariable ( "entityType" ) String entityType ,
@ApiParam ( value = ENTITY_ID_PARAM_DESCRIPTION , required = true ) @PathVariable ( "entityId" ) String entityIdStr ) throws ThingsboardException {
@ApiParam ( value = ENTITY_ID_PARAM_DESCRIPTION , required = true ) @PathVariable ( "entityId" ) String entityIdStr ) throws ThingsboardException {
try {
return accessValidator . validateEntityAndCallback ( getCurrentUser ( ) , Operation . READ_ATTRIBUTES , entityType , entityIdStr , this : : getAttributeKeysCallback ) ;
return accessValidator . validateEntityAndCallback ( getCurrentUser ( ) , Operation . READ_ATTRIBUTES , entityType , entityIdStr , this : : getAttributeKeysCallback ) ;
} catch ( Exception e ) {
throw handleException ( e ) ;
}
}
}
@ApiOperation ( value = "Get all attribute keys by scope (getAttributeKeysByScope)" ,
@ApiOperation ( value = "Get all attribute keys by scope (getAttributeKeysByScope)" ,
@ -206,12 +202,8 @@ public class TelemetryController extends BaseController {
@ApiParam ( value = ENTITY_TYPE_PARAM_DESCRIPTION , required = true , defaultValue = "DEVICE" ) @PathVariable ( "entityType" ) String entityType ,
@ApiParam ( value = ENTITY_TYPE_PARAM_DESCRIPTION , required = true , defaultValue = "DEVICE" ) @PathVariable ( "entityType" ) String entityType ,
@ApiParam ( value = ENTITY_ID_PARAM_DESCRIPTION , required = true ) @PathVariable ( "entityId" ) String entityIdStr ,
@ApiParam ( value = ENTITY_ID_PARAM_DESCRIPTION , required = true ) @PathVariable ( "entityId" ) String entityIdStr ,
@ApiParam ( value = ATTRIBUTES_SCOPE_DESCRIPTION , required = true , allowableValues = ATTRIBUTES_SCOPE_ALLOWED_VALUES ) @PathVariable ( "scope" ) String scope ) throws ThingsboardException {
@ApiParam ( value = ATTRIBUTES_SCOPE_DESCRIPTION , required = true , allowableValues = ATTRIBUTES_SCOPE_ALLOWED_VALUES ) @PathVariable ( "scope" ) String scope ) throws ThingsboardException {
try {
return accessValidator . validateEntityAndCallback ( getCurrentUser ( ) , Operation . READ_ATTRIBUTES , entityType , entityIdStr ,
return accessValidator . validateEntityAndCallback ( getCurrentUser ( ) , Operation . READ_ATTRIBUTES , entityType , entityIdStr ,
( result , tenantId , entityId ) - > getAttributeKeysCallback ( result , tenantId , entityId , scope ) ) ;
( result , tenantId , entityId ) - > getAttributeKeysCallback ( result , tenantId , entityId , scope ) ) ;
} catch ( Exception e ) {
throw handleException ( e ) ;
}
}
}
@ApiOperation ( value = "Get attributes (getAttributes)" ,
@ApiOperation ( value = "Get attributes (getAttributes)" ,
@ -229,13 +221,9 @@ public class TelemetryController extends BaseController {
@ApiParam ( value = ENTITY_TYPE_PARAM_DESCRIPTION , required = true , defaultValue = "DEVICE" ) @PathVariable ( "entityType" ) String entityType ,
@ApiParam ( value = ENTITY_TYPE_PARAM_DESCRIPTION , required = true , defaultValue = "DEVICE" ) @PathVariable ( "entityType" ) String entityType ,
@ApiParam ( value = ENTITY_ID_PARAM_DESCRIPTION , required = true ) @PathVariable ( "entityId" ) String entityIdStr ,
@ApiParam ( value = ENTITY_ID_PARAM_DESCRIPTION , required = true ) @PathVariable ( "entityId" ) String entityIdStr ,
@ApiParam ( value = ATTRIBUTES_KEYS_DESCRIPTION ) @RequestParam ( name = "keys" , required = false ) String keysStr ) throws ThingsboardException {
@ApiParam ( value = ATTRIBUTES_KEYS_DESCRIPTION ) @RequestParam ( name = "keys" , required = false ) String keysStr ) throws ThingsboardException {
try {
SecurityUser user = getCurrentUser ( ) ;
SecurityUser user = getCurrentUser ( ) ;
return accessValidator . validateEntityAndCallback ( getCurrentUser ( ) , Operation . READ_ATTRIBUTES , entityType , entityIdStr ,
return accessValidator . validateEntityAndCallback ( getCurrentUser ( ) , Operation . READ_ATTRIBUTES , entityType , entityIdStr ,
( result , tenantId , entityId ) - > getAttributeValuesCallback ( result , user , entityId , null , keysStr ) ) ;
( result , tenantId , entityId ) - > getAttributeValuesCallback ( result , user , entityId , null , keysStr ) ) ;
} catch ( Exception e ) {
throw handleException ( e ) ;
}
}
}
@ -257,13 +245,9 @@ public class TelemetryController extends BaseController {
@ApiParam ( value = ENTITY_ID_PARAM_DESCRIPTION , required = true ) @PathVariable ( "entityId" ) String entityIdStr ,
@ApiParam ( value = ENTITY_ID_PARAM_DESCRIPTION , required = true ) @PathVariable ( "entityId" ) String entityIdStr ,
@ApiParam ( value = ATTRIBUTES_SCOPE_DESCRIPTION , allowableValues = ATTRIBUTES_SCOPE_ALLOWED_VALUES , required = true ) @PathVariable ( "scope" ) String scope ,
@ApiParam ( value = ATTRIBUTES_SCOPE_DESCRIPTION , allowableValues = ATTRIBUTES_SCOPE_ALLOWED_VALUES , required = true ) @PathVariable ( "scope" ) String scope ,
@ApiParam ( value = ATTRIBUTES_KEYS_DESCRIPTION ) @RequestParam ( name = "keys" , required = false ) String keysStr ) throws ThingsboardException {
@ApiParam ( value = ATTRIBUTES_KEYS_DESCRIPTION ) @RequestParam ( name = "keys" , required = false ) String keysStr ) throws ThingsboardException {
try {
SecurityUser user = getCurrentUser ( ) ;
SecurityUser user = getCurrentUser ( ) ;
return accessValidator . validateEntityAndCallback ( getCurrentUser ( ) , Operation . READ_ATTRIBUTES , entityType , entityIdStr ,
return accessValidator . validateEntityAndCallback ( getCurrentUser ( ) , Operation . READ_ATTRIBUTES , entityType , entityIdStr ,
( result , tenantId , entityId ) - > getAttributeValuesCallback ( result , user , entityId , scope , keysStr ) ) ;
( result , tenantId , entityId ) - > getAttributeValuesCallback ( result , user , entityId , scope , keysStr ) ) ;
} catch ( Exception e ) {
throw handleException ( e ) ;
}
}
}
@ApiOperation ( value = "Get time-series keys (getTimeseriesKeys)" ,
@ApiOperation ( value = "Get time-series keys (getTimeseriesKeys)" ,
@ -276,12 +260,8 @@ public class TelemetryController extends BaseController {
public DeferredResult < ResponseEntity > getTimeseriesKeys (
public DeferredResult < ResponseEntity > getTimeseriesKeys (
@ApiParam ( value = ENTITY_TYPE_PARAM_DESCRIPTION , required = true , defaultValue = "DEVICE" ) @PathVariable ( "entityType" ) String entityType ,
@ApiParam ( value = ENTITY_TYPE_PARAM_DESCRIPTION , required = true , defaultValue = "DEVICE" ) @PathVariable ( "entityType" ) String entityType ,
@ApiParam ( value = ENTITY_ID_PARAM_DESCRIPTION , required = true ) @PathVariable ( "entityId" ) String entityIdStr ) throws ThingsboardException {
@ApiParam ( value = ENTITY_ID_PARAM_DESCRIPTION , required = true ) @PathVariable ( "entityId" ) String entityIdStr ) throws ThingsboardException {
try {
return accessValidator . validateEntityAndCallback ( getCurrentUser ( ) , Operation . READ_TELEMETRY , entityType , entityIdStr ,
return accessValidator . validateEntityAndCallback ( getCurrentUser ( ) , Operation . READ_TELEMETRY , entityType , entityIdStr ,
( result , tenantId , entityId ) - > Futures . addCallback ( tsService . findAllLatest ( tenantId , entityId ) , getTsKeysToResponseCallback ( result ) , MoreExecutors . directExecutor ( ) ) ) ;
( result , tenantId , entityId ) - > Futures . addCallback ( tsService . findAllLatest ( tenantId , entityId ) , getTsKeysToResponseCallback ( result ) , MoreExecutors . directExecutor ( ) ) ) ;
} catch ( Exception e ) {
throw handleException ( e ) ;
}
}
}
@ApiOperation ( value = "Get latest time-series value (getLatestTimeseries)" ,
@ApiOperation ( value = "Get latest time-series value (getLatestTimeseries)" ,
@ -306,13 +286,9 @@ public class TelemetryController extends BaseController {
@ApiParam ( value = TELEMETRY_KEYS_DESCRIPTION ) @RequestParam ( name = "keys" , required = false ) String keysStr ,
@ApiParam ( value = TELEMETRY_KEYS_DESCRIPTION ) @RequestParam ( name = "keys" , required = false ) String keysStr ,
@ApiParam ( value = STRICT_DATA_TYPES_DESCRIPTION )
@ApiParam ( value = STRICT_DATA_TYPES_DESCRIPTION )
@RequestParam ( name = "useStrictDataTypes" , required = false , defaultValue = "false" ) Boolean useStrictDataTypes ) throws ThingsboardException {
@RequestParam ( name = "useStrictDataTypes" , required = false , defaultValue = "false" ) Boolean useStrictDataTypes ) throws ThingsboardException {
try {
SecurityUser user = getCurrentUser ( ) ;
SecurityUser user = getCurrentUser ( ) ;
return accessValidator . validateEntityAndCallback ( getCurrentUser ( ) , Operation . READ_TELEMETRY , entityType , entityIdStr ,
return accessValidator . validateEntityAndCallback ( getCurrentUser ( ) , Operation . READ_TELEMETRY , entityType , entityIdStr ,
( result , tenantId , entityId ) - > getLatestTimeseriesValuesCallback ( result , user , entityId , keysStr , useStrictDataTypes ) ) ;
( result , tenantId , entityId ) - > getLatestTimeseriesValuesCallback ( result , user , entityId , keysStr , useStrictDataTypes ) ) ;
} catch ( Exception e ) {
throw handleException ( e ) ;
}
}
}
@ApiOperation ( value = "Get time-series data (getTimeseries)" ,
@ApiOperation ( value = "Get time-series data (getTimeseries)" ,
@ -349,19 +325,15 @@ public class TelemetryController extends BaseController {
@RequestParam ( name = "orderBy" , defaultValue = "DESC" ) String orderBy ,
@RequestParam ( name = "orderBy" , defaultValue = "DESC" ) String orderBy ,
@ApiParam ( value = STRICT_DATA_TYPES_DESCRIPTION )
@ApiParam ( value = STRICT_DATA_TYPES_DESCRIPTION )
@RequestParam ( name = "useStrictDataTypes" , required = false , defaultValue = "false" ) Boolean useStrictDataTypes ) throws ThingsboardException {
@RequestParam ( name = "useStrictDataTypes" , required = false , defaultValue = "false" ) Boolean useStrictDataTypes ) throws ThingsboardException {
try {
return accessValidator . validateEntityAndCallback ( getCurrentUser ( ) , Operation . READ_TELEMETRY , entityType , entityIdStr ,
return accessValidator . validateEntityAndCallback ( getCurrentUser ( ) , Operation . READ_TELEMETRY , entityType , entityIdStr ,
( result , tenantId , entityId ) - > {
( result , tenantId , entityId ) - > {
// If interval is 0, convert this to a NONE aggregation, which is probably what the user really wanted
// If interval is 0, convert this to a NONE aggregation, which is probably what the user really wanted
Aggregation agg = interval = = 0L ? Aggregation . valueOf ( Aggregation . NONE . name ( ) ) : Aggregation . valueOf ( aggStr ) ;
Aggregation agg = interval = = 0L ? Aggregation . valueOf ( Aggregation . NONE . name ( ) ) : Aggregation . valueOf ( aggStr ) ;
List < ReadTsKvQuery > queries = toKeysList ( keys ) . stream ( ) . map ( key - > new BaseReadTsKvQuery ( key , startTs , endTs , interval , limit , agg , orderBy ) )
List < ReadTsKvQuery > queries = toKeysList ( keys ) . stream ( ) . map ( key - > new BaseReadTsKvQuery ( key , startTs , endTs , interval , limit , agg , orderBy ) )
. collect ( Collectors . toList ( ) ) ;
. collect ( Collectors . toList ( ) ) ;
Futures . addCallback ( tsService . findAll ( tenantId , entityId , queries ) , getTsKvListCallback ( result , useStrictDataTypes ) , MoreExecutors . directExecutor ( ) ) ;
Futures . addCallback ( tsService . findAll ( tenantId , entityId , queries ) , getTsKvListCallback ( result , useStrictDataTypes ) , MoreExecutors . directExecutor ( ) ) ;
} ) ;
} ) ;
} catch ( Exception e ) {
throw handleException ( e ) ;
}
}
}
@ApiOperation ( value = "Save device attributes (saveDeviceAttributes)" ,
@ApiOperation ( value = "Save device attributes (saveDeviceAttributes)" ,
@ -385,12 +357,8 @@ public class TelemetryController extends BaseController {
@ApiParam ( value = DEVICE_ID_PARAM_DESCRIPTION , required = true ) @PathVariable ( "deviceId" ) String deviceIdStr ,
@ApiParam ( value = DEVICE_ID_PARAM_DESCRIPTION , required = true ) @PathVariable ( "deviceId" ) String deviceIdStr ,
@ApiParam ( value = ATTRIBUTES_SCOPE_DESCRIPTION , allowableValues = ATTRIBUTES_SCOPE_ALLOWED_VALUES , required = true ) @PathVariable ( "scope" ) String scope ,
@ApiParam ( value = ATTRIBUTES_SCOPE_DESCRIPTION , allowableValues = ATTRIBUTES_SCOPE_ALLOWED_VALUES , required = true ) @PathVariable ( "scope" ) String scope ,
@ApiParam ( value = ATTRIBUTES_JSON_REQUEST_DESCRIPTION , required = true ) @RequestBody JsonNode request ) throws ThingsboardException {
@ApiParam ( value = ATTRIBUTES_JSON_REQUEST_DESCRIPTION , required = true ) @RequestBody JsonNode request ) throws ThingsboardException {
try {
EntityId entityId = EntityIdFactory . getByTypeAndUuid ( EntityType . DEVICE , deviceIdStr ) ;
EntityId entityId = EntityIdFactory . getByTypeAndUuid ( EntityType . DEVICE , deviceIdStr ) ;
return saveAttributes ( getTenantId ( ) , entityId , scope , request ) ;
return saveAttributes ( getTenantId ( ) , entityId , scope , request ) ;
} catch ( Exception e ) {
throw handleException ( e ) ;
}
}
}
@ApiOperation ( value = "Save entity attributes (saveEntityAttributesV1)" ,
@ApiOperation ( value = "Save entity attributes (saveEntityAttributesV1)" ,
@ -413,12 +381,8 @@ public class TelemetryController extends BaseController {
@ApiParam ( value = ENTITY_ID_PARAM_DESCRIPTION , required = true ) @PathVariable ( "entityId" ) String entityIdStr ,
@ApiParam ( value = ENTITY_ID_PARAM_DESCRIPTION , required = true ) @PathVariable ( "entityId" ) String entityIdStr ,
@ApiParam ( value = ATTRIBUTES_SCOPE_DESCRIPTION , allowableValues = ATTRIBUTES_SCOPE_ALLOWED_VALUES ) @PathVariable ( "scope" ) String scope ,
@ApiParam ( value = ATTRIBUTES_SCOPE_DESCRIPTION , allowableValues = ATTRIBUTES_SCOPE_ALLOWED_VALUES ) @PathVariable ( "scope" ) String scope ,
@ApiParam ( value = ATTRIBUTES_JSON_REQUEST_DESCRIPTION , required = true ) @RequestBody JsonNode request ) throws ThingsboardException {
@ApiParam ( value = ATTRIBUTES_JSON_REQUEST_DESCRIPTION , required = true ) @RequestBody JsonNode request ) throws ThingsboardException {
try {
EntityId entityId = EntityIdFactory . getByTypeAndId ( entityType , entityIdStr ) ;
EntityId entityId = EntityIdFactory . getByTypeAndId ( entityType , entityIdStr ) ;
return saveAttributes ( getTenantId ( ) , entityId , scope , request ) ;
return saveAttributes ( getTenantId ( ) , entityId , scope , request ) ;
} catch ( Exception e ) {
throw handleException ( e ) ;
}
}
}
@ApiOperation ( value = "Save entity attributes (saveEntityAttributesV2)" ,
@ApiOperation ( value = "Save entity attributes (saveEntityAttributesV2)" ,
@ -441,12 +405,8 @@ public class TelemetryController extends BaseController {
@ApiParam ( value = ENTITY_ID_PARAM_DESCRIPTION , required = true ) @PathVariable ( "entityId" ) String entityIdStr ,
@ApiParam ( value = ENTITY_ID_PARAM_DESCRIPTION , required = true ) @PathVariable ( "entityId" ) String entityIdStr ,
@ApiParam ( value = ATTRIBUTES_SCOPE_DESCRIPTION , allowableValues = ATTRIBUTES_SCOPE_ALLOWED_VALUES , required = true ) @PathVariable ( "scope" ) String scope ,
@ApiParam ( value = ATTRIBUTES_SCOPE_DESCRIPTION , allowableValues = ATTRIBUTES_SCOPE_ALLOWED_VALUES , required = true ) @PathVariable ( "scope" ) String scope ,
@ApiParam ( value = ATTRIBUTES_JSON_REQUEST_DESCRIPTION , required = true ) @RequestBody JsonNode request ) throws ThingsboardException {
@ApiParam ( value = ATTRIBUTES_JSON_REQUEST_DESCRIPTION , required = true ) @RequestBody JsonNode request ) throws ThingsboardException {
try {
EntityId entityId = EntityIdFactory . getByTypeAndId ( entityType , entityIdStr ) ;
EntityId entityId = EntityIdFactory . getByTypeAndId ( entityType , entityIdStr ) ;
return saveAttributes ( getTenantId ( ) , entityId , scope , request ) ;
return saveAttributes ( getTenantId ( ) , entityId , scope , request ) ;
} catch ( Exception e ) {
throw handleException ( e ) ;
}
}
}
@ -470,12 +430,8 @@ public class TelemetryController extends BaseController {
@ApiParam ( value = ENTITY_ID_PARAM_DESCRIPTION , required = true ) @PathVariable ( "entityId" ) String entityIdStr ,
@ApiParam ( value = ENTITY_ID_PARAM_DESCRIPTION , required = true ) @PathVariable ( "entityId" ) String entityIdStr ,
@ApiParam ( value = TELEMETRY_SCOPE_DESCRIPTION , required = true , allowableValues = "ANY" ) @PathVariable ( "scope" ) String scope ,
@ApiParam ( value = TELEMETRY_SCOPE_DESCRIPTION , required = true , allowableValues = "ANY" ) @PathVariable ( "scope" ) String scope ,
@ApiParam ( value = TELEMETRY_JSON_REQUEST_DESCRIPTION , required = true ) @RequestBody String requestBody ) throws ThingsboardException {
@ApiParam ( value = TELEMETRY_JSON_REQUEST_DESCRIPTION , required = true ) @RequestBody String requestBody ) throws ThingsboardException {
try {
EntityId entityId = EntityIdFactory . getByTypeAndId ( entityType , entityIdStr ) ;
EntityId entityId = EntityIdFactory . getByTypeAndId ( entityType , entityIdStr ) ;
return saveTelemetry ( getTenantId ( ) , entityId , requestBody , 0L ) ;
return saveTelemetry ( getTenantId ( ) , entityId , requestBody , 0L ) ;
} catch ( Exception e ) {
throw handleException ( e ) ;
}
}
}
@ApiOperation ( value = "Save or update time-series data with TTL (saveEntityTelemetryWithTTL)" ,
@ApiOperation ( value = "Save or update time-series data with TTL (saveEntityTelemetryWithTTL)" ,
@ -500,12 +456,8 @@ public class TelemetryController extends BaseController {
@ApiParam ( value = TELEMETRY_SCOPE_DESCRIPTION , required = true , allowableValues = "ANY" ) @PathVariable ( "scope" ) String scope ,
@ApiParam ( value = TELEMETRY_SCOPE_DESCRIPTION , required = true , allowableValues = "ANY" ) @PathVariable ( "scope" ) String scope ,
@ApiParam ( value = "A long value representing TTL (Time to Live) parameter." , required = true ) @PathVariable ( "ttl" ) Long ttl ,
@ApiParam ( value = "A long value representing TTL (Time to Live) parameter." , required = true ) @PathVariable ( "ttl" ) Long ttl ,
@ApiParam ( value = TELEMETRY_JSON_REQUEST_DESCRIPTION , required = true ) @RequestBody String requestBody ) throws ThingsboardException {
@ApiParam ( value = TELEMETRY_JSON_REQUEST_DESCRIPTION , required = true ) @RequestBody String requestBody ) throws ThingsboardException {
try {
EntityId entityId = EntityIdFactory . getByTypeAndId ( entityType , entityIdStr ) ;
EntityId entityId = EntityIdFactory . getByTypeAndId ( entityType , entityIdStr ) ;
return saveTelemetry ( getTenantId ( ) , entityId , requestBody , ttl ) ;
return saveTelemetry ( getTenantId ( ) , entityId , requestBody , ttl ) ;
} catch ( Exception e ) {
throw handleException ( e ) ;
}
}
}
@ApiOperation ( value = "Delete entity time-series data (deleteEntityTimeseries)" ,
@ApiOperation ( value = "Delete entity time-series data (deleteEntityTimeseries)" ,
@ -538,12 +490,8 @@ public class TelemetryController extends BaseController {
@RequestParam ( name = "endTs" , required = false ) Long endTs ,
@RequestParam ( name = "endTs" , required = false ) Long endTs ,
@ApiParam ( value = "If the parameter is set to true, the latest telemetry will be rewritten in case that current latest value was removed, otherwise, in case that parameter is set to false the new latest value will not set." )
@ApiParam ( value = "If the parameter is set to true, the latest telemetry will be rewritten in case that current latest value was removed, otherwise, in case that parameter is set to false the new latest value will not set." )
@RequestParam ( name = "rewriteLatestIfDeleted" , defaultValue = "false" ) boolean rewriteLatestIfDeleted ) throws ThingsboardException {
@RequestParam ( name = "rewriteLatestIfDeleted" , defaultValue = "false" ) boolean rewriteLatestIfDeleted ) throws ThingsboardException {
try {
EntityId entityId = EntityIdFactory . getByTypeAndId ( entityType , entityIdStr ) ;
EntityId entityId = EntityIdFactory . getByTypeAndId ( entityType , entityIdStr ) ;
return deleteTimeseries ( entityId , keysStr , deleteAllDataForKeys , startTs , endTs , rewriteLatestIfDeleted ) ;
return deleteTimeseries ( entityId , keysStr , deleteAllDataForKeys , startTs , endTs , rewriteLatestIfDeleted ) ;
} catch ( Exception e ) {
throw handleException ( e ) ;
}
}
}
private DeferredResult < ResponseEntity > deleteTimeseries ( EntityId entityIdStr , String keysStr , boolean deleteAllDataForKeys ,
private DeferredResult < ResponseEntity > deleteTimeseries ( EntityId entityIdStr , String keysStr , boolean deleteAllDataForKeys ,
@ -608,12 +556,8 @@ public class TelemetryController extends BaseController {
@ApiParam ( value = DEVICE_ID_PARAM_DESCRIPTION , required = true ) @PathVariable ( DEVICE_ID ) String deviceIdStr ,
@ApiParam ( value = DEVICE_ID_PARAM_DESCRIPTION , required = true ) @PathVariable ( DEVICE_ID ) String deviceIdStr ,
@ApiParam ( value = ATTRIBUTES_SCOPE_DESCRIPTION , allowableValues = ATTRIBUTES_SCOPE_ALLOWED_VALUES , required = true ) @PathVariable ( "scope" ) String scope ,
@ApiParam ( value = ATTRIBUTES_SCOPE_DESCRIPTION , allowableValues = ATTRIBUTES_SCOPE_ALLOWED_VALUES , required = true ) @PathVariable ( "scope" ) String scope ,
@ApiParam ( value = ATTRIBUTES_KEYS_DESCRIPTION , required = true ) @RequestParam ( name = "keys" ) String keysStr ) throws ThingsboardException {
@ApiParam ( value = ATTRIBUTES_KEYS_DESCRIPTION , required = true ) @RequestParam ( name = "keys" ) String keysStr ) throws ThingsboardException {
try {
EntityId entityId = EntityIdFactory . getByTypeAndUuid ( EntityType . DEVICE , deviceIdStr ) ;
EntityId entityId = EntityIdFactory . getByTypeAndUuid ( EntityType . DEVICE , deviceIdStr ) ;
return deleteAttributes ( entityId , scope , keysStr ) ;
return deleteAttributes ( entityId , scope , keysStr ) ;
} catch ( Exception e ) {
throw handleException ( e ) ;
}
}
}
@ApiOperation ( value = "Delete entity attributes (deleteEntityAttributes)" ,
@ApiOperation ( value = "Delete entity attributes (deleteEntityAttributes)" ,
@ -636,12 +580,8 @@ public class TelemetryController extends BaseController {
@ApiParam ( value = ENTITY_ID_PARAM_DESCRIPTION , required = true ) @PathVariable ( "entityId" ) String entityIdStr ,
@ApiParam ( value = ENTITY_ID_PARAM_DESCRIPTION , required = true ) @PathVariable ( "entityId" ) String entityIdStr ,
@ApiParam ( value = ATTRIBUTES_SCOPE_DESCRIPTION , required = true , allowableValues = ATTRIBUTES_SCOPE_ALLOWED_VALUES ) @PathVariable ( "scope" ) String scope ,
@ApiParam ( value = ATTRIBUTES_SCOPE_DESCRIPTION , required = true , allowableValues = ATTRIBUTES_SCOPE_ALLOWED_VALUES ) @PathVariable ( "scope" ) String scope ,
@ApiParam ( value = ATTRIBUTES_KEYS_DESCRIPTION , required = true ) @RequestParam ( name = "keys" ) String keysStr ) throws ThingsboardException {
@ApiParam ( value = ATTRIBUTES_KEYS_DESCRIPTION , required = true ) @RequestParam ( name = "keys" ) String keysStr ) throws ThingsboardException {
try {
EntityId entityId = EntityIdFactory . getByTypeAndId ( entityType , entityIdStr ) ;
EntityId entityId = EntityIdFactory . getByTypeAndId ( entityType , entityIdStr ) ;
return deleteAttributes ( entityId , scope , keysStr ) ;
return deleteAttributes ( entityId , scope , keysStr ) ;
} catch ( Exception e ) {
throw handleException ( e ) ;
}
}
}
private DeferredResult < ResponseEntity > deleteAttributes ( EntityId entityIdSrc , String scope , String keysStr ) throws ThingsboardException {
private DeferredResult < ResponseEntity > deleteAttributes ( EntityId entityIdSrc , String scope , String keysStr ) throws ThingsboardException {