mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-23 22:48:09 +08:00
enhancement #I61EMZ 添加验证EL规则的api,供检查之用
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user