Merge pull request #6931 from YuriyLytvynchuk/fix_bug_import_rulechain
[3.4] Fix export/Import RuleChain for nested RuleChains
This commit is contained in:
commit
438f90f3ec
@ -84,7 +84,7 @@ public class BaseRuleChainService extends AbstractEntityService implements RuleC
|
|||||||
private static final int DEFAULT_PAGE_SIZE = 1000;
|
private static final int DEFAULT_PAGE_SIZE = 1000;
|
||||||
|
|
||||||
public static final String INCORRECT_TENANT_ID = "Incorrect tenantId ";
|
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
|
@Autowired
|
||||||
private RuleChainDao ruleChainDao;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user