|
@@ -93,27 +93,12 @@ import static org.thingsboard.server.controller.EdgeController.EDGE_ID; |
|
@@ -93,27 +93,12 @@ import static org.thingsboard.server.controller.EdgeController.EDGE_ID; |
93
|
@RequiredArgsConstructor
|
93
|
@RequiredArgsConstructor
|
94
|
@Slf4j
|
94
|
@Slf4j
|
95
|
public class DeviceController extends BaseController {
|
95
|
public class DeviceController extends BaseController {
|
96
|
- private final DeviceBulkImportService deviceBulkImportService;
|
|
|
97
|
|
96
|
|
98
|
- public static final String DEVICE_ID_PARAM_DESCRIPTION = "A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'";
|
|
|
99
|
- public static final String DEVICE_PROFILE_ID_DESCRIPTION = "A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'";
|
|
|
100
|
- public static final String TENANT_ID_PARAM_DESCRIPTION = "A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'";
|
|
|
101
|
- public static final String EDGE_ID_PARAM_DESCRIPTION = "A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'";
|
|
|
102
|
- public static final String CUSTOMER_ID_PARAM_DESCRIPTION = "A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'";
|
|
|
103
|
-
|
|
|
104
|
- private static final String DEVICE_ID = "deviceId";
|
|
|
105
|
- private static final String DEVICE_NAME = "deviceName";
|
|
|
106
|
- private static final String TENANT_ID = "tenantId";
|
|
|
107
|
- private final String PAGE_SIZE_DESCRIPTION = "Maximum amount of entities in a one page";
|
|
|
108
|
- private final String PAGE_NUMBER_DESCRIPTION = "Sequence number of page starting from 0";
|
|
|
109
|
- private final String DEVICE_TYPE_DESCRIPTION = "Device type as the name of the device profile";
|
|
|
110
|
- private final String DEVICE_TEXT_SEARCH_DESCRIPTION = "The search is performed by device special field 'textSearch' represented by device name";
|
|
|
111
|
- private final String SORT_PROPERTY_DESCRIPTION = "Property of device to sort by";
|
|
|
112
|
- private final String SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, name, label, type";
|
|
|
113
|
- private final String SORT_ORDER_DESCRIPTION = "Sort order. ASC (ASCENDING) or DESCENDING (DESC)";
|
|
|
114
|
- private final String SORT_ORDER_ALLOWABLE_VALUES = "ASC, DESC";
|
|
|
115
|
- private final String DEVICE_INFO_DESCRIPTION = "Device Info is an object which are an extension of default Device object. " +
|
|
|
116
|
- "Apart from Device object, Device Info provides additional information such as customer name and device profile name. ";
|
97
|
+ protected static final String DEVICE_ID = "deviceId";
|
|
|
98
|
+ protected static final String DEVICE_NAME = "deviceName";
|
|
|
99
|
+ protected static final String TENANT_ID = "tenantId";
|
|
|
100
|
+
|
|
|
101
|
+ private final DeviceBulkImportService deviceBulkImportService;
|
117
|
|
102
|
|
118
|
@ApiOperation(value = "Get Device (getDeviceById)",
|
103
|
@ApiOperation(value = "Get Device (getDeviceById)",
|
119
|
notes = "If device with given Id exists in the system it will be present in the response, otherwise an empty object will be provided")
|
104
|
notes = "If device with given Id exists in the system it will be present in the response, otherwise an empty object will be provided")
|
|
@@ -377,7 +362,7 @@ public class DeviceController extends BaseController { |
|
@@ -377,7 +362,7 @@ public class DeviceController extends BaseController { |
377
|
}
|
362
|
}
|
378
|
|
363
|
|
379
|
@ApiOperation(value = "Get Tenant Devices (getEdgeDevices)",
|
364
|
@ApiOperation(value = "Get Tenant Devices (getEdgeDevices)",
|
380
|
- notes = "Returns a page (representation of a bunch) of devices in the possession of tenant. " +
|
365
|
+ notes = "Returns a page of devices owned by tenant. " +
|
381
|
"You can specify number of parameters to filter the result set of devices. ")
|
366
|
"You can specify number of parameters to filter the result set of devices. ")
|
382
|
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
|
367
|
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
|
383
|
@RequestMapping(value = "/tenant/devices", params = {"pageSize", "page"}, method = RequestMethod.GET)
|
368
|
@RequestMapping(value = "/tenant/devices", params = {"pageSize", "page"}, method = RequestMethod.GET)
|
|
@@ -409,8 +394,8 @@ public class DeviceController extends BaseController { |
|
@@ -409,8 +394,8 @@ public class DeviceController extends BaseController { |
409
|
}
|
394
|
}
|
410
|
|
395
|
|
411
|
@ApiOperation(value = "Get Tenant Device Infos (getTenantDeviceInfos)",
|
396
|
@ApiOperation(value = "Get Tenant Device Infos (getTenantDeviceInfos)",
|
412
|
- notes = "Returns a page (representation of a bunch) of devices info objects in the possession of tenant. " +
|
|
|
413
|
- "You can specify number of parameters to filter the result set. " + DEVICE_INFO_DESCRIPTION)
|
397
|
+ notes = "Returns a page of devices info objects owned by tenant. " +
|
|
|
398
|
+ PAGE_DATA_PARAMETERS + DEVICE_INFO_DESCRIPTION)
|
414
|
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
|
399
|
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
|
415
|
@RequestMapping(value = "/tenant/deviceInfos", params = {"pageSize", "page"}, method = RequestMethod.GET)
|
400
|
@RequestMapping(value = "/tenant/deviceInfos", params = {"pageSize", "page"}, method = RequestMethod.GET)
|
416
|
@ResponseBody
|
401
|
@ResponseBody
|
|
@@ -447,8 +432,8 @@ public class DeviceController extends BaseController { |
|
@@ -447,8 +432,8 @@ public class DeviceController extends BaseController { |
447
|
}
|
432
|
}
|
448
|
|
433
|
|
449
|
@ApiOperation(value = "Get Tenant Device (getTenantDevice)",
|
434
|
@ApiOperation(value = "Get Tenant Device (getTenantDevice)",
|
450
|
- notes = "Requested device must be in the possession of user that perform request. " +
|
|
|
451
|
- "In the Thingsboard platform Device name is an unique property of device. So it can be used to identify the device.")
|
435
|
+ notes = "Requested device must be owned by tenant of customer that the user belongs to. " +
|
|
|
436
|
+ "Device name is an unique property of device. So it can be used to identify the device.")
|
452
|
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
|
437
|
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
|
453
|
@RequestMapping(value = "/tenant/devices", params = {"deviceName"}, method = RequestMethod.GET)
|
438
|
@RequestMapping(value = "/tenant/devices", params = {"deviceName"}, method = RequestMethod.GET)
|
454
|
@ResponseBody
|
439
|
@ResponseBody
|
|
@@ -463,8 +448,8 @@ public class DeviceController extends BaseController { |
|
@@ -463,8 +448,8 @@ public class DeviceController extends BaseController { |
463
|
}
|
448
|
}
|
464
|
|
449
|
|
465
|
@ApiOperation(value = "Get Customer Devices (getCustomerDevices)",
|
450
|
@ApiOperation(value = "Get Customer Devices (getCustomerDevices)",
|
466
|
- notes = "Returns a page (representation of a bunch) of devices objects in the possession of customer. " +
|
|
|
467
|
- "You can specify number of parameters to filter the result set. ")
|
451
|
+ notes = "Returns a page of devices objects assigned to customer. " +
|
|
|
452
|
+ PAGE_DATA_PARAMETERS)
|
468
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
|
453
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
|
469
|
@RequestMapping(value = "/customer/{customerId}/devices", params = {"pageSize", "page"}, method = RequestMethod.GET)
|
454
|
@RequestMapping(value = "/customer/{customerId}/devices", params = {"pageSize", "page"}, method = RequestMethod.GET)
|
470
|
@ResponseBody
|
455
|
@ResponseBody
|
|
@@ -500,8 +485,8 @@ public class DeviceController extends BaseController { |
|
@@ -500,8 +485,8 @@ public class DeviceController extends BaseController { |
500
|
}
|
485
|
}
|
501
|
|
486
|
|
502
|
@ApiOperation(value = "Get Customer Device Infos (getCustomerDeviceInfos)",
|
487
|
@ApiOperation(value = "Get Customer Device Infos (getCustomerDeviceInfos)",
|
503
|
- notes = "Returns a page (representation of a bunch) of devices info objects in the possession of customer. " +
|
|
|
504
|
- "You can specify number of parameters to filter the result set. " + DEVICE_INFO_DESCRIPTION)
|
488
|
+ notes = "Returns a page of devices info objects assigned to customer. " +
|
|
|
489
|
+ PAGE_DATA_PARAMETERS + DEVICE_INFO_DESCRIPTION)
|
505
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
|
490
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
|
506
|
@RequestMapping(value = "/customer/{customerId}/deviceInfos", params = {"pageSize", "page"}, method = RequestMethod.GET)
|
491
|
@RequestMapping(value = "/customer/{customerId}/deviceInfos", params = {"pageSize", "page"}, method = RequestMethod.GET)
|
507
|
@ResponseBody
|
492
|
@ResponseBody
|
|
@@ -782,10 +767,9 @@ public class DeviceController extends BaseController { |
|
@@ -782,10 +767,9 @@ public class DeviceController extends BaseController { |
782
|
}
|
767
|
}
|
783
|
|
768
|
|
784
|
@ApiOperation(value = "Assign device to edge (assignDeviceToEdge)",
|
769
|
@ApiOperation(value = "Assign device to edge (assignDeviceToEdge)",
|
785
|
- notes = "Creates assignment of an existing device to an instance of The ThingsBoard Edge. " +
|
|
|
786
|
- "The ThingsBoard Edge is a ThingsBoard’s software product for edge computing. " +
|
|
|
787
|
- "It allows bringing data analysis and management to the edge, while seamlessly synchronizing with ThingsBoard CE/PE server (cloud). " +
|
|
|
788
|
- "See official documentation for more details regarding provisioning the edge on ThingsBoard server")
|
770
|
+ notes = "Creates assignment of an existing device to an instance of The Edge. " +
|
|
|
771
|
+ "The Edge is a software product for edge computing. " +
|
|
|
772
|
+ "It allows bringing data analysis and management to the edge, while seamlessly synchronizing with the platform server (cloud). ")
|
789
|
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
|
773
|
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
|
790
|
@RequestMapping(value = "/edge/{edgeId}/device/{deviceId}", method = RequestMethod.POST)
|
774
|
@RequestMapping(value = "/edge/{edgeId}/device/{deviceId}", method = RequestMethod.POST)
|
791
|
@ResponseBody
|
775
|
@ResponseBody
|
|
@@ -861,7 +845,7 @@ public class DeviceController extends BaseController { |
|
@@ -861,7 +845,7 @@ public class DeviceController extends BaseController { |
861
|
}
|
845
|
}
|
862
|
|
846
|
|
863
|
@ApiOperation(value = "Get devices assigned to edge (getEdgeDevices)",
|
847
|
@ApiOperation(value = "Get devices assigned to edge (getEdgeDevices)",
|
864
|
- notes = "Returns a page (representation of a bunch) of devices assigned to edge. " +
|
848
|
+ notes = "Returns a page of devices assigned to edge. " +
|
865
|
"You can specify number of parameters to filter the result set of devices. ")
|
849
|
"You can specify number of parameters to filter the result set of devices. ")
|
866
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
|
850
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
|
867
|
@RequestMapping(value = "/edge/{edgeId}/devices", params = {"pageSize", "page"}, method = RequestMethod.GET)
|
851
|
@RequestMapping(value = "/edge/{edgeId}/devices", params = {"pageSize", "page"}, method = RequestMethod.GET)
|
|
@@ -916,7 +900,7 @@ public class DeviceController extends BaseController { |
|
@@ -916,7 +900,7 @@ public class DeviceController extends BaseController { |
916
|
}
|
900
|
}
|
917
|
|
901
|
|
918
|
@ApiOperation(value = "Count devices by device profile (countByDeviceProfileAndEmptyOtaPackage)",
|
902
|
@ApiOperation(value = "Count devices by device profile (countByDeviceProfileAndEmptyOtaPackage)",
|
919
|
- notes = "The Thingsboard platform gives an ability to load OTA (over-the-air) packages to devices. " +
|
903
|
+ notes = "The platform gives an ability to load OTA (over-the-air) packages to devices. " +
|
920
|
"It can be done in two different ways: device scope or device profile scope." +
|
904
|
"It can be done in two different ways: device scope or device profile scope." +
|
921
|
"In the response you will find the number of devices with specified device profile, but without previously defined device scope OTA package. " +
|
905
|
"In the response you will find the number of devices with specified device profile, but without previously defined device scope OTA package. " +
|
922
|
"It can be useful when you want to define number of devices that will be affected with future OTA package")
|
906
|
"It can be useful when you want to define number of devices that will be affected with future OTA package")
|