mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 20:22:07 +08:00
@@ -2,7 +2,6 @@ package com.yomahub.liteflow.builder;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.yomahub.liteflow.enums.ConditionTypeEnum;
|
||||
import com.yomahub.liteflow.flow.FlowBus;
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.yomahub.liteflow.builder;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.yomahub.liteflow.common.LocalDefaultFlowConstant;
|
||||
import com.yomahub.liteflow.enums.ConditionTypeEnum;
|
||||
import com.yomahub.liteflow.flow.element.condition.Condition;
|
||||
import com.yomahub.liteflow.flow.element.condition.WhenCondition;
|
||||
|
||||
|
||||
@@ -11,9 +11,10 @@ import com.yomahub.liteflow.exception.FlowSystemException;
|
||||
import com.yomahub.liteflow.flow.FlowBus;
|
||||
import com.yomahub.liteflow.flow.element.Chain;
|
||||
import com.yomahub.liteflow.flow.element.Executable;
|
||||
import com.yomahub.liteflow.flow.element.condition.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.yomahub.liteflow.flow.element.condition.Condition;
|
||||
import com.yomahub.liteflow.flow.element.condition.FinallyCondition;
|
||||
import com.yomahub.liteflow.flow.element.condition.PreCondition;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -25,8 +26,6 @@ import java.util.List;
|
||||
*/
|
||||
public class LiteFlowChainELBuilder {
|
||||
|
||||
private final Logger LOG = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
private Chain chain;
|
||||
|
||||
//这是主体的Condition,不包含前置和后置
|
||||
|
||||
@@ -19,15 +19,13 @@ public class AnyOperator extends BaseOperator {
|
||||
|
||||
WhenCondition whenCondition = OperatorHelper.convert(objects[0], WhenCondition.class);
|
||||
|
||||
boolean any = false;
|
||||
if (objects[1] instanceof Boolean) {
|
||||
any = Boolean.parseBoolean(objects[1].toString().toLowerCase());
|
||||
// any
|
||||
whenCondition.setAny(Boolean.parseBoolean(objects[1].toString().toLowerCase()));
|
||||
} else {
|
||||
throw new QLException("the parameter must be boolean type");
|
||||
}
|
||||
|
||||
whenCondition.setAny(any);
|
||||
|
||||
return whenCondition;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,16 +23,14 @@ public class IdOperator extends BaseOperator {
|
||||
|
||||
Condition condition = OperatorHelper.convert(objects[0], Condition.class);
|
||||
|
||||
String id;
|
||||
if (objects[1] instanceof String) {
|
||||
id = objects[1].toString();
|
||||
// id
|
||||
condition.setId(objects[1].toString());
|
||||
} else {
|
||||
LOG.error("the parameter must be String type!");
|
||||
throw new QLException("the parameter must be String type");
|
||||
}
|
||||
|
||||
condition.setId(id);
|
||||
|
||||
return condition;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,15 +19,13 @@ public class IgnoreErrorOperator extends BaseOperator {
|
||||
|
||||
WhenCondition condition = OperatorHelper.convert(objects[0], WhenCondition.class);
|
||||
|
||||
boolean ignoreError = false;
|
||||
if (objects[1] instanceof Boolean) {
|
||||
ignoreError = Boolean.parseBoolean(objects[1].toString().toLowerCase());
|
||||
// ignoreError
|
||||
condition.setErrorResume(Boolean.parseBoolean(objects[1].toString().toLowerCase()));
|
||||
} else {
|
||||
throw new QLException("The parameter must be boolean type");
|
||||
}
|
||||
|
||||
condition.setErrorResume(ignoreError);
|
||||
|
||||
return condition;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public class TagOperator extends BaseOperator {
|
||||
|
||||
Node node = OperatorHelper.convert(objects[0], Node.class);
|
||||
|
||||
String tag = null;
|
||||
String tag ;
|
||||
if (objects[1] instanceof String) {
|
||||
tag = objects[1].toString();
|
||||
} else {
|
||||
@@ -30,7 +30,9 @@ public class TagOperator extends BaseOperator {
|
||||
//这里为什么要clone一个呢?
|
||||
//因为tag是跟着chain走的。而在el上下文里的放的都是同一个node,如果多个同样的node tag不同,则这里必须copy
|
||||
Node copyNode = FlowBus.copyNode(node.getId());
|
||||
|
||||
if (null == copyNode){
|
||||
throw new QLException("The Node must be not null");
|
||||
}
|
||||
copyNode.setTag(tag);
|
||||
|
||||
return copyNode;
|
||||
|
||||
@@ -19,15 +19,13 @@ public class ThreadPoolOperator extends BaseOperator {
|
||||
|
||||
WhenCondition whenCondition = OperatorHelper.convert(objects[0], WhenCondition.class);
|
||||
|
||||
String threadPoolClazz = null;
|
||||
if (objects[1] instanceof String) {
|
||||
threadPoolClazz = objects[1].toString();
|
||||
// threadPoolClazz
|
||||
whenCondition.setThreadExecutorClass(objects[1].toString());
|
||||
} else {
|
||||
throw new QLException("the parameter must be String type");
|
||||
}
|
||||
|
||||
whenCondition.setThreadExecutorClass(threadPoolClazz);
|
||||
|
||||
return whenCondition;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user