Showing
7 changed files
with
133 additions
and
19 deletions
@@ -23,6 +23,7 @@ public class ControllerConstants { | @@ -23,6 +23,7 @@ public class ControllerConstants { | ||
23 | protected static final String CUSTOMER_ID = "customerId"; | 23 | protected static final String CUSTOMER_ID = "customerId"; |
24 | protected static final String TENANT_ID = "tenantId"; | 24 | protected static final String TENANT_ID = "tenantId"; |
25 | protected static final String DEVICE_ID = "deviceId"; | 25 | protected static final String DEVICE_ID = "deviceId"; |
26 | + protected static final String EDGE_ID = "edgeId"; | ||
26 | protected static final String RPC_ID = "rpcId"; | 27 | protected static final String RPC_ID = "rpcId"; |
27 | protected static final String ENTITY_ID = "entityId"; | 28 | protected static final String ENTITY_ID = "entityId"; |
28 | protected static final String PAGE_DATA_PARAMETERS = "You can specify parameters to filter the results. " + | 29 | protected static final String PAGE_DATA_PARAMETERS = "You can specify parameters to filter the results. " + |
@@ -51,7 +51,6 @@ import org.thingsboard.server.common.data.id.EdgeId; | @@ -51,7 +51,6 @@ import org.thingsboard.server.common.data.id.EdgeId; | ||
51 | import org.thingsboard.server.common.data.id.TenantId; | 51 | import org.thingsboard.server.common.data.id.TenantId; |
52 | import org.thingsboard.server.common.data.page.PageData; | 52 | import org.thingsboard.server.common.data.page.PageData; |
53 | import org.thingsboard.server.common.data.page.PageLink; | 53 | import org.thingsboard.server.common.data.page.PageLink; |
54 | -import org.thingsboard.server.common.data.page.TimePageLink; | ||
55 | import org.thingsboard.server.queue.util.TbCoreComponent; | 54 | import org.thingsboard.server.queue.util.TbCoreComponent; |
56 | import org.thingsboard.server.service.security.model.SecurityUser; | 55 | import org.thingsboard.server.service.security.model.SecurityUser; |
57 | import org.thingsboard.server.service.security.permission.Operation; | 56 | import org.thingsboard.server.service.security.permission.Operation; |
@@ -69,6 +68,8 @@ import static org.thingsboard.server.controller.ControllerConstants.DASHBOARD_SO | @@ -69,6 +68,8 @@ import static org.thingsboard.server.controller.ControllerConstants.DASHBOARD_SO | ||
69 | import static org.thingsboard.server.controller.ControllerConstants.DASHBOARD_TEXT_SEARCH_DESCRIPTION; | 68 | import static org.thingsboard.server.controller.ControllerConstants.DASHBOARD_TEXT_SEARCH_DESCRIPTION; |
70 | import static org.thingsboard.server.controller.ControllerConstants.EDGE_ASSIGN_ASYNC_FIRST_STEP_DESCRIPTION; | 69 | import static org.thingsboard.server.controller.ControllerConstants.EDGE_ASSIGN_ASYNC_FIRST_STEP_DESCRIPTION; |
71 | import static org.thingsboard.server.controller.ControllerConstants.EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION; | 70 | import static org.thingsboard.server.controller.ControllerConstants.EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION; |
71 | +import static org.thingsboard.server.controller.ControllerConstants.EDGE_ID; | ||
72 | +import static org.thingsboard.server.controller.ControllerConstants.EDGE_ID_PARAM_DESCRIPTION; | ||
72 | import static org.thingsboard.server.controller.ControllerConstants.EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION; | 73 | import static org.thingsboard.server.controller.ControllerConstants.EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION; |
73 | import static org.thingsboard.server.controller.ControllerConstants.EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION; | 74 | import static org.thingsboard.server.controller.ControllerConstants.EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION; |
74 | import static org.thingsboard.server.controller.ControllerConstants.PAGE_DATA_PARAMETERS; | 75 | import static org.thingsboard.server.controller.ControllerConstants.PAGE_DATA_PARAMETERS; |
@@ -906,24 +907,32 @@ public class DashboardController extends BaseController { | @@ -906,24 +907,32 @@ public class DashboardController extends BaseController { | ||
906 | } | 907 | } |
907 | } | 908 | } |
908 | 909 | ||
910 | + @ApiOperation(value = "Get Edge Dashboards (getEdgeDashboards)", | ||
911 | + notes = "Returns a page of dashboard info objects assigned to the specified edge. " | ||
912 | + + DASHBOARD_INFO_DEFINITION + " " + PAGE_DATA_PARAMETERS + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH, | ||
913 | + produces = MediaType.APPLICATION_JSON_VALUE) | ||
909 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") | 914 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") |
910 | @RequestMapping(value = "/edge/{edgeId}/dashboards", params = {"pageSize", "page"}, method = RequestMethod.GET) | 915 | @RequestMapping(value = "/edge/{edgeId}/dashboards", params = {"pageSize", "page"}, method = RequestMethod.GET) |
911 | @ResponseBody | 916 | @ResponseBody |
912 | public PageData<DashboardInfo> getEdgeDashboards( | 917 | public PageData<DashboardInfo> getEdgeDashboards( |
913 | - @PathVariable("edgeId") String strEdgeId, | 918 | + @ApiParam(value = EDGE_ID_PARAM_DESCRIPTION, required = true) |
919 | + @PathVariable(EDGE_ID) String strEdgeId, | ||
920 | + @ApiParam(value = PAGE_SIZE_DESCRIPTION, required = true) | ||
914 | @RequestParam int pageSize, | 921 | @RequestParam int pageSize, |
922 | + @ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true) | ||
915 | @RequestParam int page, | 923 | @RequestParam int page, |
924 | + @ApiParam(value = DASHBOARD_TEXT_SEARCH_DESCRIPTION) | ||
916 | @RequestParam(required = false) String textSearch, | 925 | @RequestParam(required = false) String textSearch, |
926 | + @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = DASHBOARD_SORT_PROPERTY_ALLOWABLE_VALUES) | ||
917 | @RequestParam(required = false) String sortProperty, | 927 | @RequestParam(required = false) String sortProperty, |
918 | - @RequestParam(required = false) String sortOrder, | ||
919 | - @RequestParam(required = false) Long startTime, | ||
920 | - @RequestParam(required = false) Long endTime) throws ThingsboardException { | 928 | + @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES) |
929 | + @RequestParam(required = false) String sortOrder) throws ThingsboardException { | ||
921 | checkParameter("edgeId", strEdgeId); | 930 | checkParameter("edgeId", strEdgeId); |
922 | try { | 931 | try { |
923 | TenantId tenantId = getCurrentUser().getTenantId(); | 932 | TenantId tenantId = getCurrentUser().getTenantId(); |
924 | EdgeId edgeId = new EdgeId(toUUID(strEdgeId)); | 933 | EdgeId edgeId = new EdgeId(toUUID(strEdgeId)); |
925 | checkEdgeId(edgeId, Operation.READ); | 934 | checkEdgeId(edgeId, Operation.READ); |
926 | - TimePageLink pageLink = createTimePageLink(pageSize, page, textSearch, sortProperty, sortOrder, startTime, endTime); | 935 | + PageLink pageLink = createPageLink(pageSize, page, textSearch, sortProperty, sortOrder); |
927 | PageData<DashboardInfo> nonFilteredResult = dashboardService.findDashboardsByTenantIdAndEdgeId(tenantId, edgeId, pageLink); | 936 | PageData<DashboardInfo> nonFilteredResult = dashboardService.findDashboardsByTenantIdAndEdgeId(tenantId, edgeId, pageLink); |
928 | List<DashboardInfo> filteredDashboards = nonFilteredResult.getData().stream().filter(dashboardInfo -> { | 937 | List<DashboardInfo> filteredDashboards = nonFilteredResult.getData().stream().filter(dashboardInfo -> { |
929 | try { | 938 | try { |
@@ -452,17 +452,17 @@ public class EdgeController extends BaseController { | @@ -452,17 +452,17 @@ public class EdgeController extends BaseController { | ||
452 | } | 452 | } |
453 | } | 453 | } |
454 | 454 | ||
455 | - @ApiOperation(value = "Set root rule chain for provided edge (setRootRuleChain)", | 455 | + @ApiOperation(value = "Set root rule chain for provided edge (setEdgeRootRuleChain)", |
456 | notes = "Change root rule chain of the edge to the new provided rule chain. \n" + | 456 | notes = "Change root rule chain of the edge to the new provided rule chain. \n" + |
457 | "This operation will send a notification to update root rule chain on remote edge service." + TENANT_AUTHORITY_PARAGRAPH, | 457 | "This operation will send a notification to update root rule chain on remote edge service." + TENANT_AUTHORITY_PARAGRAPH, |
458 | produces = MediaType.APPLICATION_JSON_VALUE) | 458 | produces = MediaType.APPLICATION_JSON_VALUE) |
459 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") | 459 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") |
460 | @RequestMapping(value = "/edge/{edgeId}/{ruleChainId}/root", method = RequestMethod.POST) | 460 | @RequestMapping(value = "/edge/{edgeId}/{ruleChainId}/root", method = RequestMethod.POST) |
461 | @ResponseBody | 461 | @ResponseBody |
462 | - public Edge setRootRuleChain(@ApiParam(value = EDGE_ID_PARAM_DESCRIPTION, required = true) | ||
463 | - @PathVariable(EDGE_ID) String strEdgeId, | ||
464 | - @ApiParam(value = RULE_CHAIN_ID_PARAM_DESCRIPTION, required = true) | ||
465 | - @PathVariable("ruleChainId") String strRuleChainId) throws ThingsboardException { | 462 | + public Edge setEdgeRootRuleChain(@ApiParam(value = EDGE_ID_PARAM_DESCRIPTION, required = true) |
463 | + @PathVariable(EDGE_ID) String strEdgeId, | ||
464 | + @ApiParam(value = RULE_CHAIN_ID_PARAM_DESCRIPTION, required = true) | ||
465 | + @PathVariable("ruleChainId") String strRuleChainId) throws ThingsboardException { | ||
466 | checkParameter(EDGE_ID, strEdgeId); | 466 | checkParameter(EDGE_ID, strEdgeId); |
467 | checkParameter("ruleChainId", strRuleChainId); | 467 | checkParameter("ruleChainId", strRuleChainId); |
468 | try { | 468 | try { |
@@ -736,6 +736,9 @@ public class EdgeController extends BaseController { | @@ -736,6 +736,9 @@ public class EdgeController extends BaseController { | ||
736 | edge.setEdgeLicenseKey(null); | 736 | edge.setEdgeLicenseKey(null); |
737 | } | 737 | } |
738 | 738 | ||
739 | + @ApiOperation(value = "Check edge license (checkInstance)", | ||
740 | + notes = "Checks license request from edge service by forwarding request to license portal.", | ||
741 | + produces = MediaType.APPLICATION_JSON_VALUE) | ||
739 | @RequestMapping(value = "/license/checkInstance", method = RequestMethod.POST) | 742 | @RequestMapping(value = "/license/checkInstance", method = RequestMethod.POST) |
740 | @ResponseBody | 743 | @ResponseBody |
741 | public ResponseEntity<JsonNode> checkInstance(@RequestBody JsonNode request) throws ThingsboardException { | 744 | public ResponseEntity<JsonNode> checkInstance(@RequestBody JsonNode request) throws ThingsboardException { |
@@ -748,6 +751,9 @@ public class EdgeController extends BaseController { | @@ -748,6 +751,9 @@ public class EdgeController extends BaseController { | ||
748 | } | 751 | } |
749 | } | 752 | } |
750 | 753 | ||
754 | + @ApiOperation(value = "Activate edge instance (activateInstance)", | ||
755 | + notes = "Activates edge license on license portal.", | ||
756 | + produces = MediaType.APPLICATION_JSON_VALUE) | ||
751 | @RequestMapping(value = "/license/activateInstance", params = {"licenseSecret", "releaseDate"}, method = RequestMethod.POST) | 757 | @RequestMapping(value = "/license/activateInstance", params = {"licenseSecret", "releaseDate"}, method = RequestMethod.POST) |
752 | @ResponseBody | 758 | @ResponseBody |
753 | public ResponseEntity<JsonNode> activateInstance(@RequestParam String licenseSecret, | 759 | public ResponseEntity<JsonNode> activateInstance(@RequestParam String licenseSecret, |
@@ -83,6 +83,8 @@ import java.util.stream.Collectors; | @@ -83,6 +83,8 @@ import java.util.stream.Collectors; | ||
83 | 83 | ||
84 | import static org.thingsboard.server.controller.ControllerConstants.EDGE_ASSIGN_ASYNC_FIRST_STEP_DESCRIPTION; | 84 | import static org.thingsboard.server.controller.ControllerConstants.EDGE_ASSIGN_ASYNC_FIRST_STEP_DESCRIPTION; |
85 | import static org.thingsboard.server.controller.ControllerConstants.EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION; | 85 | import static org.thingsboard.server.controller.ControllerConstants.EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION; |
86 | +import static org.thingsboard.server.controller.ControllerConstants.EDGE_ID; | ||
87 | +import static org.thingsboard.server.controller.ControllerConstants.EDGE_ID_PARAM_DESCRIPTION; | ||
86 | import static org.thingsboard.server.controller.ControllerConstants.EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION; | 88 | import static org.thingsboard.server.controller.ControllerConstants.EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION; |
87 | import static org.thingsboard.server.controller.ControllerConstants.EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION; | 89 | import static org.thingsboard.server.controller.ControllerConstants.EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION; |
88 | import static org.thingsboard.server.controller.ControllerConstants.MARKDOWN_CODE_BLOCK_END; | 90 | import static org.thingsboard.server.controller.ControllerConstants.MARKDOWN_CODE_BLOCK_END; |
@@ -676,17 +678,25 @@ public class RuleChainController extends BaseController { | @@ -676,17 +678,25 @@ public class RuleChainController extends BaseController { | ||
676 | } | 678 | } |
677 | } | 679 | } |
678 | 680 | ||
681 | + @ApiOperation(value = "Get Edge Rule Chains (getEdgeRuleChains)", | ||
682 | + notes = "Returns a page of Rule Chains assigned to the specified edge. " + RULE_CHAIN_DESCRIPTION + PAGE_DATA_PARAMETERS + TENANT_AUTHORITY_PARAGRAPH) | ||
679 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") | 683 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") |
680 | @RequestMapping(value = "/edge/{edgeId}/ruleChains", params = {"pageSize", "page"}, method = RequestMethod.GET) | 684 | @RequestMapping(value = "/edge/{edgeId}/ruleChains", params = {"pageSize", "page"}, method = RequestMethod.GET) |
681 | @ResponseBody | 685 | @ResponseBody |
682 | public PageData<RuleChain> getEdgeRuleChains( | 686 | public PageData<RuleChain> getEdgeRuleChains( |
683 | - @PathVariable("edgeId") String strEdgeId, | 687 | + @ApiParam(value = EDGE_ID_PARAM_DESCRIPTION, required = true) |
688 | + @PathVariable(EDGE_ID) String strEdgeId, | ||
689 | + @ApiParam(value = PAGE_SIZE_DESCRIPTION, required = true) | ||
684 | @RequestParam int pageSize, | 690 | @RequestParam int pageSize, |
691 | + @ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true) | ||
685 | @RequestParam int page, | 692 | @RequestParam int page, |
693 | + @ApiParam(value = RULE_CHAIN_TEXT_SEARCH_DESCRIPTION) | ||
686 | @RequestParam(required = false) String textSearch, | 694 | @RequestParam(required = false) String textSearch, |
695 | + @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = RULE_CHAIN_SORT_PROPERTY_ALLOWABLE_VALUES) | ||
687 | @RequestParam(required = false) String sortProperty, | 696 | @RequestParam(required = false) String sortProperty, |
697 | + @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES) | ||
688 | @RequestParam(required = false) String sortOrder) throws ThingsboardException { | 698 | @RequestParam(required = false) String sortOrder) throws ThingsboardException { |
689 | - checkParameter("edgeId", strEdgeId); | 699 | + checkParameter(EDGE_ID, strEdgeId); |
690 | try { | 700 | try { |
691 | TenantId tenantId = getCurrentUser().getTenantId(); | 701 | TenantId tenantId = getCurrentUser().getTenantId(); |
692 | EdgeId edgeId = new EdgeId(toUUID(strEdgeId)); | 702 | EdgeId edgeId = new EdgeId(toUUID(strEdgeId)); |
@@ -698,10 +708,14 @@ public class RuleChainController extends BaseController { | @@ -698,10 +708,14 @@ public class RuleChainController extends BaseController { | ||
698 | } | 708 | } |
699 | } | 709 | } |
700 | 710 | ||
711 | + @ApiOperation(value = "Set Edge Template Root Rule Chain (setEdgeTemplateRootRuleChain)", | ||
712 | + notes = "Makes the rule chain to be root rule chain for any new edge that will be created. " + | ||
713 | + "Does not update root rule chain for already created edges. " + TENANT_AUTHORITY_PARAGRAPH) | ||
701 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") | 714 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") |
702 | @RequestMapping(value = "/ruleChain/{ruleChainId}/edgeTemplateRoot", method = RequestMethod.POST) | 715 | @RequestMapping(value = "/ruleChain/{ruleChainId}/edgeTemplateRoot", method = RequestMethod.POST) |
703 | @ResponseBody | 716 | @ResponseBody |
704 | - public RuleChain setEdgeTemplateRootRuleChain(@PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException { | 717 | + public RuleChain setEdgeTemplateRootRuleChain(@ApiParam(value = RULE_CHAIN_ID_PARAM_DESCRIPTION) |
718 | + @PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException { | ||
705 | checkParameter(RULE_CHAIN_ID, strRuleChainId); | 719 | checkParameter(RULE_CHAIN_ID, strRuleChainId); |
706 | try { | 720 | try { |
707 | RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId)); | 721 | RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId)); |
@@ -717,10 +731,14 @@ public class RuleChainController extends BaseController { | @@ -717,10 +731,14 @@ public class RuleChainController extends BaseController { | ||
717 | } | 731 | } |
718 | } | 732 | } |
719 | 733 | ||
734 | + @ApiOperation(value = "Set Auto Assign To Edge Rule Chain (setAutoAssignToEdgeRuleChain)", | ||
735 | + notes = "Makes the rule chain to be automatically assigned for any new edge that will be created. " + | ||
736 | + "Does not assign this rule chain for already created edges. " + TENANT_AUTHORITY_PARAGRAPH) | ||
720 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") | 737 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") |
721 | @RequestMapping(value = "/ruleChain/{ruleChainId}/autoAssignToEdge", method = RequestMethod.POST) | 738 | @RequestMapping(value = "/ruleChain/{ruleChainId}/autoAssignToEdge", method = RequestMethod.POST) |
722 | @ResponseBody | 739 | @ResponseBody |
723 | - public RuleChain setAutoAssignToEdgeRuleChain(@PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException { | 740 | + public RuleChain setAutoAssignToEdgeRuleChain(@ApiParam(value = RULE_CHAIN_ID_PARAM_DESCRIPTION) |
741 | + @PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException { | ||
724 | checkParameter(RULE_CHAIN_ID, strRuleChainId); | 742 | checkParameter(RULE_CHAIN_ID, strRuleChainId); |
725 | try { | 743 | try { |
726 | RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId)); | 744 | RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId)); |
@@ -736,10 +754,14 @@ public class RuleChainController extends BaseController { | @@ -736,10 +754,14 @@ public class RuleChainController extends BaseController { | ||
736 | } | 754 | } |
737 | } | 755 | } |
738 | 756 | ||
757 | + @ApiOperation(value = "Unset Auto Assign To Edge Rule Chain (unsetAutoAssignToEdgeRuleChain)", | ||
758 | + notes = "Removes the rule chain from the list of rule chains that are going to be automatically assigned for any new edge that will be created. " + | ||
759 | + "Does not unassign this rule chain for already assigned edges. " + TENANT_AUTHORITY_PARAGRAPH) | ||
739 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") | 760 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") |
740 | @RequestMapping(value = "/ruleChain/{ruleChainId}/autoAssignToEdge", method = RequestMethod.DELETE) | 761 | @RequestMapping(value = "/ruleChain/{ruleChainId}/autoAssignToEdge", method = RequestMethod.DELETE) |
741 | @ResponseBody | 762 | @ResponseBody |
742 | - public RuleChain unsetAutoAssignToEdgeRuleChain(@PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException { | 763 | + public RuleChain unsetAutoAssignToEdgeRuleChain(@ApiParam(value = RULE_CHAIN_ID_PARAM_DESCRIPTION) |
764 | + @PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException { | ||
743 | checkParameter(RULE_CHAIN_ID, strRuleChainId); | 765 | checkParameter(RULE_CHAIN_ID, strRuleChainId); |
744 | try { | 766 | try { |
745 | RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId)); | 767 | RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId)); |
@@ -756,6 +778,8 @@ public class RuleChainController extends BaseController { | @@ -756,6 +778,8 @@ public class RuleChainController extends BaseController { | ||
756 | } | 778 | } |
757 | 779 | ||
758 | // TODO: @voba refactor this - add new config to edge rule chain to set it as auto-assign | 780 | // TODO: @voba refactor this - add new config to edge rule chain to set it as auto-assign |
781 | + @ApiOperation(value = "Get Auto Assign To Edge Rule Chains (getAutoAssignToEdgeRuleChains)", | ||
782 | + notes = "Returns a list of Rule Chains that will be assigned to a newly created edge. " + RULE_CHAIN_DESCRIPTION + TENANT_AUTHORITY_PARAGRAPH) | ||
759 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") | 783 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") |
760 | @RequestMapping(value = "/ruleChain/autoAssignToEdgeRuleChains", method = RequestMethod.GET) | 784 | @RequestMapping(value = "/ruleChain/autoAssignToEdgeRuleChains", method = RequestMethod.GET) |
761 | @ResponseBody | 785 | @ResponseBody |
@@ -15,8 +15,9 @@ | @@ -15,8 +15,9 @@ | ||
15 | */ | 15 | */ |
16 | package org.thingsboard.server.common.data.edge; | 16 | package org.thingsboard.server.common.data.edge; |
17 | 17 | ||
18 | +import io.swagger.annotations.ApiModel; | ||
19 | +import io.swagger.annotations.ApiModelProperty; | ||
18 | import lombok.EqualsAndHashCode; | 20 | import lombok.EqualsAndHashCode; |
19 | -import lombok.Getter; | ||
20 | import lombok.Setter; | 21 | import lombok.Setter; |
21 | import lombok.ToString; | 22 | import lombok.ToString; |
22 | import org.thingsboard.server.common.data.HasCustomerId; | 23 | import org.thingsboard.server.common.data.HasCustomerId; |
@@ -28,9 +29,9 @@ import org.thingsboard.server.common.data.id.EdgeId; | @@ -28,9 +29,9 @@ import org.thingsboard.server.common.data.id.EdgeId; | ||
28 | import org.thingsboard.server.common.data.id.RuleChainId; | 29 | import org.thingsboard.server.common.data.id.RuleChainId; |
29 | import org.thingsboard.server.common.data.id.TenantId; | 30 | import org.thingsboard.server.common.data.id.TenantId; |
30 | 31 | ||
32 | +@ApiModel | ||
31 | @EqualsAndHashCode(callSuper = true) | 33 | @EqualsAndHashCode(callSuper = true) |
32 | @ToString | 34 | @ToString |
33 | -@Getter | ||
34 | @Setter | 35 | @Setter |
35 | public class Edge extends SearchTextBasedWithAdditionalInfo<EdgeId> implements HasName, HasTenantId, HasCustomerId { | 36 | public class Edge extends SearchTextBasedWithAdditionalInfo<EdgeId> implements HasName, HasTenantId, HasCustomerId { |
36 | 37 | ||
@@ -82,8 +83,77 @@ public class Edge extends SearchTextBasedWithAdditionalInfo<EdgeId> implements H | @@ -82,8 +83,77 @@ public class Edge extends SearchTextBasedWithAdditionalInfo<EdgeId> implements H | ||
82 | this.cloudEndpoint = edge.getCloudEndpoint(); | 83 | this.cloudEndpoint = edge.getCloudEndpoint(); |
83 | } | 84 | } |
84 | 85 | ||
86 | + @ApiModelProperty(position = 1, value = "JSON object with the Edge Id. " + | ||
87 | + "Specify this field to update the Edge. " + | ||
88 | + "Referencing non-existing Edge Id will cause error. " + | ||
89 | + "Omit this field to create new Edge." ) | ||
90 | + @Override | ||
91 | + public EdgeId getId() { | ||
92 | + return super.getId(); | ||
93 | + } | ||
94 | + | ||
95 | + @ApiModelProperty(position = 2, value = "Timestamp of the edge creation, in milliseconds", example = "1609459200000", readOnly = true) | ||
96 | + @Override | ||
97 | + public long getCreatedTime() { | ||
98 | + return super.getCreatedTime(); | ||
99 | + } | ||
100 | + | ||
101 | + @ApiModelProperty(position = 3, value = "JSON object with Tenant Id. Use 'assignDeviceToTenant' to change the Tenant Id.", readOnly = true) | ||
102 | + @Override | ||
103 | + public TenantId getTenantId() { | ||
104 | + return this.tenantId; | ||
105 | + } | ||
106 | + | ||
107 | + @ApiModelProperty(position = 4, value = "JSON object with Customer Id. Use 'assignEdgeToCustomer' to change the Customer Id.", readOnly = true) | ||
108 | + @Override | ||
109 | + public CustomerId getCustomerId() { | ||
110 | + return this.customerId; | ||
111 | + } | ||
112 | + | ||
113 | + @ApiModelProperty(position = 5, value = "JSON object with Root Rule Chain Id. Use 'setEdgeRootRuleChain' to change the Root Rule Chain Id.", readOnly = true) | ||
114 | + public RuleChainId getRootRuleChainId() { | ||
115 | + return this.rootRuleChainId; | ||
116 | + } | ||
117 | + | ||
118 | + @ApiModelProperty(position = 6, required = true, value = "Unique Edge Name in scope of Tenant", example = "Silo_A_Edge") | ||
119 | + @Override | ||
120 | + public String getName() { | ||
121 | + return this.name; | ||
122 | + } | ||
123 | + | ||
124 | + @ApiModelProperty(position = 7, required = true, value = "Edge type", example = "Silos") | ||
125 | + public String getType() { | ||
126 | + return this.type; | ||
127 | + } | ||
128 | + | ||
129 | + @ApiModelProperty(position = 8, value = "Label that may be used in widgets", example = "Silo Edge on far field") | ||
130 | + public String getLabel() { | ||
131 | + return this.label; | ||
132 | + } | ||
133 | + | ||
85 | @Override | 134 | @Override |
86 | public String getSearchText() { | 135 | public String getSearchText() { |
87 | return getName(); | 136 | return getName(); |
88 | } | 137 | } |
138 | + | ||
139 | + @ApiModelProperty(position = 9, required = true, value = "Edge routing key ('username') to authorize on cloud") | ||
140 | + public String getRoutingKey() { | ||
141 | + return this.routingKey; | ||
142 | + } | ||
143 | + | ||
144 | + @ApiModelProperty(position = 10, required = true, value = "Edge secret ('password') to authorize on cloud") | ||
145 | + public String getSecret() { | ||
146 | + return this.secret; | ||
147 | + } | ||
148 | + | ||
149 | + @ApiModelProperty(position = 11, required = true, value = "Edge license key obtained from license portal", example = "AgcnI24Z06XC&m6Sxsdgf") | ||
150 | + public String getEdgeLicenseKey() { | ||
151 | + return this.edgeLicenseKey; | ||
152 | + } | ||
153 | + | ||
154 | + @ApiModelProperty(position = 12, required = true, value = "Edge uses this cloud URL to activate and periodically check it's license", example = "https://thingsboard.cloud") | ||
155 | + public String getCloudEndpoint() { | ||
156 | + return this.cloudEndpoint; | ||
157 | + } | ||
158 | + | ||
89 | } | 159 | } |
@@ -15,6 +15,7 @@ | @@ -15,6 +15,7 @@ | ||
15 | */ | 15 | */ |
16 | package org.thingsboard.server.common.data.edge; | 16 | package org.thingsboard.server.common.data.edge; |
17 | 17 | ||
18 | +import io.swagger.annotations.ApiModelProperty; | ||
18 | import lombok.Data; | 19 | import lombok.Data; |
19 | import org.thingsboard.server.common.data.EntityType; | 20 | import org.thingsboard.server.common.data.EntityType; |
20 | import org.thingsboard.server.common.data.relation.EntityRelation; | 21 | import org.thingsboard.server.common.data.relation.EntityRelation; |
@@ -28,8 +29,11 @@ import java.util.List; | @@ -28,8 +29,11 @@ import java.util.List; | ||
28 | @Data | 29 | @Data |
29 | public class EdgeSearchQuery { | 30 | public class EdgeSearchQuery { |
30 | 31 | ||
32 | + @ApiModelProperty(position = 3, value = "Main search parameters.") | ||
31 | private RelationsSearchParameters parameters; | 33 | private RelationsSearchParameters parameters; |
34 | + @ApiModelProperty(position = 1, value = "Type of the relation between root entity and edge (e.g. 'Contains' or 'Manages').") | ||
32 | private String relationType; | 35 | private String relationType; |
36 | + @ApiModelProperty(position = 2, value = "Array of edge types to filter the related entities (e.g. 'Silos', 'Stores').") | ||
33 | private List<String> edgeTypes; | 37 | private List<String> edgeTypes; |
34 | 38 | ||
35 | public EntityRelationsQuery toEntitySearchQuery() { | 39 | public EntityRelationsQuery toEntitySearchQuery() { |
@@ -737,7 +737,7 @@ | @@ -737,7 +737,7 @@ | ||
737 | "close": "Dialog schließen" | 737 | "close": "Dialog schließen" |
738 | }, | 738 | }, |
739 | "edge": { | 739 | "edge": { |
740 | - "edge": "Rand", | 740 | + "edge": "Edge", |
741 | "edge-instances": "Kanteninstanzen", | 741 | "edge-instances": "Kanteninstanzen", |
742 | "edge-file": "Edge-Datei", | 742 | "edge-file": "Edge-Datei", |
743 | "management": "Rand verwalten", | 743 | "management": "Rand verwalten", |