|
@@ -21,6 +21,7 @@ import com.google.common.util.concurrent.ListenableFuture; |
|
@@ -21,6 +21,7 @@ import com.google.common.util.concurrent.ListenableFuture; |
21
|
import com.google.common.util.concurrent.MoreExecutors;
|
21
|
import com.google.common.util.concurrent.MoreExecutors;
|
22
|
import com.google.common.util.concurrent.SettableFuture;
|
22
|
import com.google.common.util.concurrent.SettableFuture;
|
23
|
import io.swagger.annotations.ApiOperation;
|
23
|
import io.swagger.annotations.ApiOperation;
|
|
|
24
|
+import io.swagger.annotations.ApiParam;
|
24
|
import lombok.extern.slf4j.Slf4j;
|
25
|
import lombok.extern.slf4j.Slf4j;
|
25
|
import org.springframework.beans.factory.annotation.Autowired;
|
26
|
import org.springframework.beans.factory.annotation.Autowired;
|
26
|
import org.springframework.http.HttpStatus;
|
27
|
import org.springframework.http.HttpStatus;
|
|
@@ -74,7 +75,7 @@ import java.util.concurrent.ExecutionException; |
|
@@ -74,7 +75,7 @@ import java.util.concurrent.ExecutionException; |
74
|
import java.util.stream.Collectors;
|
75
|
import java.util.stream.Collectors;
|
75
|
|
76
|
|
76
|
import static org.apache.commons.lang3.StringUtils.isBlank;
|
77
|
import static org.apache.commons.lang3.StringUtils.isBlank;
|
77
|
-import static org.thingsboard.server.controller.ControllerConstants.CUSTOMER_ID;
|
78
|
+import static org.thingsboard.server.controller.ControllerConstants.*;
|
78
|
import static org.thingsboard.server.controller.ControllerConstants.EDGE_ASSIGN_ASYNC_FIRST_STEP_DESCRIPTION;
|
79
|
import static org.thingsboard.server.controller.ControllerConstants.EDGE_ASSIGN_ASYNC_FIRST_STEP_DESCRIPTION;
|
79
|
import static org.thingsboard.server.controller.ControllerConstants.EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION;
|
80
|
import static org.thingsboard.server.controller.ControllerConstants.EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION;
|
80
|
import static org.thingsboard.server.controller.ControllerConstants.EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION;
|
81
|
import static org.thingsboard.server.controller.ControllerConstants.EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION;
|
|
@@ -95,10 +96,16 @@ public class EntityViewController extends BaseController { |
|
@@ -95,10 +96,16 @@ public class EntityViewController extends BaseController { |
95
|
@Autowired
|
96
|
@Autowired
|
96
|
private TimeseriesService tsService;
|
97
|
private TimeseriesService tsService;
|
97
|
|
98
|
|
|
|
99
|
+ @ApiOperation(value = "Get entity view (getEntityViewById)",
|
|
|
100
|
+ notes = "Fetch the EntityView object based on the provided entity view id. "
|
|
|
101
|
+ + ENTITY_VIEW_DESCRIPTION + MODEL_DESCRIPTION + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
|
|
|
102
|
+ produces = MediaType.APPLICATION_JSON_VALUE)
|
98
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
|
103
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
|
99
|
@RequestMapping(value = "/entityView/{entityViewId}", method = RequestMethod.GET)
|
104
|
@RequestMapping(value = "/entityView/{entityViewId}", method = RequestMethod.GET)
|
100
|
@ResponseBody
|
105
|
@ResponseBody
|
101
|
- public EntityView getEntityViewById(@PathVariable(ENTITY_VIEW_ID) String strEntityViewId) throws ThingsboardException {
|
106
|
+ public EntityView getEntityViewById(
|
|
|
107
|
+ @ApiParam(value = ENTITY_VIEW_ID_PARAM_DESCRIPTION)
|
|
|
108
|
+ @PathVariable(ENTITY_VIEW_ID) String strEntityViewId) throws ThingsboardException {
|
102
|
checkParameter(ENTITY_VIEW_ID, strEntityViewId);
|
109
|
checkParameter(ENTITY_VIEW_ID, strEntityViewId);
|
103
|
try {
|
110
|
try {
|
104
|
return checkEntityViewId(new EntityViewId(toUUID(strEntityViewId)), Operation.READ);
|
111
|
return checkEntityViewId(new EntityViewId(toUUID(strEntityViewId)), Operation.READ);
|
|
@@ -107,10 +114,16 @@ public class EntityViewController extends BaseController { |
|
@@ -107,10 +114,16 @@ public class EntityViewController extends BaseController { |
107
|
}
|
114
|
}
|
108
|
}
|
115
|
}
|
109
|
|
116
|
|
|
|
117
|
+ @ApiOperation(value = "Get Entity View info (getEntityViewInfoById)",
|
|
|
118
|
+ notes = "Fetch the Entity View info object based on the provided Entity View Id. "
|
|
|
119
|
+ + ENTITY_VIEW_INFO_DESCRIPTION + MODEL_DESCRIPTION + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH,
|
|
|
120
|
+ produces = MediaType.APPLICATION_JSON_VALUE)
|
110
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
|
121
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
|
111
|
@RequestMapping(value = "/entityView/info/{entityViewId}", method = RequestMethod.GET)
|
122
|
@RequestMapping(value = "/entityView/info/{entityViewId}", method = RequestMethod.GET)
|
112
|
@ResponseBody
|
123
|
@ResponseBody
|
113
|
- public EntityViewInfo getEntityViewInfoById(@PathVariable(ENTITY_VIEW_ID) String strEntityViewId) throws ThingsboardException {
|
124
|
+ public EntityViewInfo getEntityViewInfoById(
|
|
|
125
|
+ @ApiParam(value = ENTITY_VIEW_ID_PARAM_DESCRIPTION)
|
|
|
126
|
+ @PathVariable(ENTITY_VIEW_ID) String strEntityViewId) throws ThingsboardException {
|
114
|
checkParameter(ENTITY_VIEW_ID, strEntityViewId);
|
127
|
checkParameter(ENTITY_VIEW_ID, strEntityViewId);
|
115
|
try {
|
128
|
try {
|
116
|
EntityViewId entityViewId = new EntityViewId(toUUID(strEntityViewId));
|
129
|
EntityViewId entityViewId = new EntityViewId(toUUID(strEntityViewId));
|
|
@@ -120,10 +133,15 @@ public class EntityViewController extends BaseController { |
|
@@ -120,10 +133,15 @@ public class EntityViewController extends BaseController { |
120
|
}
|
133
|
}
|
121
|
}
|
134
|
}
|
122
|
|
135
|
|
|
|
136
|
+ @ApiOperation(value = "Save or update entity view (saveEntityView)",
|
|
|
137
|
+ notes = ENTITY_VIEW_DESCRIPTION + MODEL_DESCRIPTION,
|
|
|
138
|
+ produces = MediaType.APPLICATION_JSON_VALUE)
|
123
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
|
139
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
|
124
|
@RequestMapping(value = "/entityView", method = RequestMethod.POST)
|
140
|
@RequestMapping(value = "/entityView", method = RequestMethod.POST)
|
125
|
@ResponseBody
|
141
|
@ResponseBody
|
126
|
- public EntityView saveEntityView(@RequestBody EntityView entityView) throws ThingsboardException {
|
142
|
+ public EntityView saveEntityView(
|
|
|
143
|
+ @ApiParam(value = "A JSON object representing the entity view.")
|
|
|
144
|
+ @RequestBody EntityView entityView) throws ThingsboardException {
|
127
|
try {
|
145
|
try {
|
128
|
entityView.setTenantId(getCurrentUser().getTenantId());
|
146
|
entityView.setTenantId(getCurrentUser().getTenantId());
|
129
|
|
147
|
|
|
@@ -357,10 +375,15 @@ public class EntityViewController extends BaseController { |
|
@@ -357,10 +375,15 @@ public class EntityViewController extends BaseController { |
357
|
keys);
|
375
|
keys);
|
358
|
}
|
376
|
}
|
359
|
|
377
|
|
|
|
378
|
+ @ApiOperation(value = "Delete entity view (deleteEntityView)",
|
|
|
379
|
+ notes = "Delete the EntityView object based on the provided entity view id. "
|
|
|
380
|
+ + TENANT_AUTHORITY_PARAGRAPH)
|
360
|
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
|
381
|
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
|
361
|
@RequestMapping(value = "/entityView/{entityViewId}", method = RequestMethod.DELETE)
|
382
|
@RequestMapping(value = "/entityView/{entityViewId}", method = RequestMethod.DELETE)
|
362
|
@ResponseStatus(value = HttpStatus.OK)
|
383
|
@ResponseStatus(value = HttpStatus.OK)
|
363
|
- public void deleteEntityView(@PathVariable(ENTITY_VIEW_ID) String strEntityViewId) throws ThingsboardException {
|
384
|
+ public void deleteEntityView(
|
|
|
385
|
+ @ApiParam(value = ENTITY_VIEW_ID_PARAM_DESCRIPTION)
|
|
|
386
|
+ @PathVariable(ENTITY_VIEW_ID) String strEntityViewId) throws ThingsboardException {
|
364
|
checkParameter(ENTITY_VIEW_ID, strEntityViewId);
|
387
|
checkParameter(ENTITY_VIEW_ID, strEntityViewId);
|
365
|
try {
|
388
|
try {
|
366
|
EntityViewId entityViewId = new EntityViewId(toUUID(strEntityViewId));
|
389
|
EntityViewId entityViewId = new EntityViewId(toUUID(strEntityViewId));
|
|
@@ -382,10 +405,14 @@ public class EntityViewController extends BaseController { |
|
@@ -382,10 +405,14 @@ public class EntityViewController extends BaseController { |
382
|
}
|
405
|
}
|
383
|
}
|
406
|
}
|
384
|
|
407
|
|
|
|
408
|
+ @ApiOperation(value = "Get Entity View by name (getTenantEntityView)",
|
|
|
409
|
+ notes = "Fetch the Entity View object based on the tenant id and entity view name. " + TENANT_AUTHORITY_PARAGRAPH,
|
|
|
410
|
+ produces = MediaType.APPLICATION_JSON_VALUE)
|
385
|
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
|
411
|
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
|
386
|
@RequestMapping(value = "/tenant/entityViews", params = {"entityViewName"}, method = RequestMethod.GET)
|
412
|
@RequestMapping(value = "/tenant/entityViews", params = {"entityViewName"}, method = RequestMethod.GET)
|
387
|
@ResponseBody
|
413
|
@ResponseBody
|
388
|
public EntityView getTenantEntityView(
|
414
|
public EntityView getTenantEntityView(
|
|
|
415
|
+ @ApiParam(value = "Entity View name")
|
389
|
@RequestParam String entityViewName) throws ThingsboardException {
|
416
|
@RequestParam String entityViewName) throws ThingsboardException {
|
390
|
try {
|
417
|
try {
|
391
|
TenantId tenantId = getCurrentUser().getTenantId();
|
418
|
TenantId tenantId = getCurrentUser().getTenantId();
|
|
@@ -395,11 +422,16 @@ public class EntityViewController extends BaseController { |
|
@@ -395,11 +422,16 @@ public class EntityViewController extends BaseController { |
395
|
}
|
422
|
}
|
396
|
}
|
423
|
}
|
397
|
|
424
|
|
|
|
425
|
+ @ApiOperation(value = "Assign Entity View to customer (assignEntityViewToCustomer)",
|
|
|
426
|
+ notes = "Creates assignment of the Entity View to customer. Customer will be able to query Entity View afterwards." + TENANT_AUTHORITY_PARAGRAPH)
|
398
|
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
|
427
|
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
|
399
|
@RequestMapping(value = "/customer/{customerId}/entityView/{entityViewId}", method = RequestMethod.POST)
|
428
|
@RequestMapping(value = "/customer/{customerId}/entityView/{entityViewId}", method = RequestMethod.POST)
|
400
|
@ResponseBody
|
429
|
@ResponseBody
|
401
|
- public EntityView assignEntityViewToCustomer(@PathVariable(CUSTOMER_ID) String strCustomerId,
|
|
|
402
|
- @PathVariable(ENTITY_VIEW_ID) String strEntityViewId) throws ThingsboardException {
|
430
|
+ public EntityView assignEntityViewToCustomer(
|
|
|
431
|
+ @ApiParam(value = CUSTOMER_ID_PARAM_DESCRIPTION)
|
|
|
432
|
+ @PathVariable(CUSTOMER_ID) String strCustomerId,
|
|
|
433
|
+ @ApiParam(value = ENTITY_VIEW_ID_PARAM_DESCRIPTION)
|
|
|
434
|
+ @PathVariable(ENTITY_VIEW_ID) String strEntityViewId) throws ThingsboardException {
|
403
|
checkParameter(CUSTOMER_ID, strCustomerId);
|
435
|
checkParameter(CUSTOMER_ID, strCustomerId);
|
404
|
checkParameter(ENTITY_VIEW_ID, strEntityViewId);
|
436
|
checkParameter(ENTITY_VIEW_ID, strEntityViewId);
|
405
|
try {
|
437
|
try {
|
|
@@ -426,10 +458,14 @@ public class EntityViewController extends BaseController { |
|
@@ -426,10 +458,14 @@ public class EntityViewController extends BaseController { |
426
|
}
|
458
|
}
|
427
|
}
|
459
|
}
|
428
|
|
460
|
|
|
|
461
|
+ @ApiOperation(value = "Unassign Entity View from customer (unassignEntityViewFromCustomer)",
|
|
|
462
|
+ notes = "Clears assignment of the Entity View to customer. Customer will not be able to query Entity View afterwards." + TENANT_AUTHORITY_PARAGRAPH)
|
429
|
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
|
463
|
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
|
430
|
@RequestMapping(value = "/customer/entityView/{entityViewId}", method = RequestMethod.DELETE)
|
464
|
@RequestMapping(value = "/customer/entityView/{entityViewId}", method = RequestMethod.DELETE)
|
431
|
@ResponseBody
|
465
|
@ResponseBody
|
432
|
- public EntityView unassignEntityViewFromCustomer(@PathVariable(ENTITY_VIEW_ID) String strEntityViewId) throws ThingsboardException {
|
466
|
+ public EntityView unassignEntityViewFromCustomer(
|
|
|
467
|
+ @ApiParam(value = ENTITY_VIEW_ID_PARAM_DESCRIPTION)
|
|
|
468
|
+ @PathVariable(ENTITY_VIEW_ID) String strEntityViewId) throws ThingsboardException {
|
433
|
checkParameter(ENTITY_VIEW_ID, strEntityViewId);
|
469
|
checkParameter(ENTITY_VIEW_ID, strEntityViewId);
|
434
|
try {
|
470
|
try {
|
435
|
EntityViewId entityViewId = new EntityViewId(toUUID(strEntityViewId));
|
471
|
EntityViewId entityViewId = new EntityViewId(toUUID(strEntityViewId));
|
|
@@ -455,18 +491,28 @@ public class EntityViewController extends BaseController { |
|
@@ -455,18 +491,28 @@ public class EntityViewController extends BaseController { |
455
|
}
|
491
|
}
|
456
|
}
|
492
|
}
|
457
|
|
493
|
|
|
|
494
|
+ @ApiOperation(value = "Get Customer Entity Views (getCustomerEntityViews)",
|
|
|
495
|
+ notes = "Returns a page of Entity View objects assigned to customer. " +
|
|
|
496
|
+ PAGE_DATA_PARAMETERS + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH)
|
458
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
|
497
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
|
459
|
@RequestMapping(value = "/customer/{customerId}/entityViews", params = {"pageSize", "page"}, method = RequestMethod.GET)
|
498
|
@RequestMapping(value = "/customer/{customerId}/entityViews", params = {"pageSize", "page"}, method = RequestMethod.GET)
|
460
|
@ResponseBody
|
499
|
@ResponseBody
|
461
|
public PageData<EntityView> getCustomerEntityViews(
|
500
|
public PageData<EntityView> getCustomerEntityViews(
|
462
|
- @PathVariable("customerId") String strCustomerId,
|
501
|
+ @ApiParam(value = CUSTOMER_ID_PARAM_DESCRIPTION, required = true)
|
|
|
502
|
+ @PathVariable(CUSTOMER_ID) String strCustomerId,
|
|
|
503
|
+ @ApiParam(value = PAGE_SIZE_DESCRIPTION, required = true)
|
463
|
@RequestParam int pageSize,
|
504
|
@RequestParam int pageSize,
|
|
|
505
|
+ @ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true)
|
464
|
@RequestParam int page,
|
506
|
@RequestParam int page,
|
|
|
507
|
+ @ApiParam(value = ENTITY_VIEW_TYPE)
|
465
|
@RequestParam(required = false) String type,
|
508
|
@RequestParam(required = false) String type,
|
|
|
509
|
+ @ApiParam(value = ENTITY_VIEW_TEXT_SEARCH_DESCRIPTION)
|
466
|
@RequestParam(required = false) String textSearch,
|
510
|
@RequestParam(required = false) String textSearch,
|
|
|
511
|
+ @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = ENTITY_VIEW_SORT_PROPERTY_ALLOWABLE_VALUES)
|
467
|
@RequestParam(required = false) String sortProperty,
|
512
|
@RequestParam(required = false) String sortProperty,
|
|
|
513
|
+ @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES)
|
468
|
@RequestParam(required = false) String sortOrder) throws ThingsboardException {
|
514
|
@RequestParam(required = false) String sortOrder) throws ThingsboardException {
|
469
|
- checkParameter("customerId", strCustomerId);
|
515
|
+ checkParameter(CUSTOMER_ID, strCustomerId);
|
470
|
try {
|
516
|
try {
|
471
|
TenantId tenantId = getCurrentUser().getTenantId();
|
517
|
TenantId tenantId = getCurrentUser().getTenantId();
|
472
|
CustomerId customerId = new CustomerId(toUUID(strCustomerId));
|
518
|
CustomerId customerId = new CustomerId(toUUID(strCustomerId));
|
|
@@ -482,16 +528,26 @@ public class EntityViewController extends BaseController { |
|
@@ -482,16 +528,26 @@ public class EntityViewController extends BaseController { |
482
|
}
|
528
|
}
|
483
|
}
|
529
|
}
|
484
|
|
530
|
|
|
|
531
|
+ @ApiOperation(value = "Get Customer Entity View info (getCustomerEntityViewInfos)",
|
|
|
532
|
+ notes = "Returns a page of Entity View info objects assigned to customer. " + ENTITY_VIEW_DESCRIPTION +
|
|
|
533
|
+ PAGE_DATA_PARAMETERS + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH)
|
485
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
|
534
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
|
486
|
@RequestMapping(value = "/customer/{customerId}/entityViewInfos", params = {"pageSize", "page"}, method = RequestMethod.GET)
|
535
|
@RequestMapping(value = "/customer/{customerId}/entityViewInfos", params = {"pageSize", "page"}, method = RequestMethod.GET)
|
487
|
@ResponseBody
|
536
|
@ResponseBody
|
488
|
public PageData<EntityViewInfo> getCustomerEntityViewInfos(
|
537
|
public PageData<EntityViewInfo> getCustomerEntityViewInfos(
|
489
|
- @PathVariable("customerId") String strCustomerId,
|
538
|
+ @ApiParam(value = CUSTOMER_ID_PARAM_DESCRIPTION, required = true)
|
|
|
539
|
+ @PathVariable(CUSTOMER_ID) String strCustomerId,
|
|
|
540
|
+ @ApiParam(value = PAGE_SIZE_DESCRIPTION, required = true)
|
490
|
@RequestParam int pageSize,
|
541
|
@RequestParam int pageSize,
|
|
|
542
|
+ @ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true)
|
491
|
@RequestParam int page,
|
543
|
@RequestParam int page,
|
|
|
544
|
+ @ApiParam(value = ENTITY_VIEW_TYPE)
|
492
|
@RequestParam(required = false) String type,
|
545
|
@RequestParam(required = false) String type,
|
|
|
546
|
+ @ApiParam(value = ENTITY_VIEW_TEXT_SEARCH_DESCRIPTION)
|
493
|
@RequestParam(required = false) String textSearch,
|
547
|
@RequestParam(required = false) String textSearch,
|
|
|
548
|
+ @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = ENTITY_VIEW_INFO_SORT_PROPERTY_ALLOWABLE_VALUES)
|
494
|
@RequestParam(required = false) String sortProperty,
|
549
|
@RequestParam(required = false) String sortProperty,
|
|
|
550
|
+ @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES)
|
495
|
@RequestParam(required = false) String sortOrder) throws ThingsboardException {
|
551
|
@RequestParam(required = false) String sortOrder) throws ThingsboardException {
|
496
|
checkParameter("customerId", strCustomerId);
|
552
|
checkParameter("customerId", strCustomerId);
|
497
|
try {
|
553
|
try {
|
|
@@ -509,15 +565,24 @@ public class EntityViewController extends BaseController { |
|
@@ -509,15 +565,24 @@ public class EntityViewController extends BaseController { |
509
|
}
|
565
|
}
|
510
|
}
|
566
|
}
|
511
|
|
567
|
|
|
|
568
|
+ @ApiOperation(value = "Get Tenant Entity Views (getTenantEntityViews)",
|
|
|
569
|
+ notes = "Returns a page of entity views owned by tenant. " + ENTITY_VIEW_DESCRIPTION +
|
|
|
570
|
+ PAGE_DATA_PARAMETERS + TENANT_AUTHORITY_PARAGRAPH)
|
512
|
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
|
571
|
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
|
513
|
@RequestMapping(value = "/tenant/entityViews", params = {"pageSize", "page"}, method = RequestMethod.GET)
|
572
|
@RequestMapping(value = "/tenant/entityViews", params = {"pageSize", "page"}, method = RequestMethod.GET)
|
514
|
@ResponseBody
|
573
|
@ResponseBody
|
515
|
public PageData<EntityView> getTenantEntityViews(
|
574
|
public PageData<EntityView> getTenantEntityViews(
|
|
|
575
|
+ @ApiParam(value = PAGE_SIZE_DESCRIPTION, required = true)
|
516
|
@RequestParam int pageSize,
|
576
|
@RequestParam int pageSize,
|
|
|
577
|
+ @ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true)
|
517
|
@RequestParam int page,
|
578
|
@RequestParam int page,
|
|
|
579
|
+ @ApiParam(value = ENTITY_VIEW_TYPE)
|
518
|
@RequestParam(required = false) String type,
|
580
|
@RequestParam(required = false) String type,
|
|
|
581
|
+ @ApiParam(value = ENTITY_VIEW_TEXT_SEARCH_DESCRIPTION)
|
519
|
@RequestParam(required = false) String textSearch,
|
582
|
@RequestParam(required = false) String textSearch,
|
|
|
583
|
+ @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = ENTITY_VIEW_SORT_PROPERTY_ALLOWABLE_VALUES)
|
520
|
@RequestParam(required = false) String sortProperty,
|
584
|
@RequestParam(required = false) String sortProperty,
|
|
|
585
|
+ @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES)
|
521
|
@RequestParam(required = false) String sortOrder) throws ThingsboardException {
|
586
|
@RequestParam(required = false) String sortOrder) throws ThingsboardException {
|
522
|
try {
|
587
|
try {
|
523
|
TenantId tenantId = getCurrentUser().getTenantId();
|
588
|
TenantId tenantId = getCurrentUser().getTenantId();
|
|
@@ -533,15 +598,24 @@ public class EntityViewController extends BaseController { |
|
@@ -533,15 +598,24 @@ public class EntityViewController extends BaseController { |
533
|
}
|
598
|
}
|
534
|
}
|
599
|
}
|
535
|
|
600
|
|
|
|
601
|
+ @ApiOperation(value = "Get Tenant Entity Views (getTenantEntityViews)",
|
|
|
602
|
+ notes = "Returns a page of entity views info owned by tenant. " + ENTITY_VIEW_DESCRIPTION +
|
|
|
603
|
+ PAGE_DATA_PARAMETERS + TENANT_AUTHORITY_PARAGRAPH)
|
536
|
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
|
604
|
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
|
537
|
@RequestMapping(value = "/tenant/entityViewInfos", params = {"pageSize", "page"}, method = RequestMethod.GET)
|
605
|
@RequestMapping(value = "/tenant/entityViewInfos", params = {"pageSize", "page"}, method = RequestMethod.GET)
|
538
|
@ResponseBody
|
606
|
@ResponseBody
|
539
|
public PageData<EntityViewInfo> getTenantEntityViewInfos(
|
607
|
public PageData<EntityViewInfo> getTenantEntityViewInfos(
|
|
|
608
|
+ @ApiParam(value = PAGE_SIZE_DESCRIPTION, required = true)
|
540
|
@RequestParam int pageSize,
|
609
|
@RequestParam int pageSize,
|
|
|
610
|
+ @ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true)
|
541
|
@RequestParam int page,
|
611
|
@RequestParam int page,
|
|
|
612
|
+ @ApiParam(value = ENTITY_VIEW_TYPE)
|
542
|
@RequestParam(required = false) String type,
|
613
|
@RequestParam(required = false) String type,
|
|
|
614
|
+ @ApiParam(value = ENTITY_VIEW_TEXT_SEARCH_DESCRIPTION)
|
543
|
@RequestParam(required = false) String textSearch,
|
615
|
@RequestParam(required = false) String textSearch,
|
|
|
616
|
+ @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = ENTITY_VIEW_INFO_SORT_PROPERTY_ALLOWABLE_VALUES)
|
544
|
@RequestParam(required = false) String sortProperty,
|
617
|
@RequestParam(required = false) String sortProperty,
|
|
|
618
|
+ @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES)
|
545
|
@RequestParam(required = false) String sortOrder) throws ThingsboardException {
|
619
|
@RequestParam(required = false) String sortOrder) throws ThingsboardException {
|
546
|
try {
|
620
|
try {
|
547
|
TenantId tenantId = getCurrentUser().getTenantId();
|
621
|
TenantId tenantId = getCurrentUser().getTenantId();
|
|
@@ -556,10 +630,16 @@ public class EntityViewController extends BaseController { |
|
@@ -556,10 +630,16 @@ public class EntityViewController extends BaseController { |
556
|
}
|
630
|
}
|
557
|
}
|
631
|
}
|
558
|
|
632
|
|
|
|
633
|
+ @ApiOperation(value = "Find related entity views (findByQuery)",
|
|
|
634
|
+ notes = "Returns all entity views that are related to the specific entity. " +
|
|
|
635
|
+ "The entity id, relation type, entity view types, depth of the search, and other query parameters defined using complex 'EntityViewSearchQuery' object. " +
|
|
|
636
|
+ "See 'Model' tab of the Parameters for more info." + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH)
|
559
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
|
637
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
|
560
|
@RequestMapping(value = "/entityViews", method = RequestMethod.POST)
|
638
|
@RequestMapping(value = "/entityViews", method = RequestMethod.POST)
|
561
|
@ResponseBody
|
639
|
@ResponseBody
|
562
|
- public List<EntityView> findByQuery(@RequestBody EntityViewSearchQuery query) throws ThingsboardException {
|
640
|
+ public List<EntityView> findByQuery(
|
|
|
641
|
+ @ApiParam(value = "The entity view search query JSON")
|
|
|
642
|
+ @RequestBody EntityViewSearchQuery query) throws ThingsboardException {
|
563
|
checkNotNull(query);
|
643
|
checkNotNull(query);
|
564
|
checkNotNull(query.getParameters());
|
644
|
checkNotNull(query.getParameters());
|
565
|
checkNotNull(query.getEntityViewTypes());
|
645
|
checkNotNull(query.getEntityViewTypes());
|
|
@@ -580,6 +660,9 @@ public class EntityViewController extends BaseController { |
|
@@ -580,6 +660,9 @@ public class EntityViewController extends BaseController { |
580
|
}
|
660
|
}
|
581
|
}
|
661
|
}
|
582
|
|
662
|
|
|
|
663
|
+ @ApiOperation(value = "Get Entity View Types (getEntityViewTypes)",
|
|
|
664
|
+ notes = "Returns a set of unique entity view types based on entity views that are either owned by the tenant or assigned to the customer which user is performing the request."
|
|
|
665
|
+ + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH)
|
583
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
|
666
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
|
584
|
@RequestMapping(value = "/entityView/types", method = RequestMethod.GET)
|
667
|
@RequestMapping(value = "/entityView/types", method = RequestMethod.GET)
|
585
|
@ResponseBody
|
668
|
@ResponseBody
|
|
@@ -594,10 +677,16 @@ public class EntityViewController extends BaseController { |
|
@@ -594,10 +677,16 @@ public class EntityViewController extends BaseController { |
594
|
}
|
677
|
}
|
595
|
}
|
678
|
}
|
596
|
|
679
|
|
|
|
680
|
+ @ApiOperation(value = "Make entity view publicly available (assignEntityViewToPublicCustomer)",
|
|
|
681
|
+ notes = "Entity View will be available for non-authorized (not logged-in) users. " +
|
|
|
682
|
+ "This is useful to create dashboards that you plan to share/embed on a publicly available website. " +
|
|
|
683
|
+ "However, users that are logged-in and belong to different tenant will not be able to access the entity view." + TENANT_AUTHORITY_PARAGRAPH)
|
597
|
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
|
684
|
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
|
598
|
@RequestMapping(value = "/customer/public/entityView/{entityViewId}", method = RequestMethod.POST)
|
685
|
@RequestMapping(value = "/customer/public/entityView/{entityViewId}", method = RequestMethod.POST)
|
599
|
@ResponseBody
|
686
|
@ResponseBody
|
600
|
- public EntityView assignEntityViewToPublicCustomer(@PathVariable(ENTITY_VIEW_ID) String strEntityViewId) throws ThingsboardException {
|
687
|
+ public EntityView assignEntityViewToPublicCustomer(
|
|
|
688
|
+ @ApiParam(value = ENTITY_VIEW_ID_PARAM_DESCRIPTION)
|
|
|
689
|
+ @PathVariable(ENTITY_VIEW_ID) String strEntityViewId) throws ThingsboardException {
|
601
|
checkParameter(ENTITY_VIEW_ID, strEntityViewId);
|
690
|
checkParameter(ENTITY_VIEW_ID, strEntityViewId);
|
602
|
try {
|
691
|
try {
|
603
|
EntityViewId entityViewId = new EntityViewId(toUUID(strEntityViewId));
|
692
|
EntityViewId entityViewId = new EntityViewId(toUUID(strEntityViewId));
|