Commit 339deb1d3ca76730fc10bd2ede9d4cbac3aecb58

Authored by Dima Landiak
2 parents 85b1cd04 96cdae87

Merge branch 'feature/swagger' into feature/swagger-device-profile-data

Showing 30 changed files with 573 additions and 237 deletions
@@ -46,7 +46,6 @@ import org.thingsboard.server.service.update.UpdateService; @@ -46,7 +46,6 @@ import org.thingsboard.server.service.update.UpdateService;
46 @RequestMapping("/api/admin") 46 @RequestMapping("/api/admin")
47 public class AdminController extends BaseController { 47 public class AdminController extends BaseController {
48 48
49 - public static final String SYS_ADMIN_AUTHORITY_ONLY = " Available for users with System Administrator ('SYS_ADMIN') authority only.";  
50 @Autowired 49 @Autowired
51 private MailService mailService; 50 private MailService mailService;
52 51
@@ -63,7 +62,7 @@ public class AdminController extends BaseController { @@ -63,7 +62,7 @@ public class AdminController extends BaseController {
63 private UpdateService updateService; 62 private UpdateService updateService;
64 63
65 @ApiOperation(value = "Get the Administration Settings object using key (getAdminSettings)", 64 @ApiOperation(value = "Get the Administration Settings object using key (getAdminSettings)",
66 - notes = "Get the Administration Settings object using specified string key. Referencing non-existing key will cause an error." + SYS_ADMIN_AUTHORITY_ONLY) 65 + notes = "Get the Administration Settings object using specified string key. Referencing non-existing key will cause an error." + SYSTEM_AUTHORITY_PARAGRAPH)
67 @PreAuthorize("hasAuthority('SYS_ADMIN')") 66 @PreAuthorize("hasAuthority('SYS_ADMIN')")
68 @RequestMapping(value = "/settings/{key}", method = RequestMethod.GET) 67 @RequestMapping(value = "/settings/{key}", method = RequestMethod.GET)
69 @ResponseBody 68 @ResponseBody
@@ -86,7 +85,7 @@ public class AdminController extends BaseController { @@ -86,7 +85,7 @@ public class AdminController extends BaseController {
86 @ApiOperation(value = "Get the Administration Settings object using key (getAdminSettings)", 85 @ApiOperation(value = "Get the Administration Settings object using key (getAdminSettings)",
87 notes = "Creates or Updates the Administration Settings. Platform generates random Administration Settings Id during settings creation. " + 86 notes = "Creates or Updates the Administration Settings. Platform generates random Administration Settings Id during settings creation. " +
88 "The Administration Settings Id will be present in the response. Specify the Administration Settings Id when you would like to update the Administration Settings. " + 87 "The Administration Settings Id will be present in the response. Specify the Administration Settings Id when you would like to update the Administration Settings. " +
89 - "Referencing non-existing Administration Settings Id will cause an error." + SYS_ADMIN_AUTHORITY_ONLY) 88 + "Referencing non-existing Administration Settings Id will cause an error." + SYSTEM_AUTHORITY_PARAGRAPH)
90 @PreAuthorize("hasAuthority('SYS_ADMIN')") 89 @PreAuthorize("hasAuthority('SYS_ADMIN')")
91 @RequestMapping(value = "/settings", method = RequestMethod.POST) 90 @RequestMapping(value = "/settings", method = RequestMethod.POST)
92 @ResponseBody 91 @ResponseBody
@@ -109,7 +108,7 @@ public class AdminController extends BaseController { @@ -109,7 +108,7 @@ public class AdminController extends BaseController {
109 } 108 }
110 109
111 @ApiOperation(value = "Get the Security Settings object", 110 @ApiOperation(value = "Get the Security Settings object",
112 - notes = "Get the Security Settings object that contains password policy, etc." + SYS_ADMIN_AUTHORITY_ONLY) 111 + notes = "Get the Security Settings object that contains password policy, etc." + SYSTEM_AUTHORITY_PARAGRAPH)
113 @PreAuthorize("hasAuthority('SYS_ADMIN')") 112 @PreAuthorize("hasAuthority('SYS_ADMIN')")
114 @RequestMapping(value = "/securitySettings", method = RequestMethod.GET) 113 @RequestMapping(value = "/securitySettings", method = RequestMethod.GET)
115 @ResponseBody 114 @ResponseBody
@@ -123,7 +122,7 @@ public class AdminController extends BaseController { @@ -123,7 +122,7 @@ public class AdminController extends BaseController {
123 } 122 }
124 123
125 @ApiOperation(value = "Update Security Settings (saveSecuritySettings)", 124 @ApiOperation(value = "Update Security Settings (saveSecuritySettings)",
126 - notes = "Updates the Security Settings object that contains password policy, etc." + SYS_ADMIN_AUTHORITY_ONLY) 125 + notes = "Updates the Security Settings object that contains password policy, etc." + SYSTEM_AUTHORITY_PARAGRAPH)
127 @PreAuthorize("hasAuthority('SYS_ADMIN')") 126 @PreAuthorize("hasAuthority('SYS_ADMIN')")
128 @RequestMapping(value = "/securitySettings", method = RequestMethod.POST) 127 @RequestMapping(value = "/securitySettings", method = RequestMethod.POST)
129 @ResponseBody 128 @ResponseBody
@@ -141,7 +140,7 @@ public class AdminController extends BaseController { @@ -141,7 +140,7 @@ public class AdminController extends BaseController {
141 140
142 @ApiOperation(value = "Send test email (sendTestMail)", 141 @ApiOperation(value = "Send test email (sendTestMail)",
143 notes = "Attempts to send test email to the System Administrator User using Mail Settings provided as a parameter. " + 142 notes = "Attempts to send test email to the System Administrator User using Mail Settings provided as a parameter. " +
144 - "You may change the 'To' email in the user profile of the System Administrator. " + SYS_ADMIN_AUTHORITY_ONLY) 143 + "You may change the 'To' email in the user profile of the System Administrator. " + SYSTEM_AUTHORITY_PARAGRAPH)
145 @PreAuthorize("hasAuthority('SYS_ADMIN')") 144 @PreAuthorize("hasAuthority('SYS_ADMIN')")
146 @RequestMapping(value = "/settings/testMail", method = RequestMethod.POST) 145 @RequestMapping(value = "/settings/testMail", method = RequestMethod.POST)
147 public void sendTestMail( 146 public void sendTestMail(
@@ -165,7 +164,7 @@ public class AdminController extends BaseController { @@ -165,7 +164,7 @@ public class AdminController extends BaseController {
165 164
166 @ApiOperation(value = "Send test sms (sendTestMail)", 165 @ApiOperation(value = "Send test sms (sendTestMail)",
167 notes = "Attempts to send test sms to the System Administrator User using SMS Settings and phone number provided as a parameters of the request. " 166 notes = "Attempts to send test sms to the System Administrator User using SMS Settings and phone number provided as a parameters of the request. "
168 - + SYS_ADMIN_AUTHORITY_ONLY) 167 + + SYSTEM_AUTHORITY_PARAGRAPH)
169 @PreAuthorize("hasAuthority('SYS_ADMIN')") 168 @PreAuthorize("hasAuthority('SYS_ADMIN')")
170 @RequestMapping(value = "/settings/testSms", method = RequestMethod.POST) 169 @RequestMapping(value = "/settings/testSms", method = RequestMethod.POST)
171 public void sendTestSms( 170 public void sendTestSms(
@@ -181,7 +180,7 @@ public class AdminController extends BaseController { @@ -181,7 +180,7 @@ public class AdminController extends BaseController {
181 180
182 @ApiOperation(value = "Check for new Platform Releases (checkUpdates)", 181 @ApiOperation(value = "Check for new Platform Releases (checkUpdates)",
183 notes = "Check notifications about new platform releases. " 182 notes = "Check notifications about new platform releases. "
184 - + SYS_ADMIN_AUTHORITY_ONLY) 183 + + SYSTEM_AUTHORITY_PARAGRAPH)
185 @PreAuthorize("hasAuthority('SYS_ADMIN')") 184 @PreAuthorize("hasAuthority('SYS_ADMIN')")
186 @RequestMapping(value = "/updates", method = RequestMethod.GET) 185 @RequestMapping(value = "/updates", method = RequestMethod.GET)
187 @ResponseBody 186 @ResponseBody
@@ -88,7 +88,7 @@ public class AlarmController extends BaseController { @@ -88,7 +88,7 @@ public class AlarmController extends BaseController {
88 88
89 @ApiOperation(value = "Get Alarm Info (getAlarmInfoById)", 89 @ApiOperation(value = "Get Alarm Info (getAlarmInfoById)",
90 notes = "Fetch the Alarm Info object based on the provided Alarm Id. " + 90 notes = "Fetch the Alarm Info object based on the provided Alarm Id. " +
91 - ALARM_SECURITY_CHECK + ALARM_INFO_DESCRIPTION, produces = MediaType.APPLICATION_JSON_VALUE) 91 + ALARM_SECURITY_CHECK + ALARM_INFO_DESCRIPTION + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH, produces = MediaType.APPLICATION_JSON_VALUE)
92 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 92 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
93 @RequestMapping(value = "/alarm/info/{alarmId}", method = RequestMethod.GET) 93 @RequestMapping(value = "/alarm/info/{alarmId}", method = RequestMethod.GET)
94 @ResponseBody 94 @ResponseBody
@@ -111,7 +111,7 @@ public class AlarmController extends BaseController { @@ -111,7 +111,7 @@ public class AlarmController extends BaseController {
111 "\n\nPlatform also deduplicate the alarms based on the entity id of originator and alarm 'type'. " + 111 "\n\nPlatform also deduplicate the alarms based on the entity id of originator and alarm 'type'. " +
112 "For example, if the user or system component create the alarm with the type 'HighTemperature' for device 'Device A' the new active alarm is created. " + 112 "For example, if the user or system component create the alarm with the type 'HighTemperature' for device 'Device A' the new active alarm is created. " +
113 "If the user tries to create 'HighTemperature' alarm for the same device again, the previous alarm will be updated (the 'end_ts' will be set to current timestamp). " + 113 "If the user tries to create 'HighTemperature' alarm for the same device again, the previous alarm will be updated (the 'end_ts' will be set to current timestamp). " +
114 - "If the user clears the alarm (see 'Clear Alarm(clearAlarm)'), than new alarm with the same type and same device may be created. " 114 + "If the user clears the alarm (see 'Clear Alarm(clearAlarm)'), than new alarm with the same type and same device may be created. " + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH
115 , produces = MediaType.APPLICATION_JSON_VALUE) 115 , produces = MediaType.APPLICATION_JSON_VALUE)
116 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 116 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
117 @RequestMapping(value = "/alarm", method = RequestMethod.POST) 117 @RequestMapping(value = "/alarm", method = RequestMethod.POST)
@@ -138,7 +138,7 @@ public class AlarmController extends BaseController { @@ -138,7 +138,7 @@ public class AlarmController extends BaseController {
138 } 138 }
139 139
140 @ApiOperation(value = "Delete Alarm (deleteAlarm)", 140 @ApiOperation(value = "Delete Alarm (deleteAlarm)",
141 - notes = "Deletes the Alarm. Referencing non-existing Alarm Id will cause an error.", produces = MediaType.APPLICATION_JSON_VALUE) 141 + notes = "Deletes the Alarm. Referencing non-existing Alarm Id will cause an error." + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH, produces = MediaType.APPLICATION_JSON_VALUE)
142 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 142 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
143 @RequestMapping(value = "/alarm/{alarmId}", method = RequestMethod.DELETE) 143 @RequestMapping(value = "/alarm/{alarmId}", method = RequestMethod.DELETE)
144 @ResponseBody 144 @ResponseBody
@@ -165,7 +165,7 @@ public class AlarmController extends BaseController { @@ -165,7 +165,7 @@ public class AlarmController extends BaseController {
165 @ApiOperation(value = "Acknowledge Alarm (ackAlarm)", 165 @ApiOperation(value = "Acknowledge Alarm (ackAlarm)",
166 notes = "Acknowledge the Alarm. " + 166 notes = "Acknowledge the Alarm. " +
167 "Once acknowledged, the 'ack_ts' field will be set to current timestamp and special rule chain event 'ALARM_ACK' will be generated. " + 167 "Once acknowledged, the 'ack_ts' field will be set to current timestamp and special rule chain event 'ALARM_ACK' will be generated. " +
168 - "Referencing non-existing Alarm Id will cause an error.", produces = MediaType.APPLICATION_JSON_VALUE) 168 + "Referencing non-existing Alarm Id will cause an error." + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH, produces = MediaType.APPLICATION_JSON_VALUE)
169 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 169 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
170 @RequestMapping(value = "/alarm/{alarmId}/ack", method = RequestMethod.POST) 170 @RequestMapping(value = "/alarm/{alarmId}/ack", method = RequestMethod.POST)
171 @ResponseStatus(value = HttpStatus.OK) 171 @ResponseStatus(value = HttpStatus.OK)
@@ -189,7 +189,7 @@ public class AlarmController extends BaseController { @@ -189,7 +189,7 @@ public class AlarmController extends BaseController {
189 @ApiOperation(value = "Clear Alarm (clearAlarm)", 189 @ApiOperation(value = "Clear Alarm (clearAlarm)",
190 notes = "Clear the Alarm. " + 190 notes = "Clear the Alarm. " +
191 "Once cleared, the 'clear_ts' field will be set to current timestamp and special rule chain event 'ALARM_CLEAR' will be generated. " + 191 "Once cleared, the 'clear_ts' field will be set to current timestamp and special rule chain event 'ALARM_CLEAR' will be generated. " +
192 - "Referencing non-existing Alarm Id will cause an error.", produces = MediaType.APPLICATION_JSON_VALUE) 192 + "Referencing non-existing Alarm Id will cause an error." + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH, produces = MediaType.APPLICATION_JSON_VALUE)
193 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 193 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
194 @RequestMapping(value = "/alarm/{alarmId}/clear", method = RequestMethod.POST) 194 @RequestMapping(value = "/alarm/{alarmId}/clear", method = RequestMethod.POST)
195 @ResponseStatus(value = HttpStatus.OK) 195 @ResponseStatus(value = HttpStatus.OK)
@@ -212,8 +212,8 @@ public class AlarmController extends BaseController { @@ -212,8 +212,8 @@ public class AlarmController extends BaseController {
212 212
213 @ApiOperation(value = "Get Alarms (getAlarms)", 213 @ApiOperation(value = "Get Alarms (getAlarms)",
214 notes = "Returns a page of alarms for the selected entity. Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. " + 214 notes = "Returns a page of alarms for the selected entity. Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. " +
215 - PAGE_DATA_PARAMETERS, produces = MediaType.APPLICATION_JSON_VALUE)  
216 - @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 215 + PAGE_DATA_PARAMETERS + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH, produces = MediaType.APPLICATION_JSON_VALUE)
  216 + @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
217 @RequestMapping(value = "/alarm/{entityType}/{entityId}", method = RequestMethod.GET) 217 @RequestMapping(value = "/alarm/{entityType}/{entityId}", method = RequestMethod.GET)
218 @ResponseBody 218 @ResponseBody
219 public PageData<AlarmInfo> getAlarms( 219 public PageData<AlarmInfo> getAlarms(
@@ -265,7 +265,7 @@ public class AlarmController extends BaseController { @@ -265,7 +265,7 @@ public class AlarmController extends BaseController {
265 "If the user has the authority of 'Tenant Administrator', the server returns alarms that belongs to the tenant of current user. " + 265 "If the user has the authority of 'Tenant Administrator', the server returns alarms that belongs to the tenant of current user. " +
266 "If the user has the authority of 'Customer User', the server returns alarms that belongs to the customer of current user. " + 266 "If the user has the authority of 'Customer User', the server returns alarms that belongs to the customer of current user. " +
267 "Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. " + 267 "Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. " +
268 - PAGE_DATA_PARAMETERS, produces = MediaType.APPLICATION_JSON_VALUE) 268 + PAGE_DATA_PARAMETERS + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH, produces = MediaType.APPLICATION_JSON_VALUE)
269 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 269 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
270 @RequestMapping(value = "/alarms", method = RequestMethod.GET) 270 @RequestMapping(value = "/alarms", method = RequestMethod.GET)
271 @ResponseBody 271 @ResponseBody
@@ -312,7 +312,7 @@ public class AlarmController extends BaseController { @@ -312,7 +312,7 @@ public class AlarmController extends BaseController {
312 312
313 @ApiOperation(value = "Get Highest Alarm Severity (getHighestAlarmSeverity)", 313 @ApiOperation(value = "Get Highest Alarm Severity (getHighestAlarmSeverity)",
314 notes = "Search the alarms by originator ('entityType' and entityId') and optional 'status' or 'searchStatus' filters and returns the highest AlarmSeverity(CRITICAL, MAJOR, MINOR, WARNING or INDETERMINATE). " + 314 notes = "Search the alarms by originator ('entityType' and entityId') and optional 'status' or 'searchStatus' filters and returns the highest AlarmSeverity(CRITICAL, MAJOR, MINOR, WARNING or INDETERMINATE). " +
315 - "Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error." 315 + "Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error." + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH
316 , produces = MediaType.APPLICATION_JSON_VALUE) 316 , produces = MediaType.APPLICATION_JSON_VALUE)
317 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 317 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
318 @RequestMapping(value = "/alarm/highestSeverity/{entityType}/{entityId}", method = RequestMethod.GET) 318 @RequestMapping(value = "/alarm/highestSeverity/{entityType}/{entityId}", method = RequestMethod.GET)
@@ -80,7 +80,8 @@ public class AssetController extends BaseController { @@ -80,7 +80,8 @@ public class AssetController extends BaseController {
80 @ApiOperation(value = "Get Asset (getAssetById)", 80 @ApiOperation(value = "Get Asset (getAssetById)",
81 notes = "Fetch the Asset object based on the provided Asset Id. " + 81 notes = "Fetch the Asset object based on the provided Asset Id. " +
82 "If the user has the authority of 'Tenant Administrator', the server checks that the asset is owned by the same tenant. " + 82 "If the user has the authority of 'Tenant Administrator', the server checks that the asset is owned by the same tenant. " +
83 - "If the user has the authority of 'Customer User', the server checks that the asset is assigned to the same customer.", produces = MediaType.APPLICATION_JSON_VALUE) 83 + "If the user has the authority of 'Customer User', the server checks that the asset is assigned to the same customer." + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH
  84 + , produces = MediaType.APPLICATION_JSON_VALUE)
84 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 85 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
85 @RequestMapping(value = "/asset/{assetId}", method = RequestMethod.GET) 86 @RequestMapping(value = "/asset/{assetId}", method = RequestMethod.GET)
86 @ResponseBody 87 @ResponseBody
@@ -98,7 +99,8 @@ public class AssetController extends BaseController { @@ -98,7 +99,8 @@ public class AssetController extends BaseController {
98 @ApiOperation(value = "Get Asset Info (getAssetInfoById)", 99 @ApiOperation(value = "Get Asset Info (getAssetInfoById)",
99 notes = "Fetch the Asset Info object based on the provided Asset Id. " + 100 notes = "Fetch the Asset Info object based on the provided Asset Id. " +
100 "If the user has the authority of 'Tenant Administrator', the server checks that the asset is owned by the same tenant. " + 101 "If the user has the authority of 'Tenant Administrator', the server checks that the asset is owned by the same tenant. " +
101 - "If the user has the authority of 'Customer User', the server checks that the asset is assigned to the same customer. " + ASSET_INFO_DESCRIPTION, produces = MediaType.APPLICATION_JSON_VALUE) 102 + "If the user has the authority of 'Customer User', the server checks that the asset is assigned to the same customer. "
  103 + + ASSET_INFO_DESCRIPTION + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH, produces = MediaType.APPLICATION_JSON_VALUE)
102 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 104 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
103 @RequestMapping(value = "/asset/info/{assetId}", method = RequestMethod.GET) 105 @RequestMapping(value = "/asset/info/{assetId}", method = RequestMethod.GET)
104 @ResponseBody 106 @ResponseBody
@@ -117,7 +119,7 @@ public class AssetController extends BaseController { @@ -117,7 +119,7 @@ public class AssetController extends BaseController {
117 notes = "Creates or Updates the Asset. When creating asset, platform generates Asset Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address) " + 119 notes = "Creates or Updates the Asset. When creating asset, platform generates Asset Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address) " +
118 "The newly created Asset id will be present in the response. " + 120 "The newly created Asset id will be present in the response. " +
119 "Specify existing Asset id to update the asset. " + 121 "Specify existing Asset id to update the asset. " +
120 - "Referencing non-existing Asset Id will cause 'Not Found' error.", produces = MediaType.APPLICATION_JSON_VALUE) 122 + "Referencing non-existing Asset Id will cause 'Not Found' error." + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH, produces = MediaType.APPLICATION_JSON_VALUE)
121 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 123 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
122 @RequestMapping(value = "/asset", method = RequestMethod.POST) 124 @RequestMapping(value = "/asset", method = RequestMethod.POST)
123 @ResponseBody 125 @ResponseBody
@@ -158,7 +160,7 @@ public class AssetController extends BaseController { @@ -158,7 +160,7 @@ public class AssetController extends BaseController {
158 } 160 }
159 161
160 @ApiOperation(value = "Delete asset (deleteAsset)", 162 @ApiOperation(value = "Delete asset (deleteAsset)",
161 - notes = "Deletes the asset and all the relations (from and to the asset). Referencing non-existing asset Id will cause an error.") 163 + notes = "Deletes the asset and all the relations (from and to the asset). Referencing non-existing asset Id will cause an error." + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH)
162 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 164 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
163 @RequestMapping(value = "/asset/{assetId}", method = RequestMethod.DELETE) 165 @RequestMapping(value = "/asset/{assetId}", method = RequestMethod.DELETE)
164 @ResponseStatus(value = HttpStatus.OK) 166 @ResponseStatus(value = HttpStatus.OK)
@@ -187,7 +189,7 @@ public class AssetController extends BaseController { @@ -187,7 +189,7 @@ public class AssetController extends BaseController {
187 } 189 }
188 190
189 @ApiOperation(value = "Assign asset to customer (assignAssetToCustomer)", 191 @ApiOperation(value = "Assign asset to customer (assignAssetToCustomer)",
190 - notes = "Creates assignment of the asset to customer. Customer will be able to query asset afterwards.", produces = MediaType.APPLICATION_JSON_VALUE) 192 + notes = "Creates assignment of the asset to customer. Customer will be able to query asset afterwards." + TENANT_AUTHORITY_PARAGRAPH, produces = MediaType.APPLICATION_JSON_VALUE)
191 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 193 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
192 @RequestMapping(value = "/customer/{customerId}/asset/{assetId}", method = RequestMethod.POST) 194 @RequestMapping(value = "/customer/{customerId}/asset/{assetId}", method = RequestMethod.POST)
193 @ResponseBody 195 @ResponseBody
@@ -223,7 +225,7 @@ public class AssetController extends BaseController { @@ -223,7 +225,7 @@ public class AssetController extends BaseController {
223 } 225 }
224 226
225 @ApiOperation(value = "Unassign asset from customer (unassignAssetFromCustomer)", 227 @ApiOperation(value = "Unassign asset from customer (unassignAssetFromCustomer)",
226 - notes = "Clears assignment of the asset to customer. Customer will not be able to query asset afterwards.", produces = MediaType.APPLICATION_JSON_VALUE) 228 + notes = "Clears assignment of the asset to customer. Customer will not be able to query asset afterwards." + TENANT_AUTHORITY_PARAGRAPH, produces = MediaType.APPLICATION_JSON_VALUE)
227 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 229 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
228 @RequestMapping(value = "/customer/asset/{assetId}", method = RequestMethod.DELETE) 230 @RequestMapping(value = "/customer/asset/{assetId}", method = RequestMethod.DELETE)
229 @ResponseBody 231 @ResponseBody
@@ -261,7 +263,7 @@ public class AssetController extends BaseController { @@ -261,7 +263,7 @@ public class AssetController extends BaseController {
261 @ApiOperation(value = "Make asset publicly available (assignAssetToPublicCustomer)", 263 @ApiOperation(value = "Make asset publicly available (assignAssetToPublicCustomer)",
262 notes = "Asset will be available for non-authorized (not logged-in) users. " + 264 notes = "Asset will be available for non-authorized (not logged-in) users. " +
263 "This is useful to create dashboards that you plan to share/embed on a publicly available website. " + 265 "This is useful to create dashboards that you plan to share/embed on a publicly available website. " +
264 - "However, users that are logged-in and belong to different tenant will not be able to access the asset.", produces = MediaType.APPLICATION_JSON_VALUE) 266 + "However, users that are logged-in and belong to different tenant will not be able to access the asset." + TENANT_AUTHORITY_PARAGRAPH, produces = MediaType.APPLICATION_JSON_VALUE)
265 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 267 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
266 @RequestMapping(value = "/customer/public/asset/{assetId}", method = RequestMethod.POST) 268 @RequestMapping(value = "/customer/public/asset/{assetId}", method = RequestMethod.POST)
267 @ResponseBody 269 @ResponseBody
@@ -290,7 +292,7 @@ public class AssetController extends BaseController { @@ -290,7 +292,7 @@ public class AssetController extends BaseController {
290 292
291 @ApiOperation(value = "Get Tenant Assets (getTenantAssets)", 293 @ApiOperation(value = "Get Tenant Assets (getTenantAssets)",
292 notes = "Returns a page of assets owned by tenant. " + 294 notes = "Returns a page of assets owned by tenant. " +
293 - PAGE_DATA_PARAMETERS, produces = MediaType.APPLICATION_JSON_VALUE) 295 + PAGE_DATA_PARAMETERS + TENANT_AUTHORITY_PARAGRAPH, produces = MediaType.APPLICATION_JSON_VALUE)
294 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 296 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
295 @RequestMapping(value = "/tenant/assets", params = {"pageSize", "page"}, method = RequestMethod.GET) 297 @RequestMapping(value = "/tenant/assets", params = {"pageSize", "page"}, method = RequestMethod.GET)
296 @ResponseBody 298 @ResponseBody
@@ -322,7 +324,7 @@ public class AssetController extends BaseController { @@ -322,7 +324,7 @@ public class AssetController extends BaseController {
322 324
323 @ApiOperation(value = "Get Tenant Asset Infos (getTenantAssetInfos)", 325 @ApiOperation(value = "Get Tenant Asset Infos (getTenantAssetInfos)",
324 notes = "Returns a page of assets info objects owned by tenant. " + 326 notes = "Returns a page of assets info objects owned by tenant. " +
325 - PAGE_DATA_PARAMETERS + ASSET_INFO_DESCRIPTION, produces = MediaType.APPLICATION_JSON_VALUE) 327 + PAGE_DATA_PARAMETERS + ASSET_INFO_DESCRIPTION + TENANT_AUTHORITY_PARAGRAPH, produces = MediaType.APPLICATION_JSON_VALUE)
326 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 328 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
327 @RequestMapping(value = "/tenant/assetInfos", params = {"pageSize", "page"}, method = RequestMethod.GET) 329 @RequestMapping(value = "/tenant/assetInfos", params = {"pageSize", "page"}, method = RequestMethod.GET)
328 @ResponseBody 330 @ResponseBody
@@ -354,7 +356,7 @@ public class AssetController extends BaseController { @@ -354,7 +356,7 @@ public class AssetController extends BaseController {
354 356
355 @ApiOperation(value = "Get Tenant Asset (getTenantAsset)", 357 @ApiOperation(value = "Get Tenant Asset (getTenantAsset)",
356 notes = "Requested asset must be owned by tenant that the user belongs to. " + 358 notes = "Requested asset must be owned by tenant that the user belongs to. " +
357 - "Asset name is an unique property of asset. So it can be used to identify the asset.", produces = MediaType.APPLICATION_JSON_VALUE) 359 + "Asset name is an unique property of asset. So it can be used to identify the asset." + TENANT_AUTHORITY_PARAGRAPH, produces = MediaType.APPLICATION_JSON_VALUE)
358 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 360 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
359 @RequestMapping(value = "/tenant/assets", params = {"assetName"}, method = RequestMethod.GET) 361 @RequestMapping(value = "/tenant/assets", params = {"assetName"}, method = RequestMethod.GET)
360 @ResponseBody 362 @ResponseBody
@@ -60,7 +60,7 @@ public class AuditLogController extends BaseController { @@ -60,7 +60,7 @@ public class AuditLogController extends BaseController {
60 @ApiOperation(value = "Get audit logs by customer id (getAuditLogsByCustomerId)", 60 @ApiOperation(value = "Get audit logs by customer id (getAuditLogsByCustomerId)",
61 notes = "Returns a page of audit logs related to the targeted customer entities (devices, assets, etc.), " + 61 notes = "Returns a page of audit logs related to the targeted customer entities (devices, assets, etc.), " +
62 "and users actions (login, logout, etc.) that belong to this customer. " + 62 "and users actions (login, logout, etc.) that belong to this customer. " +
63 - PAGE_DATA_PARAMETERS + ADMINISTRATOR_AUTHORITY_ONLY, 63 + PAGE_DATA_PARAMETERS + TENANT_AUTHORITY_PARAGRAPH,
64 produces = MediaType.APPLICATION_JSON_VALUE) 64 produces = MediaType.APPLICATION_JSON_VALUE)
65 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 65 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
66 @RequestMapping(value = "/audit/logs/customer/{customerId}", params = {"pageSize", "page"}, method = RequestMethod.GET) 66 @RequestMapping(value = "/audit/logs/customer/{customerId}", params = {"pageSize", "page"}, method = RequestMethod.GET)
@@ -98,7 +98,7 @@ public class AuditLogController extends BaseController { @@ -98,7 +98,7 @@ public class AuditLogController extends BaseController {
98 @ApiOperation(value = "Get audit logs by user id (getAuditLogsByUserId)", 98 @ApiOperation(value = "Get audit logs by user id (getAuditLogsByUserId)",
99 notes = "Returns a page of audit logs related to the actions of targeted user. " + 99 notes = "Returns a page of audit logs related to the actions of targeted user. " +
100 "For example, RPC call to a particular device, or alarm acknowledgment for a specific device, etc. " + 100 "For example, RPC call to a particular device, or alarm acknowledgment for a specific device, etc. " +
101 - PAGE_DATA_PARAMETERS + ADMINISTRATOR_AUTHORITY_ONLY, 101 + PAGE_DATA_PARAMETERS + TENANT_AUTHORITY_PARAGRAPH,
102 produces = MediaType.APPLICATION_JSON_VALUE) 102 produces = MediaType.APPLICATION_JSON_VALUE)
103 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 103 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
104 @RequestMapping(value = "/audit/logs/user/{userId}", params = {"pageSize", "page"}, method = RequestMethod.GET) 104 @RequestMapping(value = "/audit/logs/user/{userId}", params = {"pageSize", "page"}, method = RequestMethod.GET)
@@ -137,7 +137,7 @@ public class AuditLogController extends BaseController { @@ -137,7 +137,7 @@ public class AuditLogController extends BaseController {
137 notes = "Returns a page of audit logs related to the actions on the targeted entity. " + 137 notes = "Returns a page of audit logs related to the actions on the targeted entity. " +
138 "Basically, this API call is used to get the full lifecycle of some specific entity. " + 138 "Basically, this API call is used to get the full lifecycle of some specific entity. " +
139 "For example to see when a device was created, updated, assigned to some customer, or even deleted from the system. " + 139 "For example to see when a device was created, updated, assigned to some customer, or even deleted from the system. " +
140 - PAGE_DATA_PARAMETERS + ADMINISTRATOR_AUTHORITY_ONLY, 140 + PAGE_DATA_PARAMETERS + TENANT_AUTHORITY_PARAGRAPH,
141 produces = MediaType.APPLICATION_JSON_VALUE) 141 produces = MediaType.APPLICATION_JSON_VALUE)
142 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 142 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
143 @RequestMapping(value = "/audit/logs/entity/{entityType}/{entityId}", params = {"pageSize", "page"}, method = RequestMethod.GET) 143 @RequestMapping(value = "/audit/logs/entity/{entityType}/{entityId}", params = {"pageSize", "page"}, method = RequestMethod.GET)
@@ -177,7 +177,7 @@ public class AuditLogController extends BaseController { @@ -177,7 +177,7 @@ public class AuditLogController extends BaseController {
177 177
178 @ApiOperation(value = "Get all audit logs (getAuditLogs)", 178 @ApiOperation(value = "Get all audit logs (getAuditLogs)",
179 notes = "Returns a page of audit logs related to all entities in the scope of the current user's Tenant. " + 179 notes = "Returns a page of audit logs related to all entities in the scope of the current user's Tenant. " +
180 - PAGE_DATA_PARAMETERS + ADMINISTRATOR_AUTHORITY_ONLY, 180 + PAGE_DATA_PARAMETERS + TENANT_AUTHORITY_PARAGRAPH,
181 produces = MediaType.APPLICATION_JSON_VALUE) 181 produces = MediaType.APPLICATION_JSON_VALUE)
182 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 182 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
183 @RequestMapping(value = "/audit/logs", params = {"pageSize", "page"}, method = RequestMethod.GET) 183 @RequestMapping(value = "/audit/logs", params = {"pageSize", "page"}, method = RequestMethod.GET)
@@ -181,11 +181,16 @@ public abstract class BaseController { @@ -181,11 +181,16 @@ public abstract class BaseController {
181 public static final String ENTITY_ID_PARAM_DESCRIPTION = "A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'"; 181 public static final String ENTITY_ID_PARAM_DESCRIPTION = "A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'";
182 public static final String ENTITY_TYPE_PARAM_DESCRIPTION = "A string value representing the entity type. For example, 'DEVICE'"; 182 public static final String ENTITY_TYPE_PARAM_DESCRIPTION = "A string value representing the entity type. For example, 'DEVICE'";
183 public static final String RULE_CHAIN_ID_PARAM_DESCRIPTION = "A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'"; 183 public static final String RULE_CHAIN_ID_PARAM_DESCRIPTION = "A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'";
  184 + public static final String WIDGET_BUNDLE_ID_PARAM_DESCRIPTION = "A string value representing the widget bundle id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'";
  185 + public static final String WIDGET_TYPE_ID_PARAM_DESCRIPTION = "A string value representing the widget type id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'";
  186 +
184 187
185 protected static final String SYSTEM_AUTHORITY_PARAGRAPH = "\n\nAvailable for users with 'SYS_ADMIN' authority."; 188 protected static final String SYSTEM_AUTHORITY_PARAGRAPH = "\n\nAvailable for users with 'SYS_ADMIN' authority.";
186 - protected static final String SYSTEM_AND_TENANT_AUTHORITY_PARAGRAPH = "\n\nAvailable for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority."; 189 + protected static final String SYSTEM_OR_TENANT_AUTHORITY_PARAGRAPH = "\n\nAvailable for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority.";
187 protected static final String TENANT_AUTHORITY_PARAGRAPH = "\n\nAvailable for users with 'TENANT_ADMIN' authority."; 190 protected static final String TENANT_AUTHORITY_PARAGRAPH = "\n\nAvailable for users with 'TENANT_ADMIN' authority.";
188 - protected static final String TENANT_AND_USER_AUTHORITY_PARAGRAPH = "\n\nAvailable for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority."; 191 + protected static final String TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH = "\n\nAvailable for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority.";
  192 + protected static final String CUSTOMER_AUTHORITY_PARAGRAPH = "\n\nAvailable for users with 'CUSTOMER_USER' authority.";
  193 + protected static final String AVAILABLE_FOR_ANY_AUTHORIZED_USER = "\n\nAvailable for any authorized user. ";
189 194
190 protected static final String PAGE_SIZE_DESCRIPTION = "Maximum amount of entities in a one page"; 195 protected static final String PAGE_SIZE_DESCRIPTION = "Maximum amount of entities in a one page";
191 protected static final String PAGE_NUMBER_DESCRIPTION = "Sequence number of page starting from 0"; 196 protected static final String PAGE_NUMBER_DESCRIPTION = "Sequence number of page starting from 0";
@@ -196,8 +201,10 @@ public abstract class BaseController { @@ -196,8 +201,10 @@ public abstract class BaseController {
196 201
197 protected static final String ASSET_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'startsWith' filter based on the asset name."; 202 protected static final String ASSET_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'startsWith' filter based on the asset name.";
198 protected static final String DASHBOARD_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'startsWith' filter based on the dashboard title."; 203 protected static final String DASHBOARD_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'startsWith' filter based on the dashboard title.";
  204 + protected static final String WIDGET_BUNDLE_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'startsWith' filter based on the widget bundle title.";
199 protected static final String RPC_TEXT_SEARCH_DESCRIPTION = "Not implemented. Leave empty."; 205 protected static final String RPC_TEXT_SEARCH_DESCRIPTION = "Not implemented. Leave empty.";
200 protected static final String DEVICE_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'startsWith' filter based on the device name."; 206 protected static final String DEVICE_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'startsWith' filter based on the device name.";
  207 + protected static final String USER_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'startsWith' filter based on the user email.";
201 protected static final String TENANT_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'startsWith' filter based on the tenant name."; 208 protected static final String TENANT_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'startsWith' filter based on the tenant name.";
202 protected static final String TENANT_PROFILE_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'startsWith' filter based on the tenant profile name."; 209 protected static final String TENANT_PROFILE_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'startsWith' filter based on the tenant profile name.";
203 protected static final String RULE_CHAIN_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'startsWith' filter based on the rule chain name."; 210 protected static final String RULE_CHAIN_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'startsWith' filter based on the rule chain name.";
@@ -211,6 +218,7 @@ public abstract class BaseController { @@ -211,6 +218,7 @@ public abstract class BaseController {
211 protected static final String CUSTOMER_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, title, email, country, city"; 218 protected static final String CUSTOMER_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, title, email, country, city";
212 protected static final String RPC_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, expirationTime, request, response"; 219 protected static final String RPC_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, expirationTime, request, response";
213 protected static final String DEVICE_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, name, deviceProfileName, label, customerTitle"; 220 protected static final String DEVICE_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, name, deviceProfileName, label, customerTitle";
  221 + protected static final String USER_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, firstName, lastName, email";
214 protected static final String TENANT_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, title, email, country, state, city, address, address2, zip, phone, email"; 222 protected static final String TENANT_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, title, email, country, state, city, address, address2, zip, phone, email";
215 protected static final String TENANT_PROFILE_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, name, description, isDefault"; 223 protected static final String TENANT_PROFILE_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, name, description, isDefault";
216 protected static final String TENANT_PROFILE_INFO_SORT_PROPERTY_ALLOWABLE_VALUES = "id, name"; 224 protected static final String TENANT_PROFILE_INFO_SORT_PROPERTY_ALLOWABLE_VALUES = "id, name";
@@ -221,6 +229,7 @@ public abstract class BaseController { @@ -221,6 +229,7 @@ public abstract class BaseController {
221 protected static final String EVENT_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, id"; 229 protected static final String EVENT_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, id";
222 protected static final String EDGE_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, name, type, label, customerTitle"; 230 protected static final String EDGE_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, name, type, label, customerTitle";
223 protected static final String RULE_CHAIN_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, name, root"; 231 protected static final String RULE_CHAIN_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, name, root";
  232 + protected static final String WIDGET_BUNDLE_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, title, tenantId";
224 protected static final String AUDIT_LOG_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, entityType, entityName, userName, actionType, actionStatus"; 233 protected static final String AUDIT_LOG_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, entityType, entityName, userName, actionType, actionStatus";
225 protected static final String SORT_ORDER_DESCRIPTION = "Sort order. ASC (ASCENDING) or DESC (DESCENDING)"; 234 protected static final String SORT_ORDER_DESCRIPTION = "Sort order. ASC (ASCENDING) or DESC (DESCENDING)";
226 protected static final String SORT_ORDER_ALLOWABLE_VALUES = "ASC, DESC"; 235 protected static final String SORT_ORDER_ALLOWABLE_VALUES = "ASC, DESC";
@@ -370,8 +379,6 @@ public abstract class BaseController { @@ -370,8 +379,6 @@ public abstract class BaseController {
370 protected static final String RELATION_TYPE_PARAM_DESCRIPTION = "A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value."; 379 protected static final String RELATION_TYPE_PARAM_DESCRIPTION = "A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value.";
371 protected static final String RELATION_TYPE_GROUP_PARAM_DESCRIPTION = "A string value representing relation type group. For example, 'COMMON'"; 380 protected static final String RELATION_TYPE_GROUP_PARAM_DESCRIPTION = "A string value representing relation type group. For example, 'COMMON'";
372 381
373 - protected static final String ADMINISTRATOR_AUTHORITY_ONLY = "Available for users with 'Tenant Administrator' authority only.";  
374 -  
375 public static final String INCORRECT_TENANT_ID = "Incorrect tenantId "; 382 public static final String INCORRECT_TENANT_ID = "Incorrect tenantId ";
376 protected static final String DEFAULT_DASHBOARD = "defaultDashboardId"; 383 protected static final String DEFAULT_DASHBOARD = "defaultDashboardId";
377 protected static final String HOME_DASHBOARD = "homeDashboardId"; 384 protected static final String HOME_DASHBOARD = "homeDashboardId";
@@ -47,7 +47,7 @@ public class ComponentDescriptorController extends BaseController { @@ -47,7 +47,7 @@ public class ComponentDescriptorController extends BaseController {
47 47
48 @ApiOperation(value = "Get Component Descriptor (getComponentDescriptorByClazz)", 48 @ApiOperation(value = "Get Component Descriptor (getComponentDescriptorByClazz)",
49 notes = "Gets the Component Descriptor object using class name from the path parameters. " + 49 notes = "Gets the Component Descriptor object using class name from the path parameters. " +
50 - COMPONENT_DESCRIPTOR_DEFINITION) 50 + COMPONENT_DESCRIPTOR_DEFINITION + SYSTEM_OR_TENANT_AUTHORITY_PARAGRAPH)
51 @PreAuthorize("hasAnyAuthority('SYS_ADMIN','TENANT_ADMIN')") 51 @PreAuthorize("hasAnyAuthority('SYS_ADMIN','TENANT_ADMIN')")
52 @RequestMapping(value = "/component/{componentDescriptorClazz:.+}", method = RequestMethod.GET) 52 @RequestMapping(value = "/component/{componentDescriptorClazz:.+}", method = RequestMethod.GET)
53 @ResponseBody 53 @ResponseBody
@@ -64,7 +64,7 @@ public class ComponentDescriptorController extends BaseController { @@ -64,7 +64,7 @@ public class ComponentDescriptorController extends BaseController {
64 64
65 @ApiOperation(value = "Get Component Descriptors (getComponentDescriptorsByType)", 65 @ApiOperation(value = "Get Component Descriptors (getComponentDescriptorsByType)",
66 notes = "Gets the Component Descriptors using rule node type and optional rule chain type request parameters. " + 66 notes = "Gets the Component Descriptors using rule node type and optional rule chain type request parameters. " +
67 - COMPONENT_DESCRIPTOR_DEFINITION) 67 + COMPONENT_DESCRIPTOR_DEFINITION + SYSTEM_OR_TENANT_AUTHORITY_PARAGRAPH)
68 @PreAuthorize("hasAnyAuthority('SYS_ADMIN','TENANT_ADMIN')") 68 @PreAuthorize("hasAnyAuthority('SYS_ADMIN','TENANT_ADMIN')")
69 @RequestMapping(value = "/components/{componentType}", method = RequestMethod.GET) 69 @RequestMapping(value = "/components/{componentType}", method = RequestMethod.GET)
70 @ResponseBody 70 @ResponseBody
@@ -83,7 +83,7 @@ public class ComponentDescriptorController extends BaseController { @@ -83,7 +83,7 @@ public class ComponentDescriptorController extends BaseController {
83 83
84 @ApiOperation(value = "Get Component Descriptors (getComponentDescriptorsByTypes)", 84 @ApiOperation(value = "Get Component Descriptors (getComponentDescriptorsByTypes)",
85 notes = "Gets the Component Descriptors using coma separated list of rule node types and optional rule chain type request parameters. " + 85 notes = "Gets the Component Descriptors using coma separated list of rule node types and optional rule chain type request parameters. " +
86 - COMPONENT_DESCRIPTOR_DEFINITION) 86 + COMPONENT_DESCRIPTOR_DEFINITION + SYSTEM_OR_TENANT_AUTHORITY_PARAGRAPH)
87 @PreAuthorize("hasAnyAuthority('SYS_ADMIN','TENANT_ADMIN')") 87 @PreAuthorize("hasAnyAuthority('SYS_ADMIN','TENANT_ADMIN')")
88 @RequestMapping(value = "/components", params = {"componentTypes"}, method = RequestMethod.GET) 88 @RequestMapping(value = "/components", params = {"componentTypes"}, method = RequestMethod.GET)
89 @ResponseBody 89 @ResponseBody
@@ -57,7 +57,8 @@ public class CustomerController extends BaseController { @@ -57,7 +57,8 @@ public class CustomerController extends BaseController {
57 "If the user has the authority of 'Customer User', the server checks that the user belongs to the customer."; 57 "If the user has the authority of 'Customer User', the server checks that the user belongs to the customer.";
58 58
59 @ApiOperation(value = "Get Customer (getCustomerById)", 59 @ApiOperation(value = "Get Customer (getCustomerById)",
60 - notes = "Get the Customer object based on the provided Customer Id. " + CUSTOMER_SECURITY_CHECK) 60 + notes = "Get the Customer object based on the provided Customer Id. "
  61 + + CUSTOMER_SECURITY_CHECK + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH)
61 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 62 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
62 @RequestMapping(value = "/customer/{customerId}", method = RequestMethod.GET) 63 @RequestMapping(value = "/customer/{customerId}", method = RequestMethod.GET)
63 @ResponseBody 64 @ResponseBody
@@ -79,7 +80,8 @@ public class CustomerController extends BaseController { @@ -79,7 +80,8 @@ public class CustomerController extends BaseController {
79 80
80 81
81 @ApiOperation(value = "Get short Customer info (getShortCustomerInfoById)", 82 @ApiOperation(value = "Get short Customer info (getShortCustomerInfoById)",
82 - notes = "Get the short customer object that contains only the title and 'isPublic' flag. " + CUSTOMER_SECURITY_CHECK) 83 + notes = "Get the short customer object that contains only the title and 'isPublic' flag. "
  84 + + CUSTOMER_SECURITY_CHECK + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH)
83 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 85 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
84 @RequestMapping(value = "/customer/{customerId}/shortInfo", method = RequestMethod.GET) 86 @RequestMapping(value = "/customer/{customerId}/shortInfo", method = RequestMethod.GET)
85 @ResponseBody 87 @ResponseBody
@@ -101,7 +103,8 @@ public class CustomerController extends BaseController { @@ -101,7 +103,8 @@ public class CustomerController extends BaseController {
101 } 103 }
102 104
103 @ApiOperation(value = "Get Customer Title (getCustomerTitleById)", 105 @ApiOperation(value = "Get Customer Title (getCustomerTitleById)",
104 - notes = "Get the title of the customer. " + CUSTOMER_SECURITY_CHECK) 106 + notes = "Get the title of the customer. "
  107 + + CUSTOMER_SECURITY_CHECK + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH)
105 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 108 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
106 @RequestMapping(value = "/customer/{customerId}/title", method = RequestMethod.GET, produces = "application/text") 109 @RequestMapping(value = "/customer/{customerId}/title", method = RequestMethod.GET, produces = "application/text")
107 @ResponseBody 110 @ResponseBody
@@ -122,7 +125,7 @@ public class CustomerController extends BaseController { @@ -122,7 +125,7 @@ public class CustomerController extends BaseController {
122 notes = "Creates or Updates the Customer. When creating customer, platform generates Customer Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address) " + 125 notes = "Creates or Updates the Customer. When creating customer, platform generates Customer Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address) " +
123 "The newly created Customer Id will be present in the response. " + 126 "The newly created Customer Id will be present in the response. " +
124 "Specify existing Customer Id to update the Customer. " + 127 "Specify existing Customer Id to update the Customer. " +
125 - "Referencing non-existing Customer Id will cause 'Not Found' error.") 128 + "Referencing non-existing Customer Id will cause 'Not Found' error." + TENANT_AUTHORITY_PARAGRAPH)
126 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 129 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
127 @RequestMapping(value = "/customer", method = RequestMethod.POST) 130 @RequestMapping(value = "/customer", method = RequestMethod.POST)
128 @ResponseBody 131 @ResponseBody
@@ -153,7 +156,9 @@ public class CustomerController extends BaseController { @@ -153,7 +156,9 @@ public class CustomerController extends BaseController {
153 } 156 }
154 157
155 @ApiOperation(value = "Delete Customer (deleteCustomer)", 158 @ApiOperation(value = "Delete Customer (deleteCustomer)",
156 - notes = "Deletes the Customer and all customer Users. All assigned Dashboards, Assets, Devices, etc. will be unassigned but not deleted. Referencing non-existing Customer Id will cause an error.") 159 + notes = "Deletes the Customer and all customer Users. " +
  160 + "All assigned Dashboards, Assets, Devices, etc. will be unassigned but not deleted. " +
  161 + "Referencing non-existing Customer Id will cause an error." + TENANT_AUTHORITY_PARAGRAPH)
157 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 162 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
158 @RequestMapping(value = "/customer/{customerId}", method = RequestMethod.DELETE) 163 @RequestMapping(value = "/customer/{customerId}", method = RequestMethod.DELETE)
159 @ResponseStatus(value = HttpStatus.OK) 164 @ResponseStatus(value = HttpStatus.OK)
@@ -187,7 +192,7 @@ public class CustomerController extends BaseController { @@ -187,7 +192,7 @@ public class CustomerController extends BaseController {
187 192
188 @ApiOperation(value = "Get Tenant Customers (getCustomers)", 193 @ApiOperation(value = "Get Tenant Customers (getCustomers)",
189 notes = "Returns a page of customers owned by tenant. " + 194 notes = "Returns a page of customers owned by tenant. " +
190 - PAGE_DATA_PARAMETERS) 195 + PAGE_DATA_PARAMETERS + TENANT_AUTHORITY_PARAGRAPH)
191 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 196 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
192 @RequestMapping(value = "/customers", params = {"pageSize", "page"}, method = RequestMethod.GET) 197 @RequestMapping(value = "/customers", params = {"pageSize", "page"}, method = RequestMethod.GET)
193 @ResponseBody 198 @ResponseBody
@@ -212,7 +217,7 @@ public class CustomerController extends BaseController { @@ -212,7 +217,7 @@ public class CustomerController extends BaseController {
212 } 217 }
213 218
214 @ApiOperation(value = "Get Tenant Customer by Customer title (getTenantCustomer)", 219 @ApiOperation(value = "Get Tenant Customer by Customer title (getTenantCustomer)",
215 - notes = "Get the Customer using Customer Title. " + ADMINISTRATOR_AUTHORITY_ONLY) 220 + notes = "Get the Customer using Customer Title. " + TENANT_AUTHORITY_PARAGRAPH)
216 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 221 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
217 @RequestMapping(value = "/tenant/customers", params = {"customerTitle"}, method = RequestMethod.GET) 222 @RequestMapping(value = "/tenant/customers", params = {"customerTitle"}, method = RequestMethod.GET)
218 @ResponseBody 223 @ResponseBody
@@ -120,7 +120,7 @@ public class DashboardController extends BaseController { @@ -120,7 +120,7 @@ public class DashboardController extends BaseController {
120 } 120 }
121 121
122 @ApiOperation(value = "Get Dashboard (getDashboardById)", 122 @ApiOperation(value = "Get Dashboard (getDashboardById)",
123 - notes = "Get the dashboard based on 'dashboardId' parameter. " + DASHBOARD_DEFINITION, 123 + notes = "Get the dashboard based on 'dashboardId' parameter. " + DASHBOARD_DEFINITION + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
124 produces = MediaType.APPLICATION_JSON_VALUE 124 produces = MediaType.APPLICATION_JSON_VALUE
125 ) 125 )
126 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 126 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
@@ -143,7 +143,7 @@ public class DashboardController extends BaseController { @@ -143,7 +143,7 @@ public class DashboardController extends BaseController {
143 "The newly created Dashboard id will be present in the response. " + 143 "The newly created Dashboard id will be present in the response. " +
144 "Specify existing Dashboard id to update the dashboard. " + 144 "Specify existing Dashboard id to update the dashboard. " +
145 "Referencing non-existing dashboard Id will cause 'Not Found' error. " + 145 "Referencing non-existing dashboard Id will cause 'Not Found' error. " +
146 - "Only users with 'TENANT_ADMIN') authority may create the dashboards.", 146 + TENANT_AUTHORITY_PARAGRAPH,
147 produces = MediaType.APPLICATION_JSON_VALUE, 147 produces = MediaType.APPLICATION_JSON_VALUE,
148 consumes = MediaType.APPLICATION_JSON_VALUE) 148 consumes = MediaType.APPLICATION_JSON_VALUE)
149 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 149 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
@@ -177,7 +177,7 @@ public class DashboardController extends BaseController { @@ -177,7 +177,7 @@ public class DashboardController extends BaseController {
177 } 177 }
178 178
179 @ApiOperation(value = "Delete the Dashboard (deleteDashboard)", 179 @ApiOperation(value = "Delete the Dashboard (deleteDashboard)",
180 - notes = "Delete the Dashboard. Only users with 'TENANT_ADMIN') authority may delete the dashboards.") 180 + notes = "Delete the Dashboard." + TENANT_AUTHORITY_PARAGRAPH)
181 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 181 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
182 @RequestMapping(value = "/dashboard/{dashboardId}", method = RequestMethod.DELETE) 182 @RequestMapping(value = "/dashboard/{dashboardId}", method = RequestMethod.DELETE)
183 @ResponseStatus(value = HttpStatus.OK) 183 @ResponseStatus(value = HttpStatus.OK)
@@ -211,7 +211,7 @@ public class DashboardController extends BaseController { @@ -211,7 +211,7 @@ public class DashboardController extends BaseController {
211 211
212 @ApiOperation(value = "Assign the Dashboard (assignDashboardToCustomer)", 212 @ApiOperation(value = "Assign the Dashboard (assignDashboardToCustomer)",
213 notes = "Assign the Dashboard to specified Customer or do nothing if the Dashboard is already assigned to that Customer. " + 213 notes = "Assign the Dashboard to specified Customer or do nothing if the Dashboard is already assigned to that Customer. " +
214 - "Returns the Dashboard object. Only users with 'TENANT_ADMIN') authority may assign the dashboards to customers.", 214 + "Returns the Dashboard object." + TENANT_AUTHORITY_PARAGRAPH,
215 produces = MediaType.APPLICATION_JSON_VALUE) 215 produces = MediaType.APPLICATION_JSON_VALUE)
216 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 216 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
217 @RequestMapping(value = "/customer/{customerId}/dashboard/{dashboardId}", method = RequestMethod.POST) 217 @RequestMapping(value = "/customer/{customerId}/dashboard/{dashboardId}", method = RequestMethod.POST)
@@ -251,7 +251,7 @@ public class DashboardController extends BaseController { @@ -251,7 +251,7 @@ public class DashboardController extends BaseController {
251 251
252 @ApiOperation(value = "Unassign the Dashboard (unassignDashboardFromCustomer)", 252 @ApiOperation(value = "Unassign the Dashboard (unassignDashboardFromCustomer)",
253 notes = "Unassign the Dashboard from specified Customer or do nothing if the Dashboard is already assigned to that Customer. " + 253 notes = "Unassign the Dashboard from specified Customer or do nothing if the Dashboard is already assigned to that Customer. " +
254 - "Returns the Dashboard object. Only users with 'TENANT_ADMIN') authority may unassign the dashboards from customers.", 254 + "Returns the Dashboard object." + TENANT_AUTHORITY_PARAGRAPH,
255 produces = MediaType.APPLICATION_JSON_VALUE) 255 produces = MediaType.APPLICATION_JSON_VALUE)
256 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 256 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
257 @RequestMapping(value = "/customer/{customerId}/dashboard/{dashboardId}", method = RequestMethod.DELETE) 257 @RequestMapping(value = "/customer/{customerId}/dashboard/{dashboardId}", method = RequestMethod.DELETE)
@@ -290,7 +290,7 @@ public class DashboardController extends BaseController { @@ -290,7 +290,7 @@ public class DashboardController extends BaseController {
290 290
291 @ApiOperation(value = "Update the Dashboard Customers (updateDashboardCustomers)", 291 @ApiOperation(value = "Update the Dashboard Customers (updateDashboardCustomers)",
292 notes = "Updates the list of Customers that this Dashboard is assigned to. Removes previous assignments to customers that are not in the provided list. " + 292 notes = "Updates the list of Customers that this Dashboard is assigned to. Removes previous assignments to customers that are not in the provided list. " +
293 - "Returns the Dashboard object. Only users with 'TENANT_ADMIN') authority may assign the dashboards to customers.", 293 + "Returns the Dashboard object. " + TENANT_AUTHORITY_PARAGRAPH,
294 produces = MediaType.APPLICATION_JSON_VALUE, 294 produces = MediaType.APPLICATION_JSON_VALUE,
295 consumes = MediaType.APPLICATION_JSON_VALUE) 295 consumes = MediaType.APPLICATION_JSON_VALUE)
296 296
@@ -365,7 +365,7 @@ public class DashboardController extends BaseController { @@ -365,7 +365,7 @@ public class DashboardController extends BaseController {
365 365
366 @ApiOperation(value = "Adds the Dashboard Customers (addDashboardCustomers)", 366 @ApiOperation(value = "Adds the Dashboard Customers (addDashboardCustomers)",
367 notes = "Adds the list of Customers to the existing list of assignments for the Dashboard. Keeps previous assignments to customers that are not in the provided list. " + 367 notes = "Adds the list of Customers to the existing list of assignments for the Dashboard. Keeps previous assignments to customers that are not in the provided list. " +
368 - "Returns the Dashboard object. Only users with 'TENANT_ADMIN') authority may assign the dashboards to customers.", 368 + "Returns the Dashboard object." + TENANT_AUTHORITY_PARAGRAPH,
369 produces = MediaType.APPLICATION_JSON_VALUE, 369 produces = MediaType.APPLICATION_JSON_VALUE,
370 consumes = MediaType.APPLICATION_JSON_VALUE) 370 consumes = MediaType.APPLICATION_JSON_VALUE)
371 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 371 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
@@ -417,7 +417,7 @@ public class DashboardController extends BaseController { @@ -417,7 +417,7 @@ public class DashboardController extends BaseController {
417 417
418 @ApiOperation(value = "Remove the Dashboard Customers (removeDashboardCustomers)", 418 @ApiOperation(value = "Remove the Dashboard Customers (removeDashboardCustomers)",
419 notes = "Removes the list of Customers from the existing list of assignments for the Dashboard. Keeps other assignments to customers that are not in the provided list. " + 419 notes = "Removes the list of Customers from the existing list of assignments for the Dashboard. Keeps other assignments to customers that are not in the provided list. " +
420 - "Returns the Dashboard object. Only users with 'TENANT_ADMIN') authority may assign the dashboards to customers.", 420 + "Returns the Dashboard object." + TENANT_AUTHORITY_PARAGRAPH,
421 produces = MediaType.APPLICATION_JSON_VALUE, 421 produces = MediaType.APPLICATION_JSON_VALUE,
422 consumes = MediaType.APPLICATION_JSON_VALUE) 422 consumes = MediaType.APPLICATION_JSON_VALUE)
423 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 423 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
@@ -473,7 +473,7 @@ public class DashboardController extends BaseController { @@ -473,7 +473,7 @@ public class DashboardController extends BaseController {
473 "Be aware that making the dashboard public does not mean that it automatically makes all devices and assets you use in the dashboard to be public." + 473 "Be aware that making the dashboard public does not mean that it automatically makes all devices and assets you use in the dashboard to be public." +
474 "Use [assign Asset to Public Customer](#!/asset-controller/assignAssetToPublicCustomerUsingPOST) and " + 474 "Use [assign Asset to Public Customer](#!/asset-controller/assignAssetToPublicCustomerUsingPOST) and " +
475 "[assign Device to Public Customer](#!/device-controller/assignDeviceToPublicCustomerUsingPOST) for this purpose. " + 475 "[assign Device to Public Customer](#!/device-controller/assignDeviceToPublicCustomerUsingPOST) for this purpose. " +
476 - "Returns the Dashboard object. Only users with 'TENANT_ADMIN') authority may assign the dashboards to customers.", 476 + "Returns the Dashboard object." + TENANT_AUTHORITY_PARAGRAPH,
477 produces = MediaType.APPLICATION_JSON_VALUE) 477 produces = MediaType.APPLICATION_JSON_VALUE)
478 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 478 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
479 @RequestMapping(value = "/customer/public/dashboard/{dashboardId}", method = RequestMethod.POST) 479 @RequestMapping(value = "/customer/public/dashboard/{dashboardId}", method = RequestMethod.POST)
@@ -505,7 +505,7 @@ public class DashboardController extends BaseController { @@ -505,7 +505,7 @@ public class DashboardController extends BaseController {
505 505
506 @ApiOperation(value = "Unassign the Dashboard from Public Customer (unassignDashboardFromPublicCustomer)", 506 @ApiOperation(value = "Unassign the Dashboard from Public Customer (unassignDashboardFromPublicCustomer)",
507 notes = "Unassigns the dashboard from a special, auto-generated 'Public' Customer. Once unassigned, unauthenticated users may no longer browse the dashboard. " + 507 notes = "Unassigns the dashboard from a special, auto-generated 'Public' Customer. Once unassigned, unauthenticated users may no longer browse the dashboard. " +
508 - "Returns the Dashboard object. Only users with 'TENANT_ADMIN') authority may assign the dashboards to customers.", 508 + "Returns the Dashboard object." + TENANT_AUTHORITY_PARAGRAPH,
509 produces = MediaType.APPLICATION_JSON_VALUE) 509 produces = MediaType.APPLICATION_JSON_VALUE)
510 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 510 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
511 @RequestMapping(value = "/customer/public/dashboard/{dashboardId}", method = RequestMethod.DELETE) 511 @RequestMapping(value = "/customer/public/dashboard/{dashboardId}", method = RequestMethod.DELETE)
@@ -538,7 +538,7 @@ public class DashboardController extends BaseController { @@ -538,7 +538,7 @@ public class DashboardController extends BaseController {
538 538
539 @ApiOperation(value = "Get Tenant Dashboards by System Administrator (getTenantDashboards)", 539 @ApiOperation(value = "Get Tenant Dashboards by System Administrator (getTenantDashboards)",
540 notes = "Returns a page of dashboard info objects owned by tenant. " + DASHBOARD_INFO_DEFINITION + " " + PAGE_DATA_PARAMETERS + 540 notes = "Returns a page of dashboard info objects owned by tenant. " + DASHBOARD_INFO_DEFINITION + " " + PAGE_DATA_PARAMETERS +
541 - "Only users with 'SYS_ADMIN' authority may use this method.", 541 + SYSTEM_AUTHORITY_PARAGRAPH,
542 produces = MediaType.APPLICATION_JSON_VALUE) 542 produces = MediaType.APPLICATION_JSON_VALUE)
543 @PreAuthorize("hasAuthority('SYS_ADMIN')") 543 @PreAuthorize("hasAuthority('SYS_ADMIN')")
544 @RequestMapping(value = "/tenant/{tenantId}/dashboards", params = {"pageSize", "page"}, method = RequestMethod.GET) 544 @RequestMapping(value = "/tenant/{tenantId}/dashboards", params = {"pageSize", "page"}, method = RequestMethod.GET)
@@ -567,8 +567,8 @@ public class DashboardController extends BaseController { @@ -567,8 +567,8 @@ public class DashboardController extends BaseController {
567 } 567 }
568 568
569 @ApiOperation(value = "Get Tenant Dashboards (getTenantDashboards)", 569 @ApiOperation(value = "Get Tenant Dashboards (getTenantDashboards)",
570 - notes = "Returns a page of dashboard info objects owned by the tenant of a current user. " + DASHBOARD_INFO_DEFINITION + " " + PAGE_DATA_PARAMETERS +  
571 - "Only users with 'TENANT_ADMIN' authority may use this method.", 570 + notes = "Returns a page of dashboard info objects owned by the tenant of a current user. "
  571 + + DASHBOARD_INFO_DEFINITION + " " + PAGE_DATA_PARAMETERS + TENANT_AUTHORITY_PARAGRAPH,
572 produces = MediaType.APPLICATION_JSON_VALUE) 572 produces = MediaType.APPLICATION_JSON_VALUE)
573 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 573 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
574 @RequestMapping(value = "/tenant/dashboards", params = {"pageSize", "page"}, method = RequestMethod.GET) 574 @RequestMapping(value = "/tenant/dashboards", params = {"pageSize", "page"}, method = RequestMethod.GET)
@@ -600,8 +600,8 @@ public class DashboardController extends BaseController { @@ -600,8 +600,8 @@ public class DashboardController extends BaseController {
600 } 600 }
601 601
602 @ApiOperation(value = "Get Customer Dashboards (getCustomerDashboards)", 602 @ApiOperation(value = "Get Customer Dashboards (getCustomerDashboards)",
603 - notes = "Returns a page of dashboard info objects owned by the specified customer. " + DASHBOARD_INFO_DEFINITION + " " + PAGE_DATA_PARAMETERS +  
604 - "Only users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority may use this method.", 603 + notes = "Returns a page of dashboard info objects owned by the specified customer. "
  604 + + DASHBOARD_INFO_DEFINITION + " " + PAGE_DATA_PARAMETERS + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
605 produces = MediaType.APPLICATION_JSON_VALUE) 605 produces = MediaType.APPLICATION_JSON_VALUE)
606 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 606 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
607 @RequestMapping(value = "/customer/{customerId}/dashboards", params = {"pageSize", "page"}, method = RequestMethod.GET) 607 @RequestMapping(value = "/customer/{customerId}/dashboards", params = {"pageSize", "page"}, method = RequestMethod.GET)
@@ -641,8 +641,7 @@ public class DashboardController extends BaseController { @@ -641,8 +641,7 @@ public class DashboardController extends BaseController {
641 notes = "Returns the home dashboard object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the User. " + 641 notes = "Returns the home dashboard object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the User. " +
642 "If 'homeDashboardId' parameter is not set on the User level and the User has authority 'CUSTOMER_USER', check the same parameter for the corresponding Customer. " + 642 "If 'homeDashboardId' parameter is not set on the User level and the User has authority 'CUSTOMER_USER', check the same parameter for the corresponding Customer. " +
643 "If 'homeDashboardId' parameter is not set on the User and Customer levels then checks the same parameter for the Tenant that owns the user. " 643 "If 'homeDashboardId' parameter is not set on the User and Customer levels then checks the same parameter for the Tenant that owns the user. "
644 - + DASHBOARD_DEFINITION + " " +  
645 - "Only users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority should use this method.", 644 + + DASHBOARD_DEFINITION + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
646 produces = MediaType.APPLICATION_JSON_VALUE) 645 produces = MediaType.APPLICATION_JSON_VALUE)
647 @PreAuthorize("isAuthenticated()") 646 @PreAuthorize("isAuthenticated()")
648 @RequestMapping(value = "/dashboard/home", method = RequestMethod.GET) 647 @RequestMapping(value = "/dashboard/home", method = RequestMethod.GET)
@@ -679,7 +678,7 @@ public class DashboardController extends BaseController { @@ -679,7 +678,7 @@ public class DashboardController extends BaseController {
679 notes = "Returns the home dashboard info object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the User. " + 678 notes = "Returns the home dashboard info object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the User. " +
680 "If 'homeDashboardId' parameter is not set on the User level and the User has authority 'CUSTOMER_USER', check the same parameter for the corresponding Customer. " + 679 "If 'homeDashboardId' parameter is not set on the User level and the User has authority 'CUSTOMER_USER', check the same parameter for the corresponding Customer. " +
681 "If 'homeDashboardId' parameter is not set on the User and Customer levels then checks the same parameter for the Tenant that owns the user. " + 680 "If 'homeDashboardId' parameter is not set on the User and Customer levels then checks the same parameter for the Tenant that owns the user. " +
682 - "Only users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority should use this method.", 681 + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
683 produces = MediaType.APPLICATION_JSON_VALUE) 682 produces = MediaType.APPLICATION_JSON_VALUE)
684 @PreAuthorize("isAuthenticated()") 683 @PreAuthorize("isAuthenticated()")
685 @RequestMapping(value = "/dashboard/home/info", method = RequestMethod.GET) 684 @RequestMapping(value = "/dashboard/home/info", method = RequestMethod.GET)
@@ -714,7 +713,7 @@ public class DashboardController extends BaseController { @@ -714,7 +713,7 @@ public class DashboardController extends BaseController {
714 713
715 @ApiOperation(value = "Get Tenant Home Dashboard Info (getTenantHomeDashboardInfo)", 714 @ApiOperation(value = "Get Tenant Home Dashboard Info (getTenantHomeDashboardInfo)",
716 notes = "Returns the home dashboard info object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the corresponding tenant. " + 715 notes = "Returns the home dashboard info object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the corresponding tenant. " +
717 - "Only users with 'TENANT_ADMIN' authority may use this method.", 716 + TENANT_AUTHORITY_PARAGRAPH,
718 produces = MediaType.APPLICATION_JSON_VALUE) 717 produces = MediaType.APPLICATION_JSON_VALUE)
719 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 718 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
720 @RequestMapping(value = "/tenant/dashboard/home/info", method = RequestMethod.GET) 719 @RequestMapping(value = "/tenant/dashboard/home/info", method = RequestMethod.GET)
@@ -740,7 +739,7 @@ public class DashboardController extends BaseController { @@ -740,7 +739,7 @@ public class DashboardController extends BaseController {
740 739
741 @ApiOperation(value = "Update Tenant Home Dashboard Info (getTenantHomeDashboardInfo)", 740 @ApiOperation(value = "Update Tenant Home Dashboard Info (getTenantHomeDashboardInfo)",
742 notes = "Update the home dashboard assignment for the current tenant. " + 741 notes = "Update the home dashboard assignment for the current tenant. " +
743 - "Only users with 'TENANT_ADMIN' authority may use this method.", 742 + TENANT_AUTHORITY_PARAGRAPH,
744 produces = MediaType.APPLICATION_JSON_VALUE) 743 produces = MediaType.APPLICATION_JSON_VALUE)
745 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 744 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
746 @RequestMapping(value = "/tenant/dashboard/home/info", method = RequestMethod.POST) 745 @RequestMapping(value = "/tenant/dashboard/home/info", method = RequestMethod.POST)
@@ -810,7 +809,8 @@ public class DashboardController extends BaseController { @@ -810,7 +809,8 @@ public class DashboardController extends BaseController {
810 EDGE_ASSIGN_ASYNC_FIRST_STEP_DESCRIPTION + 809 EDGE_ASSIGN_ASYNC_FIRST_STEP_DESCRIPTION +
811 "Second, remote edge service will receive a copy of assignment dashboard " + 810 "Second, remote edge service will receive a copy of assignment dashboard " +
812 EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION + ". " + 811 EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION + ". " +
813 - "Third, once dashboard will be delivered to edge service, it's going to be available for usage on remote edge instance.", 812 + "Third, once dashboard will be delivered to edge service, it's going to be available for usage on remote edge instance." +
  813 + TENANT_AUTHORITY_PARAGRAPH,
814 produces = MediaType.APPLICATION_JSON_VALUE) 814 produces = MediaType.APPLICATION_JSON_VALUE)
815 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 815 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
816 @RequestMapping(value = "/edge/{edgeId}/dashboard/{dashboardId}", method = RequestMethod.POST) 816 @RequestMapping(value = "/edge/{edgeId}/dashboard/{dashboardId}", method = RequestMethod.POST)
@@ -850,7 +850,8 @@ public class DashboardController extends BaseController { @@ -850,7 +850,8 @@ public class DashboardController extends BaseController {
850 EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION + 850 EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION +
851 "Second, remote edge service will receive an 'unassign' command to remove dashboard " + 851 "Second, remote edge service will receive an 'unassign' command to remove dashboard " +
852 EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION + ". " + 852 EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION + ". " +
853 - "Third, once 'unassign' command will be delivered to edge service, it's going to remove dashboard locally.", 853 + "Third, once 'unassign' command will be delivered to edge service, it's going to remove dashboard locally." +
  854 + TENANT_AUTHORITY_PARAGRAPH,
854 produces = MediaType.APPLICATION_JSON_VALUE) 855 produces = MediaType.APPLICATION_JSON_VALUE)
855 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 856 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
856 @RequestMapping(value = "/edge/{edgeId}/dashboard/{dashboardId}", method = RequestMethod.DELETE) 857 @RequestMapping(value = "/edge/{edgeId}/dashboard/{dashboardId}", method = RequestMethod.DELETE)
@@ -103,8 +103,9 @@ public class DeviceController extends BaseController { @@ -103,8 +103,9 @@ public class DeviceController extends BaseController {
103 103
104 @ApiOperation(value = "Get Device (getDeviceById)", 104 @ApiOperation(value = "Get Device (getDeviceById)",
105 notes = "Fetch the Device object based on the provided Device Id. " + 105 notes = "Fetch the Device object based on the provided Device Id. " +
106 - "If the user has the authority of 'Tenant Administrator', the server checks that the device is owned by the same tenant. " +  
107 - "If the user has the authority of 'Customer User', the server checks that the device is assigned to the same customer.") 106 + "If the user has the authority of 'TENANT_ADMIN', the server checks that the device is owned by the same tenant. " +
  107 + "If the user has the authority of 'CUSTOMER_USER', the server checks that the device is assigned to the same customer." +
  108 + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH)
108 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 109 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
109 @RequestMapping(value = "/device/{deviceId}", method = RequestMethod.GET) 110 @RequestMapping(value = "/device/{deviceId}", method = RequestMethod.GET)
110 @ResponseBody 111 @ResponseBody
@@ -122,7 +123,8 @@ public class DeviceController extends BaseController { @@ -122,7 +123,8 @@ public class DeviceController extends BaseController {
122 @ApiOperation(value = "Get Device Info (getDeviceInfoById)", 123 @ApiOperation(value = "Get Device Info (getDeviceInfoById)",
123 notes = "Fetch the Device Info object based on the provided Device Id. " + 124 notes = "Fetch the Device Info object based on the provided Device Id. " +
124 "If the user has the authority of 'Tenant Administrator', the server checks that the device is owned by the same tenant. " + 125 "If the user has the authority of 'Tenant Administrator', the server checks that the device is owned by the same tenant. " +
125 - "If the user has the authority of 'Customer User', the server checks that the device is assigned to the same customer. " + DEVICE_INFO_DESCRIPTION) 126 + "If the user has the authority of 'Customer User', the server checks that the device is assigned to the same customer. " +
  127 + DEVICE_INFO_DESCRIPTION + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH)
126 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 128 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
127 @RequestMapping(value = "/device/info/{deviceId}", method = RequestMethod.GET) 129 @RequestMapping(value = "/device/info/{deviceId}", method = RequestMethod.GET)
128 @ResponseBody 130 @ResponseBody
@@ -139,11 +141,12 @@ public class DeviceController extends BaseController { @@ -139,11 +141,12 @@ public class DeviceController extends BaseController {
139 141
140 @ApiOperation(value = "Create Or Update Device (saveDevice)", 142 @ApiOperation(value = "Create Or Update Device (saveDevice)",
141 notes = "Create or update the Device. When creating device, platform generates Device Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address). " + 143 notes = "Create or update the Device. When creating device, platform generates Device Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address). " +
142 - "Device credentials are also generated if not provided in the 'accessToken' request parameter. " +  
143 - "The newly created device id will be present in the response. " +  
144 - "Specify existing Device id to update the device. " +  
145 - "Referencing non-existing device Id will cause 'Not Found' error." +  
146 - "\n\nDevice name is unique in the scope of tenant. Use unique identifiers like MAC or IMEI for the device names and non-unique 'label' field for user-friendly visualization purposes.") 144 + "Device credentials are also generated if not provided in the 'accessToken' request parameter. " +
  145 + "The newly created device id will be present in the response. " +
  146 + "Specify existing Device id to update the device. " +
  147 + "Referencing non-existing device Id will cause 'Not Found' error." +
  148 + "\n\nDevice name is unique in the scope of tenant. Use unique identifiers like MAC or IMEI for the device names and non-unique 'label' field for user-friendly visualization purposes."
  149 + + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH)
147 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 150 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
148 @RequestMapping(value = "/device", method = RequestMethod.POST) 151 @RequestMapping(value = "/device", method = RequestMethod.POST)
149 @ResponseBody 152 @ResponseBody
@@ -187,7 +190,7 @@ public class DeviceController extends BaseController { @@ -187,7 +190,7 @@ public class DeviceController extends BaseController {
187 } 190 }
188 191
189 @ApiOperation(value = "Delete device (deleteDevice)", 192 @ApiOperation(value = "Delete device (deleteDevice)",
190 - notes = "Deletes the device, it's credentials and all the relations (from and to the device). Referencing non-existing device Id will cause an error.") 193 + notes = "Deletes the device, it's credentials and all the relations (from and to the device). Referencing non-existing device Id will cause an error." + TENANT_AUTHORITY_PARAGRAPH)
191 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 194 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
192 @RequestMapping(value = "/device/{deviceId}", method = RequestMethod.DELETE) 195 @RequestMapping(value = "/device/{deviceId}", method = RequestMethod.DELETE)
193 @ResponseStatus(value = HttpStatus.OK) 196 @ResponseStatus(value = HttpStatus.OK)
@@ -219,7 +222,7 @@ public class DeviceController extends BaseController { @@ -219,7 +222,7 @@ public class DeviceController extends BaseController {
219 } 222 }
220 223
221 @ApiOperation(value = "Assign device to customer (assignDeviceToCustomer)", 224 @ApiOperation(value = "Assign device to customer (assignDeviceToCustomer)",
222 - notes = "Creates assignment of the device to customer. Customer will be able to query device afterwards.") 225 + notes = "Creates assignment of the device to customer. Customer will be able to query device afterwards." + TENANT_AUTHORITY_PARAGRAPH)
223 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 226 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
224 @RequestMapping(value = "/customer/{customerId}/device/{deviceId}", method = RequestMethod.POST) 227 @RequestMapping(value = "/customer/{customerId}/device/{deviceId}", method = RequestMethod.POST)
225 @ResponseBody 228 @ResponseBody
@@ -255,7 +258,7 @@ public class DeviceController extends BaseController { @@ -255,7 +258,7 @@ public class DeviceController extends BaseController {
255 } 258 }
256 259
257 @ApiOperation(value = "Unassign device from customer (unassignDeviceFromCustomer)", 260 @ApiOperation(value = "Unassign device from customer (unassignDeviceFromCustomer)",
258 - notes = "Clears assignment of the device to customer. Customer will not be able to query device afterwards.") 261 + notes = "Clears assignment of the device to customer. Customer will not be able to query device afterwards." + TENANT_AUTHORITY_PARAGRAPH)
259 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 262 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
260 @RequestMapping(value = "/customer/device/{deviceId}", method = RequestMethod.DELETE) 263 @RequestMapping(value = "/customer/device/{deviceId}", method = RequestMethod.DELETE)
261 @ResponseBody 264 @ResponseBody
@@ -291,7 +294,7 @@ public class DeviceController extends BaseController { @@ -291,7 +294,7 @@ public class DeviceController extends BaseController {
291 @ApiOperation(value = "Make device publicly available (assignDeviceToPublicCustomer)", 294 @ApiOperation(value = "Make device publicly available (assignDeviceToPublicCustomer)",
292 notes = "Device will be available for non-authorized (not logged-in) users. " + 295 notes = "Device will be available for non-authorized (not logged-in) users. " +
293 "This is useful to create dashboards that you plan to share/embed on a publicly available website. " + 296 "This is useful to create dashboards that you plan to share/embed on a publicly available website. " +
294 - "However, users that are logged-in and belong to different tenant will not be able to access the device.") 297 + "However, users that are logged-in and belong to different tenant will not be able to access the device." + TENANT_AUTHORITY_PARAGRAPH)
295 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 298 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
296 @RequestMapping(value = "/customer/public/device/{deviceId}", method = RequestMethod.POST) 299 @RequestMapping(value = "/customer/public/device/{deviceId}", method = RequestMethod.POST)
297 @ResponseBody 300 @ResponseBody
@@ -318,7 +321,7 @@ public class DeviceController extends BaseController { @@ -318,7 +321,7 @@ public class DeviceController extends BaseController {
318 } 321 }
319 322
320 @ApiOperation(value = "Get Device Credentials (getDeviceCredentialsByDeviceId)", 323 @ApiOperation(value = "Get Device Credentials (getDeviceCredentialsByDeviceId)",
321 - notes = "If during device creation there wasn't specified any credentials, platform generates random 'ACCESS_TOKEN' credentials.") 324 + notes = "If during device creation there wasn't specified any credentials, platform generates random 'ACCESS_TOKEN' credentials." + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH)
322 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 325 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
323 @RequestMapping(value = "/device/{deviceId}/credentials", method = RequestMethod.GET) 326 @RequestMapping(value = "/device/{deviceId}/credentials", method = RequestMethod.GET)
324 @ResponseBody 327 @ResponseBody
@@ -344,7 +347,7 @@ public class DeviceController extends BaseController { @@ -344,7 +347,7 @@ public class DeviceController extends BaseController {
344 @ApiOperation(value = "Update device credentials (updateDeviceCredentials)", notes = "During device creation, platform generates random 'ACCESS_TOKEN' credentials. " + 347 @ApiOperation(value = "Update device credentials (updateDeviceCredentials)", notes = "During device creation, platform generates random 'ACCESS_TOKEN' credentials. " +
345 "Use this method to update the device credentials. First use 'getDeviceCredentialsByDeviceId' to get the credentials id and value. " + 348 "Use this method to update the device credentials. First use 'getDeviceCredentialsByDeviceId' to get the credentials id and value. " +
346 "Then use current method to update the credentials type and value. It is not possible to create multiple device credentials for the same device. " + 349 "Then use current method to update the credentials type and value. It is not possible to create multiple device credentials for the same device. " +
347 - "The structure of device credentials id and value is simple for the 'ACCESS_TOKEN' but is much more complex for the 'MQTT_BASIC' or 'LWM2M_CREDENTIALS'.") 350 + "The structure of device credentials id and value is simple for the 'ACCESS_TOKEN' but is much more complex for the 'MQTT_BASIC' or 'LWM2M_CREDENTIALS'." + TENANT_AUTHORITY_PARAGRAPH)
348 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 351 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
349 @RequestMapping(value = "/device/credentials", method = RequestMethod.POST) 352 @RequestMapping(value = "/device/credentials", method = RequestMethod.POST)
350 @ResponseBody 353 @ResponseBody
@@ -405,7 +408,7 @@ public class DeviceController extends BaseController { @@ -405,7 +408,7 @@ public class DeviceController extends BaseController {
405 408
406 @ApiOperation(value = "Get Tenant Device Infos (getTenantDeviceInfos)", 409 @ApiOperation(value = "Get Tenant Device Infos (getTenantDeviceInfos)",
407 notes = "Returns a page of devices info objects owned by tenant. " + 410 notes = "Returns a page of devices info objects owned by tenant. " +
408 - PAGE_DATA_PARAMETERS + DEVICE_INFO_DESCRIPTION) 411 + PAGE_DATA_PARAMETERS + DEVICE_INFO_DESCRIPTION + TENANT_AUTHORITY_PARAGRAPH)
409 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 412 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
410 @RequestMapping(value = "/tenant/deviceInfos", params = {"pageSize", "page"}, method = RequestMethod.GET) 413 @RequestMapping(value = "/tenant/deviceInfos", params = {"pageSize", "page"}, method = RequestMethod.GET)
411 @ResponseBody 414 @ResponseBody
@@ -443,7 +446,7 @@ public class DeviceController extends BaseController { @@ -443,7 +446,7 @@ public class DeviceController extends BaseController {
443 446
444 @ApiOperation(value = "Get Tenant Device (getTenantDevice)", 447 @ApiOperation(value = "Get Tenant Device (getTenantDevice)",
445 notes = "Requested device must be owned by tenant that the user belongs to. " + 448 notes = "Requested device must be owned by tenant that the user belongs to. " +
446 - "Device name is an unique property of device. So it can be used to identify the device.") 449 + "Device name is an unique property of device. So it can be used to identify the device." + TENANT_AUTHORITY_PARAGRAPH)
447 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 450 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
448 @RequestMapping(value = "/tenant/devices", params = {"deviceName"}, method = RequestMethod.GET) 451 @RequestMapping(value = "/tenant/devices", params = {"deviceName"}, method = RequestMethod.GET)
449 @ResponseBody 452 @ResponseBody
@@ -460,7 +463,7 @@ public class DeviceController extends BaseController { @@ -460,7 +463,7 @@ public class DeviceController extends BaseController {
460 463
461 @ApiOperation(value = "Get Customer Devices (getCustomerDevices)", 464 @ApiOperation(value = "Get Customer Devices (getCustomerDevices)",
462 notes = "Returns a page of devices objects assigned to customer. " + 465 notes = "Returns a page of devices objects assigned to customer. " +
463 - PAGE_DATA_PARAMETERS) 466 + PAGE_DATA_PARAMETERS + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH)
464 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 467 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
465 @RequestMapping(value = "/customer/{customerId}/devices", params = {"pageSize", "page"}, method = RequestMethod.GET) 468 @RequestMapping(value = "/customer/{customerId}/devices", params = {"pageSize", "page"}, method = RequestMethod.GET)
466 @ResponseBody 469 @ResponseBody
@@ -497,7 +500,7 @@ public class DeviceController extends BaseController { @@ -497,7 +500,7 @@ public class DeviceController extends BaseController {
497 500
498 @ApiOperation(value = "Get Customer Device Infos (getCustomerDeviceInfos)", 501 @ApiOperation(value = "Get Customer Device Infos (getCustomerDeviceInfos)",
499 notes = "Returns a page of devices info objects assigned to customer. " + 502 notes = "Returns a page of devices info objects assigned to customer. " +
500 - PAGE_DATA_PARAMETERS + DEVICE_INFO_DESCRIPTION) 503 + PAGE_DATA_PARAMETERS + DEVICE_INFO_DESCRIPTION + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH)
501 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 504 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
502 @RequestMapping(value = "/customer/{customerId}/deviceInfos", params = {"pageSize", "page"}, method = RequestMethod.GET) 505 @RequestMapping(value = "/customer/{customerId}/deviceInfos", params = {"pageSize", "page"}, method = RequestMethod.GET)
503 @ResponseBody 506 @ResponseBody
@@ -538,7 +541,7 @@ public class DeviceController extends BaseController { @@ -538,7 +541,7 @@ public class DeviceController extends BaseController {
538 } 541 }
539 542
540 @ApiOperation(value = "Get Devices By Ids (getDevicesByIds)", 543 @ApiOperation(value = "Get Devices By Ids (getDevicesByIds)",
541 - notes = "Requested devices must be owned by tenant or assigned to customer which user is performing the request. ") 544 + notes = "Requested devices must be owned by tenant or assigned to customer which user is performing the request. " + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH)
542 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 545 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
543 @RequestMapping(value = "/devices", params = {"deviceIds"}, method = RequestMethod.GET) 546 @RequestMapping(value = "/devices", params = {"deviceIds"}, method = RequestMethod.GET)
544 @ResponseBody 547 @ResponseBody
@@ -569,7 +572,7 @@ public class DeviceController extends BaseController { @@ -569,7 +572,7 @@ public class DeviceController extends BaseController {
569 @ApiOperation(value = "Find related devices (findByQuery)", 572 @ApiOperation(value = "Find related devices (findByQuery)",
570 notes = "Returns all devices that are related to the specific entity. " + 573 notes = "Returns all devices that are related to the specific entity. " +
571 "The entity id, relation type, device types, depth of the search, and other query parameters defined using complex 'DeviceSearchQuery' object. " + 574 "The entity id, relation type, device types, depth of the search, and other query parameters defined using complex 'DeviceSearchQuery' object. " +
572 - "See 'Model' tab of the Parameters for more info.") 575 + "See 'Model' tab of the Parameters for more info." + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH)
573 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 576 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
574 @RequestMapping(value = "/devices", method = RequestMethod.POST) 577 @RequestMapping(value = "/devices", method = RequestMethod.POST)
575 @ResponseBody 578 @ResponseBody
@@ -597,7 +600,8 @@ public class DeviceController extends BaseController { @@ -597,7 +600,8 @@ public class DeviceController extends BaseController {
597 } 600 }
598 601
599 @ApiOperation(value = "Get Device Types (getDeviceTypes)", 602 @ApiOperation(value = "Get Device Types (getDeviceTypes)",
600 - notes = "Returns a set of unique device profile names based on devices that are either owned by the tenant or assigned to the customer which user is performing the request.") 603 + notes = "Returns a set of unique device profile names based on devices that are either owned by the tenant or assigned to the customer which user is performing the request."
  604 + + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH)
601 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 605 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
602 @RequestMapping(value = "/device/types", method = RequestMethod.GET) 606 @RequestMapping(value = "/device/types", method = RequestMethod.GET)
603 @ResponseBody 607 @ResponseBody
@@ -618,7 +622,7 @@ public class DeviceController extends BaseController { @@ -618,7 +622,7 @@ public class DeviceController extends BaseController {
618 "Once device is claimed, the customer becomes its owner and customer users may access device data as well as control the device. \n" + 622 "Once device is claimed, the customer becomes its owner and customer users may access device data as well as control the device. \n" +
619 "In order to enable claiming devices feature a system parameter security.claim.allowClaimingByDefault should be set to true, " + 623 "In order to enable claiming devices feature a system parameter security.claim.allowClaimingByDefault should be set to true, " +
620 "otherwise a server-side claimingAllowed attribute with the value true is obligatory for provisioned devices. \n" + 624 "otherwise a server-side claimingAllowed attribute with the value true is obligatory for provisioned devices. \n" +
621 - "See official documentation for more details regarding claiming.") 625 + "See official documentation for more details regarding claiming." + CUSTOMER_AUTHORITY_PARAGRAPH)
622 @PreAuthorize("hasAuthority('CUSTOMER_USER')") 626 @PreAuthorize("hasAuthority('CUSTOMER_USER')")
623 @RequestMapping(value = "/customer/device/{deviceName}/claim", method = RequestMethod.POST) 627 @RequestMapping(value = "/customer/device/{deviceName}/claim", method = RequestMethod.POST)
624 @ResponseBody 628 @ResponseBody
@@ -676,7 +680,8 @@ public class DeviceController extends BaseController { @@ -676,7 +680,8 @@ public class DeviceController extends BaseController {
676 } 680 }
677 681
678 @ApiOperation(value = "Reclaim device (reClaimDevice)", 682 @ApiOperation(value = "Reclaim device (reClaimDevice)",
679 - notes = "Reclaiming means the device will be unassigned from the customer and the device will be available for claiming again.") 683 + notes = "Reclaiming means the device will be unassigned from the customer and the device will be available for claiming again."
  684 + + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH)
680 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 685 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
681 @RequestMapping(value = "/customer/device/{deviceName}/claim", method = RequestMethod.DELETE) 686 @RequestMapping(value = "/customer/device/{deviceName}/claim", method = RequestMethod.DELETE)
682 @ResponseStatus(value = HttpStatus.OK) 687 @ResponseStatus(value = HttpStatus.OK)
@@ -730,7 +735,7 @@ public class DeviceController extends BaseController { @@ -730,7 +735,7 @@ public class DeviceController extends BaseController {
730 } 735 }
731 736
732 @ApiOperation(value = "Assign device to tenant (assignDeviceToTenant)", 737 @ApiOperation(value = "Assign device to tenant (assignDeviceToTenant)",
733 - notes = "Creates assignment of the device to tenant. Thereafter tenant will be able to reassign the device to a customer.") 738 + notes = "Creates assignment of the device to tenant. Thereafter tenant will be able to reassign the device to a customer." + TENANT_AUTHORITY_PARAGRAPH)
734 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 739 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
735 @RequestMapping(value = "/tenant/{tenantId}/device/{deviceId}", method = RequestMethod.POST) 740 @RequestMapping(value = "/tenant/{tenantId}/device/{deviceId}", method = RequestMethod.POST)
736 @ResponseBody 741 @ResponseBody
@@ -788,7 +793,7 @@ public class DeviceController extends BaseController { @@ -788,7 +793,7 @@ public class DeviceController extends BaseController {
788 EDGE_ASSIGN_ASYNC_FIRST_STEP_DESCRIPTION + 793 EDGE_ASSIGN_ASYNC_FIRST_STEP_DESCRIPTION +
789 "Second, remote edge service will receive a copy of assignment device " + 794 "Second, remote edge service will receive a copy of assignment device " +
790 EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION + ". " + 795 EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION + ". " +
791 - "Third, once device will be delivered to edge service, it's going to be available for usage on remote edge instance.", 796 + "Third, once device will be delivered to edge service, it's going to be available for usage on remote edge instance." + TENANT_AUTHORITY_PARAGRAPH,
792 produces = MediaType.APPLICATION_JSON_VALUE) 797 produces = MediaType.APPLICATION_JSON_VALUE)
793 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 798 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
794 @RequestMapping(value = "/edge/{edgeId}/device/{deviceId}", method = RequestMethod.POST) 799 @RequestMapping(value = "/edge/{edgeId}/device/{deviceId}", method = RequestMethod.POST)
@@ -831,7 +836,7 @@ public class DeviceController extends BaseController { @@ -831,7 +836,7 @@ public class DeviceController extends BaseController {
831 EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION + 836 EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION +
832 "Second, remote edge service will receive an 'unassign' command to remove device " + 837 "Second, remote edge service will receive an 'unassign' command to remove device " +
833 EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION + ". " + 838 EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION + ". " +
834 - "Third, once 'unassign' command will be delivered to edge service, it's going to remove device locally.", 839 + "Third, once 'unassign' command will be delivered to edge service, it's going to remove device locally." + TENANT_AUTHORITY_PARAGRAPH,
835 produces = MediaType.APPLICATION_JSON_VALUE) 840 produces = MediaType.APPLICATION_JSON_VALUE)
836 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 841 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
837 @RequestMapping(value = "/edge/{edgeId}/device/{deviceId}", method = RequestMethod.DELETE) 842 @RequestMapping(value = "/edge/{edgeId}/device/{deviceId}", method = RequestMethod.DELETE)
@@ -871,7 +876,7 @@ public class DeviceController extends BaseController { @@ -871,7 +876,7 @@ public class DeviceController extends BaseController {
871 876
872 @ApiOperation(value = "Get devices assigned to edge (getEdgeDevices)", 877 @ApiOperation(value = "Get devices assigned to edge (getEdgeDevices)",
873 notes = "Returns a page of devices assigned to edge. " + 878 notes = "Returns a page of devices assigned to edge. " +
874 - PAGE_DATA_PARAMETERS) 879 + PAGE_DATA_PARAMETERS + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH)
875 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 880 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
876 @RequestMapping(value = "/edge/{edgeId}/devices", params = {"pageSize", "page"}, method = RequestMethod.GET) 881 @RequestMapping(value = "/edge/{edgeId}/devices", params = {"pageSize", "page"}, method = RequestMethod.GET)
877 @ResponseBody 882 @ResponseBody
@@ -928,7 +933,7 @@ public class DeviceController extends BaseController { @@ -928,7 +933,7 @@ public class DeviceController extends BaseController {
928 notes = "The platform gives an ability to load OTA (over-the-air) packages to devices. " + 933 notes = "The platform gives an ability to load OTA (over-the-air) packages to devices. " +
929 "It can be done in two different ways: device scope or device profile scope." + 934 "It can be done in two different ways: device scope or device profile scope." +
930 "In the response you will find the number of devices with specified device profile, but without previously defined device scope OTA package. " + 935 "In the response you will find the number of devices with specified device profile, but without previously defined device scope OTA package. " +
931 - "It can be useful when you want to define number of devices that will be affected with future OTA package") 936 + "It can be useful when you want to define number of devices that will be affected with future OTA package" + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH)
932 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 937 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
933 @RequestMapping(value = "/devices/count/{otaPackageType}/{deviceProfileId}", method = RequestMethod.GET) 938 @RequestMapping(value = "/devices/count/{otaPackageType}/{deviceProfileId}", method = RequestMethod.GET)
934 @ResponseBody 939 @ResponseBody
@@ -949,7 +954,7 @@ public class DeviceController extends BaseController { @@ -949,7 +954,7 @@ public class DeviceController extends BaseController {
949 } 954 }
950 955
951 @ApiOperation(value = "Import the bulk of devices (processDevicesBulkImport)", 956 @ApiOperation(value = "Import the bulk of devices (processDevicesBulkImport)",
952 - notes = "There's an ability to import the bulk of devices using the only .csv file.") 957 + notes = "There's an ability to import the bulk of devices using the only .csv file." + TENANT_AUTHORITY_PARAGRAPH)
953 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") 958 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')")
954 @PostMapping("/device/bulk_import") 959 @PostMapping("/device/bulk_import")
955 public BulkImportResult<Device> processDevicesBulkImport(@RequestBody BulkImportRequest request) throws Exception { 960 public BulkImportResult<Device> processDevicesBulkImport(@RequestBody BulkImportRequest request) throws Exception {
@@ -528,7 +528,7 @@ public class DeviceProfileController extends BaseController { @@ -528,7 +528,7 @@ public class DeviceProfileController extends BaseController {
528 528
529 @ApiOperation(value = "Get Device Profile Info (getDeviceProfileInfoById)", 529 @ApiOperation(value = "Get Device Profile Info (getDeviceProfileInfoById)",
530 notes = "Fetch the Device Profile Info object based on the provided Device Profile Id. " 530 notes = "Fetch the Device Profile Info object based on the provided Device Profile Id. "
531 - + DEVICE_PROFILE_INFO_DESCRIPTION + TENANT_AND_USER_AUTHORITY_PARAGRAPH, 531 + + DEVICE_PROFILE_INFO_DESCRIPTION + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
532 produces = "application/json") 532 produces = "application/json")
533 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 533 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
534 @RequestMapping(value = "/deviceProfileInfo/{deviceProfileId}", method = RequestMethod.GET) 534 @RequestMapping(value = "/deviceProfileInfo/{deviceProfileId}", method = RequestMethod.GET)
@@ -547,7 +547,7 @@ public class DeviceProfileController extends BaseController { @@ -547,7 +547,7 @@ public class DeviceProfileController extends BaseController {
547 547
548 @ApiOperation(value = "Get Default Device Profile (getDefaultDeviceProfileInfo)", 548 @ApiOperation(value = "Get Default Device Profile (getDefaultDeviceProfileInfo)",
549 notes = "Fetch the Default Device Profile Info object. " + 549 notes = "Fetch the Default Device Profile Info object. " +
550 - DEVICE_PROFILE_INFO_DESCRIPTION + TENANT_AND_USER_AUTHORITY_PARAGRAPH, 550 + DEVICE_PROFILE_INFO_DESCRIPTION + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
551 produces = "application/json") 551 produces = "application/json")
552 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 552 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
553 @RequestMapping(value = "/deviceProfileInfo/default", method = RequestMethod.GET) 553 @RequestMapping(value = "/deviceProfileInfo/default", method = RequestMethod.GET)
@@ -769,7 +769,7 @@ public class DeviceProfileController extends BaseController { @@ -769,7 +769,7 @@ public class DeviceProfileController extends BaseController {
769 769
770 @ApiOperation(value = "Get Device Profiles for transport type (getDeviceProfileInfos)", 770 @ApiOperation(value = "Get Device Profiles for transport type (getDeviceProfileInfos)",
771 notes = "Returns a page of devices profile info objects owned by tenant. " + 771 notes = "Returns a page of devices profile info objects owned by tenant. " +
772 - PAGE_DATA_PARAMETERS + DEVICE_PROFILE_INFO_DESCRIPTION + TENANT_AND_USER_AUTHORITY_PARAGRAPH, 772 + PAGE_DATA_PARAMETERS + DEVICE_PROFILE_INFO_DESCRIPTION + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
773 produces = "application/json") 773 produces = "application/json")
774 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 774 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
775 @RequestMapping(value = "/deviceProfileInfos", params = {"pageSize", "page"}, method = RequestMethod.GET) 775 @RequestMapping(value = "/deviceProfileInfos", params = {"pageSize", "page"}, method = RequestMethod.GET)
@@ -91,7 +91,7 @@ public class EdgeController extends BaseController { @@ -91,7 +91,7 @@ public class EdgeController extends BaseController {
91 } 91 }
92 92
93 @ApiOperation(value = "Get Edge (getEdgeById)", 93 @ApiOperation(value = "Get Edge (getEdgeById)",
94 - notes = "Get the Edge object based on the provided Edge Id. " + EDGE_SECURITY_CHECK, 94 + notes = "Get the Edge object based on the provided Edge Id. " + EDGE_SECURITY_CHECK + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
95 produces = MediaType.APPLICATION_JSON_VALUE) 95 produces = MediaType.APPLICATION_JSON_VALUE)
96 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 96 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
97 @RequestMapping(value = "/edge/{edgeId}", method = RequestMethod.GET) 97 @RequestMapping(value = "/edge/{edgeId}", method = RequestMethod.GET)
@@ -112,7 +112,7 @@ public class EdgeController extends BaseController { @@ -112,7 +112,7 @@ public class EdgeController extends BaseController {
112 } 112 }
113 113
114 @ApiOperation(value = "Get Edge Info (getEdgeInfoById)", 114 @ApiOperation(value = "Get Edge Info (getEdgeInfoById)",
115 - notes = "Get the Edge Info object based on the provided Edge Id. " + EDGE_SECURITY_CHECK, 115 + notes = "Get the Edge Info object based on the provided Edge Id. " + EDGE_SECURITY_CHECK + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
116 produces = MediaType.APPLICATION_JSON_VALUE) 116 produces = MediaType.APPLICATION_JSON_VALUE)
117 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 117 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
118 @RequestMapping(value = "/edge/info/{edgeId}", method = RequestMethod.GET) 118 @RequestMapping(value = "/edge/info/{edgeId}", method = RequestMethod.GET)
@@ -137,7 +137,8 @@ public class EdgeController extends BaseController { @@ -137,7 +137,8 @@ public class EdgeController extends BaseController {
137 "The newly created edge id will be present in the response. " + 137 "The newly created edge id will be present in the response. " +
138 "Specify existing Edge id to update the edge. " + 138 "Specify existing Edge id to update the edge. " +
139 "Referencing non-existing Edge Id will cause 'Not Found' error." + 139 "Referencing non-existing Edge Id will cause 'Not Found' error." +
140 - "\n\nEdge name is unique in the scope of tenant. Use unique identifiers like MAC or IMEI for the edge names and non-unique 'label' field for user-friendly visualization purposes.", 140 + "\n\nEdge name is unique in the scope of tenant. Use unique identifiers like MAC or IMEI for the edge names and non-unique 'label' field for user-friendly visualization purposes."
  141 + + TENANT_AUTHORITY_PARAGRAPH,
141 produces = MediaType.APPLICATION_JSON_VALUE) 142 produces = MediaType.APPLICATION_JSON_VALUE)
142 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 143 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
143 @RequestMapping(value = "/edge", method = RequestMethod.POST) 144 @RequestMapping(value = "/edge", method = RequestMethod.POST)
@@ -187,7 +188,7 @@ public class EdgeController extends BaseController { @@ -187,7 +188,7 @@ public class EdgeController extends BaseController {
187 } 188 }
188 189
189 @ApiOperation(value = "Delete edge (deleteEdge)", 190 @ApiOperation(value = "Delete edge (deleteEdge)",
190 - notes = "Deletes the edge. Referencing non-existing edge Id will cause an error.") 191 + notes = "Deletes the edge. Referencing non-existing edge Id will cause an error."+ TENANT_AUTHORITY_PARAGRAPH)
191 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 192 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
192 @RequestMapping(value = "/edge/{edgeId}", method = RequestMethod.DELETE) 193 @RequestMapping(value = "/edge/{edgeId}", method = RequestMethod.DELETE)
193 @ResponseStatus(value = HttpStatus.OK) 194 @ResponseStatus(value = HttpStatus.OK)
@@ -219,7 +220,7 @@ public class EdgeController extends BaseController { @@ -219,7 +220,7 @@ public class EdgeController extends BaseController {
219 220
220 @ApiOperation(value = "Get Tenant Edges (getEdges)", 221 @ApiOperation(value = "Get Tenant Edges (getEdges)",
221 notes = "Returns a page of edges owned by tenant. " + 222 notes = "Returns a page of edges owned by tenant. " +
222 - PAGE_DATA_PARAMETERS, produces = MediaType.APPLICATION_JSON_VALUE) 223 + PAGE_DATA_PARAMETERS + TENANT_AUTHORITY_PARAGRAPH, produces = MediaType.APPLICATION_JSON_VALUE)
223 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 224 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
224 @RequestMapping(value = "/edges", params = {"pageSize", "page"}, method = RequestMethod.GET) 225 @RequestMapping(value = "/edges", params = {"pageSize", "page"}, method = RequestMethod.GET)
225 @ResponseBody 226 @ResponseBody
@@ -243,7 +244,7 @@ public class EdgeController extends BaseController { @@ -243,7 +244,7 @@ public class EdgeController extends BaseController {
243 } 244 }
244 245
245 @ApiOperation(value = "Assign edge to customer (assignEdgeToCustomer)", 246 @ApiOperation(value = "Assign edge to customer (assignEdgeToCustomer)",
246 - notes = "Creates assignment of the edge to customer. Customer will be able to query edge afterwards.", 247 + notes = "Creates assignment of the edge to customer. Customer will be able to query edge afterwards." + TENANT_AUTHORITY_PARAGRAPH,
247 produces = MediaType.APPLICATION_JSON_VALUE) 248 produces = MediaType.APPLICATION_JSON_VALUE)
248 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 249 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
249 @RequestMapping(value = "/customer/{customerId}/edge/{edgeId}", method = RequestMethod.POST) 250 @RequestMapping(value = "/customer/{customerId}/edge/{edgeId}", method = RequestMethod.POST)
@@ -283,7 +284,7 @@ public class EdgeController extends BaseController { @@ -283,7 +284,7 @@ public class EdgeController extends BaseController {
283 } 284 }
284 285
285 @ApiOperation(value = "Unassign edge from customer (unassignEdgeFromCustomer)", 286 @ApiOperation(value = "Unassign edge from customer (unassignEdgeFromCustomer)",
286 - notes = "Clears assignment of the edge to customer. Customer will not be able to query edge afterwards.", 287 + notes = "Clears assignment of the edge to customer. Customer will not be able to query edge afterwards." + TENANT_AUTHORITY_PARAGRAPH,
287 produces = MediaType.APPLICATION_JSON_VALUE) 288 produces = MediaType.APPLICATION_JSON_VALUE)
288 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 289 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
289 @RequestMapping(value = "/customer/edge/{edgeId}", method = RequestMethod.DELETE) 290 @RequestMapping(value = "/customer/edge/{edgeId}", method = RequestMethod.DELETE)
@@ -323,7 +324,7 @@ public class EdgeController extends BaseController { @@ -323,7 +324,7 @@ public class EdgeController extends BaseController {
323 @ApiOperation(value = "Make edge publicly available (assignEdgeToPublicCustomer)", 324 @ApiOperation(value = "Make edge publicly available (assignEdgeToPublicCustomer)",
324 notes = "Edge will be available for non-authorized (not logged-in) users. " + 325 notes = "Edge will be available for non-authorized (not logged-in) users. " +
325 "This is useful to create dashboards that you plan to share/embed on a publicly available website. " + 326 "This is useful to create dashboards that you plan to share/embed on a publicly available website. " +
326 - "However, users that are logged-in and belong to different tenant will not be able to access the edge.", 327 + "However, users that are logged-in and belong to different tenant will not be able to access the edge." + TENANT_AUTHORITY_PARAGRAPH,
327 produces = MediaType.APPLICATION_JSON_VALUE) 328 produces = MediaType.APPLICATION_JSON_VALUE)
328 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 329 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
329 @RequestMapping(value = "/customer/public/edge/{edgeId}", method = RequestMethod.POST) 330 @RequestMapping(value = "/customer/public/edge/{edgeId}", method = RequestMethod.POST)
@@ -355,7 +356,7 @@ public class EdgeController extends BaseController { @@ -355,7 +356,7 @@ public class EdgeController extends BaseController {
355 356
356 @ApiOperation(value = "Get Tenant Edges (getTenantEdges)", 357 @ApiOperation(value = "Get Tenant Edges (getTenantEdges)",
357 notes = "Returns a page of edges owned by tenant. " + 358 notes = "Returns a page of edges owned by tenant. " +
358 - PAGE_DATA_PARAMETERS, produces = MediaType.APPLICATION_JSON_VALUE) 359 + PAGE_DATA_PARAMETERS + TENANT_AUTHORITY_PARAGRAPH, produces = MediaType.APPLICATION_JSON_VALUE)
359 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 360 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
360 @RequestMapping(value = "/tenant/edges", params = {"pageSize", "page"}, method = RequestMethod.GET) 361 @RequestMapping(value = "/tenant/edges", params = {"pageSize", "page"}, method = RequestMethod.GET)
361 @ResponseBody 362 @ResponseBody
@@ -387,7 +388,7 @@ public class EdgeController extends BaseController { @@ -387,7 +388,7 @@ public class EdgeController extends BaseController {
387 388
388 @ApiOperation(value = "Get Tenant Edge Infos (getTenantEdgeInfos)", 389 @ApiOperation(value = "Get Tenant Edge Infos (getTenantEdgeInfos)",
389 notes = "Returns a page of edges info objects owned by tenant. " + 390 notes = "Returns a page of edges info objects owned by tenant. " +
390 - PAGE_DATA_PARAMETERS + EDGE_INFO_DESCRIPTION, 391 + PAGE_DATA_PARAMETERS + EDGE_INFO_DESCRIPTION + TENANT_AUTHORITY_PARAGRAPH,
391 produces = MediaType.APPLICATION_JSON_VALUE) 392 produces = MediaType.APPLICATION_JSON_VALUE)
392 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 393 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
393 @RequestMapping(value = "/tenant/edgeInfos", params = {"pageSize", "page"}, method = RequestMethod.GET) 394 @RequestMapping(value = "/tenant/edgeInfos", params = {"pageSize", "page"}, method = RequestMethod.GET)
@@ -420,7 +421,7 @@ public class EdgeController extends BaseController { @@ -420,7 +421,7 @@ public class EdgeController extends BaseController {
420 421
421 @ApiOperation(value = "Get Tenant Edge (getTenantEdge)", 422 @ApiOperation(value = "Get Tenant Edge (getTenantEdge)",
422 notes = "Requested edge must be owned by tenant or customer that the user belongs to. " + 423 notes = "Requested edge must be owned by tenant or customer that the user belongs to. " +
423 - "Edge name is an unique property of edge. So it can be used to identify the edge.", 424 + "Edge name is an unique property of edge. So it can be used to identify the edge." + TENANT_AUTHORITY_PARAGRAPH,
424 produces = MediaType.APPLICATION_JSON_VALUE) 425 produces = MediaType.APPLICATION_JSON_VALUE)
425 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 426 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
426 @RequestMapping(value = "/tenant/edges", params = {"edgeName"}, method = RequestMethod.GET) 427 @RequestMapping(value = "/tenant/edges", params = {"edgeName"}, method = RequestMethod.GET)
@@ -437,7 +438,7 @@ public class EdgeController extends BaseController { @@ -437,7 +438,7 @@ public class EdgeController extends BaseController {
437 438
438 @ApiOperation(value = "Set root rule chain for provided edge (setRootRuleChain)", 439 @ApiOperation(value = "Set root rule chain for provided edge (setRootRuleChain)",
439 notes = "Change root rule chain of the edge to the new provided rule chain. \n" + 440 notes = "Change root rule chain of the edge to the new provided rule chain. \n" +
440 - "This operation will send a notification to update root rule chain on remote edge service.", 441 + "This operation will send a notification to update root rule chain on remote edge service." + TENANT_AUTHORITY_PARAGRAPH,
441 produces = MediaType.APPLICATION_JSON_VALUE) 442 produces = MediaType.APPLICATION_JSON_VALUE)
442 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") 443 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')")
443 @RequestMapping(value = "/edge/{edgeId}/{ruleChainId}/root", method = RequestMethod.POST) 444 @RequestMapping(value = "/edge/{edgeId}/{ruleChainId}/root", method = RequestMethod.POST)
@@ -475,7 +476,7 @@ public class EdgeController extends BaseController { @@ -475,7 +476,7 @@ public class EdgeController extends BaseController {
475 476
476 @ApiOperation(value = "Get Customer Edges (getCustomerEdges)", 477 @ApiOperation(value = "Get Customer Edges (getCustomerEdges)",
477 notes = "Returns a page of edges objects assigned to customer. " + 478 notes = "Returns a page of edges objects assigned to customer. " +
478 - PAGE_DATA_PARAMETERS, produces = MediaType.APPLICATION_JSON_VALUE) 479 + PAGE_DATA_PARAMETERS + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH, produces = MediaType.APPLICATION_JSON_VALUE)
479 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 480 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
480 @RequestMapping(value = "/customer/{customerId}/edges", params = {"pageSize", "page"}, method = RequestMethod.GET) 481 @RequestMapping(value = "/customer/{customerId}/edges", params = {"pageSize", "page"}, method = RequestMethod.GET)
481 @ResponseBody 482 @ResponseBody
@@ -520,7 +521,7 @@ public class EdgeController extends BaseController { @@ -520,7 +521,7 @@ public class EdgeController extends BaseController {
520 521
521 @ApiOperation(value = "Get Customer Edge Infos (getCustomerEdgeInfos)", 522 @ApiOperation(value = "Get Customer Edge Infos (getCustomerEdgeInfos)",
522 notes = "Returns a page of edges info objects assigned to customer. " + 523 notes = "Returns a page of edges info objects assigned to customer. " +
523 - PAGE_DATA_PARAMETERS + EDGE_INFO_DESCRIPTION, produces = MediaType.APPLICATION_JSON_VALUE) 524 + PAGE_DATA_PARAMETERS + EDGE_INFO_DESCRIPTION + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH, produces = MediaType.APPLICATION_JSON_VALUE)
524 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 525 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
525 @RequestMapping(value = "/customer/{customerId}/edgeInfos", params = {"pageSize", "page"}, method = RequestMethod.GET) 526 @RequestMapping(value = "/customer/{customerId}/edgeInfos", params = {"pageSize", "page"}, method = RequestMethod.GET)
526 @ResponseBody 527 @ResponseBody
@@ -564,7 +565,7 @@ public class EdgeController extends BaseController { @@ -564,7 +565,7 @@ public class EdgeController extends BaseController {
564 } 565 }
565 566
566 @ApiOperation(value = "Get Edges By Ids (getEdgesByIds)", 567 @ApiOperation(value = "Get Edges By Ids (getEdgesByIds)",
567 - notes = "Requested edges must be owned by tenant or assigned to customer which user is performing the request.", 568 + notes = "Requested edges must be owned by tenant or assigned to customer which user is performing the request." + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
568 produces = MediaType.APPLICATION_JSON_VALUE) 569 produces = MediaType.APPLICATION_JSON_VALUE)
569 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 570 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
570 @RequestMapping(value = "/edges", params = {"edgeIds"}, method = RequestMethod.GET) 571 @RequestMapping(value = "/edges", params = {"edgeIds"}, method = RequestMethod.GET)
@@ -602,7 +603,7 @@ public class EdgeController extends BaseController { @@ -602,7 +603,7 @@ public class EdgeController extends BaseController {
602 @ApiOperation(value = "Find related edges (findByQuery)", 603 @ApiOperation(value = "Find related edges (findByQuery)",
603 notes = "Returns all edges that are related to the specific entity. " + 604 notes = "Returns all edges that are related to the specific entity. " +
604 "The entity id, relation type, edge types, depth of the search, and other query parameters defined using complex 'EdgeSearchQuery' object. " + 605 "The entity id, relation type, edge types, depth of the search, and other query parameters defined using complex 'EdgeSearchQuery' object. " +
605 - "See 'Model' tab of the Parameters for more info.", 606 + "See 'Model' tab of the Parameters for more info." + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
606 produces = MediaType.APPLICATION_JSON_VALUE) 607 produces = MediaType.APPLICATION_JSON_VALUE)
607 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 608 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
608 @RequestMapping(value = "/edges", method = RequestMethod.POST) 609 @RequestMapping(value = "/edges", method = RequestMethod.POST)
@@ -636,7 +637,8 @@ public class EdgeController extends BaseController { @@ -636,7 +637,8 @@ public class EdgeController extends BaseController {
636 } 637 }
637 638
638 @ApiOperation(value = "Get Edge Types (getEdgeTypes)", 639 @ApiOperation(value = "Get Edge Types (getEdgeTypes)",
639 - notes = "Returns a set of unique edge types based on edges that are either owned by the tenant or assigned to the customer which user is performing the request.", 640 + notes = "Returns a set of unique edge types based on edges that are either owned by the tenant or assigned to the customer which user is performing the request."
  641 + + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
640 produces = MediaType.APPLICATION_JSON_VALUE) 642 produces = MediaType.APPLICATION_JSON_VALUE)
641 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 643 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
642 @RequestMapping(value = "/edge/types", method = RequestMethod.GET) 644 @RequestMapping(value = "/edge/types", method = RequestMethod.GET)
@@ -654,7 +656,7 @@ public class EdgeController extends BaseController { @@ -654,7 +656,7 @@ public class EdgeController extends BaseController {
654 656
655 @ApiOperation(value = "Sync edge (syncEdge)", 657 @ApiOperation(value = "Sync edge (syncEdge)",
656 notes = "Starts synchronization process between edge and cloud. \n" + 658 notes = "Starts synchronization process between edge and cloud. \n" +
657 - "All entities that are assigned to particular edge are going to be send to remote edge service.") 659 + "All entities that are assigned to particular edge are going to be send to remote edge service." + TENANT_AUTHORITY_PARAGRAPH)
658 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 660 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
659 @RequestMapping(value = "/edge/sync/{edgeId}", method = RequestMethod.POST) 661 @RequestMapping(value = "/edge/sync/{edgeId}", method = RequestMethod.POST)
660 public void syncEdge(@ApiParam(value = EDGE_ID_PARAM_DESCRIPTION, required = true) 662 public void syncEdge(@ApiParam(value = EDGE_ID_PARAM_DESCRIPTION, required = true)
@@ -676,7 +678,7 @@ public class EdgeController extends BaseController { @@ -676,7 +678,7 @@ public class EdgeController extends BaseController {
676 } 678 }
677 679
678 @ApiOperation(value = "Find missing rule chains (findMissingToRelatedRuleChains)", 680 @ApiOperation(value = "Find missing rule chains (findMissingToRelatedRuleChains)",
679 - notes = "Returns list of rule chains ids that are not assigned to particular edge, but these rule chains are present in the already assigned rule chains to edge.") 681 + notes = "Returns list of rule chains ids that are not assigned to particular edge, but these rule chains are present in the already assigned rule chains to edge." + TENANT_AUTHORITY_PARAGRAPH)
680 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 682 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
681 @RequestMapping(value = "/edge/missingToRelatedRuleChains/{edgeId}", method = RequestMethod.GET) 683 @RequestMapping(value = "/edge/missingToRelatedRuleChains/{edgeId}", method = RequestMethod.GET)
682 @ResponseBody 684 @ResponseBody
@@ -694,7 +696,7 @@ public class EdgeController extends BaseController { @@ -694,7 +696,7 @@ public class EdgeController extends BaseController {
694 } 696 }
695 697
696 @ApiOperation(value = "Import the bulk of edges (processEdgesBulkImport)", 698 @ApiOperation(value = "Import the bulk of edges (processEdgesBulkImport)",
697 - notes = "There's an ability to import the bulk of edges using the only .csv file.", 699 + notes = "There's an ability to import the bulk of edges using the only .csv file." + TENANT_AUTHORITY_PARAGRAPH,
698 produces = MediaType.APPLICATION_JSON_VALUE) 700 produces = MediaType.APPLICATION_JSON_VALUE)
699 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") 701 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')")
700 @PostMapping("/edge/bulk_import") 702 @PostMapping("/edge/bulk_import")
@@ -488,7 +488,7 @@ public class EntityQueryController extends BaseController { @@ -488,7 +488,7 @@ public class EntityQueryController extends BaseController {
488 "\n\n Example mentioned above search all devices which have attribute 'active' set to 'true'. Now let's review available entity filters and key filters syntax:" + 488 "\n\n Example mentioned above search all devices which have attribute 'active' set to 'true'. Now let's review available entity filters and key filters syntax:" +
489 ENTITY_FILTERS + 489 ENTITY_FILTERS +
490 KEY_FILTERS + 490 KEY_FILTERS +
491 - TENANT_AND_USER_AUTHORITY_PARAGRAPH; 491 + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH;
492 492
493 private static final String ENTITY_DATA_QUERY_DESCRIPTION = 493 private static final String ENTITY_DATA_QUERY_DESCRIPTION =
494 "Allows to run complex queries over platform entities (devices, assets, customers, etc) " + 494 "Allows to run complex queries over platform entities (devices, assets, customers, etc) " +
@@ -571,7 +571,7 @@ public class EntityQueryController extends BaseController { @@ -571,7 +571,7 @@ public class EntityQueryController extends BaseController {
571 "\n\n Example mentioned above search all devices which have attribute 'active' set to 'true'. Now let's review available entity filters and key filters syntax:" + 571 "\n\n Example mentioned above search all devices which have attribute 'active' set to 'true'. Now let's review available entity filters and key filters syntax:" +
572 ENTITY_FILTERS + 572 ENTITY_FILTERS +
573 KEY_FILTERS + 573 KEY_FILTERS +
574 - TENANT_AND_USER_AUTHORITY_PARAGRAPH; 574 + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH;
575 575
576 576
577 private static final String ALARM_DATA_QUERY_DESCRIPTION = "This method description defines how Alarm Data Query extends the Entity Data Query. " + 577 private static final String ALARM_DATA_QUERY_DESCRIPTION = "This method description defines how Alarm Data Query extends the Entity Data Query. " +
@@ -45,7 +45,7 @@ public class OAuth2ConfigTemplateController extends BaseController { @@ -45,7 +45,7 @@ public class OAuth2ConfigTemplateController extends BaseController {
45 45
46 private static final String OAUTH2_CLIENT_REGISTRATION_TEMPLATE_DEFINITION = "Client registration template is OAuth2 provider configuration template with default settings for registering new OAuth2 clients"; 46 private static final String OAUTH2_CLIENT_REGISTRATION_TEMPLATE_DEFINITION = "Client registration template is OAuth2 provider configuration template with default settings for registering new OAuth2 clients";
47 47
48 - @ApiOperation(value = "Create or update OAuth2 client registration template (saveClientRegistrationTemplate)", 48 + @ApiOperation(value = "Create or update OAuth2 client registration template (saveClientRegistrationTemplate)" + SYSTEM_AUTHORITY_PARAGRAPH,
49 notes = OAUTH2_CLIENT_REGISTRATION_TEMPLATE_DEFINITION) 49 notes = OAUTH2_CLIENT_REGISTRATION_TEMPLATE_DEFINITION)
50 @PreAuthorize("hasAnyAuthority('SYS_ADMIN')") 50 @PreAuthorize("hasAnyAuthority('SYS_ADMIN')")
51 @RequestMapping(method = RequestMethod.POST) 51 @RequestMapping(method = RequestMethod.POST)
@@ -59,7 +59,7 @@ public class OAuth2ConfigTemplateController extends BaseController { @@ -59,7 +59,7 @@ public class OAuth2ConfigTemplateController extends BaseController {
59 } 59 }
60 } 60 }
61 61
62 - @ApiOperation(value = "Delete OAuth2 client registration template by id (deleteClientRegistrationTemplate)", 62 + @ApiOperation(value = "Delete OAuth2 client registration template by id (deleteClientRegistrationTemplate)" + SYSTEM_AUTHORITY_PARAGRAPH,
63 notes = OAUTH2_CLIENT_REGISTRATION_TEMPLATE_DEFINITION) 63 notes = OAUTH2_CLIENT_REGISTRATION_TEMPLATE_DEFINITION)
64 @PreAuthorize("hasAnyAuthority('SYS_ADMIN')") 64 @PreAuthorize("hasAnyAuthority('SYS_ADMIN')")
65 @RequestMapping(value = "/{clientRegistrationTemplateId}", method = RequestMethod.DELETE) 65 @RequestMapping(value = "/{clientRegistrationTemplateId}", method = RequestMethod.DELETE)
@@ -76,7 +76,7 @@ public class OAuth2ConfigTemplateController extends BaseController { @@ -76,7 +76,7 @@ public class OAuth2ConfigTemplateController extends BaseController {
76 } 76 }
77 } 77 }
78 78
79 - @ApiOperation(value = "Get the list of all OAuth2 client registration templates (getClientRegistrationTemplates)", 79 + @ApiOperation(value = "Get the list of all OAuth2 client registration templates (getClientRegistrationTemplates)" + SYSTEM_OR_TENANT_AUTHORITY_PARAGRAPH,
80 notes = OAUTH2_CLIENT_REGISTRATION_TEMPLATE_DEFINITION) 80 notes = OAUTH2_CLIENT_REGISTRATION_TEMPLATE_DEFINITION)
81 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") 81 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')")
82 @RequestMapping(method = RequestMethod.GET, produces = "application/json") 82 @RequestMapping(method = RequestMethod.GET, produces = "application/json")
@@ -88,7 +88,7 @@ public class OAuth2Controller extends BaseController { @@ -88,7 +88,7 @@ public class OAuth2Controller extends BaseController {
88 } 88 }
89 } 89 }
90 90
91 - @ApiOperation(value = "Get current OAuth2 settings (getCurrentOAuth2Info)") 91 + @ApiOperation(value = "Get current OAuth2 settings (getCurrentOAuth2Info)", notes = SYSTEM_AUTHORITY_PARAGRAPH)
92 @PreAuthorize("hasAnyAuthority('SYS_ADMIN')") 92 @PreAuthorize("hasAnyAuthority('SYS_ADMIN')")
93 @RequestMapping(value = "/oauth2/config", method = RequestMethod.GET, produces = "application/json") 93 @RequestMapping(value = "/oauth2/config", method = RequestMethod.GET, produces = "application/json")
94 @ResponseBody 94 @ResponseBody
@@ -101,7 +101,7 @@ public class OAuth2Controller extends BaseController { @@ -101,7 +101,7 @@ public class OAuth2Controller extends BaseController {
101 } 101 }
102 } 102 }
103 103
104 - @ApiOperation(value = "Save OAuth2 settings (saveOAuth2Info)") 104 + @ApiOperation(value = "Save OAuth2 settings (saveOAuth2Info)", notes = SYSTEM_AUTHORITY_PARAGRAPH)
105 @PreAuthorize("hasAnyAuthority('SYS_ADMIN')") 105 @PreAuthorize("hasAnyAuthority('SYS_ADMIN')")
106 @RequestMapping(value = "/oauth2/config", method = RequestMethod.POST) 106 @RequestMapping(value = "/oauth2/config", method = RequestMethod.POST)
107 @ResponseStatus(value = HttpStatus.OK) 107 @ResponseStatus(value = HttpStatus.OK)
@@ -118,7 +118,7 @@ public class OAuth2Controller extends BaseController { @@ -118,7 +118,7 @@ public class OAuth2Controller extends BaseController {
118 @ApiOperation(value = "Get OAuth2 log in processing URL (getLoginProcessingUrl)", notes = "Returns the URL enclosed in " + 118 @ApiOperation(value = "Get OAuth2 log in processing URL (getLoginProcessingUrl)", notes = "Returns the URL enclosed in " +
119 "double quotes. After successful authentication with OAuth2 provider, it makes a redirect to this path so that the platform can do " + 119 "double quotes. After successful authentication with OAuth2 provider, it makes a redirect to this path so that the platform can do " +
120 "further log in processing. This URL may be configured as 'security.oauth2.loginProcessingUrl' property in yml configuration file, or " + 120 "further log in processing. This URL may be configured as 'security.oauth2.loginProcessingUrl' property in yml configuration file, or " +
121 - "as 'SECURITY_OAUTH2_LOGIN_PROCESSING_URL' env variable. By default it is '/login/oauth2/code/'") 121 + "as 'SECURITY_OAUTH2_LOGIN_PROCESSING_URL' env variable. By default it is '/login/oauth2/code/'" + SYSTEM_AUTHORITY_PARAGRAPH)
122 @PreAuthorize("hasAnyAuthority('SYS_ADMIN')") 122 @PreAuthorize("hasAnyAuthority('SYS_ADMIN')")
123 @RequestMapping(value = "/oauth2/loginProcessingUrl", method = RequestMethod.GET) 123 @RequestMapping(value = "/oauth2/loginProcessingUrl", method = RequestMethod.GET)
124 @ResponseBody 124 @ResponseBody
@@ -40,7 +40,7 @@ import java.util.UUID; @@ -40,7 +40,7 @@ import java.util.UUID;
40 @Slf4j 40 @Slf4j
41 public class RpcV1Controller extends AbstractRpcController { 41 public class RpcV1Controller extends AbstractRpcController {
42 42
43 - @ApiOperation(value = "Send one-way RPC request (handleOneWayDeviceRPCRequest)", notes = "Deprecated. See 'Rpc V 2 Controller' instead.") 43 + @ApiOperation(value = "Send one-way RPC request (handleOneWayDeviceRPCRequest)", notes = "Deprecated. See 'Rpc V 2 Controller' instead." + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH)
44 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 44 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
45 @RequestMapping(value = "/oneway/{deviceId}", method = RequestMethod.POST) 45 @RequestMapping(value = "/oneway/{deviceId}", method = RequestMethod.POST)
46 @ResponseBody 46 @ResponseBody
@@ -52,7 +52,7 @@ public class RpcV1Controller extends AbstractRpcController { @@ -52,7 +52,7 @@ public class RpcV1Controller extends AbstractRpcController {
52 return handleDeviceRPCRequest(true, new DeviceId(UUID.fromString(deviceIdStr)), requestBody, HttpStatus.REQUEST_TIMEOUT, HttpStatus.CONFLICT); 52 return handleDeviceRPCRequest(true, new DeviceId(UUID.fromString(deviceIdStr)), requestBody, HttpStatus.REQUEST_TIMEOUT, HttpStatus.CONFLICT);
53 } 53 }
54 54
55 - @ApiOperation(value = "Send two-way RPC request (handleTwoWayDeviceRPCRequest)", notes = "Deprecated. See 'Rpc V 2 Controller' instead.") 55 + @ApiOperation(value = "Send two-way RPC request (handleTwoWayDeviceRPCRequest)", notes = "Deprecated. See 'Rpc V 2 Controller' instead." + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH)
56 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 56 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
57 @RequestMapping(value = "/twoway/{deviceId}", method = RequestMethod.POST) 57 @RequestMapping(value = "/twoway/{deviceId}", method = RequestMethod.POST)
58 @ResponseBody 58 @ResponseBody
@@ -91,9 +91,9 @@ public class RpcV2Controller extends AbstractRpcController { @@ -91,9 +91,9 @@ public class RpcV2Controller extends AbstractRpcController {
91 "In case of persistent RPC, the result of this call is 'rpcId' UUID. In case of lightweight RPC, " + 91 "In case of persistent RPC, the result of this call is 'rpcId' UUID. In case of lightweight RPC, " +
92 "the result of this call is the response from device, or 504 Gateway Timeout if device is offline."; 92 "the result of this call is the response from device, or 504 Gateway Timeout if device is offline.";
93 93
94 - private static final String ONE_WAY_RPC_REQUEST_DESCRIPTION = "Sends the one-way remote-procedure call (RPC) request to device. " + RPC_REQUEST_DESCRIPTION + ONE_WAY_RPC_RESULT + TENANT_AND_USER_AUTHORITY_PARAGRAPH; 94 + private static final String ONE_WAY_RPC_REQUEST_DESCRIPTION = "Sends the one-way remote-procedure call (RPC) request to device. " + RPC_REQUEST_DESCRIPTION + ONE_WAY_RPC_RESULT + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH;
95 95
96 - private static final String TWO_WAY_RPC_REQUEST_DESCRIPTION = "Sends the two-way remote-procedure call (RPC) request to device. " + RPC_REQUEST_DESCRIPTION + TWO_WAY_RPC_RESULT + TENANT_AND_USER_AUTHORITY_PARAGRAPH; 96 + private static final String TWO_WAY_RPC_REQUEST_DESCRIPTION = "Sends the two-way remote-procedure call (RPC) request to device. " + RPC_REQUEST_DESCRIPTION + TWO_WAY_RPC_RESULT + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH;
97 97
98 @ApiOperation(value = "Send one-way RPC request", notes = ONE_WAY_RPC_REQUEST_DESCRIPTION) 98 @ApiOperation(value = "Send one-way RPC request", notes = ONE_WAY_RPC_REQUEST_DESCRIPTION)
99 @ApiResponses(value = { 99 @ApiResponses(value = {
@@ -131,7 +131,7 @@ public class RpcV2Controller extends AbstractRpcController { @@ -131,7 +131,7 @@ public class RpcV2Controller extends AbstractRpcController {
131 return handleDeviceRPCRequest(false, new DeviceId(UUID.fromString(deviceIdStr)), requestBody, HttpStatus.GATEWAY_TIMEOUT, HttpStatus.GATEWAY_TIMEOUT); 131 return handleDeviceRPCRequest(false, new DeviceId(UUID.fromString(deviceIdStr)), requestBody, HttpStatus.GATEWAY_TIMEOUT, HttpStatus.GATEWAY_TIMEOUT);
132 } 132 }
133 133
134 - @ApiOperation(value = "Get persistent RPC request", notes = "Get information about the status of the RPC call." + TENANT_AND_USER_AUTHORITY_PARAGRAPH) 134 + @ApiOperation(value = "Get persistent RPC request", notes = "Get information about the status of the RPC call." + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH)
135 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 135 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
136 @RequestMapping(value = "/persistent/{rpcId}", method = RequestMethod.GET) 136 @RequestMapping(value = "/persistent/{rpcId}", method = RequestMethod.GET)
137 @ResponseBody 137 @ResponseBody
@@ -147,7 +147,7 @@ public class RpcV2Controller extends AbstractRpcController { @@ -147,7 +147,7 @@ public class RpcV2Controller extends AbstractRpcController {
147 } 147 }
148 } 148 }
149 149
150 - @ApiOperation(value = "Get persistent RPC requests", notes = "Allows to query RPC calls for specific device using pagination." + TENANT_AND_USER_AUTHORITY_PARAGRAPH) 150 + @ApiOperation(value = "Get persistent RPC requests", notes = "Allows to query RPC calls for specific device using pagination." + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH)
151 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 151 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
152 @RequestMapping(value = "/persistent/device/{deviceId}", method = RequestMethod.GET) 152 @RequestMapping(value = "/persistent/device/{deviceId}", method = RequestMethod.GET)
153 @ResponseBody 153 @ResponseBody
@@ -169,7 +169,7 @@ public class RuleChainController extends BaseController { @@ -169,7 +169,7 @@ public class RuleChainController extends BaseController {
169 "The newly created Rule Chain Id will be present in the response. " + 169 "The newly created Rule Chain Id will be present in the response. " +
170 "Specify existing Rule Chain id to update the rule chain. " + 170 "Specify existing Rule Chain id to update the rule chain. " +
171 "Referencing non-existing rule chain Id will cause 'Not Found' error." + 171 "Referencing non-existing rule chain Id will cause 'Not Found' error." +
172 - "\n\n" + RULE_CHAIN_DESCRIPTION) 172 + "\n\n" + RULE_CHAIN_DESCRIPTION + TENANT_AUTHORITY_PARAGRAPH)
173 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") 173 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')")
174 @RequestMapping(value = "/ruleChain", method = RequestMethod.POST) 174 @RequestMapping(value = "/ruleChain", method = RequestMethod.POST)
175 @ResponseBody 175 @ResponseBody
@@ -327,7 +327,7 @@ public class RuleChainController extends BaseController { @@ -327,7 +327,7 @@ public class RuleChainController extends BaseController {
327 327
328 328
329 @ApiOperation(value = "Get Rule Chains (getRuleChains)", 329 @ApiOperation(value = "Get Rule Chains (getRuleChains)",
330 - notes = "Returns a page of Rule Chains owned by tenant. " + RULE_CHAIN_DESCRIPTION + PAGE_DATA_PARAMETERS) 330 + notes = "Returns a page of Rule Chains owned by tenant. " + RULE_CHAIN_DESCRIPTION + PAGE_DATA_PARAMETERS + TENANT_AUTHORITY_PARAGRAPH)
331 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 331 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
332 @RequestMapping(value = "/ruleChains", params = {"pageSize", "page"}, method = RequestMethod.GET) 332 @RequestMapping(value = "/ruleChains", params = {"pageSize", "page"}, method = RequestMethod.GET)
333 @ResponseBody 333 @ResponseBody
@@ -358,7 +358,8 @@ public class RuleChainController extends BaseController { @@ -358,7 +358,8 @@ public class RuleChainController extends BaseController {
358 } 358 }
359 359
360 @ApiOperation(value = "Delete rule chain (deleteRuleChain)", 360 @ApiOperation(value = "Delete rule chain (deleteRuleChain)",
361 - notes = "Deletes the rule chain. Referencing non-existing rule chain Id will cause an error. Referencing rule chain that is used in the device profiles will cause an error.") 361 + notes = "Deletes the rule chain. Referencing non-existing rule chain Id will cause an error. " +
  362 + "Referencing rule chain that is used in the device profiles will cause an error." + TENANT_AUTHORITY_PARAGRAPH)
362 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") 363 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')")
363 @RequestMapping(value = "/ruleChain/{ruleChainId}", method = RequestMethod.DELETE) 364 @RequestMapping(value = "/ruleChain/{ruleChainId}", method = RequestMethod.DELETE)
364 @ResponseStatus(value = HttpStatus.OK) 365 @ResponseStatus(value = HttpStatus.OK)
@@ -409,7 +410,7 @@ public class RuleChainController extends BaseController { @@ -409,7 +410,7 @@ public class RuleChainController extends BaseController {
409 410
410 @ApiOperation(value = "Get latest input message (getLatestRuleNodeDebugInput)", 411 @ApiOperation(value = "Get latest input message (getLatestRuleNodeDebugInput)",
411 notes = "Gets the input message from the debug events for specified Rule Chain Id. " + 412 notes = "Gets the input message from the debug events for specified Rule Chain Id. " +
412 - "Referencing non-existing rule chain Id will cause an error. ") 413 + "Referencing non-existing rule chain Id will cause an error. " + TENANT_AUTHORITY_PARAGRAPH)
413 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") 414 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')")
414 @RequestMapping(value = "/ruleNode/{ruleNodeId}/debugIn", method = RequestMethod.GET) 415 @RequestMapping(value = "/ruleNode/{ruleNodeId}/debugIn", method = RequestMethod.GET)
415 @ResponseBody 416 @ResponseBody
@@ -582,7 +583,7 @@ public class RuleChainController extends BaseController { @@ -582,7 +583,7 @@ public class RuleChainController extends BaseController {
582 "Second, remote edge service will receive a copy of assignment rule chain " + 583 "Second, remote edge service will receive a copy of assignment rule chain " +
583 EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION + ". " + 584 EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION + ". " +
584 "Third, once rule chain will be delivered to edge service, it's going to start processing messages locally. " + 585 "Third, once rule chain will be delivered to edge service, it's going to start processing messages locally. " +
585 - "\n\nOnly rule chain with type 'EDGE' can be assigned to edge.", 586 + "\n\nOnly rule chain with type 'EDGE' can be assigned to edge." + TENANT_AUTHORITY_PARAGRAPH,
586 produces = MediaType.APPLICATION_JSON_VALUE) 587 produces = MediaType.APPLICATION_JSON_VALUE)
587 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 588 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
588 @RequestMapping(value = "/edge/{edgeId}/ruleChain/{ruleChainId}", method = RequestMethod.POST) 589 @RequestMapping(value = "/edge/{edgeId}/ruleChain/{ruleChainId}", method = RequestMethod.POST)
@@ -622,7 +623,7 @@ public class RuleChainController extends BaseController { @@ -622,7 +623,7 @@ public class RuleChainController extends BaseController {
622 EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION + 623 EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION +
623 "Second, remote edge service will receive an 'unassign' command to remove rule chain " + 624 "Second, remote edge service will receive an 'unassign' command to remove rule chain " +
624 EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION + ". " + 625 EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION + ". " +
625 - "Third, once 'unassign' command will be delivered to edge service, it's going to remove rule chain locally.", 626 + "Third, once 'unassign' command will be delivered to edge service, it's going to remove rule chain locally." + TENANT_AUTHORITY_PARAGRAPH,
626 produces = MediaType.APPLICATION_JSON_VALUE) 627 produces = MediaType.APPLICATION_JSON_VALUE)
627 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 628 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
628 @RequestMapping(value = "/edge/{edgeId}/ruleChain/{ruleChainId}", method = RequestMethod.DELETE) 629 @RequestMapping(value = "/edge/{edgeId}/ruleChain/{ruleChainId}", method = RequestMethod.DELETE)
@@ -28,10 +28,13 @@ import com.google.gson.JsonParseException; @@ -28,10 +28,13 @@ import com.google.gson.JsonParseException;
28 import com.google.gson.JsonParser; 28 import com.google.gson.JsonParser;
29 import io.swagger.annotations.ApiOperation; 29 import io.swagger.annotations.ApiOperation;
30 import io.swagger.annotations.ApiParam; 30 import io.swagger.annotations.ApiParam;
  31 +import io.swagger.annotations.ApiResponse;
  32 +import io.swagger.annotations.ApiResponses;
31 import lombok.extern.slf4j.Slf4j; 33 import lombok.extern.slf4j.Slf4j;
32 import org.springframework.beans.factory.annotation.Autowired; 34 import org.springframework.beans.factory.annotation.Autowired;
33 import org.springframework.beans.factory.annotation.Value; 35 import org.springframework.beans.factory.annotation.Value;
34 import org.springframework.http.HttpStatus; 36 import org.springframework.http.HttpStatus;
  37 +import org.springframework.http.MediaType;
35 import org.springframework.http.ResponseEntity; 38 import org.springframework.http.ResponseEntity;
36 import org.springframework.security.access.prepost.PreAuthorize; 39 import org.springframework.security.access.prepost.PreAuthorize;
37 import org.springframework.util.StringUtils; 40 import org.springframework.util.StringUtils;
@@ -113,12 +116,43 @@ public class TelemetryController extends BaseController { @@ -113,12 +116,43 @@ public class TelemetryController extends BaseController {
113 private static final String ATTRIBUTES_KEYS_DESCRIPTION = "A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'."; 116 private static final String ATTRIBUTES_KEYS_DESCRIPTION = "A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'.";
114 private static final String ATTRIBUTES_SCOPE_ALLOWED_VALUES = "SERVER_SCOPE, CLIENT_SCOPE, SHARED_SCOPE"; 117 private static final String ATTRIBUTES_SCOPE_ALLOWED_VALUES = "SERVER_SCOPE, CLIENT_SCOPE, SHARED_SCOPE";
115 private static final String ATTRIBUTES_JSON_REQUEST_DESCRIPTION = "A string value representing the json object. For example, '{\"key\":\"value\"}'"; 118 private static final String ATTRIBUTES_JSON_REQUEST_DESCRIPTION = "A string value representing the json object. For example, '{\"key\":\"value\"}'";
116 -  
117 - private static final String TELEMETRY_KEYS_DESCRIPTION = "A string value representing the comma-separated list of timeseries keys. If keys are not selected, the result will return all latest timeseries. For example, 'temp,humidity'.";  
118 - private static final String TELEMETRY_SCOPE_DESCRIPTION = "Value is not used in the API call implementation";  
119 - private static final String TELEMETRY_JSON_REQUEST_DESCRIPTION = "A string value representing the json object. For example, '{\"key\":\"value\"}' or '{\"ts\":1527863043000,\"values\":{\"key1\":\"value1\",\"key2\":\"value2\"}}'";  
120 -  
121 - private static final String STRICT_DATA_TYPES_DESCRIPTION = "A boolean value to specify if values of selected timeseries keys will representing a string (by default) or use strict data type."; 119 + private static final String ATTRIBUTE_DATA_CLASS_DESCRIPTION = "AttributeData class represents information regarding a particular attribute and includes the next parameters: 'lastUpdatesTs' - a long value representing the timestamp of the last attribute modification in milliseconds. 'key' - attribute key name, and 'value' - attribute value.";
  120 + private static final String GET_ALL_ATTRIBUTES_BASE_DESCRIPTION = "Returns a JSON structure that represents a list of AttributeData class objects for the selected entity based on the specified comma-separated list of attribute key names. " + ATTRIBUTE_DATA_CLASS_DESCRIPTION;
  121 + private static final String GET_ALL_ATTRIBUTES_BY_SCOPE_BASE_DESCRIPTION = "Returns a JSON structure that represents a list of AttributeData class objects for the selected entity based on the attributes scope selected and a comma-separated list of attribute key names. " + ATTRIBUTE_DATA_CLASS_DESCRIPTION;
  122 +
  123 + private static final String TS_DATA_CLASS_DESCRIPTION = "TsData class is a timeseries data point for specific telemetry key that includes 'value' - object value, and 'ts' - a long value representing timestamp in milliseconds for this value. ";
  124 +
  125 + private static final String TELEMETRY_KEYS_BASE_DESCRIPTION = "A string value representing the comma-separated list of telemetry keys.";
  126 + private static final String TELEMETRY_KEYS_DESCRIPTION = TELEMETRY_KEYS_BASE_DESCRIPTION + " If keys are not selected, the result will return all latest timeseries. For example, 'temp,humidity'.";
  127 + private static final String TELEMETRY_SCOPE_DESCRIPTION = "Value is not used in the API call implementation. However, you need to specify whatever value cause scope is a path variable.";
  128 + private static final String TELEMETRY_JSON_REQUEST_DESCRIPTION = "A string value representing the json object. For example, '{\"key\":\"value\"}' or '{\"ts\":1527863043000,\"values\":{\"key1\":\"value1\",\"key2\":\"value2\"}}' or [{\"ts\":1527863043000,\"values\":{\"key1\":\"value1\",\"key2\":\"value2\"}}, {\"ts\":1527863053000,\"values\":{\"key1\":\"value3\",\"key2\":\"value4\"}}]";
  129 +
  130 +
  131 + private static final String STRICT_DATA_TYPES_DESCRIPTION = "A boolean value to specify if values of selected telemetry keys will represent string values(by default) or use strict data type.";
  132 + private static final String INVALID_ENTITY_ID_OR_ENTITY_TYPE_DESCRIPTION = "Referencing a non-existing entity Id or invalid entity type will cause an error. ";
  133 +
  134 + private static final String SAVE_ENTITY_ATTRIBUTES_DESCRIPTION = "Creates or updates the entity attributes based on entity id, entity type, specified attributes scope " +
  135 + "and request payload that represents a JSON object with key-value format of attributes to create or update. " +
  136 + "For example, '{\"temperature\": 26}'. Key is a unique parameter and cannot be overwritten. Only value can be overwritten for the key. ";
  137 + private static final String SAVE_ATTIRIBUTES_STATUS_OK = "Attribute from the request was created or updated. ";
  138 + private static final String INVALID_STRUCTURE_OF_THE_REQUEST = "Invalid structure of the request";
  139 + private static final String SAVE_ATTIRIBUTES_STATUS_BAD_REQUEST = INVALID_STRUCTURE_OF_THE_REQUEST + " or invalid attributes scope provided.";
  140 + private static final String SAVE_ENTITY_ATTRIBUTES_STATUS_OK = "Platform creates an audit log event about entity attributes updates with action type 'ATTRIBUTES_UPDATED', " +
  141 + "and also sends event msg to the rule engine with msg type 'ATTRIBUTES_UPDATED'.";
  142 + private static final String SAVE_ENTITY_ATTRIBUTES_STATUS_UNAUTHORIZED = "User is not authorized to save entity attributes for selected entity. Most likely, User belongs to different Customer or Tenant.";
  143 + private static final String SAVE_ENTITY_ATTRIBUTES_STATUS_INTERNAL_SERVER_ERROR = "The exception was thrown during processing the request. " +
  144 + "Platform creates an audit log event about entity attributes updates with action type 'ATTRIBUTES_UPDATED' that includes an error stacktrace.";
  145 + private static final String SAVE_ENTITY_TIMESERIES_DESCRIPTION = "Creates or updates the entity timeseries based on entity id, entity type " +
  146 + "and request payload that represents a JSON object with key-value or ts-values format. " +
  147 + "For example, '{\"temperature\": 26}' or '{\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}', " +
  148 + "or JSON array with inner objects inside of ts-values format. " +
  149 + "For example, '[{\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\":25, \"humidity\":88}}]'. " +
  150 + "The scope parameter is not used in the API call implementation but should be specified whatever value because it is used as a path variable. ";
  151 + private static final String SAVE_ENTITY_TIMESERIES_STATUS_OK = "Timeseries from the request was created or updated. " +
  152 + "Platform creates an audit log event about entity timeseries updates with action type 'TIMESERIES_UPDATED'.";
  153 + private static final String SAVE_ENTITY_TIMESERIES_STATUS_UNAUTHORIZED = "User is not authorized to save entity timeseries for selected entity. Most likely, User belongs to different Customer or Tenant.";
  154 + private static final String SAVE_ENTITY_TIMESERIES_STATUS_INTERNAL_SERVER_ERROR = "The exception was thrown during processing the request. " +
  155 + "Platform creates an audit log event about entity timeseries updates with action type 'TIMESERIES_UPDATED' that includes an error stacktrace.";
122 156
123 @Autowired 157 @Autowired
124 private TimeseriesService tsService; 158 private TimeseriesService tsService;
@@ -146,7 +180,11 @@ public class TelemetryController extends BaseController { @@ -146,7 +180,11 @@ public class TelemetryController extends BaseController {
146 } 180 }
147 181
148 @ApiOperation(value = "Get all attribute keys (getAttributeKeys)", 182 @ApiOperation(value = "Get all attribute keys (getAttributeKeys)",
149 - notes = "Returns key names for the selected entity.") 183 + notes = "Returns a list of all attribute key names for the selected entity. " +
  184 + "In the case of device entity specified, a response will include merged attribute key names list from each scope: " +
  185 + "SERVER_SCOPE, CLIENT_SCOPE, SHARED_SCOPE. "
  186 + + INVALID_ENTITY_ID_OR_ENTITY_TYPE_DESCRIPTION + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
  187 + produces = MediaType.APPLICATION_JSON_VALUE)
150 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 188 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
151 @RequestMapping(value = "/{entityType}/{entityId}/keys/attributes", method = RequestMethod.GET) 189 @RequestMapping(value = "/{entityType}/{entityId}/keys/attributes", method = RequestMethod.GET)
152 @ResponseBody 190 @ResponseBody
@@ -156,8 +194,11 @@ public class TelemetryController extends BaseController { @@ -156,8 +194,11 @@ public class TelemetryController extends BaseController {
156 return accessValidator.validateEntityAndCallback(getCurrentUser(), Operation.READ_ATTRIBUTES, entityType, entityIdStr, this::getAttributeKeysCallback); 194 return accessValidator.validateEntityAndCallback(getCurrentUser(), Operation.READ_ATTRIBUTES, entityType, entityIdStr, this::getAttributeKeysCallback);
157 } 195 }
158 196
159 - @ApiOperation(value = "Get all attributes by scope (getAttributeKeysByScope)",  
160 - notes = "Returns key names of specified scope for the selected entity.") 197 + @ApiOperation(value = "Get all attributes keys by scope (getAttributeKeysByScope)",
  198 + notes = "Returns a list of attribute key names from the specified attributes scope for the selected entity. " +
  199 + "If scope parameter is omitted, Get all attribute keys(getAttributeKeys) API will be called. "
  200 + + INVALID_ENTITY_ID_OR_ENTITY_TYPE_DESCRIPTION + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
  201 + produces = MediaType.APPLICATION_JSON_VALUE)
161 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 202 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
162 @RequestMapping(value = "/{entityType}/{entityId}/keys/attributes/{scope}", method = RequestMethod.GET) 203 @RequestMapping(value = "/{entityType}/{entityId}/keys/attributes/{scope}", method = RequestMethod.GET)
163 @ResponseBody 204 @ResponseBody
@@ -170,7 +211,9 @@ public class TelemetryController extends BaseController { @@ -170,7 +211,9 @@ public class TelemetryController extends BaseController {
170 } 211 }
171 212
172 @ApiOperation(value = "Get attributes (getAttributes)", 213 @ApiOperation(value = "Get attributes (getAttributes)",
173 - notes = "Returns JSON array of AttributeData objects for the selected entity.") 214 + notes = GET_ALL_ATTRIBUTES_BASE_DESCRIPTION + " If 'keys' parameter is omitted, AttributeData class objects will be added to the response for all existing keys of the selected entity. " +
  215 + INVALID_ENTITY_ID_OR_ENTITY_TYPE_DESCRIPTION + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
  216 + produces = MediaType.APPLICATION_JSON_VALUE)
174 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 217 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
175 @RequestMapping(value = "/{entityType}/{entityId}/values/attributes", method = RequestMethod.GET) 218 @RequestMapping(value = "/{entityType}/{entityId}/values/attributes", method = RequestMethod.GET)
176 @ResponseBody 219 @ResponseBody
@@ -184,7 +227,11 @@ public class TelemetryController extends BaseController { @@ -184,7 +227,11 @@ public class TelemetryController extends BaseController {
184 } 227 }
185 228
186 @ApiOperation(value = "Get attributes by scope (getAttributesByScope)", 229 @ApiOperation(value = "Get attributes by scope (getAttributesByScope)",
187 - notes = "Returns JSON array of AttributeData objects for the selected entity.") 230 + notes = GET_ALL_ATTRIBUTES_BY_SCOPE_BASE_DESCRIPTION + " In case that 'keys' parameter is not selected, " +
  231 + "AttributeData class objects will be added to the response for all existing attribute keys from the " +
  232 + "specified attributes scope of the selected entity. If 'scope' parameter is omitted, " +
  233 + "Get attributes (getAttributes) API will be called. " + INVALID_ENTITY_ID_OR_ENTITY_TYPE_DESCRIPTION + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
  234 + produces = MediaType.APPLICATION_JSON_VALUE)
188 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 235 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
189 @RequestMapping(value = "/{entityType}/{entityId}/values/attributes/{scope}", method = RequestMethod.GET) 236 @RequestMapping(value = "/{entityType}/{entityId}/values/attributes/{scope}", method = RequestMethod.GET)
190 @ResponseBody 237 @ResponseBody
@@ -199,7 +246,9 @@ public class TelemetryController extends BaseController { @@ -199,7 +246,9 @@ public class TelemetryController extends BaseController {
199 } 246 }
200 247
201 @ApiOperation(value = "Get timeseries keys (getTimeseriesKeys)", 248 @ApiOperation(value = "Get timeseries keys (getTimeseriesKeys)",
202 - notes = "Returns latest timeseries keys for selected entity.") 249 + notes = "Returns a list of all telemetry key names for the selected entity based on entity id and entity type specified. " +
  250 + INVALID_ENTITY_ID_OR_ENTITY_TYPE_DESCRIPTION + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
  251 + produces = MediaType.APPLICATION_JSON_VALUE)
203 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 252 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
204 @RequestMapping(value = "/{entityType}/{entityId}/keys/timeseries", method = RequestMethod.GET) 253 @RequestMapping(value = "/{entityType}/{entityId}/keys/timeseries", method = RequestMethod.GET)
205 @ResponseBody 254 @ResponseBody
@@ -211,7 +260,10 @@ public class TelemetryController extends BaseController { @@ -211,7 +260,10 @@ public class TelemetryController extends BaseController {
211 } 260 }
212 261
213 @ApiOperation(value = "Get latest timeseries (getLatestTimeseries)", 262 @ApiOperation(value = "Get latest timeseries (getLatestTimeseries)",
214 - notes = "Returns JSON object with mapping latest timeseries keys to JSON arrays of TsData objects for the selected entity.") 263 + notes = "Returns a JSON structure that represents a Map, where the map key is a telemetry key name " +
  264 + "and map value - is a singleton list of TsData class objects. "
  265 + + TS_DATA_CLASS_DESCRIPTION + INVALID_ENTITY_ID_OR_ENTITY_TYPE_DESCRIPTION + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
  266 + produces = MediaType.APPLICATION_JSON_VALUE)
215 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 267 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
216 @RequestMapping(value = "/{entityType}/{entityId}/values/timeseries", method = RequestMethod.GET) 268 @RequestMapping(value = "/{entityType}/{entityId}/values/timeseries", method = RequestMethod.GET)
217 @ResponseBody 269 @ResponseBody
@@ -222,30 +274,36 @@ public class TelemetryController extends BaseController { @@ -222,30 +274,36 @@ public class TelemetryController extends BaseController {
222 @ApiParam(value = STRICT_DATA_TYPES_DESCRIPTION) 274 @ApiParam(value = STRICT_DATA_TYPES_DESCRIPTION)
223 @RequestParam(name = "useStrictDataTypes", required = false, defaultValue = "false") Boolean useStrictDataTypes) throws ThingsboardException { 275 @RequestParam(name = "useStrictDataTypes", required = false, defaultValue = "false") Boolean useStrictDataTypes) throws ThingsboardException {
224 SecurityUser user = getCurrentUser(); 276 SecurityUser user = getCurrentUser();
225 -  
226 return accessValidator.validateEntityAndCallback(getCurrentUser(), Operation.READ_TELEMETRY, entityType, entityIdStr, 277 return accessValidator.validateEntityAndCallback(getCurrentUser(), Operation.READ_TELEMETRY, entityType, entityIdStr,
227 (result, tenantId, entityId) -> getLatestTimeseriesValuesCallback(result, user, entityId, keysStr, useStrictDataTypes)); 278 (result, tenantId, entityId) -> getLatestTimeseriesValuesCallback(result, user, entityId, keysStr, useStrictDataTypes));
228 } 279 }
229 280
230 @ApiOperation(value = "Get timeseries (getTimeseries)", 281 @ApiOperation(value = "Get timeseries (getTimeseries)",
231 - notes = "Returns JSON object with mapping timeseries keys to JSON arrays of TsData objects based on specified filters for the selected entity.") 282 + notes = "Returns a JSON structure that represents a Map, where the map key is a telemetry key name " +
  283 + "and map value - is a list of TsData class objects. " + TS_DATA_CLASS_DESCRIPTION +
  284 + "This method allows us to group original data into intervals and aggregate it using one of the aggregation methods or just limit the number of TsData objects to fetch for each key specified. " +
  285 + "See the desription of the request parameters for more details. " +
  286 + "The result can also be sorted in ascending or descending order. "
  287 + + INVALID_ENTITY_ID_OR_ENTITY_TYPE_DESCRIPTION + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
  288 + produces = MediaType.APPLICATION_JSON_VALUE)
232 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 289 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
233 @RequestMapping(value = "/{entityType}/{entityId}/values/timeseries", method = RequestMethod.GET, params = {"keys", "startTs", "endTs"}) 290 @RequestMapping(value = "/{entityType}/{entityId}/values/timeseries", method = RequestMethod.GET, params = {"keys", "startTs", "endTs"})
234 @ResponseBody 291 @ResponseBody
235 public DeferredResult<ResponseEntity> getTimeseries( 292 public DeferredResult<ResponseEntity> getTimeseries(
236 @ApiParam(value = ENTITY_TYPE_PARAM_DESCRIPTION) @PathVariable("entityType") String entityType, 293 @ApiParam(value = ENTITY_TYPE_PARAM_DESCRIPTION) @PathVariable("entityType") String entityType,
237 @ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION) @PathVariable("entityId") String entityIdStr, 294 @ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION) @PathVariable("entityId") String entityIdStr,
238 - @ApiParam(value = TELEMETRY_KEYS_DESCRIPTION) @RequestParam(name = "keys") String keys,  
239 - @ApiParam(value = "A long value representing the start timestamp(milliseconds) of search time range.") 295 + @ApiParam(value = TELEMETRY_KEYS_BASE_DESCRIPTION) @RequestParam(name = "keys") String keys,
  296 + @ApiParam(value = "A long value representing the start timestamp of search time range in milliseconds.")
240 @RequestParam(name = "startTs") Long startTs, 297 @RequestParam(name = "startTs") Long startTs,
241 - @ApiParam(value = "A long value representing the end timestamp(milliseconds) of search time range.") 298 + @ApiParam(value = "A long value representing the end timestamp of search time range in milliseconds.")
242 @RequestParam(name = "endTs") Long endTs, 299 @RequestParam(name = "endTs") Long endTs,
243 - @ApiParam(value = "A long value representing the aggregation interval(milliseconds) range.") 300 + @ApiParam(value = "A long value representing the aggregation interval range in milliseconds.")
244 @RequestParam(name = "interval", defaultValue = "0") Long interval, 301 @RequestParam(name = "interval", defaultValue = "0") Long interval,
245 - @ApiParam(value = "An integer value representing max number of selected data points.", defaultValue = "100") 302 + @ApiParam(value = "An integer value that represents a max number of timeseries data points to fetch." +
  303 + " This parameter is used only in the case if 'agg' parameter is set to 'NONE'.", defaultValue = "100")
246 @RequestParam(name = "limit", defaultValue = "100") Integer limit, 304 @RequestParam(name = "limit", defaultValue = "100") Integer limit,
247 @ApiParam(value = "A string value representing the aggregation function. " + 305 @ApiParam(value = "A string value representing the aggregation function. " +
248 - "If the interval is not specified, 'agg' parameter will be converted to 'NONE' value.", 306 + "If the interval is not specified, 'agg' parameter will use 'NONE' value.",
249 allowableValues = "MIN, MAX, AVG, SUM, COUNT, NONE") 307 allowableValues = "MIN, MAX, AVG, SUM, COUNT, NONE")
250 @RequestParam(name = "agg", defaultValue = "NONE") String aggStr, 308 @RequestParam(name = "agg", defaultValue = "NONE") String aggStr,
251 @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES) 309 @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES)
@@ -263,7 +321,21 @@ public class TelemetryController extends BaseController { @@ -263,7 +321,21 @@ public class TelemetryController extends BaseController {
263 }); 321 });
264 } 322 }
265 323
266 - @ApiOperation(value = "Save or update device attributes (saveDeviceAttributes)") 324 + @ApiOperation(value = "Save or update device attributes (saveDeviceAttributes)",
  325 + notes = "Creates or updates the device attributes based on device id, specified attribute scope, " +
  326 + "and request payload that represents a JSON object with key-value format of attributes to create or update. " +
  327 + "For example, '{\"temperature\": 26}'. Key is a unique parameter and cannot be overwritten. Only value can " +
  328 + "be overwritten for the key. " + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
  329 + produces = MediaType.APPLICATION_JSON_VALUE)
  330 + @ApiResponses(value = {
  331 + @ApiResponse(code = 200, message = SAVE_ATTIRIBUTES_STATUS_OK +
  332 + "Platform creates an audit log event about device attributes updates with action type 'ATTRIBUTES_UPDATED', " +
  333 + "and also sends event msg to the rule engine with msg type 'ATTRIBUTES_UPDATED'."),
  334 + @ApiResponse(code = 400, message = SAVE_ATTIRIBUTES_STATUS_BAD_REQUEST),
  335 + @ApiResponse(code = 401, message = "User is not authorized to save device attributes for selected device. Most likely, User belongs to different Customer or Tenant."),
  336 + @ApiResponse(code = 500, message = "The exception was thrown during processing the request. " +
  337 + "Platform creates an audit log event about device attributes updates with action type 'ATTRIBUTES_UPDATED' that includes an error stacktrace."),
  338 + })
267 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 339 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
268 @RequestMapping(value = "/{deviceId}/{scope}", method = RequestMethod.POST) 340 @RequestMapping(value = "/{deviceId}/{scope}", method = RequestMethod.POST)
269 @ResponseBody 341 @ResponseBody
@@ -275,7 +347,15 @@ public class TelemetryController extends BaseController { @@ -275,7 +347,15 @@ public class TelemetryController extends BaseController {
275 return saveAttributes(getTenantId(), entityId, scope, request); 347 return saveAttributes(getTenantId(), entityId, scope, request);
276 } 348 }
277 349
278 - @ApiOperation(value = "Save or update attributes (saveEntityAttributesV1)") 350 + @ApiOperation(value = "Save or update attributes (saveEntityAttributesV1)",
  351 + notes = SAVE_ENTITY_ATTRIBUTES_DESCRIPTION + INVALID_ENTITY_ID_OR_ENTITY_TYPE_DESCRIPTION + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
  352 + produces = MediaType.APPLICATION_JSON_VALUE)
  353 + @ApiResponses(value = {
  354 + @ApiResponse(code = 200, message = SAVE_ATTIRIBUTES_STATUS_OK + SAVE_ENTITY_ATTRIBUTES_STATUS_OK),
  355 + @ApiResponse(code = 400, message = SAVE_ATTIRIBUTES_STATUS_BAD_REQUEST),
  356 + @ApiResponse(code = 401, message = SAVE_ENTITY_ATTRIBUTES_STATUS_UNAUTHORIZED),
  357 + @ApiResponse(code = 500, message = SAVE_ENTITY_ATTRIBUTES_STATUS_INTERNAL_SERVER_ERROR),
  358 + })
279 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 359 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
280 @RequestMapping(value = "/{entityType}/{entityId}/{scope}", method = RequestMethod.POST) 360 @RequestMapping(value = "/{entityType}/{entityId}/{scope}", method = RequestMethod.POST)
281 @ResponseBody 361 @ResponseBody
@@ -288,7 +368,15 @@ public class TelemetryController extends BaseController { @@ -288,7 +368,15 @@ public class TelemetryController extends BaseController {
288 return saveAttributes(getTenantId(), entityId, scope, request); 368 return saveAttributes(getTenantId(), entityId, scope, request);
289 } 369 }
290 370
291 - @ApiOperation(value = "Save or update attributes (saveEntityAttributesV2)") 371 + @ApiOperation(value = "Save or update attributes (saveEntityAttributesV2)",
  372 + notes = SAVE_ENTITY_ATTRIBUTES_DESCRIPTION + INVALID_ENTITY_ID_OR_ENTITY_TYPE_DESCRIPTION + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
  373 + produces = MediaType.APPLICATION_JSON_VALUE)
  374 + @ApiResponses(value = {
  375 + @ApiResponse(code = 200, message = SAVE_ATTIRIBUTES_STATUS_OK + SAVE_ENTITY_ATTRIBUTES_STATUS_OK),
  376 + @ApiResponse(code = 400, message = SAVE_ATTIRIBUTES_STATUS_BAD_REQUEST),
  377 + @ApiResponse(code = 401, message = SAVE_ENTITY_ATTRIBUTES_STATUS_UNAUTHORIZED),
  378 + @ApiResponse(code = 500, message = SAVE_ENTITY_ATTRIBUTES_STATUS_INTERNAL_SERVER_ERROR),
  379 + })
292 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 380 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
293 @RequestMapping(value = "/{entityType}/{entityId}/attributes/{scope}", method = RequestMethod.POST) 381 @RequestMapping(value = "/{entityType}/{entityId}/attributes/{scope}", method = RequestMethod.POST)
294 @ResponseBody 382 @ResponseBody
@@ -301,7 +389,15 @@ public class TelemetryController extends BaseController { @@ -301,7 +389,15 @@ public class TelemetryController extends BaseController {
301 return saveAttributes(getTenantId(), entityId, scope, request); 389 return saveAttributes(getTenantId(), entityId, scope, request);
302 } 390 }
303 391
304 - @ApiOperation(value = "Save or update telemetry (saveEntityTelemetry)") 392 + @ApiOperation(value = "Save or update telemetry (saveEntityTelemetry)",
  393 + notes = SAVE_ENTITY_TIMESERIES_DESCRIPTION + INVALID_ENTITY_ID_OR_ENTITY_TYPE_DESCRIPTION + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
  394 + produces = MediaType.APPLICATION_JSON_VALUE)
  395 + @ApiResponses(value = {
  396 + @ApiResponse(code = 200, message = SAVE_ENTITY_TIMESERIES_STATUS_OK),
  397 + @ApiResponse(code = 400, message = INVALID_STRUCTURE_OF_THE_REQUEST),
  398 + @ApiResponse(code = 401, message = SAVE_ENTITY_TIMESERIES_STATUS_UNAUTHORIZED),
  399 + @ApiResponse(code = 500, message = SAVE_ENTITY_TIMESERIES_STATUS_INTERNAL_SERVER_ERROR),
  400 + })
305 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 401 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
306 @RequestMapping(value = "/{entityType}/{entityId}/timeseries/{scope}", method = RequestMethod.POST) 402 @RequestMapping(value = "/{entityType}/{entityId}/timeseries/{scope}", method = RequestMethod.POST)
307 @ResponseBody 403 @ResponseBody
@@ -315,7 +411,15 @@ public class TelemetryController extends BaseController { @@ -315,7 +411,15 @@ public class TelemetryController extends BaseController {
315 } 411 }
316 412
317 @ApiOperation(value = "Save or update telemetry with TTL (saveEntityTelemetryWithTTL)", 413 @ApiOperation(value = "Save or update telemetry with TTL (saveEntityTelemetryWithTTL)",
318 - notes = "The TTL parameter is used to extract the number of days to store the data.") 414 + notes = SAVE_ENTITY_TIMESERIES_DESCRIPTION + "The ttl parameter used only in case of Cassandra DB use for timeseries data storage. "
  415 + + INVALID_ENTITY_ID_OR_ENTITY_TYPE_DESCRIPTION + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
  416 + produces = MediaType.APPLICATION_JSON_VALUE)
  417 + @ApiResponses(value = {
  418 + @ApiResponse(code = 200, message = SAVE_ENTITY_TIMESERIES_STATUS_OK),
  419 + @ApiResponse(code = 400, message = INVALID_STRUCTURE_OF_THE_REQUEST),
  420 + @ApiResponse(code = 401, message = SAVE_ENTITY_TIMESERIES_STATUS_UNAUTHORIZED),
  421 + @ApiResponse(code = 500, message = SAVE_ENTITY_TIMESERIES_STATUS_INTERNAL_SERVER_ERROR),
  422 + })
319 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 423 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
320 @RequestMapping(value = "/{entityType}/{entityId}/timeseries/{scope}/{ttl}", method = RequestMethod.POST) 424 @RequestMapping(value = "/{entityType}/{entityId}/timeseries/{scope}/{ttl}", method = RequestMethod.POST)
321 @ResponseBody 425 @ResponseBody
@@ -323,14 +427,25 @@ public class TelemetryController extends BaseController { @@ -323,14 +427,25 @@ public class TelemetryController extends BaseController {
323 @ApiParam(value = ENTITY_TYPE_PARAM_DESCRIPTION) @PathVariable("entityType") String entityType, 427 @ApiParam(value = ENTITY_TYPE_PARAM_DESCRIPTION) @PathVariable("entityType") String entityType,
324 @ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION) @PathVariable("entityId") String entityIdStr, 428 @ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION) @PathVariable("entityId") String entityIdStr,
325 @ApiParam(value = TELEMETRY_SCOPE_DESCRIPTION) @PathVariable("scope") String scope, 429 @ApiParam(value = TELEMETRY_SCOPE_DESCRIPTION) @PathVariable("scope") String scope,
326 - @ApiParam(value = "A long value representing TTL(Time to Live) parameter.") @PathVariable("ttl") Long ttl, 430 + @ApiParam(value = "A long value representing TTL (Time to Live) parameter.") @PathVariable("ttl") Long ttl,
327 @ApiParam(value = TELEMETRY_JSON_REQUEST_DESCRIPTION) @RequestBody String requestBody) throws ThingsboardException { 431 @ApiParam(value = TELEMETRY_JSON_REQUEST_DESCRIPTION) @RequestBody String requestBody) throws ThingsboardException {
328 EntityId entityId = EntityIdFactory.getByTypeAndId(entityType, entityIdStr); 432 EntityId entityId = EntityIdFactory.getByTypeAndId(entityType, entityIdStr);
329 return saveTelemetry(getTenantId(), entityId, requestBody, ttl); 433 return saveTelemetry(getTenantId(), entityId, requestBody, ttl);
330 } 434 }
331 435
332 @ApiOperation(value = "Delete entity timeseries (deleteEntityTimeseries)", 436 @ApiOperation(value = "Delete entity timeseries (deleteEntityTimeseries)",
333 - notes = "Delete timeseries in the specified time range for selected entity.") 437 + notes = "Delete timeseries for selected entity based on entity id, entity type, keys " +
  438 + "and removal time range. To delete all data for keys parameter 'deleteAllDataForKeys' should be set to true, " +
  439 + "otherwise, will be deleted data that is in range of the selected time interval. " + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
  440 + produces = MediaType.APPLICATION_JSON_VALUE)
  441 + @ApiResponses(value = {
  442 + @ApiResponse(code = 200, message = "Timeseries for the selected keys in the request was removed. " +
  443 + "Platform creates an audit log event about entity timeseries removal with action type 'TIMESERIES_DELETED'."),
  444 + @ApiResponse(code = 400, message = "Platform returns a bad request in case if keys list is empty or start and end timestamp values is empty when deleteAllDataForKeys is set to false."),
  445 + @ApiResponse(code = 401, message = "User is not authorized to delete entity timeseries for selected entity. Most likely, User belongs to different Customer or Tenant."),
  446 + @ApiResponse(code = 500, message = "The exception was thrown during processing the request. " +
  447 + "Platform creates an audit log event about entity timeseries removal with action type 'TIMESERIES_DELETED' that includes an error stacktrace."),
  448 + })
334 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 449 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
335 @RequestMapping(value = "/{entityType}/{entityId}/timeseries/delete", method = RequestMethod.DELETE) 450 @RequestMapping(value = "/{entityType}/{entityId}/timeseries/delete", method = RequestMethod.DELETE)
336 @ResponseBody 451 @ResponseBody
@@ -340,11 +455,11 @@ public class TelemetryController extends BaseController { @@ -340,11 +455,11 @@ public class TelemetryController extends BaseController {
340 @ApiParam(value = TELEMETRY_KEYS_DESCRIPTION) @RequestParam(name = "keys") String keysStr, 455 @ApiParam(value = TELEMETRY_KEYS_DESCRIPTION) @RequestParam(name = "keys") String keysStr,
341 @ApiParam(value = "A boolean value to specify if should be deleted all data for selected keys or only data that are in the selected time range.") 456 @ApiParam(value = "A boolean value to specify if should be deleted all data for selected keys or only data that are in the selected time range.")
342 @RequestParam(name = "deleteAllDataForKeys", defaultValue = "false") boolean deleteAllDataForKeys, 457 @RequestParam(name = "deleteAllDataForKeys", defaultValue = "false") boolean deleteAllDataForKeys,
343 - @ApiParam(value = "A long value representing the start timestamp(milliseconds) of removal time range.") 458 + @ApiParam(value = "A long value representing the start timestamp of removal time range in milliseconds.")
344 @RequestParam(name = "startTs", required = false) Long startTs, 459 @RequestParam(name = "startTs", required = false) Long startTs,
345 - @ApiParam(value = "A long value representing the end timestamp(milliseconds) of removal time range.") 460 + @ApiParam(value = "A long value representing the end timestamp of removal time range in milliseconds.")
346 @RequestParam(name = "endTs", required = false) Long endTs, 461 @RequestParam(name = "endTs", required = false) Long endTs,
347 - @ApiParam(value = "If the parameter is set to true, the latest telemetry will be rewritten if the current latest value was removed, otherwise, the new latest value will not set.") 462 + @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.")
348 @RequestParam(name = "rewriteLatestIfDeleted", defaultValue = "false") boolean rewriteLatestIfDeleted) throws ThingsboardException { 463 @RequestParam(name = "rewriteLatestIfDeleted", defaultValue = "false") boolean rewriteLatestIfDeleted) throws ThingsboardException {
349 EntityId entityId = EntityIdFactory.getByTypeAndId(entityType, entityIdStr); 464 EntityId entityId = EntityIdFactory.getByTypeAndId(entityType, entityIdStr);
350 return deleteTimeseries(entityId, keysStr, deleteAllDataForKeys, startTs, endTs, rewriteLatestIfDeleted); 465 return deleteTimeseries(entityId, keysStr, deleteAllDataForKeys, startTs, endTs, rewriteLatestIfDeleted);
@@ -395,7 +510,17 @@ public class TelemetryController extends BaseController { @@ -395,7 +510,17 @@ public class TelemetryController extends BaseController {
395 } 510 }
396 511
397 @ApiOperation(value = "Delete device attributes (deleteEntityAttributes)", 512 @ApiOperation(value = "Delete device attributes (deleteEntityAttributes)",
398 - notes = "Delete attributes of specified scope for selected device.") 513 + notes = "Delete device attributes from the specified attributes scope based on device id and a list of keys to delete. " +
  514 + "Selected keys will be deleted only if there are exist in the specified attribute scope. Referencing a non-existing device Id will cause an error" + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
  515 + produces = MediaType.APPLICATION_JSON_VALUE)
  516 + @ApiResponses(value = {
  517 + @ApiResponse(code = 200, message = "Device attributes was removed for the selected keys in the request. " +
  518 + "Platform creates an audit log event about device attributes removal with action type 'ATTRIBUTES_DELETED'."),
  519 + @ApiResponse(code = 400, message = "Platform returns a bad request in case if keys or scope are not specified."),
  520 + @ApiResponse(code = 401, message = "User is not authorized to delete device attributes for selected entity. Most likely, User belongs to different Customer or Tenant."),
  521 + @ApiResponse(code = 500, message = "The exception was thrown during processing the request. " +
  522 + "Platform creates an audit log event about device attributes removal with action type 'ATTRIBUTES_DELETED' that includes an error stacktrace."),
  523 + })
399 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 524 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
400 @RequestMapping(value = "/{deviceId}/{scope}", method = RequestMethod.DELETE) 525 @RequestMapping(value = "/{deviceId}/{scope}", method = RequestMethod.DELETE)
401 @ResponseBody 526 @ResponseBody
@@ -408,7 +533,17 @@ public class TelemetryController extends BaseController { @@ -408,7 +533,17 @@ public class TelemetryController extends BaseController {
408 } 533 }
409 534
410 @ApiOperation(value = "Delete entity attributes (deleteEntityAttributes)", 535 @ApiOperation(value = "Delete entity attributes (deleteEntityAttributes)",
411 - notes = "Delete attributes of specified scope for selected entity.") 536 + notes = "Delete entity attributes from the specified attributes scope based on entity id, entity type and a list of keys to delete. " +
  537 + "Selected keys will be deleted only if there are exist in the specified attribute scope." + INVALID_ENTITY_ID_OR_ENTITY_TYPE_DESCRIPTION + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
  538 + produces = MediaType.APPLICATION_JSON_VALUE)
  539 + @ApiResponses(value = {
  540 + @ApiResponse(code = 200, message = "Entity attributes was removed for the selected keys in the request. " +
  541 + "Platform creates an audit log event about entity attributes removal with action type 'ATTRIBUTES_DELETED'."),
  542 + @ApiResponse(code = 400, message = "Platform returns a bad request in case if keys or scope are not specified."),
  543 + @ApiResponse(code = 401, message = "User is not authorized to delete entity attributes for selected entity. Most likely, User belongs to different Customer or Tenant."),
  544 + @ApiResponse(code = 500, message = "The exception was thrown during processing the request. " +
  545 + "Platform creates an audit log event about entity attributes removal with action type 'ATTRIBUTES_DELETED' that includes an error stacktrace."),
  546 + })
412 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 547 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
413 @RequestMapping(value = "/{entityType}/{entityId}/{scope}", method = RequestMethod.DELETE) 548 @RequestMapping(value = "/{entityType}/{entityId}/{scope}", method = RequestMethod.DELETE)
414 @ResponseBody 549 @ResponseBody
@@ -57,7 +57,7 @@ public class TenantController extends BaseController { @@ -57,7 +57,7 @@ public class TenantController extends BaseController {
57 private TenantService tenantService; 57 private TenantService tenantService;
58 58
59 @ApiOperation(value = "Get Tenant (getTenantById)", 59 @ApiOperation(value = "Get Tenant (getTenantById)",
60 - notes = "Fetch the Tenant object based on the provided Tenant Id. " + SYSTEM_AND_TENANT_AUTHORITY_PARAGRAPH) 60 + notes = "Fetch the Tenant object based on the provided Tenant Id. " + SYSTEM_OR_TENANT_AUTHORITY_PARAGRAPH)
61 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") 61 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')")
62 @RequestMapping(value = "/tenant/{tenantId}", method = RequestMethod.GET) 62 @RequestMapping(value = "/tenant/{tenantId}", method = RequestMethod.GET)
63 @ResponseBody 63 @ResponseBody
@@ -79,7 +79,7 @@ public class TenantController extends BaseController { @@ -79,7 +79,7 @@ public class TenantController extends BaseController {
79 79
80 @ApiOperation(value = "Get Tenant Info (getTenantInfoById)", 80 @ApiOperation(value = "Get Tenant Info (getTenantInfoById)",
81 notes = "Fetch the Tenant Info object based on the provided Tenant Id. " + 81 notes = "Fetch the Tenant Info object based on the provided Tenant Id. " +
82 - TENANT_INFO_DESCRIPTION + SYSTEM_AND_TENANT_AUTHORITY_PARAGRAPH) 82 + TENANT_INFO_DESCRIPTION + SYSTEM_OR_TENANT_AUTHORITY_PARAGRAPH)
83 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") 83 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')")
84 @RequestMapping(value = "/tenant/info/{tenantId}", method = RequestMethod.GET) 84 @RequestMapping(value = "/tenant/info/{tenantId}", method = RequestMethod.GET)
85 @ResponseBody 85 @ResponseBody
@@ -108,11 +108,6 @@ public class TenantProfileController extends BaseController { @@ -108,11 +108,6 @@ public class TenantProfileController extends BaseController {
108 "Let's review the example of tenant profile data below: " + 108 "Let's review the example of tenant profile data below: " +
109 "\n\n" + MARKDOWN_CODE_BLOCK_START + 109 "\n\n" + MARKDOWN_CODE_BLOCK_START +
110 "{\n" + 110 "{\n" +
111 - " \"id\": {\n" +  
112 - " \"entityType\": \"TENANT_PROFILE\",\n" +  
113 - " \"id\": \"0f2978a0-0d46-11eb-ab90-09ceaa526dd8\"\n" +  
114 - " },\n" +  
115 - " \"createdTime\": 1602588011818,\n" +  
116 " \"name\": \"Default\",\n" + 111 " \"name\": \"Default\",\n" +
117 " \"description\": \"Default tenant profile\",\n" + 112 " \"description\": \"Default tenant profile\",\n" +
118 " \"isolatedTbCore\": false,\n" + 113 " \"isolatedTbCore\": false,\n" +
@@ -15,9 +15,9 @@ @@ -15,9 +15,9 @@
15 */ 15 */
16 package org.thingsboard.server.controller; 16 package org.thingsboard.server.controller;
17 17
18 -import com.fasterxml.jackson.databind.JsonNode;  
19 -import com.fasterxml.jackson.databind.ObjectMapper;  
20 import com.fasterxml.jackson.databind.node.ObjectNode; 18 import com.fasterxml.jackson.databind.node.ObjectNode;
  19 +import io.swagger.annotations.ApiOperation;
  20 +import io.swagger.annotations.ApiParam;
21 import lombok.Getter; 21 import lombok.Getter;
22 import lombok.RequiredArgsConstructor; 22 import lombok.RequiredArgsConstructor;
23 import org.springframework.beans.factory.annotation.Value; 23 import org.springframework.beans.factory.annotation.Value;
@@ -32,7 +32,6 @@ import org.springframework.web.bind.annotation.RequestParam; @@ -32,7 +32,6 @@ import org.springframework.web.bind.annotation.RequestParam;
32 import org.springframework.web.bind.annotation.ResponseBody; 32 import org.springframework.web.bind.annotation.ResponseBody;
33 import org.springframework.web.bind.annotation.ResponseStatus; 33 import org.springframework.web.bind.annotation.ResponseStatus;
34 import org.springframework.web.bind.annotation.RestController; 34 import org.springframework.web.bind.annotation.RestController;
35 -import org.thingsboard.common.util.JacksonUtil;  
36 import org.thingsboard.rule.engine.api.MailService; 35 import org.thingsboard.rule.engine.api.MailService;
37 import org.thingsboard.server.common.data.EntityType; 36 import org.thingsboard.server.common.data.EntityType;
38 import org.thingsboard.server.common.data.User; 37 import org.thingsboard.server.common.data.User;
@@ -52,6 +51,7 @@ import org.thingsboard.server.common.data.security.event.UserAuthDataChangedEven @@ -52,6 +51,7 @@ import org.thingsboard.server.common.data.security.event.UserAuthDataChangedEven
52 import org.thingsboard.server.common.data.security.model.JwtToken; 51 import org.thingsboard.server.common.data.security.model.JwtToken;
53 import org.thingsboard.server.queue.util.TbCoreComponent; 52 import org.thingsboard.server.queue.util.TbCoreComponent;
54 import org.thingsboard.server.service.security.auth.jwt.RefreshTokenRepository; 53 import org.thingsboard.server.service.security.auth.jwt.RefreshTokenRepository;
  54 +import org.thingsboard.server.service.security.model.JwtTokenPair;
55 import org.thingsboard.server.service.security.model.SecurityUser; 55 import org.thingsboard.server.service.security.model.SecurityUser;
56 import org.thingsboard.server.service.security.model.UserPrincipal; 56 import org.thingsboard.server.service.security.model.UserPrincipal;
57 import org.thingsboard.server.service.security.model.token.JwtTokenFactory; 57 import org.thingsboard.server.service.security.model.token.JwtTokenFactory;
@@ -82,20 +82,27 @@ public class UserController extends BaseController { @@ -82,20 +82,27 @@ public class UserController extends BaseController {
82 private final SystemSecurityService systemSecurityService; 82 private final SystemSecurityService systemSecurityService;
83 private final ApplicationEventPublisher eventPublisher; 83 private final ApplicationEventPublisher eventPublisher;
84 84
  85 + @ApiOperation(value = "Get User (getUserById)",
  86 + notes = "Fetch the User object based on the provided User Id. " +
  87 + "If the user has the authority of 'SYS_ADMIN', the server does not perform additional checks. " +
  88 + "If the user has the authority of 'TENANT_ADMIN', the server checks that the requested user is owned by the same tenant. " +
  89 + "If the user has the authority of 'CUSTOMER_USER', the server checks that the requested user is owned by the same customer.")
85 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 90 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
86 @RequestMapping(value = "/user/{userId}", method = RequestMethod.GET) 91 @RequestMapping(value = "/user/{userId}", method = RequestMethod.GET)
87 @ResponseBody 92 @ResponseBody
88 - public User getUserById(@PathVariable(USER_ID) String strUserId) throws ThingsboardException { 93 + public User getUserById(
  94 + @ApiParam(value = USER_ID_PARAM_DESCRIPTION)
  95 + @PathVariable(USER_ID) String strUserId) throws ThingsboardException {
89 checkParameter(USER_ID, strUserId); 96 checkParameter(USER_ID, strUserId);
90 try { 97 try {
91 UserId userId = new UserId(toUUID(strUserId)); 98 UserId userId = new UserId(toUUID(strUserId));
92 User user = checkUserId(userId, Operation.READ); 99 User user = checkUserId(userId, Operation.READ);
93 - if(user.getAdditionalInfo().isObject()) { 100 + if (user.getAdditionalInfo().isObject()) {
94 ObjectNode additionalInfo = (ObjectNode) user.getAdditionalInfo(); 101 ObjectNode additionalInfo = (ObjectNode) user.getAdditionalInfo();
95 processDashboardIdFromAdditionalInfo(additionalInfo, DEFAULT_DASHBOARD); 102 processDashboardIdFromAdditionalInfo(additionalInfo, DEFAULT_DASHBOARD);
96 processDashboardIdFromAdditionalInfo(additionalInfo, HOME_DASHBOARD); 103 processDashboardIdFromAdditionalInfo(additionalInfo, HOME_DASHBOARD);
97 UserCredentials userCredentials = userService.findUserCredentialsByUserId(user.getTenantId(), user.getId()); 104 UserCredentials userCredentials = userService.findUserCredentialsByUserId(user.getTenantId(), user.getId());
98 - if(userCredentials.isEnabled() && !additionalInfo.has("userCredentialsEnabled")) { 105 + if (userCredentials.isEnabled() && !additionalInfo.has("userCredentialsEnabled")) {
99 additionalInfo.put("userCredentialsEnabled", true); 106 additionalInfo.put("userCredentialsEnabled", true);
100 } 107 }
101 } 108 }
@@ -105,6 +112,10 @@ public class UserController extends BaseController { @@ -105,6 +112,10 @@ public class UserController extends BaseController {
105 } 112 }
106 } 113 }
107 114
  115 + @ApiOperation(value = "Check Token Access Enabled (isUserTokenAccessEnabled)",
  116 + notes = "Checks that the system is configured to allow administrators to impersonate themself as other users. " +
  117 + "If the user who performs the request has the authority of 'SYS_ADMIN', it is possible to login as any tenant administrator. " +
  118 + "If the user who performs the request has the authority of 'TENANT_ADMIN', it is possible to login as any customer user. ")
108 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") 119 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')")
109 @RequestMapping(value = "/user/tokenAccessEnabled", method = RequestMethod.GET) 120 @RequestMapping(value = "/user/tokenAccessEnabled", method = RequestMethod.GET)
110 @ResponseBody 121 @ResponseBody
@@ -112,10 +123,16 @@ public class UserController extends BaseController { @@ -112,10 +123,16 @@ public class UserController extends BaseController {
112 return userTokenAccessEnabled; 123 return userTokenAccessEnabled;
113 } 124 }
114 125
  126 + @ApiOperation(value = "Get User Token (getUserToken)",
  127 + notes = "Returns the token of the User based on the provided User Id. " +
  128 + "If the user who performs the request has the authority of 'SYS_ADMIN', it is possible to get the token of any tenant administrator. " +
  129 + "If the user who performs the request has the authority of 'TENANT_ADMIN', it is possible to get the token of any customer user that belongs to the same tenant. ")
115 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") 130 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')")
116 @RequestMapping(value = "/user/{userId}/token", method = RequestMethod.GET) 131 @RequestMapping(value = "/user/{userId}/token", method = RequestMethod.GET)
117 @ResponseBody 132 @ResponseBody
118 - public JsonNode getUserToken(@PathVariable(USER_ID) String strUserId) throws ThingsboardException { 133 + public JwtTokenPair getUserToken(
  134 + @ApiParam(value = USER_ID_PARAM_DESCRIPTION)
  135 + @PathVariable(USER_ID) String strUserId) throws ThingsboardException {
119 checkParameter(USER_ID, strUserId); 136 checkParameter(USER_ID, strUserId);
120 try { 137 try {
121 if (!userTokenAccessEnabled) { 138 if (!userTokenAccessEnabled) {
@@ -130,22 +147,26 @@ public class UserController extends BaseController { @@ -130,22 +147,26 @@ public class UserController extends BaseController {
130 SecurityUser securityUser = new SecurityUser(user, credentials.isEnabled(), principal); 147 SecurityUser securityUser = new SecurityUser(user, credentials.isEnabled(), principal);
131 JwtToken accessToken = tokenFactory.createAccessJwtToken(securityUser); 148 JwtToken accessToken = tokenFactory.createAccessJwtToken(securityUser);
132 JwtToken refreshToken = refreshTokenRepository.requestRefreshToken(securityUser); 149 JwtToken refreshToken = refreshTokenRepository.requestRefreshToken(securityUser);
133 - ObjectMapper objectMapper = new ObjectMapper();  
134 - ObjectNode tokenObject = objectMapper.createObjectNode();  
135 - tokenObject.put("token", accessToken.getToken());  
136 - tokenObject.put("refreshToken", refreshToken.getToken());  
137 - return tokenObject; 150 + return new JwtTokenPair(accessToken.getToken(), refreshToken.getToken());
138 } catch (Exception e) { 151 } catch (Exception e) {
139 throw handleException(e); 152 throw handleException(e);
140 } 153 }
141 } 154 }
142 155
  156 + @ApiOperation(value = "Save Or update User (saveUser)",
  157 + notes = "Create or update the User. When creating user, platform generates User Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address). " +
  158 + "The newly created User Id will be present in the response. " +
  159 + "Specify existing User Id to update the device. " +
  160 + "Referencing non-existing User Id will cause 'Not Found' error." +
  161 + "\n\nDevice email is unique for entire platform setup.")
143 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 162 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
144 @RequestMapping(value = "/user", method = RequestMethod.POST) 163 @RequestMapping(value = "/user", method = RequestMethod.POST)
145 @ResponseBody 164 @ResponseBody
146 - public User saveUser(@RequestBody User user,  
147 - @RequestParam(required = false, defaultValue = "true") boolean sendActivationMail,  
148 - HttpServletRequest request) throws ThingsboardException { 165 + public User saveUser(
  166 + @ApiParam(value = "A JSON value representing the User.", required = true)
  167 + @RequestBody User user,
  168 + @ApiParam(value = "Send activation email (or use activation link)", defaultValue = "true")
  169 + @RequestParam(required = false, defaultValue = "true") boolean sendActivationMail, HttpServletRequest request) throws ThingsboardException {
149 try { 170 try {
150 171
151 if (Authority.TENANT_ADMIN.equals(getCurrentUser().getAuthority())) { 172 if (Authority.TENANT_ADMIN.equals(getCurrentUser().getAuthority())) {
@@ -188,10 +209,13 @@ public class UserController extends BaseController { @@ -188,10 +209,13 @@ public class UserController extends BaseController {
188 } 209 }
189 } 210 }
190 211
  212 + @ApiOperation(value = "Send or re-send the activation email",
  213 + notes = "Force send the activation email to the user. Useful to resend the email if user has accidentally deleted it. " + SYSTEM_OR_TENANT_AUTHORITY_PARAGRAPH)
191 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") 214 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')")
192 @RequestMapping(value = "/user/sendActivationMail", method = RequestMethod.POST) 215 @RequestMapping(value = "/user/sendActivationMail", method = RequestMethod.POST)
193 @ResponseStatus(value = HttpStatus.OK) 216 @ResponseStatus(value = HttpStatus.OK)
194 public void sendActivationEmail( 217 public void sendActivationEmail(
  218 + @ApiParam(value = "Email of the user", required = true)
195 @RequestParam(value = "email") String email, 219 @RequestParam(value = "email") String email,
196 HttpServletRequest request) throws ThingsboardException { 220 HttpServletRequest request) throws ThingsboardException {
197 try { 221 try {
@@ -214,10 +238,14 @@ public class UserController extends BaseController { @@ -214,10 +238,14 @@ public class UserController extends BaseController {
214 } 238 }
215 } 239 }
216 240
  241 + @ApiOperation(value = "Get the activation link (getActivationLink)",
  242 + notes = "Get the activation link for the user. " +
  243 + "The base url for activation link is configurable in the general settings of system administrator. " + SYSTEM_OR_TENANT_AUTHORITY_PARAGRAPH)
217 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") 244 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')")
218 @RequestMapping(value = "/user/{userId}/activationLink", method = RequestMethod.GET, produces = "text/plain") 245 @RequestMapping(value = "/user/{userId}/activationLink", method = RequestMethod.GET, produces = "text/plain")
219 @ResponseBody 246 @ResponseBody
220 public String getActivationLink( 247 public String getActivationLink(
  248 + @ApiParam(value = USER_ID_PARAM_DESCRIPTION)
221 @PathVariable(USER_ID) String strUserId, 249 @PathVariable(USER_ID) String strUserId,
222 HttpServletRequest request) throws ThingsboardException { 250 HttpServletRequest request) throws ThingsboardException {
223 checkParameter(USER_ID, strUserId); 251 checkParameter(USER_ID, strUserId);
@@ -239,10 +267,15 @@ public class UserController extends BaseController { @@ -239,10 +267,15 @@ public class UserController extends BaseController {
239 } 267 }
240 } 268 }
241 269
  270 + @ApiOperation(value = "Delete User (deleteUser)",
  271 + notes = "Deletes the User, it's credentials and all the relations (from and to the User). " +
  272 + "Referencing non-existing User Id will cause an error. " + SYSTEM_OR_TENANT_AUTHORITY_PARAGRAPH)
242 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") 273 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')")
243 @RequestMapping(value = "/user/{userId}", method = RequestMethod.DELETE) 274 @RequestMapping(value = "/user/{userId}", method = RequestMethod.DELETE)
244 @ResponseStatus(value = HttpStatus.OK) 275 @ResponseStatus(value = HttpStatus.OK)
245 - public void deleteUser(@PathVariable(USER_ID) String strUserId) throws ThingsboardException { 276 + public void deleteUser(
  277 + @ApiParam(value = USER_ID_PARAM_DESCRIPTION)
  278 + @PathVariable(USER_ID) String strUserId) throws ThingsboardException {
246 checkParameter(USER_ID, strUserId); 279 checkParameter(USER_ID, strUserId);
247 try { 280 try {
248 UserId userId = new UserId(toUUID(strUserId)); 281 UserId userId = new UserId(toUUID(strUserId));
@@ -267,14 +300,22 @@ public class UserController extends BaseController { @@ -267,14 +300,22 @@ public class UserController extends BaseController {
267 } 300 }
268 } 301 }
269 302
  303 + @ApiOperation(value = "Get Users (getUsers)",
  304 + notes = "Returns a page of users owned by tenant or customer. The scope depends on authority of the user that performs the request." +
  305 + PAGE_DATA_PARAMETERS + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH)
270 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") 306 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
271 @RequestMapping(value = "/users", params = {"pageSize", "page"}, method = RequestMethod.GET) 307 @RequestMapping(value = "/users", params = {"pageSize", "page"}, method = RequestMethod.GET)
272 @ResponseBody 308 @ResponseBody
273 public PageData<User> getUsers( 309 public PageData<User> getUsers(
  310 + @ApiParam(value = PAGE_SIZE_DESCRIPTION, required = true)
274 @RequestParam int pageSize, 311 @RequestParam int pageSize,
  312 + @ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true)
275 @RequestParam int page, 313 @RequestParam int page,
  314 + @ApiParam(value = USER_TEXT_SEARCH_DESCRIPTION)
276 @RequestParam(required = false) String textSearch, 315 @RequestParam(required = false) String textSearch,
  316 + @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = USER_SORT_PROPERTY_ALLOWABLE_VALUES)
277 @RequestParam(required = false) String sortProperty, 317 @RequestParam(required = false) String sortProperty,
  318 + @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES)
278 @RequestParam(required = false) String sortOrder) throws ThingsboardException { 319 @RequestParam(required = false) String sortOrder) throws ThingsboardException {
279 try { 320 try {
280 PageLink pageLink = createPageLink(pageSize, page, textSearch, sortProperty, sortOrder); 321 PageLink pageLink = createPageLink(pageSize, page, textSearch, sortProperty, sortOrder);
@@ -289,15 +330,23 @@ public class UserController extends BaseController { @@ -289,15 +330,23 @@ public class UserController extends BaseController {
289 } 330 }
290 } 331 }
291 332
  333 + @ApiOperation(value = "Get Tenant Users (getTenantAdmins)",
  334 + notes = "Returns a page of users owned by tenant. " + PAGE_DATA_PARAMETERS + SYSTEM_AUTHORITY_PARAGRAPH)
292 @PreAuthorize("hasAuthority('SYS_ADMIN')") 335 @PreAuthorize("hasAuthority('SYS_ADMIN')")
293 @RequestMapping(value = "/tenant/{tenantId}/users", params = {"pageSize", "page"}, method = RequestMethod.GET) 336 @RequestMapping(value = "/tenant/{tenantId}/users", params = {"pageSize", "page"}, method = RequestMethod.GET)
294 @ResponseBody 337 @ResponseBody
295 public PageData<User> getTenantAdmins( 338 public PageData<User> getTenantAdmins(
296 - @PathVariable("tenantId") String strTenantId, 339 + @ApiParam(value = TENANT_ID_PARAM_DESCRIPTION, required = true)
  340 + @PathVariable(TENANT_ID) String strTenantId,
  341 + @ApiParam(value = PAGE_SIZE_DESCRIPTION, required = true)
297 @RequestParam int pageSize, 342 @RequestParam int pageSize,
  343 + @ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true)
298 @RequestParam int page, 344 @RequestParam int page,
  345 + @ApiParam(value = USER_TEXT_SEARCH_DESCRIPTION)
299 @RequestParam(required = false) String textSearch, 346 @RequestParam(required = false) String textSearch,
  347 + @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = USER_SORT_PROPERTY_ALLOWABLE_VALUES)
300 @RequestParam(required = false) String sortProperty, 348 @RequestParam(required = false) String sortProperty,
  349 + @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES)
301 @RequestParam(required = false) String sortOrder) throws ThingsboardException { 350 @RequestParam(required = false) String sortOrder) throws ThingsboardException {
302 checkParameter("tenantId", strTenantId); 351 checkParameter("tenantId", strTenantId);
303 try { 352 try {
@@ -309,15 +358,23 @@ public class UserController extends BaseController { @@ -309,15 +358,23 @@ public class UserController extends BaseController {
309 } 358 }
310 } 359 }
311 360
  361 + @ApiOperation(value = "Get Customer Users (getCustomerUsers)",
  362 + notes = "Returns a page of users owned by customer. " + PAGE_DATA_PARAMETERS + TENANT_AUTHORITY_PARAGRAPH)
312 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 363 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
313 @RequestMapping(value = "/customer/{customerId}/users", params = {"pageSize", "page"}, method = RequestMethod.GET) 364 @RequestMapping(value = "/customer/{customerId}/users", params = {"pageSize", "page"}, method = RequestMethod.GET)
314 @ResponseBody 365 @ResponseBody
315 public PageData<User> getCustomerUsers( 366 public PageData<User> getCustomerUsers(
316 - @PathVariable("customerId") String strCustomerId, 367 + @ApiParam(value = CUSTOMER_ID_PARAM_DESCRIPTION, required = true)
  368 + @PathVariable(CUSTOMER_ID) String strCustomerId,
  369 + @ApiParam(value = PAGE_SIZE_DESCRIPTION, required = true)
317 @RequestParam int pageSize, 370 @RequestParam int pageSize,
  371 + @ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true)
318 @RequestParam int page, 372 @RequestParam int page,
  373 + @ApiParam(value = USER_TEXT_SEARCH_DESCRIPTION)
319 @RequestParam(required = false) String textSearch, 374 @RequestParam(required = false) String textSearch,
  375 + @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = USER_SORT_PROPERTY_ALLOWABLE_VALUES)
320 @RequestParam(required = false) String sortProperty, 376 @RequestParam(required = false) String sortProperty,
  377 + @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES)
321 @RequestParam(required = false) String sortOrder) throws ThingsboardException { 378 @RequestParam(required = false) String sortOrder) throws ThingsboardException {
322 checkParameter("customerId", strCustomerId); 379 checkParameter("customerId", strCustomerId);
323 try { 380 try {
@@ -331,11 +388,16 @@ public class UserController extends BaseController { @@ -331,11 +388,16 @@ public class UserController extends BaseController {
331 } 388 }
332 } 389 }
333 390
  391 + @ApiOperation(value = "Enable/Disable User credentials (setUserCredentialsEnabled)",
  392 + notes = "Enables or Disables user credentials. Useful when you would like to block user account without deleting it. " + PAGE_DATA_PARAMETERS + TENANT_AUTHORITY_PARAGRAPH)
334 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") 393 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')")
335 @RequestMapping(value = "/user/{userId}/userCredentialsEnabled", method = RequestMethod.POST) 394 @RequestMapping(value = "/user/{userId}/userCredentialsEnabled", method = RequestMethod.POST)
336 @ResponseBody 395 @ResponseBody
337 - public void setUserCredentialsEnabled(@PathVariable(USER_ID) String strUserId,  
338 - @RequestParam(required = false, defaultValue = "true") boolean userCredentialsEnabled) throws ThingsboardException { 396 + public void setUserCredentialsEnabled(
  397 + @ApiParam(value = USER_ID_PARAM_DESCRIPTION)
  398 + @PathVariable(USER_ID) String strUserId,
  399 + @ApiParam(value = "Disable (\"true\") or enable (\"false\") the credentials.", defaultValue = "true")
  400 + @RequestParam(required = false, defaultValue = "true") boolean userCredentialsEnabled) throws ThingsboardException {
339 checkParameter(USER_ID, strUserId); 401 checkParameter(USER_ID, strUserId);
340 try { 402 try {
341 UserId userId = new UserId(toUUID(strUserId)); 403 UserId userId = new UserId(toUUID(strUserId));
@@ -15,6 +15,8 @@ @@ -15,6 +15,8 @@
15 */ 15 */
16 package org.thingsboard.server.controller; 16 package org.thingsboard.server.controller;
17 17
  18 +import io.swagger.annotations.ApiOperation;
  19 +import io.swagger.annotations.ApiParam;
18 import lombok.extern.slf4j.Slf4j; 20 import lombok.extern.slf4j.Slf4j;
19 import org.springframework.http.HttpStatus; 21 import org.springframework.http.HttpStatus;
20 import org.springframework.security.access.prepost.PreAuthorize; 22 import org.springframework.security.access.prepost.PreAuthorize;
@@ -48,10 +50,20 @@ import java.util.List; @@ -48,10 +50,20 @@ import java.util.List;
48 @RequestMapping("/api") 50 @RequestMapping("/api")
49 public class WidgetTypeController extends BaseController { 51 public class WidgetTypeController extends BaseController {
50 52
  53 + private static final String WIDGET_TYPE_DESCRIPTION = "Widget Type represents the template for widget creation. Widget Type and Widget are similar to class and object in OOP theory.";
  54 + private static final String WIDGET_TYPE_DETAILS_DESCRIPTION = "Widget Type Details extend Widget Type and add image and description properties. " +
  55 + "Those properties are useful to edit the Widget Type but they are not required for Dashboard rendering. ";
  56 + private static final String WIDGET_TYPE_INFO_DESCRIPTION = "Widget Type Info is a lightweight object that represents Widget Type but does not contain the heavyweight widget descriptor JSON";
  57 +
  58 +
  59 + @ApiOperation(value = "Get Widget Type Details (getWidgetTypeById)",
  60 + notes = "Get the Widget Type Details based on the provided Widget Type Id. " + WIDGET_TYPE_DETAILS_DESCRIPTION + SYSTEM_OR_TENANT_AUTHORITY_PARAGRAPH)
51 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") 61 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')")
52 @RequestMapping(value = "/widgetType/{widgetTypeId}", method = RequestMethod.GET) 62 @RequestMapping(value = "/widgetType/{widgetTypeId}", method = RequestMethod.GET)
53 @ResponseBody 63 @ResponseBody
54 - public WidgetTypeDetails getWidgetTypeById(@PathVariable("widgetTypeId") String strWidgetTypeId) throws ThingsboardException { 64 + public WidgetTypeDetails getWidgetTypeById(
  65 + @ApiParam(value = WIDGET_TYPE_ID_PARAM_DESCRIPTION, required = true)
  66 + @PathVariable("widgetTypeId") String strWidgetTypeId) throws ThingsboardException {
55 checkParameter("widgetTypeId", strWidgetTypeId); 67 checkParameter("widgetTypeId", strWidgetTypeId);
56 try { 68 try {
57 WidgetTypeId widgetTypeId = new WidgetTypeId(toUUID(strWidgetTypeId)); 69 WidgetTypeId widgetTypeId = new WidgetTypeId(toUUID(strWidgetTypeId));
@@ -61,10 +73,21 @@ public class WidgetTypeController extends BaseController { @@ -61,10 +73,21 @@ public class WidgetTypeController extends BaseController {
61 } 73 }
62 } 74 }
63 75
  76 + @ApiOperation(value = "Create Or Update Widget Type (saveWidgetType)",
  77 + notes = "Create or update the Widget Type. " + WIDGET_TYPE_DESCRIPTION + " " +
  78 + "When creating the Widget Type, platform generates Widget Type Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address). " +
  79 + "The newly created Widget Type Id will be present in the response. " +
  80 + "Specify existing Widget Type id to update the Widget Type. " +
  81 + "Referencing non-existing Widget Type Id will cause 'Not Found' error." +
  82 + "\n\nWidget Type alias is unique in the scope of Widget Bundle. " +
  83 + "Special Tenant Id '13814000-1dd2-11b2-8080-808080808080' is automatically used if the create request is sent by user with 'SYS_ADMIN' authority."
  84 + + SYSTEM_OR_TENANT_AUTHORITY_PARAGRAPH)
64 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") 85 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')")
65 @RequestMapping(value = "/widgetType", method = RequestMethod.POST) 86 @RequestMapping(value = "/widgetType", method = RequestMethod.POST)
66 @ResponseBody 87 @ResponseBody
67 - public WidgetTypeDetails saveWidgetType(@RequestBody WidgetTypeDetails widgetTypeDetails) throws ThingsboardException { 88 + public WidgetTypeDetails saveWidgetType(
  89 + @ApiParam(value = "A JSON value representing the Widget Type Details.", required = true)
  90 + @RequestBody WidgetTypeDetails widgetTypeDetails) throws ThingsboardException {
68 try { 91 try {
69 if (Authority.SYS_ADMIN.equals(getCurrentUser().getAuthority())) { 92 if (Authority.SYS_ADMIN.equals(getCurrentUser().getAuthority())) {
70 widgetTypeDetails.setTenantId(TenantId.SYS_TENANT_ID); 93 widgetTypeDetails.setTenantId(TenantId.SYS_TENANT_ID);
@@ -84,10 +107,14 @@ public class WidgetTypeController extends BaseController { @@ -84,10 +107,14 @@ public class WidgetTypeController extends BaseController {
84 } 107 }
85 } 108 }
86 109
  110 + @ApiOperation(value = "Delete widget type (deleteWidgetType)",
  111 + notes = "Deletes the Widget Type. Referencing non-existing Widget Type Id will cause an error." + SYSTEM_OR_TENANT_AUTHORITY_PARAGRAPH)
87 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") 112 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')")
88 @RequestMapping(value = "/widgetType/{widgetTypeId}", method = RequestMethod.DELETE) 113 @RequestMapping(value = "/widgetType/{widgetTypeId}", method = RequestMethod.DELETE)
89 @ResponseStatus(value = HttpStatus.OK) 114 @ResponseStatus(value = HttpStatus.OK)
90 - public void deleteWidgetType(@PathVariable("widgetTypeId") String strWidgetTypeId) throws ThingsboardException { 115 + public void deleteWidgetType(
  116 + @ApiParam(value = WIDGET_TYPE_ID_PARAM_DESCRIPTION, required = true)
  117 + @PathVariable("widgetTypeId") String strWidgetTypeId) throws ThingsboardException {
91 checkParameter("widgetTypeId", strWidgetTypeId); 118 checkParameter("widgetTypeId", strWidgetTypeId);
92 try { 119 try {
93 WidgetTypeId widgetTypeId = new WidgetTypeId(toUUID(strWidgetTypeId)); 120 WidgetTypeId widgetTypeId = new WidgetTypeId(toUUID(strWidgetTypeId));
@@ -101,11 +128,15 @@ public class WidgetTypeController extends BaseController { @@ -101,11 +128,15 @@ public class WidgetTypeController extends BaseController {
101 } 128 }
102 } 129 }
103 130
  131 + @ApiOperation(value = "Get all Widget types for specified Bundle (getBundleWidgetTypes)",
  132 + notes = "Returns an array of Widget Type objects that belong to specified Widget Bundle." + WIDGET_TYPE_DESCRIPTION + " " + SYSTEM_OR_TENANT_AUTHORITY_PARAGRAPH)
104 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") 133 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')")
105 @RequestMapping(value = "/widgetTypes", params = {"isSystem", "bundleAlias"}, method = RequestMethod.GET) 134 @RequestMapping(value = "/widgetTypes", params = {"isSystem", "bundleAlias"}, method = RequestMethod.GET)
106 @ResponseBody 135 @ResponseBody
107 public List<WidgetType> getBundleWidgetTypes( 136 public List<WidgetType> getBundleWidgetTypes(
  137 + @ApiParam(value = "System or Tenant", required = true)
108 @RequestParam boolean isSystem, 138 @RequestParam boolean isSystem,
  139 + @ApiParam(value = "Widget Bundle alias", required = true)
109 @RequestParam String bundleAlias) throws ThingsboardException { 140 @RequestParam String bundleAlias) throws ThingsboardException {
110 try { 141 try {
111 TenantId tenantId; 142 TenantId tenantId;
@@ -120,11 +151,15 @@ public class WidgetTypeController extends BaseController { @@ -120,11 +151,15 @@ public class WidgetTypeController extends BaseController {
120 } 151 }
121 } 152 }
122 153
  154 + @ApiOperation(value = "Get all Widget types details for specified Bundle (getBundleWidgetTypes)",
  155 + notes = "Returns an array of Widget Type Details objects that belong to specified Widget Bundle." + WIDGET_TYPE_DETAILS_DESCRIPTION + " " + SYSTEM_OR_TENANT_AUTHORITY_PARAGRAPH)
123 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") 156 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')")
124 @RequestMapping(value = "/widgetTypesDetails", params = {"isSystem", "bundleAlias"}, method = RequestMethod.GET) 157 @RequestMapping(value = "/widgetTypesDetails", params = {"isSystem", "bundleAlias"}, method = RequestMethod.GET)
125 @ResponseBody 158 @ResponseBody
126 public List<WidgetTypeDetails> getBundleWidgetTypesDetails( 159 public List<WidgetTypeDetails> getBundleWidgetTypesDetails(
  160 + @ApiParam(value = "System or Tenant", required = true)
127 @RequestParam boolean isSystem, 161 @RequestParam boolean isSystem,
  162 + @ApiParam(value = "Widget Bundle alias", required = true)
128 @RequestParam String bundleAlias) throws ThingsboardException { 163 @RequestParam String bundleAlias) throws ThingsboardException {
129 try { 164 try {
130 TenantId tenantId; 165 TenantId tenantId;
@@ -139,11 +174,15 @@ public class WidgetTypeController extends BaseController { @@ -139,11 +174,15 @@ public class WidgetTypeController extends BaseController {
139 } 174 }
140 } 175 }
141 176
  177 + @ApiOperation(value = "Get Widget Type Info objects (getBundleWidgetTypesInfos)",
  178 + notes = "Get the Widget Type Info objects based on the provided parameters. " + WIDGET_TYPE_INFO_DESCRIPTION + AVAILABLE_FOR_ANY_AUTHORIZED_USER)
142 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") 179 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')")
143 @RequestMapping(value = "/widgetTypesInfos", params = {"isSystem", "bundleAlias"}, method = RequestMethod.GET) 180 @RequestMapping(value = "/widgetTypesInfos", params = {"isSystem", "bundleAlias"}, method = RequestMethod.GET)
144 @ResponseBody 181 @ResponseBody
145 public List<WidgetTypeInfo> getBundleWidgetTypesInfos( 182 public List<WidgetTypeInfo> getBundleWidgetTypesInfos(
  183 + @ApiParam(value = "System or Tenant", required = true)
146 @RequestParam boolean isSystem, 184 @RequestParam boolean isSystem,
  185 + @ApiParam(value = "Widget Bundle alias", required = true)
147 @RequestParam String bundleAlias) throws ThingsboardException { 186 @RequestParam String bundleAlias) throws ThingsboardException {
148 try { 187 try {
149 TenantId tenantId; 188 TenantId tenantId;
@@ -158,12 +197,17 @@ public class WidgetTypeController extends BaseController { @@ -158,12 +197,17 @@ public class WidgetTypeController extends BaseController {
158 } 197 }
159 } 198 }
160 199
  200 + @ApiOperation(value = "Get Widget Type (getWidgetType)",
  201 + notes = "Get the Widget Type based on the provided parameters. " + WIDGET_TYPE_DESCRIPTION + AVAILABLE_FOR_ANY_AUTHORIZED_USER)
161 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 202 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
162 @RequestMapping(value = "/widgetType", params = {"isSystem", "bundleAlias", "alias"}, method = RequestMethod.GET) 203 @RequestMapping(value = "/widgetType", params = {"isSystem", "bundleAlias", "alias"}, method = RequestMethod.GET)
163 @ResponseBody 204 @ResponseBody
164 public WidgetType getWidgetType( 205 public WidgetType getWidgetType(
  206 + @ApiParam(value = "System or Tenant", required = true)
165 @RequestParam boolean isSystem, 207 @RequestParam boolean isSystem,
  208 + @ApiParam(value = "Widget Bundle alias", required = true)
166 @RequestParam String bundleAlias, 209 @RequestParam String bundleAlias,
  210 + @ApiParam(value = "Widget Type alias", required = true)
167 @RequestParam String alias) throws ThingsboardException { 211 @RequestParam String alias) throws ThingsboardException {
168 try { 212 try {
169 TenantId tenantId; 213 TenantId tenantId;
@@ -15,6 +15,8 @@ @@ -15,6 +15,8 @@
15 */ 15 */
16 package org.thingsboard.server.controller; 16 package org.thingsboard.server.controller;
17 17
  18 +import io.swagger.annotations.ApiOperation;
  19 +import io.swagger.annotations.ApiParam;
18 import org.springframework.http.HttpStatus; 20 import org.springframework.http.HttpStatus;
19 import org.springframework.security.access.prepost.PreAuthorize; 21 import org.springframework.security.access.prepost.PreAuthorize;
20 import org.springframework.web.bind.annotation.PathVariable; 22 import org.springframework.web.bind.annotation.PathVariable;
@@ -44,10 +46,16 @@ import java.util.List; @@ -44,10 +46,16 @@ import java.util.List;
44 @RequestMapping("/api") 46 @RequestMapping("/api")
45 public class WidgetsBundleController extends BaseController { 47 public class WidgetsBundleController extends BaseController {
46 48
  49 + private static final String WIDGET_BUNDLE_DESCRIPTION = "Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. ";
  50 +
  51 + @ApiOperation(value = "Get Widget Bundle (getWidgetsBundleById)",
  52 + notes = "Get the Widget Bundle based on the provided Widget Bundle Id. " + WIDGET_BUNDLE_DESCRIPTION + AVAILABLE_FOR_ANY_AUTHORIZED_USER)
47 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 53 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
48 @RequestMapping(value = "/widgetsBundle/{widgetsBundleId}", method = RequestMethod.GET) 54 @RequestMapping(value = "/widgetsBundle/{widgetsBundleId}", method = RequestMethod.GET)
49 @ResponseBody 55 @ResponseBody
50 - public WidgetsBundle getWidgetsBundleById(@PathVariable("widgetsBundleId") String strWidgetsBundleId) throws ThingsboardException { 56 + public WidgetsBundle getWidgetsBundleById(
  57 + @ApiParam(value = WIDGET_BUNDLE_ID_PARAM_DESCRIPTION, required = true)
  58 + @PathVariable("widgetsBundleId") String strWidgetsBundleId) throws ThingsboardException {
51 checkParameter("widgetsBundleId", strWidgetsBundleId); 59 checkParameter("widgetsBundleId", strWidgetsBundleId);
52 try { 60 try {
53 WidgetsBundleId widgetsBundleId = new WidgetsBundleId(toUUID(strWidgetsBundleId)); 61 WidgetsBundleId widgetsBundleId = new WidgetsBundleId(toUUID(strWidgetsBundleId));
@@ -57,10 +65,21 @@ public class WidgetsBundleController extends BaseController { @@ -57,10 +65,21 @@ public class WidgetsBundleController extends BaseController {
57 } 65 }
58 } 66 }
59 67
  68 + @ApiOperation(value = "Create Or Update Widget Bundle (saveWidgetsBundle)",
  69 + notes = "Create or update the Widget Bundle. " + WIDGET_BUNDLE_DESCRIPTION + " " +
  70 + "When creating the bundle, platform generates Widget Bundle Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address). " +
  71 + "The newly created Widget Bundle Id will be present in the response. " +
  72 + "Specify existing Widget Bundle id to update the Widget Bundle. " +
  73 + "Referencing non-existing Widget Bundle Id will cause 'Not Found' error." +
  74 + "\n\nWidget Bundle alias is unique in the scope of tenant. " +
  75 + "Special Tenant Id '13814000-1dd2-11b2-8080-808080808080' is automatically used if the create bundle request is sent by user with 'SYS_ADMIN' authority."
  76 + + SYSTEM_OR_TENANT_AUTHORITY_PARAGRAPH)
60 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") 77 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')")
61 @RequestMapping(value = "/widgetsBundle", method = RequestMethod.POST) 78 @RequestMapping(value = "/widgetsBundle", method = RequestMethod.POST)
62 @ResponseBody 79 @ResponseBody
63 - public WidgetsBundle saveWidgetsBundle(@RequestBody WidgetsBundle widgetsBundle) throws ThingsboardException { 80 + public WidgetsBundle saveWidgetsBundle(
  81 + @ApiParam(value = "A JSON value representing the Widget Bundle.", required = true)
  82 + @RequestBody WidgetsBundle widgetsBundle) throws ThingsboardException {
64 try { 83 try {
65 if (Authority.SYS_ADMIN.equals(getCurrentUser().getAuthority())) { 84 if (Authority.SYS_ADMIN.equals(getCurrentUser().getAuthority())) {
66 widgetsBundle.setTenantId(TenantId.SYS_TENANT_ID); 85 widgetsBundle.setTenantId(TenantId.SYS_TENANT_ID);
@@ -80,10 +99,14 @@ public class WidgetsBundleController extends BaseController { @@ -80,10 +99,14 @@ public class WidgetsBundleController extends BaseController {
80 } 99 }
81 } 100 }
82 101
  102 + @ApiOperation(value = "Delete widgets bundle (deleteWidgetsBundle)",
  103 + notes = "Deletes the widget bundle. Referencing non-existing Widget Bundle Id will cause an error." + SYSTEM_OR_TENANT_AUTHORITY_PARAGRAPH)
83 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") 104 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')")
84 @RequestMapping(value = "/widgetsBundle/{widgetsBundleId}", method = RequestMethod.DELETE) 105 @RequestMapping(value = "/widgetsBundle/{widgetsBundleId}", method = RequestMethod.DELETE)
85 @ResponseStatus(value = HttpStatus.OK) 106 @ResponseStatus(value = HttpStatus.OK)
86 - public void deleteWidgetsBundle(@PathVariable("widgetsBundleId") String strWidgetsBundleId) throws ThingsboardException { 107 + public void deleteWidgetsBundle(
  108 + @ApiParam(value = WIDGET_BUNDLE_ID_PARAM_DESCRIPTION, required = true)
  109 + @PathVariable("widgetsBundleId") String strWidgetsBundleId) throws ThingsboardException {
87 checkParameter("widgetsBundleId", strWidgetsBundleId); 110 checkParameter("widgetsBundleId", strWidgetsBundleId);
88 try { 111 try {
89 WidgetsBundleId widgetsBundleId = new WidgetsBundleId(toUUID(strWidgetsBundleId)); 112 WidgetsBundleId widgetsBundleId = new WidgetsBundleId(toUUID(strWidgetsBundleId));
@@ -97,14 +120,22 @@ public class WidgetsBundleController extends BaseController { @@ -97,14 +120,22 @@ public class WidgetsBundleController extends BaseController {
97 } 120 }
98 } 121 }
99 122
  123 + @ApiOperation(value = "Get Widget Bundles (getWidgetsBundles)",
  124 + notes = "Returns a page of Widget Bundle objects available for current user. " + WIDGET_BUNDLE_DESCRIPTION + " " +
  125 + PAGE_DATA_PARAMETERS + AVAILABLE_FOR_ANY_AUTHORIZED_USER)
100 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 126 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
101 @RequestMapping(value = "/widgetsBundles", params = {"pageSize", "page"}, method = RequestMethod.GET) 127 @RequestMapping(value = "/widgetsBundles", params = {"pageSize", "page"}, method = RequestMethod.GET)
102 @ResponseBody 128 @ResponseBody
103 public PageData<WidgetsBundle> getWidgetsBundles( 129 public PageData<WidgetsBundle> getWidgetsBundles(
  130 + @ApiParam(value = PAGE_SIZE_DESCRIPTION, required = true)
104 @RequestParam int pageSize, 131 @RequestParam int pageSize,
  132 + @ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true)
105 @RequestParam int page, 133 @RequestParam int page,
  134 + @ApiParam(value = WIDGET_BUNDLE_TEXT_SEARCH_DESCRIPTION)
106 @RequestParam(required = false) String textSearch, 135 @RequestParam(required = false) String textSearch,
  136 + @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = WIDGET_BUNDLE_SORT_PROPERTY_ALLOWABLE_VALUES)
107 @RequestParam(required = false) String sortProperty, 137 @RequestParam(required = false) String sortProperty,
  138 + @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES)
108 @RequestParam(required = false) String sortOrder) throws ThingsboardException { 139 @RequestParam(required = false) String sortOrder) throws ThingsboardException {
109 try { 140 try {
110 PageLink pageLink = createPageLink(pageSize, page, textSearch, sortProperty, sortOrder); 141 PageLink pageLink = createPageLink(pageSize, page, textSearch, sortProperty, sortOrder);
@@ -119,6 +150,8 @@ public class WidgetsBundleController extends BaseController { @@ -119,6 +150,8 @@ public class WidgetsBundleController extends BaseController {
119 } 150 }
120 } 151 }
121 152
  153 + @ApiOperation(value = "Get all Widget Bundles (getWidgetsBundles)",
  154 + notes = "Returns an array of Widget Bundle objects that are available for current user." + WIDGET_BUNDLE_DESCRIPTION + " " + AVAILABLE_FOR_ANY_AUTHORIZED_USER)
122 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 155 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
123 @RequestMapping(value = "/widgetsBundles", method = RequestMethod.GET) 156 @RequestMapping(value = "/widgetsBundles", method = RequestMethod.GET)
124 @ResponseBody 157 @ResponseBody
@@ -15,6 +15,10 @@ @@ -15,6 +15,10 @@
15 */ 15 */
16 package org.thingsboard.server.service.telemetry; 16 package org.thingsboard.server.service.telemetry;
17 17
  18 +import io.swagger.annotations.ApiModel;
  19 +import io.swagger.annotations.ApiModelProperty;
  20 +
  21 +@ApiModel
18 public class AttributeData implements Comparable<AttributeData>{ 22 public class AttributeData implements Comparable<AttributeData>{
19 23
20 private final long lastUpdateTs; 24 private final long lastUpdateTs;
@@ -28,14 +32,17 @@ public class AttributeData implements Comparable<AttributeData>{ @@ -28,14 +32,17 @@ public class AttributeData implements Comparable<AttributeData>{
28 this.value = value; 32 this.value = value;
29 } 33 }
30 34
  35 + @ApiModelProperty(position = 1, value = "Timestamp last updated attribute, in milliseconds", example = "1609459200000", readOnly = true)
31 public long getLastUpdateTs() { 36 public long getLastUpdateTs() {
32 return lastUpdateTs; 37 return lastUpdateTs;
33 } 38 }
34 39
  40 + @ApiModelProperty(position = 2, value = "String representing attribute key", example = "active", readOnly = true)
35 public String getKey() { 41 public String getKey() {
36 return key; 42 return key;
37 } 43 }
38 44
  45 + @ApiModelProperty(position = 3, value = "Object representing value of attribute key", example = "false", readOnly = true)
39 public Object getValue() { 46 public Object getValue() {
40 return value; 47 return value;
41 } 48 }
@@ -15,6 +15,10 @@ @@ -15,6 +15,10 @@
15 */ 15 */
16 package org.thingsboard.server.service.telemetry; 16 package org.thingsboard.server.service.telemetry;
17 17
  18 +import io.swagger.annotations.ApiModel;
  19 +import io.swagger.annotations.ApiModelProperty;
  20 +
  21 +@ApiModel
18 public class TsData implements Comparable<TsData>{ 22 public class TsData implements Comparable<TsData>{
19 23
20 private final long ts; 24 private final long ts;
@@ -26,10 +30,12 @@ public class TsData implements Comparable<TsData>{ @@ -26,10 +30,12 @@ public class TsData implements Comparable<TsData>{
26 this.value = value; 30 this.value = value;
27 } 31 }
28 32
  33 + @ApiModelProperty(position = 1, value = "Timestamp last updated timeseries, in milliseconds", example = "1609459200000", readOnly = true)
29 public long getTs() { 34 public long getTs() {
30 return ts; 35 return ts;
31 } 36 }
32 37
  38 + @ApiModelProperty(position = 2, value = "Object representing value of timeseries key", example = "20", readOnly = true)
33 public Object getValue() { 39 public Object getValue() {
34 return value; 40 return value;
35 } 41 }
@@ -15,6 +15,7 @@ @@ -15,6 +15,7 @@
15 */ 15 */
16 package org.thingsboard.server.common.data.widget; 16 package org.thingsboard.server.common.data.widget;
17 17
  18 +import io.swagger.annotations.ApiModelProperty;
18 import lombok.Data; 19 import lombok.Data;
19 import org.thingsboard.server.common.data.BaseData; 20 import org.thingsboard.server.common.data.BaseData;
20 import org.thingsboard.server.common.data.HasTenantId; 21 import org.thingsboard.server.common.data.HasTenantId;
@@ -27,12 +28,16 @@ public class BaseWidgetType extends BaseData<WidgetTypeId> implements HasTenantI @@ -27,12 +28,16 @@ public class BaseWidgetType extends BaseData<WidgetTypeId> implements HasTenantI
27 28
28 private static final long serialVersionUID = 8388684344603660756L; 29 private static final long serialVersionUID = 8388684344603660756L;
29 30
  31 + @ApiModelProperty(position = 3, value = "JSON object with Tenant Id.", readOnly = true)
30 private TenantId tenantId; 32 private TenantId tenantId;
31 @NoXss 33 @NoXss
  34 + @ApiModelProperty(position = 4, value = "Reference to widget bundle", readOnly = true)
32 private String bundleAlias; 35 private String bundleAlias;
33 @NoXss 36 @NoXss
  37 + @ApiModelProperty(position = 5, value = "Unique alias that is used in dashboards as a reference widget type", readOnly = true)
34 private String alias; 38 private String alias;
35 @NoXss 39 @NoXss
  40 + @ApiModelProperty(position = 6, value = "Widget name used in search and UI", readOnly = true)
36 private String name; 41 private String name;
37 42
38 public BaseWidgetType() { 43 public BaseWidgetType() {
@@ -50,4 +55,19 @@ public class BaseWidgetType extends BaseData<WidgetTypeId> implements HasTenantI @@ -50,4 +55,19 @@ public class BaseWidgetType extends BaseData<WidgetTypeId> implements HasTenantI
50 this.alias = widgetType.getAlias(); 55 this.alias = widgetType.getAlias();
51 this.name = widgetType.getName(); 56 this.name = widgetType.getName();
52 } 57 }
  58 +
  59 + @ApiModelProperty(position = 1, value = "JSON object with the Widget Type Id. " +
  60 + "Specify this field to update the Widget Type. " +
  61 + "Referencing non-existing Widget Type Id will cause error. " +
  62 + "Omit this field to create new Widget Type." )
  63 + @Override
  64 + public WidgetTypeId getId() {
  65 + return super.getId();
  66 + }
  67 +
  68 + @ApiModelProperty(position = 2, value = "Timestamp of the Widget Type creation, in milliseconds", example = "1609459200000", readOnly = true)
  69 + @Override
  70 + public long getCreatedTime() {
  71 + return super.getCreatedTime();
  72 + }
53 } 73 }
@@ -16,12 +16,14 @@ @@ -16,12 +16,14 @@
16 package org.thingsboard.server.common.data.widget; 16 package org.thingsboard.server.common.data.widget;
17 17
18 import com.fasterxml.jackson.databind.JsonNode; 18 import com.fasterxml.jackson.databind.JsonNode;
  19 +import io.swagger.annotations.ApiModelProperty;
19 import lombok.Data; 20 import lombok.Data;
20 import org.thingsboard.server.common.data.id.WidgetTypeId; 21 import org.thingsboard.server.common.data.id.WidgetTypeId;
21 22
22 @Data 23 @Data
23 public class WidgetType extends BaseWidgetType { 24 public class WidgetType extends BaseWidgetType {
24 25
  26 + @ApiModelProperty(position = 7, value = "Complex JSON object that describes the widget type", readOnly = true)
25 private transient JsonNode descriptor; 27 private transient JsonNode descriptor;
26 28
27 public WidgetType() { 29 public WidgetType() {
@@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
16 package org.thingsboard.server.common.data.widget; 16 package org.thingsboard.server.common.data.widget;
17 17
18 import com.fasterxml.jackson.annotation.JsonPropertyOrder; 18 import com.fasterxml.jackson.annotation.JsonPropertyOrder;
  19 +import io.swagger.annotations.ApiModelProperty;
19 import lombok.Data; 20 import lombok.Data;
20 import org.thingsboard.server.common.data.id.WidgetTypeId; 21 import org.thingsboard.server.common.data.id.WidgetTypeId;
21 import org.thingsboard.server.common.data.validation.NoXss; 22 import org.thingsboard.server.common.data.validation.NoXss;
@@ -24,8 +25,10 @@ import org.thingsboard.server.common.data.validation.NoXss; @@ -24,8 +25,10 @@ import org.thingsboard.server.common.data.validation.NoXss;
24 @JsonPropertyOrder({ "alias", "name", "image", "description", "descriptor" }) 25 @JsonPropertyOrder({ "alias", "name", "image", "description", "descriptor" })
25 public class WidgetTypeDetails extends WidgetType { 26 public class WidgetTypeDetails extends WidgetType {
26 27
  28 + @ApiModelProperty(position = 8, value = "Base64 encoded thumbnail", readOnly = true)
27 private String image; 29 private String image;
28 @NoXss 30 @NoXss
  31 + @ApiModelProperty(position = 9, value = "Description of the widget", readOnly = true)
29 private String description; 32 private String description;
30 33
31 public WidgetTypeDetails() { 34 public WidgetTypeDetails() {
@@ -15,6 +15,7 @@ @@ -15,6 +15,7 @@
15 */ 15 */
16 package org.thingsboard.server.common.data.widget; 16 package org.thingsboard.server.common.data.widget;
17 17
  18 +import io.swagger.annotations.ApiModelProperty;
18 import lombok.Data; 19 import lombok.Data;
19 import org.thingsboard.server.common.data.id.WidgetTypeId; 20 import org.thingsboard.server.common.data.id.WidgetTypeId;
20 import org.thingsboard.server.common.data.validation.NoXss; 21 import org.thingsboard.server.common.data.validation.NoXss;
@@ -22,10 +23,13 @@ import org.thingsboard.server.common.data.validation.NoXss; @@ -22,10 +23,13 @@ import org.thingsboard.server.common.data.validation.NoXss;
22 @Data 23 @Data
23 public class WidgetTypeInfo extends BaseWidgetType { 24 public class WidgetTypeInfo extends BaseWidgetType {
24 25
  26 + @ApiModelProperty(position = 7, value = "Base64 encoded widget thumbnail", readOnly = true)
25 private String image; 27 private String image;
26 @NoXss 28 @NoXss
  29 + @ApiModelProperty(position = 7, value = "Description of the widget type", readOnly = true)
27 private String description; 30 private String description;
28 @NoXss 31 @NoXss
  32 + @ApiModelProperty(position = 8, value = "Type of the widget (timeseries, latest, control, alarm or static)", readOnly = true)
29 private String widgetType; 33 private String widgetType;
30 34
31 public WidgetTypeInfo() { 35 public WidgetTypeInfo() {
@@ -15,6 +15,10 @@ @@ -15,6 +15,10 @@
15 */ 15 */
16 package org.thingsboard.server.common.data.widget; 16 package org.thingsboard.server.common.data.widget;
17 17
  18 +import io.swagger.annotations.ApiModel;
  19 +import io.swagger.annotations.ApiModelProperty;
  20 +import lombok.Getter;
  21 +import lombok.Setter;
18 import org.thingsboard.server.common.data.HasTenantId; 22 import org.thingsboard.server.common.data.HasTenantId;
19 import org.thingsboard.server.common.data.SearchTextBased; 23 import org.thingsboard.server.common.data.SearchTextBased;
20 import org.thingsboard.server.common.data.id.TenantId; 24 import org.thingsboard.server.common.data.id.TenantId;
@@ -23,17 +27,37 @@ import org.thingsboard.server.common.data.validation.NoXss; @@ -23,17 +27,37 @@ import org.thingsboard.server.common.data.validation.NoXss;
23 27
24 import java.util.Arrays; 28 import java.util.Arrays;
25 29
  30 +@ApiModel
26 public class WidgetsBundle extends SearchTextBased<WidgetsBundleId> implements HasTenantId { 31 public class WidgetsBundle extends SearchTextBased<WidgetsBundleId> implements HasTenantId {
27 32
28 private static final long serialVersionUID = -7627368878362410489L; 33 private static final long serialVersionUID = -7627368878362410489L;
29 34
  35 + @Getter
  36 + @Setter
  37 + @ApiModelProperty(position = 3, value = "JSON object with Tenant Id.", readOnly = true)
30 private TenantId tenantId; 38 private TenantId tenantId;
  39 +
31 @NoXss 40 @NoXss
  41 + @Getter
  42 + @Setter
  43 + @ApiModelProperty(position = 4, value = "Unique alias that is used in widget types as a reference widget bundle", readOnly = true)
32 private String alias; 44 private String alias;
  45 +
33 @NoXss 46 @NoXss
  47 + @Getter
  48 + @Setter
  49 + @ApiModelProperty(position = 5, value = "Title used in search and UI", readOnly = true)
34 private String title; 50 private String title;
  51 +
  52 + @Getter
  53 + @Setter
  54 + @ApiModelProperty(position = 6, value = "Base64 encoded thumbnail", readOnly = true)
35 private String image; 55 private String image;
  56 +
36 @NoXss 57 @NoXss
  58 + @Getter
  59 + @Setter
  60 + @ApiModelProperty(position = 7, value = "Description", readOnly = true)
37 private String description; 61 private String description;
38 62
39 public WidgetsBundle() { 63 public WidgetsBundle() {
@@ -53,42 +77,21 @@ public class WidgetsBundle extends SearchTextBased<WidgetsBundleId> implements H @@ -53,42 +77,21 @@ public class WidgetsBundle extends SearchTextBased<WidgetsBundleId> implements H
53 this.description = widgetsBundle.getDescription(); 77 this.description = widgetsBundle.getDescription();
54 } 78 }
55 79
56 - public TenantId getTenantId() {  
57 - return tenantId;  
58 - }  
59 -  
60 - public void setTenantId(TenantId tenantId) {  
61 - this.tenantId = tenantId;  
62 - }  
63 -  
64 - public String getAlias() {  
65 - return alias;  
66 - }  
67 -  
68 - public void setAlias(String alias) {  
69 - this.alias = alias;  
70 - }  
71 -  
72 - public String getTitle() {  
73 - return title;  
74 - }  
75 -  
76 - public void setTitle(String title) {  
77 - this.title = title;  
78 - }  
79 -  
80 - public String getImage() {  
81 - return image; 80 + @ApiModelProperty(position = 1, value = "JSON object with the Widget Bundle Id. " +
  81 + "Specify this field to update the Widget Bundle. " +
  82 + "Referencing non-existing Widget Bundle Id will cause error. " +
  83 + "Omit this field to create new Widget Bundle." )
  84 + @Override
  85 + public WidgetsBundleId getId() {
  86 + return super.getId();
82 } 87 }
83 88
84 - public void setImage(String image) {  
85 - this.image = image; 89 + @ApiModelProperty(position = 2, value = "Timestamp of the Widget Bundle creation, in milliseconds", example = "1609459200000", readOnly = true)
  90 + @Override
  91 + public long getCreatedTime() {
  92 + return super.getCreatedTime();
86 } 93 }
87 94
88 - public String getDescription() { return description; }  
89 -  
90 - public void setDescription(String description) { this.description = description; }  
91 -  
92 @Override 95 @Override
93 public String getSearchText() { 96 public String getSearchText() {
94 return getTitle(); 97 return getTitle();