enhancement #I61EMZ 添加验证EL规则的api,供检查之用

This commit is contained in:
zendwang
2022-11-29 18:36:31 +08:00
parent d9d8ace091
commit 2921694314
2 changed files with 46 additions and 1 deletions

View File

@@ -32,6 +32,11 @@ public class LiteFlowChainELBuilder {
private Chain chain;
/**
* 是否只需要验证EL表达式
*/
private Boolean onlyValidate;
/**
* //这是主体的Condition不包含前置和后置
* //声明这个变量而不是用chain.getConditionList的目的是为了辅助平滑加载
@@ -87,6 +92,7 @@ public class LiteFlowChainELBuilder {
public LiteFlowChainELBuilder() {
chain = new Chain();
onlyValidate = Boolean.FALSE;
conditionList = new ArrayList<>();
preConditionList = new ArrayList<>();
finallyConditionList = new ArrayList<>();
@@ -118,6 +124,11 @@ public class LiteFlowChainELBuilder {
return this;
}
public LiteFlowChainELBuilder setOnlyValidate() {
this.onlyValidate = Boolean.TRUE;
return this;
}
public LiteFlowChainELBuilder setEL(String elStr) {
if (StrUtil.isBlank(elStr)) {
String errMsg = StrUtil.format("no content in this chain[{}]", chain.getChainId());
@@ -176,7 +187,10 @@ public class LiteFlowChainELBuilder {
checkBuild();
FlowBus.addChain(this.chain);
// 仅校验EL表达式格式是否正确时当前生成的chain 不加入元数据
if (!this.onlyValidate) {
FlowBus.addChain(this.chain);
}
}
/**