@ -83,6 +83,8 @@ import java.util.stream.Collectors;
import static org.thingsboard.server.controller.ControllerConstants.EDGE_ASSIGN_ASYNC_FIRST_STEP_DESCRIPTION ;
import static org.thingsboard.server.controller.ControllerConstants.EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION ;
import static org.thingsboard.server.controller.ControllerConstants.EDGE_ID ;
import static org.thingsboard.server.controller.ControllerConstants.EDGE_ID_PARAM_DESCRIPTION ;
import static org.thingsboard.server.controller.ControllerConstants.EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION ;
import static org.thingsboard.server.controller.ControllerConstants.EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION ;
import static org.thingsboard.server.controller.ControllerConstants.MARKDOWN_CODE_BLOCK_END ;
@ -676,17 +678,25 @@ public class RuleChainController extends BaseController {
}
}
@ApiOperation ( value = "Get Edge Rule Chains (getEdgeRuleChains)" ,
notes = "Returns a page of Rule Chains assigned to the specified edge. " + RULE_CHAIN_DESCRIPTION + PAGE_DATA_PARAMETERS + TENANT_AUTHORITY_PARAGRAPH )
@PreAuthorize ( "hasAnyAuthority('TENANT_ADMIN')" )
@RequestMapping ( value = "/edge/{edgeId}/ruleChains" , params = { "pageSize" , "page" } , method = RequestMethod . GET )
@ResponseBody
public PageData < RuleChain > getEdgeRuleChains (
@PathVariable ( "edgeId" ) String strEdgeId ,
@ApiParam ( value = EDGE_ID_PARAM_DESCRIPTION , required = true )
@PathVariable ( EDGE_ID ) String strEdgeId ,
@ApiParam ( value = PAGE_SIZE_DESCRIPTION , required = true )
@RequestParam int pageSize ,
@ApiParam ( value = PAGE_NUMBER_DESCRIPTION , required = true )
@RequestParam int page ,
@ApiParam ( value = RULE_CHAIN_TEXT_SEARCH_DESCRIPTION )
@RequestParam ( required = false ) String textSearch ,
@ApiParam ( value = SORT_PROPERTY_DESCRIPTION , allowableValues = RULE_CHAIN_SORT_PROPERTY_ALLOWABLE_VALUES )
@RequestParam ( required = false ) String sortProperty ,
@ApiParam ( value = SORT_ORDER_DESCRIPTION , allowableValues = SORT_ORDER_ALLOWABLE_VALUES )
@RequestParam ( required = false ) String sortOrder ) throws ThingsboardException {
checkParameter ( "edgeId" , strEdgeId ) ;
checkParameter ( EDGE_ID , strEdgeId ) ;
try {
TenantId tenantId = getCurrentUser ( ) . getTenantId ( ) ;
EdgeId edgeId = new EdgeId ( toUUID ( strEdgeId ) ) ;
@ -698,10 +708,14 @@ public class RuleChainController extends BaseController {
}
}
@ApiOperation ( value = "Set Edge Template Root Rule Chain (setEdgeTemplateRootRuleChain)" ,
notes = "Makes the rule chain to be root rule chain for any new edge that will be created. " +
"Does not update root rule chain for already created edges. " + TENANT_AUTHORITY_PARAGRAPH )
@PreAuthorize ( "hasAnyAuthority('TENANT_ADMIN')" )
@RequestMapping ( value = "/ruleChain/{ruleChainId}/edgeTemplateRoot" , method = RequestMethod . POST )
@ResponseBody
public RuleChain setEdgeTemplateRootRuleChain ( @PathVariable ( RULE_CHAIN_ID ) String strRuleChainId ) throws ThingsboardException {
public RuleChain setEdgeTemplateRootRuleChain ( @ApiParam ( value = RULE_CHAIN_ID_PARAM_DESCRIPTION )
@PathVariable ( RULE_CHAIN_ID ) String strRuleChainId ) throws ThingsboardException {
checkParameter ( RULE_CHAIN_ID , strRuleChainId ) ;
try {
RuleChainId ruleChainId = new RuleChainId ( toUUID ( strRuleChainId ) ) ;
@ -717,10 +731,14 @@ public class RuleChainController extends BaseController {
}
}
@ApiOperation ( value = "Set Auto Assign To Edge Rule Chain (setAutoAssignToEdgeRuleChain)" ,
notes = "Makes the rule chain to be automatically assigned for any new edge that will be created. " +
"Does not assign this rule chain for already created edges. " + TENANT_AUTHORITY_PARAGRAPH )
@PreAuthorize ( "hasAuthority('TENANT_ADMIN')" )
@RequestMapping ( value = "/ruleChain/{ruleChainId}/autoAssignToEdge" , method = RequestMethod . POST )
@ResponseBody
public RuleChain setAutoAssignToEdgeRuleChain ( @PathVariable ( RULE_CHAIN_ID ) String strRuleChainId ) throws ThingsboardException {
public RuleChain setAutoAssignToEdgeRuleChain ( @ApiParam ( value = RULE_CHAIN_ID_PARAM_DESCRIPTION )
@PathVariable ( RULE_CHAIN_ID ) String strRuleChainId ) throws ThingsboardException {
checkParameter ( RULE_CHAIN_ID , strRuleChainId ) ;
try {
RuleChainId ruleChainId = new RuleChainId ( toUUID ( strRuleChainId ) ) ;
@ -736,10 +754,14 @@ public class RuleChainController extends BaseController {
}
}
@ApiOperation ( value = "Unset Auto Assign To Edge Rule Chain (unsetAutoAssignToEdgeRuleChain)" ,
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. " +
"Does not unassign this rule chain for already assigned edges. " + TENANT_AUTHORITY_PARAGRAPH )
@PreAuthorize ( "hasAuthority('TENANT_ADMIN')" )
@RequestMapping ( value = "/ruleChain/{ruleChainId}/autoAssignToEdge" , method = RequestMethod . DELETE )
@ResponseBody
public RuleChain unsetAutoAssignToEdgeRuleChain ( @PathVariable ( RULE_CHAIN_ID ) String strRuleChainId ) throws ThingsboardException {
public RuleChain unsetAutoAssignToEdgeRuleChain ( @ApiParam ( value = RULE_CHAIN_ID_PARAM_DESCRIPTION )
@PathVariable ( RULE_CHAIN_ID ) String strRuleChainId ) throws ThingsboardException {
checkParameter ( RULE_CHAIN_ID , strRuleChainId ) ;
try {
RuleChainId ruleChainId = new RuleChainId ( toUUID ( strRuleChainId ) ) ;
@ -756,6 +778,8 @@ public class RuleChainController extends BaseController {
}
// TODO: @voba refactor this - add new config to edge rule chain to set it as auto-assign
@ApiOperation ( value = "Get Auto Assign To Edge Rule Chains (getAutoAssignToEdgeRuleChains)" ,
notes = "Returns a list of Rule Chains that will be assigned to a newly created edge. " + RULE_CHAIN_DESCRIPTION + TENANT_AUTHORITY_PARAGRAPH )
@PreAuthorize ( "hasAnyAuthority('TENANT_ADMIN')" )
@RequestMapping ( value = "/ruleChain/autoAssignToEdgeRuleChains" , method = RequestMethod . GET )
@ResponseBody