feature #I7YYLE 完善注释

This commit is contained in:
Dale Lee
2023-10-02 20:14:33 +08:00
parent acdafba090
commit bb9b355f8b
6 changed files with 21 additions and 16 deletions

View File

@@ -1,15 +1,7 @@
package com.yomahub.liteflow.builder.el.operator;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.ql.util.express.ArraySwap;
import com.ql.util.express.IExpressContext;
import com.ql.util.express.InstructionSetContext;
import com.ql.util.express.OperateData;
import com.ql.util.express.exception.QLException;
import com.yomahub.liteflow.builder.el.operator.base.BaseOperator;
import com.yomahub.liteflow.builder.el.operator.base.OperatorHelper;
import com.yomahub.liteflow.core.NodeComponent;
import com.yomahub.liteflow.exception.ELParseException;
import com.yomahub.liteflow.flow.FlowBus;
import com.yomahub.liteflow.flow.element.FallbackNodeProxy;
@@ -20,20 +12,13 @@ import com.yomahub.liteflow.property.LiteflowConfigGetter;
/**
* EL规则中的node的操作符
*
* @author Bryan.Zhang
* @author Bryan.Zhang,DaleLee
* @since 2.8.3
*/
public class NodeOperator extends BaseOperator<Node> {
@Override
public Node build(Object[] objects) throws Exception {
// 检查是否开启了组件降级功能
LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
Boolean enable = liteflowConfig.getFallbackCmpEnable();
if (!enable) {
throw new ELParseException("The fallback component is disabled");
}
OperatorHelper.checkObjectSizeEqOne(objects);
String nodeId = OperatorHelper.convert(objects[0], String.class);
@@ -41,6 +26,12 @@ public class NodeOperator extends BaseOperator<Node> {
// 找到对应节点
return FlowBus.getNode(nodeId);
} else {
// 检查是否开启了组件降级功能
LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
Boolean enable = liteflowConfig.getFallbackCmpEnable();
if (!enable) {
throw new ELParseException("The fallback component is disabled");
}
// 生成代理节点
return new FallbackNodeProxy(nodeId);
}

View File

@@ -45,6 +45,7 @@ import java.util.stream.Collectors;
* 流程元数据类
*
* @author Bryan.Zhang
* @author DaleLee
*/
public class FlowBus {

View File

@@ -28,6 +28,7 @@ import java.util.Map;
* Condition的抽象类
*
* @author Bryan.Zhang
* @author DaleLee
*/
public abstract class Condition implements Executable {

View File

@@ -17,6 +17,12 @@ import com.yomahub.liteflow.flow.element.condition.WhileCondition;
import com.yomahub.liteflow.slot.DataBus;
import com.yomahub.liteflow.slot.Slot;
/**
* 降级组件代理
*
* @author DaleLee
* @since
*/
public class FallbackNodeProxy extends Node {
// 原节点 id

View File

@@ -33,6 +33,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
*
* @author Bryan.Zhang
* @author LeoLee
* @author DaleLee
*/
@SuppressWarnings("unchecked")
public class Slot {

View File

@@ -11,6 +11,11 @@ import org.springframework.test.context.TestPropertySource;
import javax.annotation.Resource;
/**
* SpringBoot 降级组件测试
*
* @author DaleLee
*/
@TestPropertySource(value = "classpath:/fallback/application.properties")
@SpringBootTest(classes = FallbackSpringbootTest.class)
@EnableAutoConfiguration