Commit df11b383c1625ce65870b82178676931a3548f80

Authored by Volodymyr Babak
1 parent 81f1091a

Naming conventions update

@@ -92,10 +92,10 @@ public class EdgeController extends BaseController { @@ -92,10 +92,10 @@ public class EdgeController extends BaseController {
92 edge.setTenantId(tenantId); 92 edge.setTenantId(tenantId);
93 boolean created = edge.getId() == null; 93 boolean created = edge.getId() == null;
94 94
95 - RuleChain defaultRootEdgeRuleChain = null; 95 + RuleChain edgeTemplateRootRuleChain = null;
96 if (created) { 96 if (created) {
97 - defaultRootEdgeRuleChain = ruleChainService.getDefaultRootEdgeRuleChain(tenantId);  
98 - if (defaultRootEdgeRuleChain == null) { 97 + edgeTemplateRootRuleChain = ruleChainService.getEdgeTemplateRootRuleChain(tenantId);
  98 + if (edgeTemplateRootRuleChain == null) {
99 throw new DataValidationException("Root edge rule chain is not available!"); 99 throw new DataValidationException("Root edge rule chain is not available!");
100 } 100 }
101 } 101 }
@@ -108,8 +108,8 @@ public class EdgeController extends BaseController { @@ -108,8 +108,8 @@ public class EdgeController extends BaseController {
108 Edge savedEdge = checkNotNull(edgeService.saveEdge(edge)); 108 Edge savedEdge = checkNotNull(edgeService.saveEdge(edge));
109 109
110 if (created) { 110 if (created) {
111 - ruleChainService.assignRuleChainToEdge(tenantId, defaultRootEdgeRuleChain.getId(), savedEdge.getId());  
112 - edgeNotificationService.setEdgeRootRuleChain(tenantId, savedEdge, defaultRootEdgeRuleChain.getId()); 111 + ruleChainService.assignRuleChainToEdge(tenantId, edgeTemplateRootRuleChain.getId(), savedEdge.getId());
  112 + edgeNotificationService.setEdgeRootRuleChain(tenantId, savedEdge, edgeTemplateRootRuleChain.getId());
113 edgeService.assignDefaultRuleChainsToEdge(tenantId, savedEdge.getId()); 113 edgeService.assignDefaultRuleChainsToEdge(tenantId, savedEdge.getId());
114 } 114 }
115 115
@@ -495,14 +495,14 @@ public class RuleChainController extends BaseController { @@ -495,14 +495,14 @@ public class RuleChainController extends BaseController {
495 } 495 }
496 496
497 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") 497 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')")
498 - @RequestMapping(value = "/ruleChain/{ruleChainId}/defaultRootEdge", method = RequestMethod.POST) 498 + @RequestMapping(value = "/ruleChain/{ruleChainId}/edgeTemplateRoot", method = RequestMethod.POST)
499 @ResponseBody 499 @ResponseBody
500 - public RuleChain setDefaultRootEdgeRuleChain(@PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException { 500 + public RuleChain setEdgeTemplateRootRuleChain(@PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException {
501 checkParameter(RULE_CHAIN_ID, strRuleChainId); 501 checkParameter(RULE_CHAIN_ID, strRuleChainId);
502 try { 502 try {
503 RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId)); 503 RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId));
504 RuleChain ruleChain = checkRuleChain(ruleChainId, Operation.WRITE); 504 RuleChain ruleChain = checkRuleChain(ruleChainId, Operation.WRITE);
505 - ruleChainService.setDefaultRootEdgeRuleChain(getTenantId(), ruleChainId); 505 + ruleChainService.setEdgeTemplateRootRuleChain(getTenantId(), ruleChainId);
506 return ruleChain; 506 return ruleChain;
507 } catch (Exception e) { 507 } catch (Exception e) {
508 logEntityAction(emptyId(EntityType.RULE_CHAIN), 508 logEntityAction(emptyId(EntityType.RULE_CHAIN),
@@ -514,14 +514,14 @@ public class RuleChainController extends BaseController { @@ -514,14 +514,14 @@ public class RuleChainController extends BaseController {
514 } 514 }
515 515
516 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 516 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
517 - @RequestMapping(value = "/ruleChain/{ruleChainId}/defaultEdge", method = RequestMethod.POST) 517 + @RequestMapping(value = "/ruleChain/{ruleChainId}/autoAssignToEdge", method = RequestMethod.POST)
518 @ResponseBody 518 @ResponseBody
519 - public RuleChain addDefaultEdgeRuleChain(@PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException { 519 + public RuleChain setAutoAssignToEdgeRuleChain(@PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException {
520 checkParameter(RULE_CHAIN_ID, strRuleChainId); 520 checkParameter(RULE_CHAIN_ID, strRuleChainId);
521 try { 521 try {
522 RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId)); 522 RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId));
523 RuleChain ruleChain = checkRuleChain(ruleChainId, Operation.WRITE); 523 RuleChain ruleChain = checkRuleChain(ruleChainId, Operation.WRITE);
524 - ruleChainService.addDefaultEdgeRuleChain(getTenantId(), ruleChainId); 524 + ruleChainService.setAutoAssignToEdgeRuleChain(getTenantId(), ruleChainId);
525 return ruleChain; 525 return ruleChain;
526 } catch (Exception e) { 526 } catch (Exception e) {
527 logEntityAction(emptyId(EntityType.RULE_CHAIN), 527 logEntityAction(emptyId(EntityType.RULE_CHAIN),
@@ -533,14 +533,14 @@ public class RuleChainController extends BaseController { @@ -533,14 +533,14 @@ public class RuleChainController extends BaseController {
533 } 533 }
534 534
535 @PreAuthorize("hasAuthority('TENANT_ADMIN')") 535 @PreAuthorize("hasAuthority('TENANT_ADMIN')")
536 - @RequestMapping(value = "/ruleChain/{ruleChainId}/defaultEdge", method = RequestMethod.DELETE) 536 + @RequestMapping(value = "/ruleChain/{ruleChainId}/autoAssignToEdge", method = RequestMethod.DELETE)
537 @ResponseBody 537 @ResponseBody
538 - public RuleChain removeDefaultEdgeRuleChain(@PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException { 538 + public RuleChain unsetAutoAssignToEdgeRuleChain(@PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException {
539 checkParameter(RULE_CHAIN_ID, strRuleChainId); 539 checkParameter(RULE_CHAIN_ID, strRuleChainId);
540 try { 540 try {
541 RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId)); 541 RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId));
542 RuleChain ruleChain = checkRuleChain(ruleChainId, Operation.WRITE); 542 RuleChain ruleChain = checkRuleChain(ruleChainId, Operation.WRITE);
543 - ruleChainService.removeDefaultEdgeRuleChain(getTenantId(), ruleChainId); 543 + ruleChainService.unsetAutoAssignToEdgeRuleChain(getTenantId(), ruleChainId);
544 return ruleChain; 544 return ruleChain;
545 } catch (Exception e) { 545 } catch (Exception e) {
546 logEntityAction(emptyId(EntityType.RULE_CHAIN), 546 logEntityAction(emptyId(EntityType.RULE_CHAIN),
@@ -552,12 +552,12 @@ public class RuleChainController extends BaseController { @@ -552,12 +552,12 @@ public class RuleChainController extends BaseController {
552 } 552 }
553 553
554 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") 554 @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')")
555 - @RequestMapping(value = "/ruleChain/defaultEdgeRuleChains", method = RequestMethod.GET) 555 + @RequestMapping(value = "/ruleChain/autoAssignToEdgeRuleChains", method = RequestMethod.GET)
556 @ResponseBody 556 @ResponseBody
557 - public List<RuleChain> getDefaultEdgeRuleChains() throws ThingsboardException { 557 + public List<RuleChain> getAutoAssignToEdgeRuleChains() throws ThingsboardException {
558 try { 558 try {
559 TenantId tenantId = getCurrentUser().getTenantId(); 559 TenantId tenantId = getCurrentUser().getTenantId();
560 - return checkNotNull(ruleChainService.findDefaultEdgeRuleChainsByTenantId(tenantId)).get(); 560 + return checkNotNull(ruleChainService.findAutoAssignToEdgeRuleChainsByTenantId(tenantId)).get();
561 } catch (Exception e) { 561 } catch (Exception e) {
562 throw handleException(e); 562 throw handleException(e);
563 } 563 }
@@ -89,7 +89,7 @@ public class DefaultDataUpdateService implements DataUpdateService { @@ -89,7 +89,7 @@ public class DefaultDataUpdateService implements DataUpdateService {
89 @Override 89 @Override
90 protected void updateEntity(Tenant tenant) { 90 protected void updateEntity(Tenant tenant) {
91 try { 91 try {
92 - RuleChain defaultEdgeRuleChain = ruleChainService.getDefaultRootEdgeRuleChain(tenant.getId()); 92 + RuleChain defaultEdgeRuleChain = ruleChainService.getEdgeTemplateRootRuleChain(tenant.getId());
93 if (defaultEdgeRuleChain == null) { 93 if (defaultEdgeRuleChain == null) {
94 installScripts.createDefaultEdgeRuleChains(tenant.getId()); 94 installScripts.createDefaultEdgeRuleChains(tenant.getId());
95 } 95 }
@@ -73,14 +73,14 @@ public interface RuleChainService { @@ -73,14 +73,14 @@ public interface RuleChainService {
73 73
74 ListenableFuture<TimePageData<RuleChain>> findRuleChainsByTenantIdAndEdgeId(TenantId tenantId, EdgeId edgeId, TimePageLink pageLink); 74 ListenableFuture<TimePageData<RuleChain>> findRuleChainsByTenantIdAndEdgeId(TenantId tenantId, EdgeId edgeId, TimePageLink pageLink);
75 75
76 - RuleChain getDefaultRootEdgeRuleChain(TenantId tenantId); 76 + RuleChain getEdgeTemplateRootRuleChain(TenantId tenantId);
77 77
78 - boolean setDefaultRootEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId); 78 + boolean setEdgeTemplateRootRuleChain(TenantId tenantId, RuleChainId ruleChainId);
79 79
80 - boolean addDefaultEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId); 80 + boolean setAutoAssignToEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId);
81 81
82 - boolean removeDefaultEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId); 82 + boolean unsetAutoAssignToEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId);
83 83
84 - ListenableFuture<List<RuleChain>> findDefaultEdgeRuleChainsByTenantId(TenantId tenantId); 84 + ListenableFuture<List<RuleChain>> findAutoAssignToEdgeRuleChainsByTenantId(TenantId tenantId);
85 85
86 } 86 }
@@ -23,6 +23,6 @@ public enum RelationTypeGroup { @@ -23,6 +23,6 @@ public enum RelationTypeGroup {
23 RULE_CHAIN, 23 RULE_CHAIN,
24 RULE_NODE, 24 RULE_NODE,
25 EDGE, 25 EDGE,
26 - EDGE_DEFAULT_RULE_CHAIN 26 + EDGE_AUTO_ASSIGN_RULE_CHAIN
27 27
28 } 28 }
@@ -340,7 +340,7 @@ public class EdgeServiceImpl extends AbstractEntityService implements EdgeServic @@ -340,7 +340,7 @@ public class EdgeServiceImpl extends AbstractEntityService implements EdgeServic
340 @Override 340 @Override
341 public void assignDefaultRuleChainsToEdge(TenantId tenantId, EdgeId edgeId) { 341 public void assignDefaultRuleChainsToEdge(TenantId tenantId, EdgeId edgeId) {
342 log.trace("Executing assignDefaultRuleChainsToEdge, tenantId [{}], edgeId [{}]", tenantId, edgeId); 342 log.trace("Executing assignDefaultRuleChainsToEdge, tenantId [{}], edgeId [{}]", tenantId, edgeId);
343 - ListenableFuture<List<RuleChain>> future = ruleChainService.findDefaultEdgeRuleChainsByTenantId(tenantId); 343 + ListenableFuture<List<RuleChain>> future = ruleChainService.findAutoAssignToEdgeRuleChainsByTenantId(tenantId);
344 Futures.addCallback(future, new FutureCallback<List<RuleChain>>() { 344 Futures.addCallback(future, new FutureCallback<List<RuleChain>>() {
345 @Override 345 @Override
346 public void onSuccess(List<RuleChain> ruleChains) { 346 public void onSuccess(List<RuleChain> ruleChains) {
@@ -484,21 +484,21 @@ public class BaseRuleChainService extends AbstractEntityService implements RuleC @@ -484,21 +484,21 @@ public class BaseRuleChainService extends AbstractEntityService implements RuleC
484 } 484 }
485 485
486 @Override 486 @Override
487 - public RuleChain getDefaultRootEdgeRuleChain(TenantId tenantId) { 487 + public RuleChain getEdgeTemplateRootRuleChain(TenantId tenantId) {
488 return getRootRuleChainByType(tenantId, RuleChainType.EDGE); 488 return getRootRuleChainByType(tenantId, RuleChainType.EDGE);
489 } 489 }
490 490
491 @Override 491 @Override
492 - public boolean setDefaultRootEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId) { 492 + public boolean setEdgeTemplateRootRuleChain(TenantId tenantId, RuleChainId ruleChainId) {
493 RuleChain ruleChain = ruleChainDao.findById(tenantId, ruleChainId.getId()); 493 RuleChain ruleChain = ruleChainDao.findById(tenantId, ruleChainId.getId());
494 - RuleChain previousDefaultRootEdgeRuleChain = getDefaultRootEdgeRuleChain(ruleChain.getTenantId());  
495 - if (previousDefaultRootEdgeRuleChain == null || !previousDefaultRootEdgeRuleChain.getId().equals(ruleChain.getId())) { 494 + RuleChain previousEdgeTemplateRootRuleChain = getEdgeTemplateRootRuleChain(ruleChain.getTenantId());
  495 + if (previousEdgeTemplateRootRuleChain == null || !previousEdgeTemplateRootRuleChain.getId().equals(ruleChain.getId())) {
496 try { 496 try {
497 - if (previousDefaultRootEdgeRuleChain != null) {  
498 - deleteRelation(tenantId, new EntityRelation(previousDefaultRootEdgeRuleChain.getTenantId(), previousDefaultRootEdgeRuleChain.getId(), 497 + if (previousEdgeTemplateRootRuleChain != null) {
  498 + deleteRelation(tenantId, new EntityRelation(previousEdgeTemplateRootRuleChain.getTenantId(), previousEdgeTemplateRootRuleChain.getId(),
499 EntityRelation.CONTAINS_TYPE, RelationTypeGroup.RULE_CHAIN)); 499 EntityRelation.CONTAINS_TYPE, RelationTypeGroup.RULE_CHAIN));
500 - previousDefaultRootEdgeRuleChain.setRoot(false);  
501 - ruleChainDao.save(tenantId, previousDefaultRootEdgeRuleChain); 500 + previousEdgeTemplateRootRuleChain.setRoot(false);
  501 + ruleChainDao.save(tenantId, previousEdgeTemplateRootRuleChain);
502 } 502 }
503 createRelation(tenantId, new EntityRelation(ruleChain.getTenantId(), ruleChain.getId(), 503 createRelation(tenantId, new EntityRelation(ruleChain.getTenantId(), ruleChain.getId(),
504 EntityRelation.CONTAINS_TYPE, RelationTypeGroup.RULE_CHAIN)); 504 EntityRelation.CONTAINS_TYPE, RelationTypeGroup.RULE_CHAIN));
@@ -506,7 +506,7 @@ public class BaseRuleChainService extends AbstractEntityService implements RuleC @@ -506,7 +506,7 @@ public class BaseRuleChainService extends AbstractEntityService implements RuleC
506 ruleChainDao.save(tenantId, ruleChain); 506 ruleChainDao.save(tenantId, ruleChain);
507 return true; 507 return true;
508 } catch (Exception e) { 508 } catch (Exception e) {
509 - log.warn("Failed to set default root edge rule chain, ruleChainId: [{}]", ruleChainId, e); 509 + log.warn("Failed to set edge template root rule chain, ruleChainId: [{}]", ruleChainId, e);
510 throw new RuntimeException(e); 510 throw new RuntimeException(e);
511 } 511 }
512 } 512 }
@@ -514,34 +514,34 @@ public class BaseRuleChainService extends AbstractEntityService implements RuleC @@ -514,34 +514,34 @@ public class BaseRuleChainService extends AbstractEntityService implements RuleC
514 } 514 }
515 515
516 @Override 516 @Override
517 - public boolean addDefaultEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId) { 517 + public boolean setAutoAssignToEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId) {
518 try { 518 try {
519 createRelation(tenantId, new EntityRelation(tenantId, ruleChainId, 519 createRelation(tenantId, new EntityRelation(tenantId, ruleChainId,
520 - EntityRelation.CONTAINS_TYPE, RelationTypeGroup.EDGE_DEFAULT_RULE_CHAIN)); 520 + EntityRelation.CONTAINS_TYPE, RelationTypeGroup.EDGE_AUTO_ASSIGN_RULE_CHAIN));
521 return true; 521 return true;
522 } catch (Exception e) { 522 } catch (Exception e) {
523 - log.warn("Failed to add default edge rule chain, ruleChainId: [{}]", ruleChainId, e); 523 + log.warn("Failed to set auto assign to edge rule chain, ruleChainId: [{}]", ruleChainId, e);
524 throw new RuntimeException(e); 524 throw new RuntimeException(e);
525 } 525 }
526 } 526 }
527 527
528 @Override 528 @Override
529 - public boolean removeDefaultEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId) { 529 + public boolean unsetAutoAssignToEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId) {
530 try { 530 try {
531 deleteRelation(tenantId, new EntityRelation(tenantId, ruleChainId, 531 deleteRelation(tenantId, new EntityRelation(tenantId, ruleChainId,
532 - EntityRelation.CONTAINS_TYPE, RelationTypeGroup.EDGE_DEFAULT_RULE_CHAIN)); 532 + EntityRelation.CONTAINS_TYPE, RelationTypeGroup.EDGE_AUTO_ASSIGN_RULE_CHAIN));
533 return true; 533 return true;
534 } catch (Exception e) { 534 } catch (Exception e) {
535 - log.warn("Failed to remove default edge rule chain, ruleChainId: [{}]", ruleChainId, e); 535 + log.warn("Failed to unset auto assign to edge rule chain, ruleChainId: [{}]", ruleChainId, e);
536 throw new RuntimeException(e); 536 throw new RuntimeException(e);
537 } 537 }
538 } 538 }
539 539
540 @Override 540 @Override
541 - public ListenableFuture<List<RuleChain>> findDefaultEdgeRuleChainsByTenantId(TenantId tenantId) {  
542 - log.trace("Executing findDefaultEdgeRuleChainsByTenantId, tenantId [{}]", tenantId); 541 + public ListenableFuture<List<RuleChain>> findAutoAssignToEdgeRuleChainsByTenantId(TenantId tenantId) {
  542 + log.trace("Executing findAutoAssignToEdgeRuleChainsByTenantId, tenantId [{}]", tenantId);
543 validateId(tenantId, INCORRECT_TENANT_ID + tenantId); 543 validateId(tenantId, INCORRECT_TENANT_ID + tenantId);
544 - return ruleChainDao.findDefaultEdgeRuleChainsByTenantId(tenantId.getId()); 544 + return ruleChainDao.findAutoAssignToEdgeRuleChainsByTenantId(tenantId.getId());
545 } 545 }
546 546
547 547
@@ -592,9 +592,9 @@ public class BaseRuleChainService extends AbstractEntityService implements RuleC @@ -592,9 +592,9 @@ public class BaseRuleChainService extends AbstractEntityService implements RuleC
592 } 592 }
593 } 593 }
594 if (ruleChain.isRoot() && RuleChainType.EDGE.equals(ruleChain.getType())) { 594 if (ruleChain.isRoot() && RuleChainType.EDGE.equals(ruleChain.getType())) {
595 - RuleChain defaultRootEdgeRuleChain = getDefaultRootEdgeRuleChain(ruleChain.getTenantId());  
596 - if (defaultRootEdgeRuleChain != null && !defaultRootEdgeRuleChain.getId().equals(ruleChain.getId())) {  
597 - throw new DataValidationException("Another default root edge rule chain is present in scope of current tenant!"); 595 + RuleChain edgeTemplateRootRuleChain = getEdgeTemplateRootRuleChain(ruleChain.getTenantId());
  596 + if (edgeTemplateRootRuleChain != null && !edgeTemplateRootRuleChain.getId().equals(ruleChain.getId())) {
  597 + throw new DataValidationException("Another edge template root rule chain is present in scope of current tenant!");
598 } 598 }
599 } 599 }
600 } 600 }
@@ -103,9 +103,10 @@ public class CassandraRuleChainDao extends CassandraAbstractSearchTextDao<RuleCh @@ -103,9 +103,10 @@ public class CassandraRuleChainDao extends CassandraAbstractSearchTextDao<RuleCh
103 } 103 }
104 104
105 @Override 105 @Override
106 - public ListenableFuture<List<RuleChain>> findDefaultEdgeRuleChainsByTenantId(UUID tenantId) {  
107 - log.debug("Try to find default edge rule chains by tenantId [{}]", tenantId);  
108 - ListenableFuture<List<EntityRelation>> relations = relationDao.findAllByFromAndType(new TenantId(tenantId), new TenantId(tenantId), EntityRelation.CONTAINS_TYPE, RelationTypeGroup.EDGE_DEFAULT_RULE_CHAIN); 106 + public ListenableFuture<List<RuleChain>> findAutoAssignToEdgeRuleChainsByTenantId(UUID tenantId) {
  107 + log.debug("Try to find auto assign to edge rule chains by tenantId [{}]", tenantId);
  108 + ListenableFuture<List<EntityRelation>> relations =
  109 + relationDao.findAllByFromAndType(new TenantId(tenantId), new TenantId(tenantId), EntityRelation.CONTAINS_TYPE, RelationTypeGroup.EDGE_AUTO_ASSIGN_RULE_CHAIN);
109 return Futures.transformAsync(relations, input -> { 110 return Futures.transformAsync(relations, input -> {
110 List<ListenableFuture<RuleChain>> ruleChainFutures = new ArrayList<>(input.size()); 111 List<ListenableFuture<RuleChain>> ruleChainFutures = new ArrayList<>(input.size());
111 for (EntityRelation relation : input) { 112 for (EntityRelation relation : input) {
@@ -60,10 +60,10 @@ public interface RuleChainDao extends Dao<RuleChain> { @@ -60,10 +60,10 @@ public interface RuleChainDao extends Dao<RuleChain> {
60 ListenableFuture<List<RuleChain>> findRuleChainsByTenantIdAndEdgeId(UUID tenantId, UUID edgeId, TimePageLink pageLink); 60 ListenableFuture<List<RuleChain>> findRuleChainsByTenantIdAndEdgeId(UUID tenantId, UUID edgeId, TimePageLink pageLink);
61 61
62 /** 62 /**
63 - * Find default edge rule chains by tenantId. 63 + * Find auto assign to edge rule chains by tenantId.
64 * 64 *
65 * @param tenantId the tenantId 65 * @param tenantId the tenantId
66 * @return the list of rule chain objects 66 * @return the list of rule chain objects
67 */ 67 */
68 - ListenableFuture<List<RuleChain>> findDefaultEdgeRuleChainsByTenantId(UUID tenantId); 68 + ListenableFuture<List<RuleChain>> findAutoAssignToEdgeRuleChainsByTenantId(UUID tenantId);
69 } 69 }
@@ -25,9 +25,7 @@ import org.springframework.data.repository.CrudRepository; @@ -25,9 +25,7 @@ import org.springframework.data.repository.CrudRepository;
25 import org.springframework.stereotype.Component; 25 import org.springframework.stereotype.Component;
26 import org.thingsboard.server.common.data.EntityType; 26 import org.thingsboard.server.common.data.EntityType;
27 import org.thingsboard.server.common.data.UUIDConverter; 27 import org.thingsboard.server.common.data.UUIDConverter;
28 -import org.thingsboard.server.common.data.edge.Edge;  
29 import org.thingsboard.server.common.data.id.EdgeId; 28 import org.thingsboard.server.common.data.id.EdgeId;
30 -import org.thingsboard.server.common.data.id.RuleChainId;  
31 import org.thingsboard.server.common.data.id.TenantId; 29 import org.thingsboard.server.common.data.id.TenantId;
32 import org.thingsboard.server.common.data.page.TextPageLink; 30 import org.thingsboard.server.common.data.page.TextPageLink;
33 import org.thingsboard.server.common.data.page.TimePageLink; 31 import org.thingsboard.server.common.data.page.TimePageLink;
@@ -107,9 +105,10 @@ public class JpaRuleChainDao extends JpaAbstractSearchTextDao<RuleChainEntity, R @@ -107,9 +105,10 @@ public class JpaRuleChainDao extends JpaAbstractSearchTextDao<RuleChainEntity, R
107 } 105 }
108 106
109 @Override 107 @Override
110 - public ListenableFuture<List<RuleChain>> findDefaultEdgeRuleChainsByTenantId(UUID tenantId) {  
111 - log.debug("Try to find default edge rule chains by tenantId [{}]", tenantId);  
112 - ListenableFuture<List<EntityRelation>> relations = relationDao.findAllByFromAndType(new TenantId(tenantId), new TenantId(tenantId), EntityRelation.CONTAINS_TYPE, RelationTypeGroup.EDGE_DEFAULT_RULE_CHAIN); 108 + public ListenableFuture<List<RuleChain>> findAutoAssignToEdgeRuleChainsByTenantId(UUID tenantId) {
  109 + log.debug("Try to find auto assign to edge rule chains by tenantId [{}]", tenantId);
  110 + ListenableFuture<List<EntityRelation>> relations =
  111 + relationDao.findAllByFromAndType(new TenantId(tenantId), new TenantId(tenantId), EntityRelation.CONTAINS_TYPE, RelationTypeGroup.EDGE_AUTO_ASSIGN_RULE_CHAIN);
113 return Futures.transformAsync(relations, input -> { 112 return Futures.transformAsync(relations, input -> {
114 List<ListenableFuture<RuleChain>> ruleChainsFutures = new ArrayList<>(input.size()); 113 List<ListenableFuture<RuleChain>> ruleChainsFutures = new ArrayList<>(input.size());
115 for (EntityRelation relation : input) { 114 for (EntityRelation relation : input) {
@@ -331,24 +331,24 @@ public abstract class BaseRuleChainServiceTest extends AbstractServiceTest { @@ -331,24 +331,24 @@ public abstract class BaseRuleChainServiceTest extends AbstractServiceTest {
331 331
332 @Test 332 @Test
333 public void testGetDefaultEdgeRuleChains() throws Exception { 333 public void testGetDefaultEdgeRuleChains() throws Exception {
334 - RuleChainId ruleChainId = saveRuleChainAndSetDefaultEdge("Default Edge Rule Chain 1");  
335 - saveRuleChainAndSetDefaultEdge("Default Edge Rule Chain 2");  
336 - List<RuleChain> result = ruleChainService.findDefaultEdgeRuleChainsByTenantId(tenantId).get(); 334 + RuleChainId ruleChainId = saveRuleChainAndSetAutoAssignToEdge("Default Edge Rule Chain 1");
  335 + saveRuleChainAndSetAutoAssignToEdge("Default Edge Rule Chain 2");
  336 + List<RuleChain> result = ruleChainService.findAutoAssignToEdgeRuleChainsByTenantId(tenantId).get();
337 Assert.assertEquals(2, result.size()); 337 Assert.assertEquals(2, result.size());
338 338
339 - ruleChainService.removeDefaultEdgeRuleChain(tenantId, ruleChainId); 339 + ruleChainService.unsetAutoAssignToEdgeRuleChain(tenantId, ruleChainId);
340 340
341 - result = ruleChainService.findDefaultEdgeRuleChainsByTenantId(tenantId).get(); 341 + result = ruleChainService.findAutoAssignToEdgeRuleChainsByTenantId(tenantId).get();
342 Assert.assertEquals(1, result.size()); 342 Assert.assertEquals(1, result.size());
343 } 343 }
344 344
345 @Test 345 @Test
346 - public void setDefaultRootEdgeRuleChain() throws Exception {  
347 - RuleChainId ruleChainId1 = saveRuleChainAndSetDefaultEdge("Default Edge Rule Chain 1");  
348 - RuleChainId ruleChainId2 = saveRuleChainAndSetDefaultEdge("Default Edge Rule Chain 2"); 346 + public void setEdgeTemplateRootRuleChain() throws Exception {
  347 + RuleChainId ruleChainId1 = saveRuleChainAndSetAutoAssignToEdge("Default Edge Rule Chain 1");
  348 + RuleChainId ruleChainId2 = saveRuleChainAndSetAutoAssignToEdge("Default Edge Rule Chain 2");
349 349
350 - ruleChainService.setDefaultRootEdgeRuleChain(tenantId, ruleChainId1);  
351 - ruleChainService.setDefaultRootEdgeRuleChain(tenantId, ruleChainId2); 350 + ruleChainService.setEdgeTemplateRootRuleChain(tenantId, ruleChainId1);
  351 + ruleChainService.setEdgeTemplateRootRuleChain(tenantId, ruleChainId2);
352 352
353 RuleChain ruleChainById = ruleChainService.findRuleChainById(tenantId, ruleChainId1); 353 RuleChain ruleChainById = ruleChainService.findRuleChainById(tenantId, ruleChainId1);
354 Assert.assertFalse(ruleChainById.isRoot()); 354 Assert.assertFalse(ruleChainById.isRoot());
@@ -357,13 +357,13 @@ public abstract class BaseRuleChainServiceTest extends AbstractServiceTest { @@ -357,13 +357,13 @@ public abstract class BaseRuleChainServiceTest extends AbstractServiceTest {
357 Assert.assertTrue(ruleChainById.isRoot()); 357 Assert.assertTrue(ruleChainById.isRoot());
358 } 358 }
359 359
360 - private RuleChainId saveRuleChainAndSetDefaultEdge(String name) { 360 + private RuleChainId saveRuleChainAndSetAutoAssignToEdge(String name) {
361 RuleChain edgeRuleChain = new RuleChain(); 361 RuleChain edgeRuleChain = new RuleChain();
362 edgeRuleChain.setTenantId(tenantId); 362 edgeRuleChain.setTenantId(tenantId);
363 edgeRuleChain.setType(RuleChainType.EDGE); 363 edgeRuleChain.setType(RuleChainType.EDGE);
364 edgeRuleChain.setName(name); 364 edgeRuleChain.setName(name);
365 RuleChain savedEdgeRuleChain = ruleChainService.saveRuleChain(edgeRuleChain); 365 RuleChain savedEdgeRuleChain = ruleChainService.saveRuleChain(edgeRuleChain);
366 - ruleChainService.addDefaultEdgeRuleChain(tenantId, savedEdgeRuleChain.getId()); 366 + ruleChainService.setAutoAssignToEdgeRuleChain(tenantId, savedEdgeRuleChain.getId());
367 return savedEdgeRuleChain.getId(); 367 return savedEdgeRuleChain.getId();
368 } 368 }
369 369
@@ -2262,9 +2262,9 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable { @@ -2262,9 +2262,9 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable {
2262 }, params).getBody(); 2262 }, params).getBody();
2263 } 2263 }
2264 2264
2265 - public Optional<RuleChain> addDefaultEdgeRuleChain(RuleChainId ruleChainId) { 2265 + public Optional<RuleChain> setAutoAssignToEdgeRuleChain(RuleChainId ruleChainId) {
2266 try { 2266 try {
2267 - ResponseEntity<RuleChain> ruleChain = restTemplate.postForEntity(baseURL + "/api/ruleChain/{ruleChainId}/defaultEdge", null, RuleChain.class, ruleChainId.getId()); 2267 + ResponseEntity<RuleChain> ruleChain = restTemplate.postForEntity(baseURL + "/api/ruleChain/{ruleChainId}/autoAssignToEdge", null, RuleChain.class, ruleChainId.getId());
2268 return Optional.ofNullable(ruleChain.getBody()); 2268 return Optional.ofNullable(ruleChain.getBody());
2269 } catch (HttpClientErrorException exception) { 2269 } catch (HttpClientErrorException exception) {
2270 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 2270 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -2275,9 +2275,9 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable { @@ -2275,9 +2275,9 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable {
2275 } 2275 }
2276 } 2276 }
2277 2277
2278 - public Optional<RuleChain> removeDefaultEdgeRuleChain(RuleChainId ruleChainId) { 2278 + public Optional<RuleChain> unsetAutoAssignToEdgeRuleChain(RuleChainId ruleChainId) {
2279 try { 2279 try {
2280 - ResponseEntity<RuleChain> ruleChain = restTemplate.exchange(baseURL + "/api/ruleChain/{ruleChainId}/defaultEdge", HttpMethod.DELETE, HttpEntity.EMPTY, RuleChain.class, ruleChainId.getId()); 2280 + ResponseEntity<RuleChain> ruleChain = restTemplate.exchange(baseURL + "/api/ruleChain/{ruleChainId}/autoAssignToEdge", HttpMethod.DELETE, HttpEntity.EMPTY, RuleChain.class, ruleChainId.getId());
2281 return Optional.ofNullable(ruleChain.getBody()); 2281 return Optional.ofNullable(ruleChain.getBody());
2282 } catch (HttpClientErrorException exception) { 2282 } catch (HttpClientErrorException exception) {
2283 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 2283 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -2288,17 +2288,17 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable { @@ -2288,17 +2288,17 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable {
2288 } 2288 }
2289 } 2289 }
2290 2290
2291 - public List<RuleChain> getDefaultEdgeRuleChains() {  
2292 - return restTemplate.exchange(baseURL + "/api/ruleChain/defaultEdgeRuleChains", 2291 + public List<RuleChain> getAutoAssignToEdgeRuleChains() {
  2292 + return restTemplate.exchange(baseURL + "/api/ruleChain/autoAssignToEdgeRuleChains",
2293 HttpMethod.GET, 2293 HttpMethod.GET,
2294 HttpEntity.EMPTY, 2294 HttpEntity.EMPTY,
2295 new ParameterizedTypeReference<List<RuleChain>>() { 2295 new ParameterizedTypeReference<List<RuleChain>>() {
2296 }).getBody(); 2296 }).getBody();
2297 } 2297 }
2298 2298
2299 - public Optional<RuleChain> setDefaultRootEdgeRuleChain(RuleChainId ruleChainId) { 2299 + public Optional<RuleChain> setRootEdgeTemplateRuleChain(RuleChainId ruleChainId) {
2300 try { 2300 try {
2301 - ResponseEntity<RuleChain> ruleChain = restTemplate.postForEntity(baseURL + "/api/ruleChain/{ruleChainId}/defaultRootEdge", null, RuleChain.class, ruleChainId.getId()); 2301 + ResponseEntity<RuleChain> ruleChain = restTemplate.postForEntity(baseURL + "/api/ruleChain/{ruleChainId}/edgeTemplateRoot", null, RuleChain.class, ruleChainId.getId());
2302 return Optional.ofNullable(ruleChain.getBody()); 2302 return Optional.ofNullable(ruleChain.getBody());
2303 } catch (HttpClientErrorException exception) { 2303 } catch (HttpClientErrorException exception) {
2304 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 2304 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -40,10 +40,10 @@ function RuleChainService($http, $q, $filter, $ocLazyLoad, $translate, types, co @@ -40,10 +40,10 @@ function RuleChainService($http, $q, $filter, $ocLazyLoad, $translate, types, co
40 getEdgesRuleChains: getEdgesRuleChains, 40 getEdgesRuleChains: getEdgesRuleChains,
41 assignRuleChainToEdge: assignRuleChainToEdge, 41 assignRuleChainToEdge: assignRuleChainToEdge,
42 unassignRuleChainFromEdge: unassignRuleChainFromEdge, 42 unassignRuleChainFromEdge: unassignRuleChainFromEdge,
43 - setDefaultRootEdgeRuleChain: setDefaultRootEdgeRuleChain,  
44 - addDefaultEdgeRuleChain: addDefaultEdgeRuleChain,  
45 - removeDefaultEdgeRuleChain: removeDefaultEdgeRuleChain,  
46 - getDefaultEdgeRuleChains: getDefaultEdgeRuleChains 43 + setEdgeTemplateRootRuleChain: setEdgeTemplateRootRuleChain,
  44 + setAutoAssignToEdgeRuleChain: setAutoAssignToEdgeRuleChain,
  45 + unsetAutoAssignToEdgeRuleChain: unsetAutoAssignToEdgeRuleChain,
  46 + getAutoAssignToEdgeRuleChains: getAutoAssignToEdgeRuleChains
47 }; 47 };
48 48
49 return service; 49 return service;
@@ -350,9 +350,9 @@ function RuleChainService($http, $q, $filter, $ocLazyLoad, $translate, types, co @@ -350,9 +350,9 @@ function RuleChainService($http, $q, $filter, $ocLazyLoad, $translate, types, co
350 return deferred.promise; 350 return deferred.promise;
351 } 351 }
352 352
353 - function setDefaultRootEdgeRuleChain(ruleChainId) { 353 + function setEdgeTemplateRootRuleChain(ruleChainId) {
354 var deferred = $q.defer(); 354 var deferred = $q.defer();
355 - var url = '/api/ruleChain/' + ruleChainId + '/defaultRootEdge'; 355 + var url = '/api/ruleChain/' + ruleChainId + '/edgeTemplateRoot';
356 $http.post(url).then(function success(response) { 356 $http.post(url).then(function success(response) {
357 deferred.resolve(response.data); 357 deferred.resolve(response.data);
358 }, function fail() { 358 }, function fail() {
@@ -361,9 +361,9 @@ function RuleChainService($http, $q, $filter, $ocLazyLoad, $translate, types, co @@ -361,9 +361,9 @@ function RuleChainService($http, $q, $filter, $ocLazyLoad, $translate, types, co
361 return deferred.promise; 361 return deferred.promise;
362 } 362 }
363 363
364 - function addDefaultEdgeRuleChain(ruleChainId) { 364 + function setAutoAssignToEdgeRuleChain(ruleChainId) {
365 var deferred = $q.defer(); 365 var deferred = $q.defer();
366 - var url = '/api/ruleChain/' + ruleChainId + '/defaultEdge'; 366 + var url = '/api/ruleChain/' + ruleChainId + '/autoAssignToEdge';
367 $http.post(url, null).then(function success(response) { 367 $http.post(url, null).then(function success(response) {
368 deferred.resolve(response.data); 368 deferred.resolve(response.data);
369 }, function fail() { 369 }, function fail() {
@@ -372,9 +372,9 @@ function RuleChainService($http, $q, $filter, $ocLazyLoad, $translate, types, co @@ -372,9 +372,9 @@ function RuleChainService($http, $q, $filter, $ocLazyLoad, $translate, types, co
372 return deferred.promise; 372 return deferred.promise;
373 } 373 }
374 374
375 - function removeDefaultEdgeRuleChain(ruleChainId) { 375 + function unsetAutoAssignToEdgeRuleChain(ruleChainId) {
376 var deferred = $q.defer(); 376 var deferred = $q.defer();
377 - var url = '/api/ruleChain/' + ruleChainId + '/defaultEdge'; 377 + var url = '/api/ruleChain/' + ruleChainId + '/autoAssignToEdge';
378 $http.delete(url).then(function success(response) { 378 $http.delete(url).then(function success(response) {
379 deferred.resolve(response.data); 379 deferred.resolve(response.data);
380 }, function fail() { 380 }, function fail() {
@@ -383,9 +383,9 @@ function RuleChainService($http, $q, $filter, $ocLazyLoad, $translate, types, co @@ -383,9 +383,9 @@ function RuleChainService($http, $q, $filter, $ocLazyLoad, $translate, types, co
383 return deferred.promise; 383 return deferred.promise;
384 } 384 }
385 385
386 - function getDefaultEdgeRuleChains(config) { 386 + function getAutoAssignToEdgeRuleChains(config) {
387 var deferred = $q.defer(); 387 var deferred = $q.defer();
388 - var url = '/api/ruleChain/defaultEdgeRuleChains'; 388 + var url = '/api/ruleChain/autoAssignToEdgeRuleChains';
389 $http.get(url, config).then(function success(response) { 389 $http.get(url, config).then(function success(response) {
390 deferred.resolve(response.data); 390 deferred.resolve(response.data);
391 }, function fail() { 391 }, function fail() {
@@ -98,7 +98,7 @@ export default function RuleChainsController(ruleChainService, userService, impo @@ -98,7 +98,7 @@ export default function RuleChainsController(ruleChainService, userService, impo
98 vm.exportRuleChain = exportRuleChain; 98 vm.exportRuleChain = exportRuleChain;
99 vm.setRootRuleChain = setRootRuleChain; 99 vm.setRootRuleChain = setRootRuleChain;
100 vm.setDefaultEdgeRuleChain = setDefaultEdgeRuleChain; 100 vm.setDefaultEdgeRuleChain = setDefaultEdgeRuleChain;
101 - vm.removeDefaultEdgeRuleChain = removeDefaultEdgeRuleChain; 101 + vm.unsetAutoAssignToEdgeRuleChain = unsetAutoAssignToEdgeRuleChain;
102 102
103 initController(); 103 initController();
104 104
@@ -195,7 +195,7 @@ export default function RuleChainsController(ruleChainService, userService, impo @@ -195,7 +195,7 @@ export default function RuleChainsController(ruleChainService, userService, impo
195 195
196 ruleChainActionsList.push({ 196 ruleChainActionsList.push({
197 onAction: function ($event, item) { 197 onAction: function ($event, item) {
198 - removeDefaultEdgeRuleChain($event, item); 198 + unsetAutoAssignToEdgeRuleChain($event, item);
199 }, 199 },
200 name: function() { return $translate.instant('rulechain.remove-default-edge') }, 200 name: function() { return $translate.instant('rulechain.remove-default-edge') },
201 details: function() { return $translate.instant('rulechain.remove-default-edge') }, 201 details: function() { return $translate.instant('rulechain.remove-default-edge') },
@@ -205,7 +205,7 @@ export default function RuleChainsController(ruleChainService, userService, impo @@ -205,7 +205,7 @@ export default function RuleChainsController(ruleChainService, userService, impo
205 205
206 ruleChainActionsList.push({ 206 ruleChainActionsList.push({
207 onAction: function ($event, item) { 207 onAction: function ($event, item) {
208 - setDefaultRootEdgeRuleChain($event, item); 208 + setEdgeTemplateRootRuleChain($event, item);
209 }, 209 },
210 name: function() { return $translate.instant('rulechain.set-default-root-edge') }, 210 name: function() { return $translate.instant('rulechain.set-default-root-edge') },
211 details: function() { return $translate.instant('rulechain.set-default-root-edge') }, 211 details: function() { return $translate.instant('rulechain.set-default-root-edge') },
@@ -339,7 +339,7 @@ export default function RuleChainsController(ruleChainService, userService, impo @@ -339,7 +339,7 @@ export default function RuleChainsController(ruleChainService, userService, impo
339 339
340 function mapRuleChainsWithDefaultEdges(ruleChains) { 340 function mapRuleChainsWithDefaultEdges(ruleChains) {
341 var deferred = $q.defer(); 341 var deferred = $q.defer();
342 - ruleChainService.getDefaultEdgeRuleChains(null).then( 342 + ruleChainService.getAutoAssignToEdgeRuleChains(null).then(
343 function success(response) { 343 function success(response) {
344 let defaultEdgeRuleChainIds = []; 344 let defaultEdgeRuleChainIds = [];
345 response.map(function (ruleChain) { 345 response.map(function (ruleChain) {
@@ -481,7 +481,7 @@ export default function RuleChainsController(ruleChainService, userService, impo @@ -481,7 +481,7 @@ export default function RuleChainsController(ruleChainService, userService, impo
481 .cancel($translate.instant('action.no')) 481 .cancel($translate.instant('action.no'))
482 .ok($translate.instant('action.yes')); 482 .ok($translate.instant('action.yes'));
483 $mdDialog.show(confirm).then(function () { 483 $mdDialog.show(confirm).then(function () {
484 - ruleChainService.addDefaultEdgeRuleChain(ruleChain.id.id).then( 484 + ruleChainService.setAutoAssignToEdgeRuleChain(ruleChain.id.id).then(
485 () => { 485 () => {
486 vm.grid.refreshList(); 486 vm.grid.refreshList();
487 } 487 }
@@ -489,7 +489,7 @@ export default function RuleChainsController(ruleChainService, userService, impo @@ -489,7 +489,7 @@ export default function RuleChainsController(ruleChainService, userService, impo
489 }); 489 });
490 } 490 }
491 491
492 - function removeDefaultEdgeRuleChain($event, ruleChain) { 492 + function unsetAutoAssignToEdgeRuleChain($event, ruleChain) {
493 $event.stopPropagation(); 493 $event.stopPropagation();
494 var confirm = $mdDialog.confirm() 494 var confirm = $mdDialog.confirm()
495 .targetEvent($event) 495 .targetEvent($event)
@@ -499,7 +499,7 @@ export default function RuleChainsController(ruleChainService, userService, impo @@ -499,7 +499,7 @@ export default function RuleChainsController(ruleChainService, userService, impo
499 .cancel($translate.instant('action.no')) 499 .cancel($translate.instant('action.no'))
500 .ok($translate.instant('action.yes')); 500 .ok($translate.instant('action.yes'));
501 $mdDialog.show(confirm).then(function () { 501 $mdDialog.show(confirm).then(function () {
502 - ruleChainService.removeDefaultEdgeRuleChain(ruleChain.id.id).then( 502 + ruleChainService.unsetAutoAssignToEdgeRuleChain(ruleChain.id.id).then(
503 () => { 503 () => {
504 vm.grid.refreshList(); 504 vm.grid.refreshList();
505 } 505 }
@@ -507,7 +507,7 @@ export default function RuleChainsController(ruleChainService, userService, impo @@ -507,7 +507,7 @@ export default function RuleChainsController(ruleChainService, userService, impo
507 }); 507 });
508 } 508 }
509 509
510 - function setDefaultRootEdgeRuleChain($event, ruleChain) { 510 + function setEdgeTemplateRootRuleChain($event, ruleChain) {
511 $event.stopPropagation(); 511 $event.stopPropagation();
512 var confirm = $mdDialog.confirm() 512 var confirm = $mdDialog.confirm()
513 .targetEvent($event) 513 .targetEvent($event)
@@ -517,7 +517,7 @@ export default function RuleChainsController(ruleChainService, userService, impo @@ -517,7 +517,7 @@ export default function RuleChainsController(ruleChainService, userService, impo
517 .cancel($translate.instant('action.no')) 517 .cancel($translate.instant('action.no'))
518 .ok($translate.instant('action.yes')); 518 .ok($translate.instant('action.yes'));
519 $mdDialog.show(confirm).then(function () { 519 $mdDialog.show(confirm).then(function () {
520 - ruleChainService.setDefaultRootEdgeRuleChain(ruleChain.id.id).then( 520 + ruleChainService.setEdgeTemplateRootRuleChain(ruleChain.id.id).then(
521 () => { 521 () => {
522 vm.grid.refreshList(); 522 vm.grid.refreshList();
523 } 523 }
@@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
29 rule-chains-scope="vm.ruleChainsScope" 29 rule-chains-scope="vm.ruleChainsScope"
30 edge="vm.edge" 30 edge="vm.edge"
31 on-set-default-edge-rule-chain="vm.setDefaultEdgeRuleChain(event, vm.grid.detailsConfig.currentItem)" 31 on-set-default-edge-rule-chain="vm.setDefaultEdgeRuleChain(event, vm.grid.detailsConfig.currentItem)"
32 - on-remove-default-edge-rule-chain="vm.removeDefaultEdgeRuleChain(event, vm.grid.detailsConfig.currentItem)" 32 + on-remove-default-edge-rule-chain="vm.unsetAutoAssignToEdgeRuleChain(event, vm.grid.detailsConfig.currentItem)"
33 on-set-root-rule-chain="vm.setRootRuleChain(event, vm.grid.detailsConfig.currentItem)" 33 on-set-root-rule-chain="vm.setRootRuleChain(event, vm.grid.detailsConfig.currentItem)"
34 on-export-rule-chain="vm.exportRuleChain(event, vm.grid.detailsConfig.currentItem)" 34 on-export-rule-chain="vm.exportRuleChain(event, vm.grid.detailsConfig.currentItem)"
35 on-delete-rule-chain="vm.grid.deleteItem(event, vm.grid.detailsConfig.currentItem)"> 35 on-delete-rule-chain="vm.grid.deleteItem(event, vm.grid.detailsConfig.currentItem)">