Commit 626437117de2d6b01fb4f32f4a733682ca00be11
1 parent
318dc282
Added required config. Added produces config
Showing
3 changed files
with
75 additions
and
56 deletions
... | ... | @@ -194,12 +194,14 @@ public abstract class BaseController { |
194 | 194 | protected final String ASSET_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, name, type, label, customerTitle"; |
195 | 195 | protected final String ALARM_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, startTs, endTs, type, ackTs, clearTs, severity, status"; |
196 | 196 | protected final String EVENT_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, id"; |
197 | + protected final String EDGE_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, name, type, label, customerTitle"; | |
197 | 198 | protected final String SORT_ORDER_DESCRIPTION = "Sort order. ASC (ASCENDING) or DESC (DESCENDING)"; |
198 | 199 | protected final String SORT_ORDER_ALLOWABLE_VALUES = "ASC, DESC"; |
199 | 200 | protected final String DEVICE_INFO_DESCRIPTION = "Device Info is an extension of the default Device object that contains information about the assigned customer name and device profile name. "; |
200 | 201 | protected final String ASSET_INFO_DESCRIPTION = "Asset Info is an extension of the default Asset object that contains information about the assigned customer name. "; |
201 | 202 | protected final String ALARM_INFO_DESCRIPTION = "Alarm Info is an extension of the default Alarm object that also contains name of the alarm originator."; |
202 | 203 | protected final String RELATION_INFO_DESCRIPTION = "Relation Info is an extension of the default Relation object that contains information about the 'from' and 'to' entity names. "; |
204 | + protected final String EDGE_INFO_DESCRIPTION = "Edge Info is an extension of the default Edge object that contains information about the assigned customer name. "; | |
203 | 205 | |
204 | 206 | protected final String DEVICE_NAME_DESCRIPTION = "A string value representing the Device name."; |
205 | 207 | protected final String ASSET_NAME_DESCRIPTION = "A string value representing the Asset name."; | ... | ... |
... | ... | @@ -22,6 +22,7 @@ import io.swagger.annotations.ApiParam; |
22 | 22 | import lombok.RequiredArgsConstructor; |
23 | 23 | import lombok.extern.slf4j.Slf4j; |
24 | 24 | import org.springframework.http.HttpStatus; |
25 | +import org.springframework.http.MediaType; | |
25 | 26 | import org.springframework.http.ResponseEntity; |
26 | 27 | import org.springframework.security.access.prepost.PreAuthorize; |
27 | 28 | import org.springframework.web.bind.annotation.PathVariable; |
... | ... | @@ -90,11 +91,12 @@ public class EdgeController extends BaseController { |
90 | 91 | } |
91 | 92 | |
92 | 93 | @ApiOperation(value = "Get Edge (getEdgeById)", |
93 | - 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, | |
95 | + produces = MediaType.APPLICATION_JSON_VALUE) | |
94 | 96 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") |
95 | 97 | @RequestMapping(value = "/edge/{edgeId}", method = RequestMethod.GET) |
96 | 98 | @ResponseBody |
97 | - public Edge getEdgeById(@ApiParam(value = EDGE_ID_PARAM_DESCRIPTION) | |
99 | + public Edge getEdgeById(@ApiParam(value = EDGE_ID_PARAM_DESCRIPTION, required = true) | |
98 | 100 | @PathVariable(EDGE_ID) String strEdgeId) throws ThingsboardException { |
99 | 101 | checkParameter(EDGE_ID, strEdgeId); |
100 | 102 | try { |
... | ... | @@ -110,11 +112,12 @@ public class EdgeController extends BaseController { |
110 | 112 | } |
111 | 113 | |
112 | 114 | @ApiOperation(value = "Get Edge Info (getEdgeInfoById)", |
113 | - 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, | |
116 | + produces = MediaType.APPLICATION_JSON_VALUE) | |
114 | 117 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") |
115 | 118 | @RequestMapping(value = "/edge/info/{edgeId}", method = RequestMethod.GET) |
116 | 119 | @ResponseBody |
117 | - public EdgeInfo getEdgeInfoById(@ApiParam(value = EDGE_ID_PARAM_DESCRIPTION) | |
120 | + public EdgeInfo getEdgeInfoById(@ApiParam(value = EDGE_ID_PARAM_DESCRIPTION, required = true) | |
118 | 121 | @PathVariable(EDGE_ID) String strEdgeId) throws ThingsboardException { |
119 | 122 | checkParameter(EDGE_ID, strEdgeId); |
120 | 123 | try { |
... | ... | @@ -130,13 +133,16 @@ public class EdgeController extends BaseController { |
130 | 133 | } |
131 | 134 | |
132 | 135 | @ApiOperation(value = "Create Or Update Edge (saveEdge)", |
133 | - notes = "Creates or Updates the Edge. Platform generates random Edge Id during edge creation. " + | |
134 | - "The edge id will be present in the response. " + | |
135 | - "Specify the Edge id when you would like to update the edge. Referencing non-existing edge Id will cause an error.") | |
136 | + notes = "Create or update the Edge. When creating edge, platform generates Edge Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address). " + | |
137 | + "The newly created edge id will be present in the response. " + | |
138 | + "Specify existing Edge id to update the edge. " + | |
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.", | |
141 | + produces = MediaType.APPLICATION_JSON_VALUE) | |
136 | 142 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") |
137 | 143 | @RequestMapping(value = "/edge", method = RequestMethod.POST) |
138 | 144 | @ResponseBody |
139 | - public Edge saveEdge(@ApiParam(value = "A JSON value representing the ed.") | |
145 | + public Edge saveEdge(@ApiParam(value = "A JSON value representing the ed.", required = true) | |
140 | 146 | @RequestBody Edge edge) throws ThingsboardException { |
141 | 147 | try { |
142 | 148 | TenantId tenantId = getCurrentUser().getTenantId(); |
... | ... | @@ -185,7 +191,7 @@ public class EdgeController extends BaseController { |
185 | 191 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") |
186 | 192 | @RequestMapping(value = "/edge/{edgeId}", method = RequestMethod.DELETE) |
187 | 193 | @ResponseStatus(value = HttpStatus.OK) |
188 | - public void deleteEdge(@ApiParam(value = EDGE_ID_PARAM_DESCRIPTION) | |
194 | + public void deleteEdge(@ApiParam(value = EDGE_ID_PARAM_DESCRIPTION, required = true) | |
189 | 195 | @PathVariable(EDGE_ID) String strEdgeId) throws ThingsboardException { |
190 | 196 | checkParameter(EDGE_ID, strEdgeId); |
191 | 197 | try { |
... | ... | @@ -213,17 +219,17 @@ public class EdgeController extends BaseController { |
213 | 219 | |
214 | 220 | @ApiOperation(value = "Get Tenant Edges (getEdges)", |
215 | 221 | notes = "Returns a page of edges owned by tenant. " + |
216 | - PAGE_DATA_PARAMETERS) | |
222 | + PAGE_DATA_PARAMETERS, produces = MediaType.APPLICATION_JSON_VALUE) | |
217 | 223 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") |
218 | 224 | @RequestMapping(value = "/edges", params = {"pageSize", "page"}, method = RequestMethod.GET) |
219 | 225 | @ResponseBody |
220 | - public PageData<Edge> getEdges(@ApiParam(value = PAGE_SIZE_DESCRIPTION) | |
226 | + public PageData<Edge> getEdges(@ApiParam(value = PAGE_SIZE_DESCRIPTION, required = true) | |
221 | 227 | @RequestParam int pageSize, |
222 | - @ApiParam(value = PAGE_NUMBER_DESCRIPTION) | |
228 | + @ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true) | |
223 | 229 | @RequestParam int page, |
224 | 230 | @ApiParam(value = EDGE_TEXT_SEARCH_DESCRIPTION) |
225 | 231 | @RequestParam(required = false) String textSearch, |
226 | - @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = SORT_PROPERTY_ALLOWABLE_VALUES) | |
232 | + @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = EDGE_SORT_PROPERTY_ALLOWABLE_VALUES) | |
227 | 233 | @RequestParam(required = false) String sortProperty, |
228 | 234 | @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES) |
229 | 235 | @RequestParam(required = false) String sortOrder) throws ThingsboardException { |
... | ... | @@ -237,13 +243,14 @@ public class EdgeController extends BaseController { |
237 | 243 | } |
238 | 244 | |
239 | 245 | @ApiOperation(value = "Assign edge to customer (assignEdgeToCustomer)", |
240 | - notes = "Creates assignment of the edge to customer. Customer will be able to query edge afterwards.") | |
246 | + notes = "Creates assignment of the edge to customer. Customer will be able to query edge afterwards.", | |
247 | + produces = MediaType.APPLICATION_JSON_VALUE) | |
241 | 248 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") |
242 | 249 | @RequestMapping(value = "/customer/{customerId}/edge/{edgeId}", method = RequestMethod.POST) |
243 | 250 | @ResponseBody |
244 | - public Edge assignEdgeToCustomer(@ApiParam(value = CUSTOMER_ID_PARAM_DESCRIPTION) | |
251 | + public Edge assignEdgeToCustomer(@ApiParam(value = CUSTOMER_ID_PARAM_DESCRIPTION, required = true) | |
245 | 252 | @PathVariable("customerId") String strCustomerId, |
246 | - @ApiParam(value = EDGE_ID_PARAM_DESCRIPTION) | |
253 | + @ApiParam(value = EDGE_ID_PARAM_DESCRIPTION, required = true) | |
247 | 254 | @PathVariable(EDGE_ID) String strEdgeId) throws ThingsboardException { |
248 | 255 | checkParameter("customerId", strCustomerId); |
249 | 256 | checkParameter(EDGE_ID, strEdgeId); |
... | ... | @@ -276,11 +283,12 @@ public class EdgeController extends BaseController { |
276 | 283 | } |
277 | 284 | |
278 | 285 | @ApiOperation(value = "Unassign edge from customer (unassignEdgeFromCustomer)", |
279 | - notes = "Clears assignment of the edge to customer. Customer will not be able to query edge afterwards.") | |
286 | + notes = "Clears assignment of the edge to customer. Customer will not be able to query edge afterwards.", | |
287 | + produces = MediaType.APPLICATION_JSON_VALUE) | |
280 | 288 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") |
281 | 289 | @RequestMapping(value = "/customer/edge/{edgeId}", method = RequestMethod.DELETE) |
282 | 290 | @ResponseBody |
283 | - public Edge unassignEdgeFromCustomer(@ApiParam(value = EDGE_ID_PARAM_DESCRIPTION) | |
291 | + public Edge unassignEdgeFromCustomer(@ApiParam(value = EDGE_ID_PARAM_DESCRIPTION, required = true) | |
284 | 292 | @PathVariable(EDGE_ID) String strEdgeId) throws ThingsboardException { |
285 | 293 | checkParameter(EDGE_ID, strEdgeId); |
286 | 294 | try { |
... | ... | @@ -315,11 +323,12 @@ public class EdgeController extends BaseController { |
315 | 323 | @ApiOperation(value = "Make edge publicly available (assignEdgeToPublicCustomer)", |
316 | 324 | notes = "Edge will be available for non-authorized (not logged-in) users. " + |
317 | 325 | "This is useful to create dashboards that you plan to share/embed on a publicly available website. " + |
318 | - "However, users that are logged-in and belong to different tenant will not be able to access the edge.") | |
326 | + "However, users that are logged-in and belong to different tenant will not be able to access the edge.", | |
327 | + produces = MediaType.APPLICATION_JSON_VALUE) | |
319 | 328 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") |
320 | 329 | @RequestMapping(value = "/customer/public/edge/{edgeId}", method = RequestMethod.POST) |
321 | 330 | @ResponseBody |
322 | - public Edge assignEdgeToPublicCustomer(@ApiParam(value = EDGE_ID_PARAM_DESCRIPTION) | |
331 | + public Edge assignEdgeToPublicCustomer(@ApiParam(value = EDGE_ID_PARAM_DESCRIPTION, required = true) | |
323 | 332 | @PathVariable(EDGE_ID) String strEdgeId) throws ThingsboardException { |
324 | 333 | checkParameter(EDGE_ID, strEdgeId); |
325 | 334 | try { |
... | ... | @@ -346,20 +355,20 @@ public class EdgeController extends BaseController { |
346 | 355 | |
347 | 356 | @ApiOperation(value = "Get Tenant Edges (getTenantEdges)", |
348 | 357 | notes = "Returns a page of edges owned by tenant. " + |
349 | - PAGE_DATA_PARAMETERS) | |
358 | + PAGE_DATA_PARAMETERS, produces = MediaType.APPLICATION_JSON_VALUE) | |
350 | 359 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") |
351 | 360 | @RequestMapping(value = "/tenant/edges", params = {"pageSize", "page"}, method = RequestMethod.GET) |
352 | 361 | @ResponseBody |
353 | 362 | public PageData<Edge> getTenantEdges( |
354 | - @ApiParam(value = PAGE_SIZE_DESCRIPTION) | |
363 | + @ApiParam(value = PAGE_SIZE_DESCRIPTION, required = true) | |
355 | 364 | @RequestParam int pageSize, |
356 | - @ApiParam(value = PAGE_NUMBER_DESCRIPTION) | |
365 | + @ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true) | |
357 | 366 | @RequestParam int page, |
358 | 367 | @ApiParam(value = EDGE_TYPE_DESCRIPTION) |
359 | 368 | @RequestParam(required = false) String type, |
360 | 369 | @ApiParam(value = EDGE_TEXT_SEARCH_DESCRIPTION) |
361 | 370 | @RequestParam(required = false) String textSearch, |
362 | - @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = SORT_PROPERTY_ALLOWABLE_VALUES) | |
371 | + @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = EDGE_SORT_PROPERTY_ALLOWABLE_VALUES) | |
363 | 372 | @RequestParam(required = false) String sortProperty, |
364 | 373 | @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES) |
365 | 374 | @RequestParam(required = false) String sortOrder) throws ThingsboardException { |
... | ... | @@ -378,20 +387,21 @@ public class EdgeController extends BaseController { |
378 | 387 | |
379 | 388 | @ApiOperation(value = "Get Tenant Edge Infos (getTenantEdgeInfos)", |
380 | 389 | notes = "Returns a page of edges info objects owned by tenant. " + |
381 | - PAGE_DATA_PARAMETERS + DEVICE_INFO_DESCRIPTION) | |
390 | + PAGE_DATA_PARAMETERS + EDGE_INFO_DESCRIPTION, | |
391 | + produces = MediaType.APPLICATION_JSON_VALUE) | |
382 | 392 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") |
383 | 393 | @RequestMapping(value = "/tenant/edgeInfos", params = {"pageSize", "page"}, method = RequestMethod.GET) |
384 | 394 | @ResponseBody |
385 | 395 | public PageData<EdgeInfo> getTenantEdgeInfos( |
386 | - @ApiParam(value = PAGE_SIZE_DESCRIPTION) | |
396 | + @ApiParam(value = PAGE_SIZE_DESCRIPTION, required = true) | |
387 | 397 | @RequestParam int pageSize, |
388 | - @ApiParam(value = PAGE_NUMBER_DESCRIPTION) | |
398 | + @ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true) | |
389 | 399 | @RequestParam int page, |
390 | 400 | @ApiParam(value = EDGE_TYPE_DESCRIPTION) |
391 | 401 | @RequestParam(required = false) String type, |
392 | 402 | @ApiParam(value = EDGE_TEXT_SEARCH_DESCRIPTION) |
393 | 403 | @RequestParam(required = false) String textSearch, |
394 | - @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = SORT_PROPERTY_ALLOWABLE_VALUES) | |
404 | + @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = EDGE_SORT_PROPERTY_ALLOWABLE_VALUES) | |
395 | 405 | @RequestParam(required = false) String sortProperty, |
396 | 406 | @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES) |
397 | 407 | @RequestParam(required = false) String sortOrder) throws ThingsboardException { |
... | ... | @@ -410,11 +420,12 @@ public class EdgeController extends BaseController { |
410 | 420 | |
411 | 421 | @ApiOperation(value = "Get Tenant Edge (getTenantEdge)", |
412 | 422 | notes = "Requested edge must be owned by tenant or customer that the user belongs to. " + |
413 | - "Edge name is an unique property of edge. So it can be used to identify the edge.") | |
423 | + "Edge name is an unique property of edge. So it can be used to identify the edge.", | |
424 | + produces = MediaType.APPLICATION_JSON_VALUE) | |
414 | 425 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") |
415 | 426 | @RequestMapping(value = "/tenant/edges", params = {"edgeName"}, method = RequestMethod.GET) |
416 | 427 | @ResponseBody |
417 | - public Edge getTenantEdge(@ApiParam(value = "Unique name of the edge") | |
428 | + public Edge getTenantEdge(@ApiParam(value = "Unique name of the edge", required = true) | |
418 | 429 | @RequestParam String edgeName) throws ThingsboardException { |
419 | 430 | try { |
420 | 431 | TenantId tenantId = getCurrentUser().getTenantId(); |
... | ... | @@ -425,14 +436,15 @@ public class EdgeController extends BaseController { |
425 | 436 | } |
426 | 437 | |
427 | 438 | @ApiOperation(value = "Set root rule chain for provided edge (setRootRuleChain)", |
428 | - notes = "Change root rule chain of the edge from the current to the new provided rule chain. \n" + | |
429 | - "This operation will send a notification to remote edge service to update root rule chain remotely.") | |
439 | + 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 | + produces = MediaType.APPLICATION_JSON_VALUE) | |
430 | 442 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") |
431 | 443 | @RequestMapping(value = "/edge/{edgeId}/{ruleChainId}/root", method = RequestMethod.POST) |
432 | 444 | @ResponseBody |
433 | - public Edge setRootRuleChain(@ApiParam(value = EDGE_ID_PARAM_DESCRIPTION) | |
445 | + public Edge setRootRuleChain(@ApiParam(value = EDGE_ID_PARAM_DESCRIPTION, required = true) | |
434 | 446 | @PathVariable(EDGE_ID) String strEdgeId, |
435 | - @ApiParam(value = RULE_CHAIN_ID_PARAM_DESCRIPTION) | |
447 | + @ApiParam(value = RULE_CHAIN_ID_PARAM_DESCRIPTION, required = true) | |
436 | 448 | @PathVariable("ruleChainId") String strRuleChainId) throws ThingsboardException { |
437 | 449 | checkParameter(EDGE_ID, strEdgeId); |
438 | 450 | checkParameter("ruleChainId", strRuleChainId); |
... | ... | @@ -463,22 +475,22 @@ public class EdgeController extends BaseController { |
463 | 475 | |
464 | 476 | @ApiOperation(value = "Get Customer Edges (getCustomerEdges)", |
465 | 477 | notes = "Returns a page of edges objects assigned to customer. " + |
466 | - PAGE_DATA_PARAMETERS) | |
478 | + PAGE_DATA_PARAMETERS, produces = MediaType.APPLICATION_JSON_VALUE) | |
467 | 479 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") |
468 | 480 | @RequestMapping(value = "/customer/{customerId}/edges", params = {"pageSize", "page"}, method = RequestMethod.GET) |
469 | 481 | @ResponseBody |
470 | 482 | public PageData<Edge> getCustomerEdges( |
471 | 483 | @ApiParam(value = CUSTOMER_ID_PARAM_DESCRIPTION) |
472 | 484 | @PathVariable("customerId") String strCustomerId, |
473 | - @ApiParam(value = PAGE_SIZE_DESCRIPTION) | |
485 | + @ApiParam(value = PAGE_SIZE_DESCRIPTION, required = true) | |
474 | 486 | @RequestParam int pageSize, |
475 | - @ApiParam(value = PAGE_NUMBER_DESCRIPTION) | |
487 | + @ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true) | |
476 | 488 | @RequestParam int page, |
477 | 489 | @ApiParam(value = EDGE_TYPE_DESCRIPTION) |
478 | 490 | @RequestParam(required = false) String type, |
479 | 491 | @ApiParam(value = EDGE_TEXT_SEARCH_DESCRIPTION) |
480 | 492 | @RequestParam(required = false) String textSearch, |
481 | - @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = SORT_PROPERTY_ALLOWABLE_VALUES) | |
493 | + @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = EDGE_SORT_PROPERTY_ALLOWABLE_VALUES) | |
482 | 494 | @RequestParam(required = false) String sortProperty, |
483 | 495 | @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES) |
484 | 496 | @RequestParam(required = false) String sortOrder) throws ThingsboardException { |
... | ... | @@ -508,22 +520,22 @@ public class EdgeController extends BaseController { |
508 | 520 | |
509 | 521 | @ApiOperation(value = "Get Customer Edge Infos (getCustomerEdgeInfos)", |
510 | 522 | notes = "Returns a page of edges info objects assigned to customer. " + |
511 | - PAGE_DATA_PARAMETERS + DEVICE_INFO_DESCRIPTION) | |
523 | + PAGE_DATA_PARAMETERS + EDGE_INFO_DESCRIPTION, produces = MediaType.APPLICATION_JSON_VALUE) | |
512 | 524 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") |
513 | 525 | @RequestMapping(value = "/customer/{customerId}/edgeInfos", params = {"pageSize", "page"}, method = RequestMethod.GET) |
514 | 526 | @ResponseBody |
515 | 527 | public PageData<EdgeInfo> getCustomerEdgeInfos( |
516 | 528 | @ApiParam(value = CUSTOMER_ID_PARAM_DESCRIPTION) |
517 | 529 | @PathVariable("customerId") String strCustomerId, |
518 | - @ApiParam(value = PAGE_SIZE_DESCRIPTION) | |
530 | + @ApiParam(value = PAGE_SIZE_DESCRIPTION, required = true) | |
519 | 531 | @RequestParam int pageSize, |
520 | - @ApiParam(value = PAGE_NUMBER_DESCRIPTION) | |
532 | + @ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true) | |
521 | 533 | @RequestParam int page, |
522 | 534 | @ApiParam(value = EDGE_TYPE_DESCRIPTION) |
523 | 535 | @RequestParam(required = false) String type, |
524 | 536 | @ApiParam(value = EDGE_TEXT_SEARCH_DESCRIPTION) |
525 | 537 | @RequestParam(required = false) String textSearch, |
526 | - @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = SORT_PROPERTY_ALLOWABLE_VALUES) | |
538 | + @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = EDGE_SORT_PROPERTY_ALLOWABLE_VALUES) | |
527 | 539 | @RequestParam(required = false) String sortProperty, |
528 | 540 | @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES) |
529 | 541 | @RequestParam(required = false) String sortOrder) throws ThingsboardException { |
... | ... | @@ -552,12 +564,13 @@ public class EdgeController extends BaseController { |
552 | 564 | } |
553 | 565 | |
554 | 566 | @ApiOperation(value = "Get Edges By Ids (getEdgesByIds)", |
555 | - notes = "Requested edges must be owned by tenant or assigned to customer which user is performing the request. ") | |
567 | + notes = "Requested edges must be owned by tenant or assigned to customer which user is performing the request.", | |
568 | + produces = MediaType.APPLICATION_JSON_VALUE) | |
556 | 569 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") |
557 | 570 | @RequestMapping(value = "/edges", params = {"edgeIds"}, method = RequestMethod.GET) |
558 | 571 | @ResponseBody |
559 | 572 | public List<Edge> getEdgesByIds( |
560 | - @ApiParam(value = "A list of edges ids, separated by comma ','") | |
573 | + @ApiParam(value = "A list of edges ids, separated by comma ','", required = true) | |
561 | 574 | @RequestParam("edgeIds") String[] strEdgeIds) throws ThingsboardException { |
562 | 575 | checkArrayParameter("edgeIds", strEdgeIds); |
563 | 576 | try { |
... | ... | @@ -588,8 +601,9 @@ public class EdgeController extends BaseController { |
588 | 601 | |
589 | 602 | @ApiOperation(value = "Find related edges (findByQuery)", |
590 | 603 | notes = "Returns all edges that are related to the specific entity. " + |
591 | - "The entity id, relation type, device types, depth of the search, and other query parameters defined using complex 'EdgeSearchQuery' object. " + | |
592 | - "See 'Model' tab of the Parameters for more info.") | |
604 | + "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 | + produces = MediaType.APPLICATION_JSON_VALUE) | |
593 | 607 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") |
594 | 608 | @RequestMapping(value = "/edges", method = RequestMethod.POST) |
595 | 609 | @ResponseBody |
... | ... | @@ -622,7 +636,8 @@ public class EdgeController extends BaseController { |
622 | 636 | } |
623 | 637 | |
624 | 638 | @ApiOperation(value = "Get Edge Types (getEdgeTypes)", |
625 | - 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.") | |
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 | + produces = MediaType.APPLICATION_JSON_VALUE) | |
626 | 641 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") |
627 | 642 | @RequestMapping(value = "/edge/types", method = RequestMethod.GET) |
628 | 643 | @ResponseBody |
... | ... | @@ -642,7 +657,7 @@ public class EdgeController extends BaseController { |
642 | 657 | "All entities that are assigned to particular edge are going to be send to remote edge service.") |
643 | 658 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") |
644 | 659 | @RequestMapping(value = "/edge/sync/{edgeId}", method = RequestMethod.POST) |
645 | - public void syncEdge(@ApiParam(value = EDGE_ID_PARAM_DESCRIPTION) | |
660 | + public void syncEdge(@ApiParam(value = EDGE_ID_PARAM_DESCRIPTION, required = true) | |
646 | 661 | @PathVariable("edgeId") String strEdgeId) throws ThingsboardException { |
647 | 662 | checkParameter("edgeId", strEdgeId); |
648 | 663 | try { |
... | ... | @@ -661,11 +676,11 @@ public class EdgeController extends BaseController { |
661 | 676 | } |
662 | 677 | |
663 | 678 | @ApiOperation(value = "Find missing rule chains (findMissingToRelatedRuleChains)", |
664 | - 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") | |
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.") | |
665 | 680 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") |
666 | 681 | @RequestMapping(value = "/edge/missingToRelatedRuleChains/{edgeId}", method = RequestMethod.GET) |
667 | 682 | @ResponseBody |
668 | - public String findMissingToRelatedRuleChains(@ApiParam(value = EDGE_ID_PARAM_DESCRIPTION) | |
683 | + public String findMissingToRelatedRuleChains(@ApiParam(value = EDGE_ID_PARAM_DESCRIPTION, required = true) | |
669 | 684 | @PathVariable("edgeId") String strEdgeId) throws ThingsboardException { |
670 | 685 | try { |
671 | 686 | EdgeId edgeId = new EdgeId(toUUID(strEdgeId)); |
... | ... | @@ -679,7 +694,8 @@ public class EdgeController extends BaseController { |
679 | 694 | } |
680 | 695 | |
681 | 696 | @ApiOperation(value = "Import the bulk of edges (processEdgesBulkImport)", |
682 | - notes = "There's an ability to import the bulk of edges using the only .csv file.") | |
697 | + notes = "There's an ability to import the bulk of edges using the only .csv file.", | |
698 | + produces = MediaType.APPLICATION_JSON_VALUE) | |
683 | 699 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") |
684 | 700 | @PostMapping("/edge/bulk_import") |
685 | 701 | public BulkImportResult<Edge> processEdgesBulkImport(@RequestBody BulkImportRequest request) throws Exception { | ... | ... |
... | ... | @@ -19,6 +19,7 @@ import io.swagger.annotations.ApiOperation; |
19 | 19 | import io.swagger.annotations.ApiParam; |
20 | 20 | import lombok.extern.slf4j.Slf4j; |
21 | 21 | import org.springframework.beans.factory.annotation.Autowired; |
22 | +import org.springframework.http.MediaType; | |
22 | 23 | import org.springframework.security.access.prepost.PreAuthorize; |
23 | 24 | import org.springframework.web.bind.annotation.PathVariable; |
24 | 25 | import org.springframework.web.bind.annotation.RequestMapping; |
... | ... | @@ -49,20 +50,20 @@ public class EdgeEventController extends BaseController { |
49 | 50 | |
50 | 51 | @ApiOperation(value = "Get Edge Events (getEdgeEvents)", |
51 | 52 | notes = "Returns a page of edge events for the requested edge. " + |
52 | - PAGE_DATA_PARAMETERS) | |
53 | + PAGE_DATA_PARAMETERS, produces = MediaType.APPLICATION_JSON_VALUE) | |
53 | 54 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") |
54 | 55 | @RequestMapping(value = "/edge/{edgeId}/events", method = RequestMethod.GET) |
55 | 56 | @ResponseBody |
56 | 57 | public PageData<EdgeEvent> getEdgeEvents( |
57 | - @ApiParam(value = EDGE_ID_PARAM_DESCRIPTION) | |
58 | + @ApiParam(value = EDGE_ID_PARAM_DESCRIPTION, required = true) | |
58 | 59 | @PathVariable(EDGE_ID) String strEdgeId, |
59 | - @ApiParam(value = PAGE_SIZE_DESCRIPTION) | |
60 | + @ApiParam(value = PAGE_SIZE_DESCRIPTION, required = true) | |
60 | 61 | @RequestParam int pageSize, |
61 | - @ApiParam(value = PAGE_NUMBER_DESCRIPTION) | |
62 | + @ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true) | |
62 | 63 | @RequestParam int page, |
63 | 64 | @ApiParam(value = "The case insensitive 'startsWith' filter based on the edge event type name.") |
64 | 65 | @RequestParam(required = false) String textSearch, |
65 | - @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = SORT_PROPERTY_ALLOWABLE_VALUES) | |
66 | + @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = EDGE_SORT_PROPERTY_ALLOWABLE_VALUES) | |
66 | 67 | @RequestParam(required = false) String sortProperty, |
67 | 68 | @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES) |
68 | 69 | @RequestParam(required = false) String sortOrder, | ... | ... |