Browse Source
Merge pull request #6931 from YuriyLytvynchuk/fix_bug_import_rulechain
[3.4] Fix export/Import RuleChain for nested RuleChains
pull/6939/head
Igor Kulikov
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
14 additions and
1 deletions
-
dao/src/main/java/org/thingsboard/server/dao/rule/BaseRuleChainService.java
|
|
|
@ -84,7 +84,7 @@ public class BaseRuleChainService extends AbstractEntityService implements RuleC |
|
|
|
private static final int DEFAULT_PAGE_SIZE = 1000; |
|
|
|
|
|
|
|
public static final String INCORRECT_TENANT_ID = "Incorrect tenantId "; |
|
|
|
|
|
|
|
public static final String TB_RULE_CHAIN_INPUT_NODE = "org.thingsboard.rule.engine.flow.TbRuleChainInputNode"; |
|
|
|
@Autowired |
|
|
|
private RuleChainDao ruleChainDao; |
|
|
|
|
|
|
|
@ -566,6 +566,19 @@ public class BaseRuleChainService extends AbstractEntityService implements RuleC |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (!CollectionUtils.isEmpty(metaData.getNodes())) { |
|
|
|
metaData.getNodes().stream() |
|
|
|
.filter(ruleNode -> ruleNode.getType().equals(TB_RULE_CHAIN_INPUT_NODE)) |
|
|
|
.forEach(ruleNode -> { |
|
|
|
ObjectNode configuration = (ObjectNode) ruleNode.getConfiguration(); |
|
|
|
if (configuration.has("ruleChainId")) { |
|
|
|
if (configuration.get("ruleChainId").asText().equals(oldRuleChainId.toString())) { |
|
|
|
configuration.put("ruleChainId", newRuleChainId.toString()); |
|
|
|
ruleNode.setConfiguration(configuration); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|