enhancement #I8SMQB BREAK、IF、WHILE组件统一变成布尔组件

This commit is contained in:
everywhere.z 2024-02-21 17:23:36 +08:00
parent 32f8c33589
commit 6058038302
157 changed files with 463 additions and 688 deletions

View File

@ -1,5 +1,6 @@
package com.yomahub.liteflow.annotation; package com.yomahub.liteflow.annotation;
import com.yomahub.liteflow.enums.BooleanTypeEnum;
import com.yomahub.liteflow.enums.NodeTypeEnum; import com.yomahub.liteflow.enums.NodeTypeEnum;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
@ -20,4 +21,6 @@ import java.lang.annotation.Target;
@Documented @Documented
@Inherited @Inherited
public @interface FallbackCmp { public @interface FallbackCmp {
BooleanTypeEnum value() default BooleanTypeEnum.NOT_BOOL;
} }

View File

@ -34,22 +34,14 @@ public class LiteFlowNodeBuilder {
return new LiteFlowNodeBuilder(NodeTypeEnum.SWITCH); return new LiteFlowNodeBuilder(NodeTypeEnum.SWITCH);
} }
public static LiteFlowNodeBuilder createIfNode() { public static LiteFlowNodeBuilder createBooleanNode() {
return new LiteFlowNodeBuilder(NodeTypeEnum.IF); return new LiteFlowNodeBuilder(NodeTypeEnum.BOOLEAN);
} }
public static LiteFlowNodeBuilder createForNode() { public static LiteFlowNodeBuilder createForNode() {
return new LiteFlowNodeBuilder(NodeTypeEnum.FOR); return new LiteFlowNodeBuilder(NodeTypeEnum.FOR);
} }
public static LiteFlowNodeBuilder createWhileNode() {
return new LiteFlowNodeBuilder(NodeTypeEnum.WHILE);
}
public static LiteFlowNodeBuilder createBreakNode() {
return new LiteFlowNodeBuilder(NodeTypeEnum.BREAK);
}
public static LiteFlowNodeBuilder createIteratorNode() { public static LiteFlowNodeBuilder createIteratorNode() {
return new LiteFlowNodeBuilder(NodeTypeEnum.ITERATOR); return new LiteFlowNodeBuilder(NodeTypeEnum.ITERATOR);
} }
@ -62,22 +54,14 @@ public class LiteFlowNodeBuilder {
return new LiteFlowNodeBuilder(NodeTypeEnum.SWITCH_SCRIPT); return new LiteFlowNodeBuilder(NodeTypeEnum.SWITCH_SCRIPT);
} }
public static LiteFlowNodeBuilder createScriptIfNode() { public static LiteFlowNodeBuilder createScriptBooleanNode() {
return new LiteFlowNodeBuilder(NodeTypeEnum.IF_SCRIPT); return new LiteFlowNodeBuilder(NodeTypeEnum.BOOLEAN_SCRIPT);
} }
public static LiteFlowNodeBuilder createScriptForNode() { public static LiteFlowNodeBuilder createScriptForNode() {
return new LiteFlowNodeBuilder(NodeTypeEnum.FOR_SCRIPT); return new LiteFlowNodeBuilder(NodeTypeEnum.FOR_SCRIPT);
} }
public static LiteFlowNodeBuilder createScriptWhileNode() {
return new LiteFlowNodeBuilder(NodeTypeEnum.WHILE_SCRIPT);
}
public static LiteFlowNodeBuilder createScriptBreakNode() {
return new LiteFlowNodeBuilder(NodeTypeEnum.BREAK_SCRIPT);
}
public LiteFlowNodeBuilder() { public LiteFlowNodeBuilder() {
this.node = new Node(); this.node = new Node();
} }

View File

@ -167,12 +167,8 @@ public class OperatorHelper {
Executable item = (Executable) object; Executable item = (Executable) object;
if (item.getExecuteType().equals(ExecuteTypeEnum.NODE)){ if (item.getExecuteType().equals(ExecuteTypeEnum.NODE)){
Node node = (Node) item; Node node = (Node) item;
if (!ListUtil.toList(NodeTypeEnum.IF, if (!ListUtil.toList(NodeTypeEnum.BOOLEAN,
NodeTypeEnum.IF_SCRIPT, NodeTypeEnum.BOOLEAN_SCRIPT,
NodeTypeEnum.WHILE,
NodeTypeEnum.WHILE_SCRIPT,
NodeTypeEnum.BREAK,
NodeTypeEnum.BREAK_SCRIPT,
NodeTypeEnum.FALLBACK).contains(node.getType())){ NodeTypeEnum.FALLBACK).contains(node.getType())){
throw new QLException(StrUtil.format("The node[{}] must be boolean type Node.", node.getId())); throw new QLException(StrUtil.format("The node[{}] must be boolean type Node.", node.getId()));
} }

View File

@ -1,23 +1,22 @@
package com.yomahub.liteflow.core; package com.yomahub.liteflow.core;
import com.yomahub.liteflow.slot.DataBus; import com.yomahub.liteflow.slot.DataBus;
import com.yomahub.liteflow.core.proxy.LiteFlowProxyUtil;
/** /**
* IF节点抽象类 * BOOLEAN类型的抽象节点
* *
* @author Bryan.Zhang * @author Bryan.Zhang
* @since 2.8.5 * @since 2.12.0
*/ */
public abstract class NodeIfComponent extends NodeComponent { public abstract class NodeBooleanComponent extends NodeComponent {
@Override @Override
public void process() throws Exception { public void process() throws Exception {
boolean result = this.processIf(); boolean result = this.processBoolean();
this.getSlot().setIfResult(this.getMetaValueKey(), result); this.getSlot().setIfResult(this.getMetaValueKey(), result);
} }
public abstract boolean processIf() throws Exception; public abstract boolean processBoolean() throws Exception;
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View File

@ -1,30 +0,0 @@
package com.yomahub.liteflow.core;
import com.yomahub.liteflow.slot.DataBus;
import com.yomahub.liteflow.slot.Slot;
import com.yomahub.liteflow.core.proxy.LiteFlowProxyUtil;
/**
* 循环跳出节点逻辑抽象类
*
* @author Bryan.Zhang
* @since 2.9.0
*/
public abstract class NodeBreakComponent extends NodeComponent {
@Override
public void process() throws Exception {
boolean breakFlag = processBreak();
Slot slot = this.getSlot();
slot.setBreakResult(this.getMetaValueKey(), breakFlag);
}
public abstract boolean processBreak() throws Exception;
@Override
@SuppressWarnings("unchecked")
public Boolean getItemResultMetaValue(Integer slotIndex) {
return DataBus.getSlot(slotIndex).getBreakResult(this.getMetaValueKey());
}
}

View File

@ -1,30 +0,0 @@
package com.yomahub.liteflow.core;
import com.yomahub.liteflow.slot.DataBus;
import com.yomahub.liteflow.slot.Slot;
import com.yomahub.liteflow.core.proxy.LiteFlowProxyUtil;
/**
* WHILE条件节点抽象类
*
* @author Bryan.Zhang
* @since 2.9.0
*/
public abstract class NodeWhileComponent extends NodeComponent {
@Override
public void process() throws Exception {
boolean whileFlag = processWhile();
Slot slot = this.getSlot();
slot.setWhileResult(this.getMetaValueKey(), whileFlag);
}
public abstract boolean processWhile() throws Exception;
@Override
@SuppressWarnings("unchecked")
public Boolean getItemResultMetaValue(Integer slotIndex) {
return DataBus.getSlot(slotIndex).getWhileResult(this.getMetaValueKey());
}
}

View File

@ -3,18 +3,16 @@ package com.yomahub.liteflow.core;
import com.yomahub.liteflow.script.ScriptExecuteWrap; import com.yomahub.liteflow.script.ScriptExecuteWrap;
import com.yomahub.liteflow.script.ScriptExecutorFactory; import com.yomahub.liteflow.script.ScriptExecutorFactory;
import java.util.Map;
/** /**
* 脚本IF节点 * 脚本BOOLEAN节点
* *
* @author Bryan.Zhang * @author Bryan.Zhang
* @since 2.8.5 * @since 2.12.0
*/ */
public class ScriptIfComponent extends NodeIfComponent implements ScriptComponent { public class ScriptBooleanComponent extends NodeBooleanComponent implements ScriptComponent {
@Override @Override
public boolean processIf() throws Exception { public boolean processBoolean() throws Exception {
ScriptExecuteWrap wrap = this.buildWrap(this); ScriptExecuteWrap wrap = this.buildWrap(this);
return (boolean) ScriptExecutorFactory.loadInstance() return (boolean) ScriptExecutorFactory.loadInstance()
.getScriptExecutor(this.getRefNode().getLanguage()) .getScriptExecutor(this.getRefNode().getLanguage())

View File

@ -1,29 +0,0 @@
package com.yomahub.liteflow.core;
import com.yomahub.liteflow.script.ScriptExecuteWrap;
import com.yomahub.liteflow.script.ScriptExecutorFactory;
import java.util.Map;
/**
* 脚本BREAK节点
*
* @author Bryan.Zhang
* @since 2.9.0
*/
public class ScriptBreakComponent extends NodeBreakComponent implements ScriptComponent {
@Override
public boolean processBreak() throws Exception {
ScriptExecuteWrap wrap = this.buildWrap(this);
return (boolean) ScriptExecutorFactory.loadInstance()
.getScriptExecutor(this.getRefNode().getLanguage())
.execute(wrap);
}
@Override
public void loadScript(String script, String language) {
ScriptExecutorFactory.loadInstance().getScriptExecutor(language).load(getNodeId(), script);
}
}

View File

@ -21,10 +21,8 @@ public interface ScriptComponent {
{ {
put(NodeTypeEnum.SCRIPT, ScriptCommonComponent.class); put(NodeTypeEnum.SCRIPT, ScriptCommonComponent.class);
put(NodeTypeEnum.SWITCH_SCRIPT, ScriptSwitchComponent.class); put(NodeTypeEnum.SWITCH_SCRIPT, ScriptSwitchComponent.class);
put(NodeTypeEnum.IF_SCRIPT, ScriptIfComponent.class); put(NodeTypeEnum.BOOLEAN_SCRIPT, ScriptBooleanComponent.class);
put(NodeTypeEnum.FOR_SCRIPT, ScriptForComponent.class); put(NodeTypeEnum.FOR_SCRIPT, ScriptForComponent.class);
put(NodeTypeEnum.WHILE_SCRIPT, ScriptWhileComponent.class);
put(NodeTypeEnum.BREAK_SCRIPT, ScriptBreakComponent.class);
} }
}; };

View File

@ -1,29 +0,0 @@
package com.yomahub.liteflow.core;
import com.yomahub.liteflow.script.ScriptExecuteWrap;
import com.yomahub.liteflow.script.ScriptExecutorFactory;
import java.util.Map;
/**
* 脚本WHILE节点
*
* @author Bryan.Zhang
* @since 2.9.0
*/
public class ScriptWhileComponent extends NodeWhileComponent implements ScriptComponent {
@Override
public boolean processWhile() throws Exception {
ScriptExecuteWrap wrap = this.buildWrap(this);
return (boolean) ScriptExecutorFactory.loadInstance()
.getScriptExecutor(this.getRefNode().getLanguage())
.execute(wrap);
}
@Override
public void loadScript(String script, String language) {
ScriptExecutorFactory.loadInstance().getScriptExecutor(language).load(getNodeId(), script);
}
}

View File

@ -0,0 +1,13 @@
package com.yomahub.liteflow.enums;
/**
* 布尔节点的细分TYPE
* 主要用于组件降级
*
* @author Bryan.Zhang
* @since 2.12.0
*/
public enum BooleanTypeEnum {
NOT_BOOL,IF,WHILE,BREAK
}

View File

@ -4,10 +4,8 @@ public enum LiteFlowMethodEnum {
PROCESS("process", true), PROCESS("process", true),
PROCESS_SWITCH("processSwitch", true), PROCESS_SWITCH("processSwitch", true),
PROCESS_IF("processIf", true), PROCESS_BOOLEAN("processBoolean", true),
PROCESS_FOR("processFor", true), PROCESS_FOR("processFor", true),
PROCESS_WHILE("processWhile", true),
PROCESS_BREAK("processBreak", true),
PROCESS_ITERATOR("processIterator", true), PROCESS_ITERATOR("processIterator", true),

View File

@ -25,28 +25,20 @@ public enum NodeTypeEnum {
SWITCH("switch", "选择", false, NodeSwitchComponent.class), SWITCH("switch", "选择", false, NodeSwitchComponent.class),
IF("if", "条件", false, NodeIfComponent.class), BOOLEAN("boolean", "布尔", false, NodeBooleanComponent.class),
FOR("for", "循环次数", false, NodeForComponent.class), FOR("for", "循环次数", false, NodeForComponent.class),
WHILE("while", "循环条件", false, NodeWhileComponent.class),
BREAK("break", "循环跳出", false, NodeBreakComponent.class),
ITERATOR("iterator", "循环迭代", false, NodeIteratorComponent.class), ITERATOR("iterator", "循环迭代", false, NodeIteratorComponent.class),
SCRIPT("script", "脚本", true, ScriptCommonComponent.class), SCRIPT("script", "脚本", true, ScriptCommonComponent.class),
SWITCH_SCRIPT("switch_script", "选择脚本", true, ScriptSwitchComponent.class), SWITCH_SCRIPT("switch_script", "选择脚本", true, ScriptSwitchComponent.class),
IF_SCRIPT("if_script", "条件脚本", true, ScriptIfComponent.class), BOOLEAN_SCRIPT("boolean_script", "布尔脚本", true, ScriptBooleanComponent.class),
FOR_SCRIPT("for_script", "循环次数脚本", true, ScriptForComponent.class), FOR_SCRIPT("for_script", "循环次数脚本", true, ScriptForComponent.class),
WHILE_SCRIPT("while_script", "循环条件脚本", true, ScriptWhileComponent.class),
BREAK_SCRIPT("break_script", "循环跳出脚本", true, ScriptBreakComponent.class),
FALLBACK("fallback", "降级", false, null); FALLBACK("fallback", "降级", false, null);
private static final LFLog LOG = LFLoggerManager.getLogger(NodeTypeEnum.class); private static final LFLog LOG = LFLoggerManager.getLogger(NodeTypeEnum.class);

View File

@ -16,6 +16,7 @@ import com.yomahub.liteflow.core.ComponentInitializer;
import com.yomahub.liteflow.core.NodeComponent; import com.yomahub.liteflow.core.NodeComponent;
import com.yomahub.liteflow.core.ScriptComponent; import com.yomahub.liteflow.core.ScriptComponent;
import com.yomahub.liteflow.core.proxy.DeclWarpBean; import com.yomahub.liteflow.core.proxy.DeclWarpBean;
import com.yomahub.liteflow.enums.BooleanTypeEnum;
import com.yomahub.liteflow.enums.FlowParserTypeEnum; import com.yomahub.liteflow.enums.FlowParserTypeEnum;
import com.yomahub.liteflow.enums.NodeTypeEnum; import com.yomahub.liteflow.enums.NodeTypeEnum;
import com.yomahub.liteflow.exception.ComponentCannotRegisterException; import com.yomahub.liteflow.exception.ComponentCannotRegisterException;
@ -59,7 +60,7 @@ public class FlowBus {
private static final Map<String, Node> nodeMap; private static final Map<String, Node> nodeMap;
private static final Map<NodeTypeEnum, Node> fallbackNodeMap; private static final Map<String, Node> fallbackNodeMap;
private static AtomicBoolean initStat = new AtomicBoolean(false); private static AtomicBoolean initStat = new AtomicBoolean(false);
@ -261,7 +262,12 @@ public class FlowBus {
} }
public static Node getFallBackNode(NodeTypeEnum nodeType) { public static Node getFallBackNode(NodeTypeEnum nodeType) {
return fallbackNodeMap.get(nodeType); return getFallBackNode(nodeType, BooleanTypeEnum.NOT_BOOL);
}
public static Node getFallBackNode(NodeTypeEnum nodeType, BooleanTypeEnum booleanTypeEnum){
String key = StrUtil.format("{}_{}", nodeType.name(), booleanTypeEnum.name());
return fallbackNodeMap.get(key);
} }
public static void cleanCache() { public static void cleanCache() {
@ -322,7 +328,8 @@ public class FlowBus {
} }
NodeTypeEnum nodeType = node.getType(); NodeTypeEnum nodeType = node.getType();
fallbackNodeMap.put(nodeType, node); String key = StrUtil.format("{}_{}", nodeType.name(), fallbackCmp.value().name());
fallbackNodeMap.put(key, node);
} }
// 重新加载脚本 // 重新加载脚本

View File

@ -3,6 +3,7 @@ package com.yomahub.liteflow.flow.element;
import cn.hutool.core.text.StrFormatter; import cn.hutool.core.text.StrFormatter;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.yomahub.liteflow.core.NodeComponent; import com.yomahub.liteflow.core.NodeComponent;
import com.yomahub.liteflow.enums.BooleanTypeEnum;
import com.yomahub.liteflow.enums.ConditionTypeEnum; import com.yomahub.liteflow.enums.ConditionTypeEnum;
import com.yomahub.liteflow.enums.NodeTypeEnum; import com.yomahub.liteflow.enums.NodeTypeEnum;
import com.yomahub.liteflow.exception.FallbackCmpNotFoundException; import com.yomahub.liteflow.exception.FallbackCmpNotFoundException;
@ -89,7 +90,8 @@ public class FallbackNode extends Node {
return findNodeInIterator((IteratorCondition) condition); return findNodeInIterator((IteratorCondition) condition);
case TYPE_NOT_OPT: case TYPE_NOT_OPT:
case TYPE_AND_OR_OPT: case TYPE_AND_OR_OPT:
return FlowBus.getFallBackNode(NodeTypeEnum.IF); //组件降级用在与并或中只能用在IF表达式中
return FlowBus.getFallBackNode(NodeTypeEnum.BOOLEAN, BooleanTypeEnum.IF);
default: default:
return null; return null;
} }
@ -99,7 +101,7 @@ public class FallbackNode extends Node {
Executable ifItem = ifCondition.getIfItem(); Executable ifItem = ifCondition.getIfItem();
if (ifItem == this) { if (ifItem == this) {
// 需要条件组件 // 需要条件组件
return FlowBus.getFallBackNode(NodeTypeEnum.IF); return FlowBus.getFallBackNode(NodeTypeEnum.BOOLEAN, BooleanTypeEnum.IF);
} }
// 需要普通组件 // 需要普通组件
@ -127,7 +129,7 @@ public class FallbackNode extends Node {
private Node findNodeInWhile(WhileCondition whileCondition) { private Node findNodeInWhile(WhileCondition whileCondition) {
Executable whileItem = whileCondition.getWhileItem(); Executable whileItem = whileCondition.getWhileItem();
if (whileItem == this) { if (whileItem == this) {
return FlowBus.getFallBackNode(NodeTypeEnum.WHILE); return FlowBus.getFallBackNode(NodeTypeEnum.BOOLEAN, BooleanTypeEnum.WHILE);
} }
return findNodeInLoop(whileCondition); return findNodeInLoop(whileCondition);
@ -145,7 +147,7 @@ public class FallbackNode extends Node {
private Node findNodeInLoop(LoopCondition loopCondition) { private Node findNodeInLoop(LoopCondition loopCondition) {
Executable breakItem = loopCondition.getExecutableOne(ConditionKey.BREAK_KEY); Executable breakItem = loopCondition.getExecutableOne(ConditionKey.BREAK_KEY);
if (breakItem == this) { if (breakItem == this) {
return FlowBus.getFallBackNode(NodeTypeEnum.BREAK); return FlowBus.getFallBackNode(NodeTypeEnum.BOOLEAN, BooleanTypeEnum.BREAK);
} }
return FlowBus.getFallBackNode(NodeTypeEnum.COMMON); return FlowBus.getFallBackNode(NodeTypeEnum.COMMON);

View File

@ -1,6 +1,6 @@
package com.yomahub.liteflow.solon; package com.yomahub.liteflow.solon;
import com.yomahub.liteflow.core.NodeIfComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import com.yomahub.liteflow.enums.LiteFlowMethodEnum; import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
import com.yomahub.liteflow.exception.LiteFlowException; import com.yomahub.liteflow.exception.LiteFlowException;
import org.noear.solon.core.BeanWrap; import org.noear.solon.core.BeanWrap;
@ -11,7 +11,7 @@ import java.lang.reflect.Method;
* @author noear * @author noear
* @since 1.11 * @since 1.11
*/ */
public class NodeIfComponentOfMethod extends NodeIfComponent { public class NodeBooleanComponentOfMethod extends NodeBooleanComponent {
final BeanWrap beanWrap; final BeanWrap beanWrap;
@ -19,7 +19,7 @@ public class NodeIfComponentOfMethod extends NodeIfComponent {
final LiteFlowMethodEnum methodEnum; final LiteFlowMethodEnum methodEnum;
public NodeIfComponentOfMethod(BeanWrap beanWrap, Method method, LiteFlowMethodEnum methodEnum) { public NodeBooleanComponentOfMethod(BeanWrap beanWrap, Method method, LiteFlowMethodEnum methodEnum) {
this.beanWrap = beanWrap; this.beanWrap = beanWrap;
this.method = method; this.method = method;
this.methodEnum = methodEnum; this.methodEnum = methodEnum;
@ -45,7 +45,7 @@ public class NodeIfComponentOfMethod extends NodeIfComponent {
} }
@Override @Override
public boolean processIf() throws Exception { public boolean processBoolean() throws Exception {
return (boolean) exec(); return (boolean) exec();
} }

View File

@ -1,53 +0,0 @@
package com.yomahub.liteflow.solon;
import com.yomahub.liteflow.core.NodeBreakComponent;
import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
import com.yomahub.liteflow.exception.LiteFlowException;
import org.noear.solon.core.BeanWrap;
import java.lang.reflect.Method;
/**
* @author noear
* @since 1.11
*/
public class NodeBreakComponentOfMethod extends NodeBreakComponent {
final BeanWrap beanWrap;
final Method method;
final LiteFlowMethodEnum methodEnum;
public NodeBreakComponentOfMethod(BeanWrap beanWrap, Method method, LiteFlowMethodEnum methodEnum) {
this.beanWrap = beanWrap;
this.method = method;
this.methodEnum = methodEnum;
if (method.getParameterCount() > 1) {
String methodFullName = beanWrap.clz().getName() + "::" + method.getName();
throw new LiteFlowException(
"NodeBreakComponent method parameter cannot be more than one: " + methodFullName);
}
if (method.getReturnType() != Boolean.class && method.getReturnType() != boolean.class) {
String methodFullName = beanWrap.clz().getName() + "::" + method.getName();
throw new LiteFlowException("NodeBreakComponent method returnType can only be boolean: " + methodFullName);
}
}
private Object exec() throws Exception {
if (method.getParameterCount() == 0) {
return method.invoke(beanWrap.get());
}
else {
return method.invoke(beanWrap.get(), this);
}
}
@Override
public boolean processBreak() throws Exception {
return (boolean) exec();
}
}

View File

@ -1,53 +0,0 @@
package com.yomahub.liteflow.solon;
import com.yomahub.liteflow.core.NodeWhileComponent;
import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
import com.yomahub.liteflow.exception.LiteFlowException;
import org.noear.solon.core.BeanWrap;
import java.lang.reflect.Method;
/**
* @author noear
* @since 1.11
*/
public class NodeWhileComponentOfMethod extends NodeWhileComponent {
final BeanWrap beanWrap;
final Method method;
final LiteFlowMethodEnum methodEnum;
public NodeWhileComponentOfMethod(BeanWrap beanWrap, Method method, LiteFlowMethodEnum methodEnum) {
this.beanWrap = beanWrap;
this.method = method;
this.methodEnum = methodEnum;
if (method.getParameterCount() > 1) {
String methodFullName = beanWrap.clz().getName() + "::" + method.getName();
throw new LiteFlowException(
"NodeWhileComponent method parameter cannot be more than one: " + methodFullName);
}
if (method.getReturnType() != Boolean.class && method.getReturnType() != boolean.class) {
String methodFullName = beanWrap.clz().getName() + "::" + method.getName();
throw new LiteFlowException("NodeWhileComponent method returnType can only be boolean: " + methodFullName);
}
}
private Object exec() throws Exception {
if (method.getParameterCount() == 0) {
return method.invoke(beanWrap.get());
}
else {
return method.invoke(beanWrap.get(), this);
}
}
@Override
public boolean processWhile() throws Exception {
return (boolean) exec();
}
}

View File

@ -58,18 +58,12 @@ public class XPluginImpl implements Plugin {
case PROCESS_SWITCH: case PROCESS_SWITCH:
node1 = new NodeSwitchComponentOfMethod(bw, method, anno.value()); node1 = new NodeSwitchComponentOfMethod(bw, method, anno.value());
break; break;
case PROCESS_IF: case PROCESS_BOOLEAN:
node1 = new NodeIfComponentOfMethod(bw, method, anno.value()); node1 = new NodeBooleanComponentOfMethod(bw, method, anno.value());
break; break;
case PROCESS_FOR: case PROCESS_FOR:
node1 = new NodeForComponentOfMethod(bw, method, anno.value()); node1 = new NodeForComponentOfMethod(bw, method, anno.value());
break; break;
case PROCESS_WHILE:
node1 = new NodeWhileComponentOfMethod(bw, method, anno.value());
break;
case PROCESS_BREAK:
node1 = new NodeBreakComponentOfMethod(bw, method, anno.value());
break;
default: default:
node1 = new NodeComponentOfMethod(bw, method, anno.value()); node1 = new NodeComponentOfMethod(bw, method, anno.value());
} }

View File

@ -25,7 +25,7 @@ public class CmpConfig {
System.out.println("BCmp executed!"); System.out.println("BCmp executed!");
} }
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_IF, nodeId = "c", nodeType = NodeTypeEnum.IF) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeId = "c", nodeType = NodeTypeEnum.BOOLEAN)
public boolean processIfC(NodeComponent bindCmp) throws Exception{ public boolean processIfC(NodeComponent bindCmp) throws Exception{
return true; return true;
} }

View File

@ -30,7 +30,7 @@ public class CmpConfig {
System.out.println("DCmp executed!"); System.out.println("DCmp executed!");
} }
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_IF, nodeId = "x1", nodeType = NodeTypeEnum.IF) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeId = "x1", nodeType = NodeTypeEnum.BOOLEAN)
public boolean processIfX1(NodeComponent bindCmp) throws Exception { public boolean processIfX1(NodeComponent bindCmp) throws Exception {
return Boolean.parseBoolean(bindCmp.getTag()); return Boolean.parseBoolean(bindCmp.getTag());
} }

View File

@ -29,7 +29,7 @@ public class CmpConfig {
} }
} }
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BREAK, nodeId = "b", nodeType = NodeTypeEnum.BREAK) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeId = "b", nodeType = NodeTypeEnum.BOOLEAN)
public boolean processB(NodeComponent bindCmp) { public boolean processB(NodeComponent bindCmp) {
return bindCmp.getLoopIndex() == 1; return bindCmp.getLoopIndex() == 1;
} }

View File

@ -59,14 +59,14 @@ public class CmpConfig {
return 3; return 3;
} }
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BREAK, nodeId = "y", nodeType = NodeTypeEnum.BREAK) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeId = "y", nodeType = NodeTypeEnum.BOOLEAN)
public boolean processY(NodeComponent bindCmp) { public boolean processY(NodeComponent bindCmp) {
DefaultContext context = bindCmp.getFirstContextBean(); DefaultContext context = bindCmp.getFirstContextBean();
int count = context.getData("test"); int count = context.getData("test");
return count > 3; return count > 3;
} }
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_WHILE, nodeId = "z", nodeType = NodeTypeEnum.WHILE) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeId = "z", nodeType = NodeTypeEnum.BOOLEAN)
public boolean processZ(NodeComponent bindCmp) { public boolean processZ(NodeComponent bindCmp) {
DefaultContext context = bindCmp.getFirstContextBean(); DefaultContext context = bindCmp.getFirstContextBean();
String key = "test"; String key = "test";

View File

@ -69,7 +69,7 @@ public class CmpConfig {
System.out.println("DCmp executed!"); System.out.println("DCmp executed!");
} }
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_IF, nodeId = "f", nodeType = NodeTypeEnum.IF) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeId = "f", nodeType = NodeTypeEnum.BOOLEAN)
public boolean processIf(NodeComponent bindCmp) throws Exception { public boolean processIf(NodeComponent bindCmp) throws Exception {
return true; return true;
} }
@ -79,7 +79,7 @@ public class CmpConfig {
return "b"; return "b";
} }
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_WHILE, nodeId = "w", nodeType = NodeTypeEnum.WHILE) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeId = "w", nodeType = NodeTypeEnum.BOOLEAN)
public boolean processWhile(NodeComponent bindCmp) throws Exception { public boolean processWhile(NodeComponent bindCmp) throws Exception {
// 判断是否切换了 chain // 判断是否切换了 chain
if (!executedChain.contains(bindCmp.getCurrChainId())) { if (!executedChain.contains(bindCmp.getCurrChainId())) {

View File

@ -69,7 +69,7 @@ public class CmpConfig {
System.out.println("DCmp executed!"); System.out.println("DCmp executed!");
} }
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_IF, nodeId = "f", nodeType = NodeTypeEnum.IF) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeId = "f", nodeType = NodeTypeEnum.BOOLEAN)
public boolean processIf(NodeComponent bindCmp) throws Exception { public boolean processIf(NodeComponent bindCmp) throws Exception {
return true; return true;
} }
@ -79,7 +79,7 @@ public class CmpConfig {
return "b"; return "b";
} }
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_WHILE, nodeId = "w", nodeType = NodeTypeEnum.WHILE) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeId = "w", nodeType = NodeTypeEnum.BOOLEAN)
public boolean processWhile(NodeComponent bindCmp) throws Exception { public boolean processWhile(NodeComponent bindCmp) throws Exception {
// 判断是否切换了 chain // 判断是否切换了 chain
if (!executedChain.contains(bindCmp.getCurrChainId())) { if (!executedChain.contains(bindCmp.getCurrChainId())) {

View File

@ -94,7 +94,7 @@ public class CmpConfig {
return 3; return 3;
} }
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BREAK, nodeId = "y", nodeType = NodeTypeEnum.BREAK) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeId = "y", nodeType = NodeTypeEnum.BOOLEAN)
public boolean processY(NodeComponent bindCmp) { public boolean processY(NodeComponent bindCmp) {
DefaultContext context = bindCmp.getFirstContextBean(); DefaultContext context = bindCmp.getFirstContextBean();
int count = 0; int count = 0;
@ -104,7 +104,7 @@ public class CmpConfig {
return count > 3; return count > 3;
} }
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_WHILE, nodeId = "z", nodeType = NodeTypeEnum.WHILE) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeId = "z", nodeType = NodeTypeEnum.BOOLEAN)
public boolean processZ(NodeComponent bindCmp) { public boolean processZ(NodeComponent bindCmp) {
DefaultContext context = bindCmp.getFirstContextBean(); DefaultContext context = bindCmp.getFirstContextBean();
String key = "test"; String key = "test";

View File

@ -51,7 +51,7 @@ public class CmpConfig {
else return "a"; else return "a";
} }
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_IF, nodeId = "f", nodeType = NodeTypeEnum.IF) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeId = "f", nodeType = NodeTypeEnum.BOOLEAN)
public boolean processF(NodeComponent bindCmp) { public boolean processF(NodeComponent bindCmp) {
System.out.println("FCmp executed!"); System.out.println("FCmp executed!");
flagf ++; flagf ++;
@ -77,7 +77,7 @@ public class CmpConfig {
else flagm = 0; else flagm = 0;
} }
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_WHILE, nodeId = "n", nodeType = NodeTypeEnum.WHILE) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeId = "n", nodeType = NodeTypeEnum.BOOLEAN)
public boolean processN(NodeComponent bindCmp) { public boolean processN(NodeComponent bindCmp) {
flagn ++; flagn ++;
System.out.println("NCmp executed!"); System.out.println("NCmp executed!");

View File

@ -102,13 +102,13 @@ public class CmpConfig {
System.out.println("GCmp rollback!"); System.out.println("GCmp rollback!");
} }
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BREAK, nodeId = "h", nodeType = NodeTypeEnum.BREAK) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeId = "h", nodeType = NodeTypeEnum.BOOLEAN)
public int processH(NodeComponent bindCmp) { public int processH(NodeComponent bindCmp) {
System.out.println("HCmp executed!"); System.out.println("HCmp executed!");
throw new RuntimeException(); throw new RuntimeException();
} }
@LiteflowMethod(value = LiteFlowMethodEnum.ROLLBACK, nodeId = "h", nodeType = NodeTypeEnum.BREAK) @LiteflowMethod(value = LiteFlowMethodEnum.ROLLBACK, nodeId = "h", nodeType = NodeTypeEnum.BOOLEAN)
public void rollbackH() throws Exception { public void rollbackH() throws Exception {
System.out.println("HCmp rollback!"); System.out.println("HCmp rollback!");
} }
@ -124,24 +124,24 @@ public class CmpConfig {
System.out.println("ICmp rollback!"); System.out.println("ICmp rollback!");
} }
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_WHILE, nodeId = "w", nodeType = NodeTypeEnum.WHILE) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeId = "w", nodeType = NodeTypeEnum.BOOLEAN)
public boolean processW(NodeComponent bindCmp) { public boolean processW(NodeComponent bindCmp) {
System.out.println("WCmp executed!"); System.out.println("WCmp executed!");
return true; return true;
} }
@LiteflowMethod(value = LiteFlowMethodEnum.ROLLBACK, nodeId = "w", nodeType = NodeTypeEnum.WHILE) @LiteflowMethod(value = LiteFlowMethodEnum.ROLLBACK, nodeId = "w", nodeType = NodeTypeEnum.BOOLEAN)
public void rollbackW() throws Exception { public void rollbackW() throws Exception {
System.out.println("WCmp rollback!"); System.out.println("WCmp rollback!");
} }
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_IF, nodeId = "x", nodeType = NodeTypeEnum.IF) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeId = "x", nodeType = NodeTypeEnum.BOOLEAN)
public boolean processX(NodeComponent bindCmp) { public boolean processX(NodeComponent bindCmp) {
System.out.println("XCmp executed!"); System.out.println("XCmp executed!");
return true; return true;
} }
@LiteflowMethod(value = LiteFlowMethodEnum.ROLLBACK, nodeId = "x", nodeType = NodeTypeEnum.IF) @LiteflowMethod(value = LiteFlowMethodEnum.ROLLBACK, nodeId = "x", nodeType = NodeTypeEnum.BOOLEAN)
public void rollbackX() throws Exception { public void rollbackX() throws Exception {
System.out.println("XCmp rollback!"); System.out.println("XCmp rollback!");
} }

View File

@ -8,9 +8,9 @@ import com.yomahub.liteflow.enums.NodeTypeEnum;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component("c") @Component("c")
@LiteflowCmpDefine(NodeTypeEnum.IF) @LiteflowCmpDefine(NodeTypeEnum.BOOLEAN)
public class CCmp { public class CCmp {
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_IF, nodeType = NodeTypeEnum.IF) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeType = NodeTypeEnum.BOOLEAN)
public boolean processIf(NodeComponent bindCmp) throws Exception { public boolean processIf(NodeComponent bindCmp) throws Exception {
return true; return true;
} }

View File

@ -5,15 +5,16 @@ import com.yomahub.liteflow.annotation.LiteflowCmpDefine;
import com.yomahub.liteflow.annotation.LiteflowComponent; import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.annotation.LiteflowMethod; import com.yomahub.liteflow.annotation.LiteflowMethod;
import com.yomahub.liteflow.core.NodeComponent; import com.yomahub.liteflow.core.NodeComponent;
import com.yomahub.liteflow.enums.BooleanTypeEnum;
import com.yomahub.liteflow.enums.LiteFlowMethodEnum; import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
import com.yomahub.liteflow.enums.NodeTypeEnum; import com.yomahub.liteflow.enums.NodeTypeEnum;
@LiteflowComponent("bn1") @LiteflowComponent("bn1")
@LiteflowCmpDefine(NodeTypeEnum.BREAK) @LiteflowCmpDefine(NodeTypeEnum.BOOLEAN)
@FallbackCmp @FallbackCmp(BooleanTypeEnum.BREAK)
public class BreakCmp { public class BreakCmp {
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BREAK) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN)
public boolean processBreak(NodeComponent bindCmp) throws Exception { public boolean processBreak(NodeComponent bindCmp) throws Exception {
return true; return true;
} }

View File

@ -8,10 +8,10 @@ import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
import com.yomahub.liteflow.enums.NodeTypeEnum; import com.yomahub.liteflow.enums.NodeTypeEnum;
@LiteflowComponent("ifn1") @LiteflowComponent("ifn1")
@LiteflowCmpDefine(NodeTypeEnum.IF) @LiteflowCmpDefine(NodeTypeEnum.BOOLEAN)
public class IfCmp1 { public class IfCmp1 {
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_IF) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN)
public boolean processIf(NodeComponent bindCmp) throws Exception { public boolean processIf(NodeComponent bindCmp) throws Exception {
return true; return true;
} }

View File

@ -5,15 +5,16 @@ import com.yomahub.liteflow.annotation.LiteflowCmpDefine;
import com.yomahub.liteflow.annotation.LiteflowComponent; import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.annotation.LiteflowMethod; import com.yomahub.liteflow.annotation.LiteflowMethod;
import com.yomahub.liteflow.core.NodeComponent; import com.yomahub.liteflow.core.NodeComponent;
import com.yomahub.liteflow.enums.BooleanTypeEnum;
import com.yomahub.liteflow.enums.LiteFlowMethodEnum; import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
import com.yomahub.liteflow.enums.NodeTypeEnum; import com.yomahub.liteflow.enums.NodeTypeEnum;
@LiteflowComponent("ifn2") @LiteflowComponent("ifn2")
@LiteflowCmpDefine(NodeTypeEnum.IF) @LiteflowCmpDefine(NodeTypeEnum.BOOLEAN)
@FallbackCmp @FallbackCmp(BooleanTypeEnum.IF)
public class IfCmp2 { public class IfCmp2 {
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_IF) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN)
public boolean processIf(NodeComponent bindCmp) throws Exception { public boolean processIf(NodeComponent bindCmp) throws Exception {
return false; return false;
} }

View File

@ -11,14 +11,14 @@ import java.util.HashSet;
import java.util.Set; import java.util.Set;
@LiteflowComponent("wn1") @LiteflowComponent("wn1")
@LiteflowCmpDefine(NodeTypeEnum.WHILE) @LiteflowCmpDefine(NodeTypeEnum.BOOLEAN)
public class WhileCmp1 { public class WhileCmp1 {
private int count = 0; private int count = 0;
// 执行过的 chain // 执行过的 chain
Set<String> executedChain = new HashSet<>(); Set<String> executedChain = new HashSet<>();
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_WHILE) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN)
public boolean processWhile(NodeComponent bindCmp) throws Exception { public boolean processWhile(NodeComponent bindCmp) throws Exception {
// 判断是否切换了 chain // 判断是否切换了 chain
if (!executedChain.contains(bindCmp.getCurrChainId())) { if (!executedChain.contains(bindCmp.getCurrChainId())) {

View File

@ -5,15 +5,16 @@ import com.yomahub.liteflow.annotation.LiteflowCmpDefine;
import com.yomahub.liteflow.annotation.LiteflowComponent; import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.annotation.LiteflowMethod; import com.yomahub.liteflow.annotation.LiteflowMethod;
import com.yomahub.liteflow.core.NodeComponent; import com.yomahub.liteflow.core.NodeComponent;
import com.yomahub.liteflow.enums.BooleanTypeEnum;
import com.yomahub.liteflow.enums.LiteFlowMethodEnum; import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
import com.yomahub.liteflow.enums.NodeTypeEnum; import com.yomahub.liteflow.enums.NodeTypeEnum;
@LiteflowComponent("wn2") @LiteflowComponent("wn2")
@LiteflowCmpDefine(NodeTypeEnum.WHILE) @LiteflowCmpDefine(NodeTypeEnum.BOOLEAN)
@FallbackCmp @FallbackCmp(BooleanTypeEnum.WHILE)
public class WhileCmp2 { public class WhileCmp2 {
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_WHILE) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN)
public boolean processWhile(NodeComponent bindCmp) throws Exception { public boolean processWhile(NodeComponent bindCmp) throws Exception {
return false; return false;
} }

View File

@ -16,7 +16,7 @@ import org.springframework.stereotype.Component;
@Component("x1") @Component("x1")
public class X1Cmp { public class X1Cmp {
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_IF, nodeType = NodeTypeEnum.IF) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeType = NodeTypeEnum.BOOLEAN)
public boolean processIf(NodeComponent bindCmp) throws Exception { public boolean processIf(NodeComponent bindCmp) throws Exception {
return Boolean.parseBoolean(bindCmp.getTag()); return Boolean.parseBoolean(bindCmp.getTag());
} }

View File

@ -3,17 +3,17 @@ package com.yomahub.liteflow.test.iterator.cmp;
import com.yomahub.liteflow.annotation.LiteflowCmpDefine; import com.yomahub.liteflow.annotation.LiteflowCmpDefine;
import com.yomahub.liteflow.annotation.LiteflowMethod; import com.yomahub.liteflow.annotation.LiteflowMethod;
import com.yomahub.liteflow.core.NodeBreakComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import com.yomahub.liteflow.core.NodeComponent; import com.yomahub.liteflow.core.NodeComponent;
import com.yomahub.liteflow.enums.LiteFlowMethodEnum; import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
import com.yomahub.liteflow.enums.NodeTypeEnum; import com.yomahub.liteflow.enums.NodeTypeEnum;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component("b") @Component("b")
@LiteflowCmpDefine(NodeTypeEnum.BREAK) @LiteflowCmpDefine(NodeTypeEnum.BOOLEAN)
public class BCmp { public class BCmp {
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_BREAK) @LiteflowMethod(LiteFlowMethodEnum.PROCESS_BOOLEAN)
public boolean processBreak(NodeComponent bindCmp) throws Exception { public boolean processBreak(NodeComponent bindCmp) throws Exception {
return bindCmp.getLoopIndex() == 1; return bindCmp.getLoopIndex() == 1;
} }

View File

@ -10,7 +10,7 @@ import com.yomahub.liteflow.slot.DefaultContext;
@LiteflowComponent("y") @LiteflowComponent("y")
public class YCmp { public class YCmp {
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BREAK, nodeType = NodeTypeEnum.BREAK) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeType = NodeTypeEnum.BOOLEAN)
public boolean processBreak(NodeComponent bindCmp) throws Exception { public boolean processBreak(NodeComponent bindCmp) throws Exception {
DefaultContext context = bindCmp.getFirstContextBean(); DefaultContext context = bindCmp.getFirstContextBean();
int count = context.getData("test"); int count = context.getData("test");

View File

@ -10,7 +10,7 @@ import com.yomahub.liteflow.slot.DefaultContext;
@LiteflowComponent("z") @LiteflowComponent("z")
public class ZCmp { public class ZCmp {
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_WHILE, nodeType = NodeTypeEnum.WHILE) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeType = NodeTypeEnum.BOOLEAN)
public boolean processWhile(NodeComponent bindCmp) throws Exception { public boolean processWhile(NodeComponent bindCmp) throws Exception {
DefaultContext context = bindCmp.getFirstContextBean(); DefaultContext context = bindCmp.getFirstContextBean();
String key = "test"; String key = "test";

View File

@ -8,10 +8,10 @@ import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
import com.yomahub.liteflow.enums.NodeTypeEnum; import com.yomahub.liteflow.enums.NodeTypeEnum;
@LiteflowComponent("f") @LiteflowComponent("f")
@LiteflowCmpDefine(NodeTypeEnum.IF) @LiteflowCmpDefine(NodeTypeEnum.BOOLEAN)
public class FCmp { public class FCmp {
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_IF, nodeType = NodeTypeEnum.IF) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeType = NodeTypeEnum.BOOLEAN)
public boolean processIf(NodeComponent bindCmp) throws Exception { public boolean processIf(NodeComponent bindCmp) throws Exception {
return true; return true;
} }

View File

@ -11,14 +11,14 @@ import java.util.HashSet;
import java.util.Set; import java.util.Set;
@LiteflowComponent("w") @LiteflowComponent("w")
@LiteflowCmpDefine(NodeTypeEnum.WHILE) @LiteflowCmpDefine(NodeTypeEnum.BOOLEAN)
public class WCmp { public class WCmp {
private int count = 0; private int count = 0;
// 执行过的 chain // 执行过的 chain
Set<String> executedChain = new HashSet<>(); Set<String> executedChain = new HashSet<>();
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_WHILE, nodeType = NodeTypeEnum.WHILE) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeType = NodeTypeEnum.BOOLEAN)
public boolean processWhile(NodeComponent bindCmp) throws Exception { public boolean processWhile(NodeComponent bindCmp) throws Exception {
// 判断是否切换了 chain // 判断是否切换了 chain
if (!executedChain.contains(bindCmp.getCurrChainId())) { if (!executedChain.contains(bindCmp.getCurrChainId())) {

View File

@ -8,10 +8,10 @@ import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
import com.yomahub.liteflow.enums.NodeTypeEnum; import com.yomahub.liteflow.enums.NodeTypeEnum;
@LiteflowComponent("f") @LiteflowComponent("f")
@LiteflowCmpDefine(NodeTypeEnum.IF) @LiteflowCmpDefine(NodeTypeEnum.BOOLEAN)
public class FCmp { public class FCmp {
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_IF, nodeType = NodeTypeEnum.IF) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeType = NodeTypeEnum.BOOLEAN)
public boolean processIf(NodeComponent bindCmp) throws Exception { public boolean processIf(NodeComponent bindCmp) throws Exception {
return true; return true;
} }

View File

@ -11,14 +11,14 @@ import java.util.HashSet;
import java.util.Set; import java.util.Set;
@LiteflowComponent("w") @LiteflowComponent("w")
@LiteflowCmpDefine(NodeTypeEnum.WHILE) @LiteflowCmpDefine(NodeTypeEnum.BOOLEAN)
public class WCmp { public class WCmp {
private int count = 0; private int count = 0;
// 执行过的 chain // 执行过的 chain
Set<String> executedChain = new HashSet<>(); Set<String> executedChain = new HashSet<>();
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_WHILE, nodeType = NodeTypeEnum.WHILE) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeType = NodeTypeEnum.BOOLEAN)
public boolean processWhile(NodeComponent bindCmp) throws Exception { public boolean processWhile(NodeComponent bindCmp) throws Exception {
// 判断是否切换了 chain // 判断是否切换了 chain
if (!executedChain.contains(bindCmp.getCurrChainId())) { if (!executedChain.contains(bindCmp.getCurrChainId())) {

View File

@ -10,7 +10,7 @@ import com.yomahub.liteflow.slot.DefaultContext;
@LiteflowComponent("y") @LiteflowComponent("y")
public class YCmp { public class YCmp {
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BREAK, nodeType = NodeTypeEnum.BREAK) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeType = NodeTypeEnum.BOOLEAN)
public boolean processBreak(NodeComponent bindCmp) throws Exception { public boolean processBreak(NodeComponent bindCmp) throws Exception {
DefaultContext context = bindCmp.getFirstContextBean(); DefaultContext context = bindCmp.getFirstContextBean();
int count = 0; int count = 0;

View File

@ -10,7 +10,7 @@ import com.yomahub.liteflow.slot.DefaultContext;
@LiteflowComponent("z") @LiteflowComponent("z")
public class ZCmp { public class ZCmp {
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_WHILE, nodeType = NodeTypeEnum.WHILE) @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeType = NodeTypeEnum.BOOLEAN)
public boolean processWhile(NodeComponent bindCmp) throws Exception { public boolean processWhile(NodeComponent bindCmp) throws Exception {
DefaultContext context = bindCmp.getFirstContextBean(); DefaultContext context = bindCmp.getFirstContextBean();
String key = "test"; String key = "test";

View File

@ -1,13 +1,13 @@
package com.yomahub.liteflow.test.retry.cmp; package com.yomahub.liteflow.test.retry.cmp;
import com.yomahub.liteflow.annotation.LiteflowComponent; import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeIfComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
@LiteflowComponent("f") @LiteflowComponent("f")
public class FCmp extends NodeIfComponent { public class FCmp extends NodeBooleanComponent {
int flag = 0; int flag = 0;
@Override @Override
public boolean processIf() throws Exception { public boolean processBoolean() throws Exception {
System.out.println("FCmp executed!"); System.out.println("FCmp executed!");
flag ++; flag ++;
if(flag < 4) throw new RuntimeException(); if(flag < 4) throw new RuntimeException();

View File

@ -1,14 +1,14 @@
package com.yomahub.liteflow.test.retry.cmp; package com.yomahub.liteflow.test.retry.cmp;
import com.yomahub.liteflow.annotation.LiteflowComponent; import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeWhileComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
@LiteflowComponent("n") @LiteflowComponent("n")
public class NCmp extends NodeWhileComponent { public class NCmp extends NodeBooleanComponent {
int flag = 0; int flag = 0;
@Override @Override
public boolean processWhile() throws Exception { public boolean processBoolean() throws Exception {
flag ++; flag ++;
System.out.println("NCmp executed!"); System.out.println("NCmp executed!");
if(flag < 4) throw new RuntimeException(); if(flag < 4) throw new RuntimeException();

View File

@ -1,13 +1,13 @@
package com.yomahub.liteflow.test.rollback.cmp; package com.yomahub.liteflow.test.rollback.cmp;
import com.yomahub.liteflow.core.NodeBreakComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component("h") @Component("h")
public class HCmp extends NodeBreakComponent { public class HCmp extends NodeBooleanComponent {
@Override @Override
public boolean processBreak() throws Exception { public boolean processBoolean() throws Exception {
System.out.println("HCmp executed!"); System.out.println("HCmp executed!");
throw new RuntimeException(); throw new RuntimeException();
} }

View File

@ -1,13 +1,13 @@
package com.yomahub.liteflow.test.rollback.cmp; package com.yomahub.liteflow.test.rollback.cmp;
import com.yomahub.liteflow.core.NodeWhileComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component("w") @Component("w")
public class WCmp extends NodeWhileComponent { public class WCmp extends NodeBooleanComponent {
@Override @Override
public boolean processWhile() throws Exception { public boolean processBoolean() throws Exception {
System.out.println("WCmp executed!"); System.out.println("WCmp executed!");
return true; return true;
} }

View File

@ -1,12 +1,12 @@
package com.yomahub.liteflow.test.rollback.cmp; package com.yomahub.liteflow.test.rollback.cmp;
import com.yomahub.liteflow.core.NodeIfComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component("x") @Component("x")
public class XCmp extends NodeIfComponent { public class XCmp extends NodeBooleanComponent {
@Override @Override
public boolean processIf() throws Exception { public boolean processBoolean() throws Exception {
System.out.println("XCmp executed!"); System.out.println("XCmp executed!");
return true; return true;
} }

View File

@ -1,11 +1,11 @@
package com.yomahub.liteflow.test.abstractChain.cmp; package com.yomahub.liteflow.test.abstractChain.cmp;
import com.yomahub.liteflow.core.NodeIfComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
public class CCmp extends NodeIfComponent { public class CCmp extends NodeBooleanComponent {
@Override @Override
public boolean processIf() throws Exception { public boolean processBoolean() throws Exception {
//do your biz //do your biz
return true; return true;
} }

View File

@ -1,13 +1,14 @@
package com.yomahub.liteflow.test.fallback.cmp; package com.yomahub.liteflow.test.fallback.cmp;
import com.yomahub.liteflow.annotation.FallbackCmp; import com.yomahub.liteflow.annotation.FallbackCmp;
import com.yomahub.liteflow.core.NodeBreakComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import com.yomahub.liteflow.enums.BooleanTypeEnum;
@FallbackCmp @FallbackCmp(BooleanTypeEnum.BREAK)
public class BreakCmp extends NodeBreakComponent { public class BreakCmp extends NodeBooleanComponent {
@Override @Override
public boolean processBreak() throws Exception { public boolean processBoolean() throws Exception {
return true; return true;
} }
} }

View File

@ -1,11 +1,11 @@
package com.yomahub.liteflow.test.fallback.cmp; package com.yomahub.liteflow.test.fallback.cmp;
import com.yomahub.liteflow.core.NodeIfComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
public class IfCmp1 extends NodeIfComponent { public class IfCmp1 extends NodeBooleanComponent {
@Override @Override
public boolean processIf() throws Exception { public boolean processBoolean() throws Exception {
return true; return true;
} }
} }

View File

@ -1,13 +1,14 @@
package com.yomahub.liteflow.test.fallback.cmp; package com.yomahub.liteflow.test.fallback.cmp;
import com.yomahub.liteflow.annotation.FallbackCmp; import com.yomahub.liteflow.annotation.FallbackCmp;
import com.yomahub.liteflow.core.NodeIfComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import com.yomahub.liteflow.enums.BooleanTypeEnum;
@FallbackCmp @FallbackCmp(BooleanTypeEnum.IF)
public class IfCmp2 extends NodeIfComponent { public class IfCmp2 extends NodeBooleanComponent {
@Override @Override
public boolean processIf() throws Exception { public boolean processBoolean() throws Exception {
return false; return false;
} }
} }

View File

@ -1,18 +1,18 @@
package com.yomahub.liteflow.test.fallback.cmp; package com.yomahub.liteflow.test.fallback.cmp;
import com.yomahub.liteflow.core.NodeWhileComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
public class WhileCmp1 extends NodeWhileComponent { public class WhileCmp1 extends NodeBooleanComponent {
private int count = 0; private int count = 0;
// 执行过的 chain // 执行过的 chain
Set<String> executedChain = new HashSet<>(); Set<String> executedChain = new HashSet<>();
@Override @Override
public boolean processWhile() throws Exception { public boolean processBoolean() throws Exception {
// 判断是否切换了 chain // 判断是否切换了 chain
if (!executedChain.contains(this.getCurrChainId())) { if (!executedChain.contains(this.getCurrChainId())) {
count = 0; count = 0;

View File

@ -1,13 +1,14 @@
package com.yomahub.liteflow.test.fallback.cmp; package com.yomahub.liteflow.test.fallback.cmp;
import com.yomahub.liteflow.annotation.FallbackCmp; import com.yomahub.liteflow.annotation.FallbackCmp;
import com.yomahub.liteflow.core.NodeWhileComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import com.yomahub.liteflow.enums.BooleanTypeEnum;
@FallbackCmp @FallbackCmp(BooleanTypeEnum.WHILE)
public class WhileCmp2 extends NodeWhileComponent { public class WhileCmp2 extends NodeBooleanComponent {
@Override @Override
public boolean processWhile() throws Exception { public boolean processBoolean() throws Exception {
return false; return false;
} }
} }

View File

@ -7,12 +7,12 @@
*/ */
package com.yomahub.liteflow.test.ifelse.cmp; package com.yomahub.liteflow.test.ifelse.cmp;
import com.yomahub.liteflow.core.NodeIfComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
public class X1Cmp extends NodeIfComponent { public class X1Cmp extends NodeBooleanComponent {
@Override @Override
public boolean processIf() throws Exception { public boolean processBoolean() throws Exception {
return Boolean.parseBoolean(this.getTag()); return Boolean.parseBoolean(this.getTag());
} }

View File

@ -1,12 +1,12 @@
package com.yomahub.liteflow.test.iterator.cmp; package com.yomahub.liteflow.test.iterator.cmp;
import com.yomahub.liteflow.core.NodeBreakComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
public class BCmp extends NodeBreakComponent { public class BCmp extends NodeBooleanComponent {
@Override @Override
public boolean processBreak() throws Exception { public boolean processBoolean() throws Exception {
return this.getLoopIndex() == 1; return this.getLoopIndex() == 1;
} }

View File

@ -1,12 +1,12 @@
package com.yomahub.liteflow.test.loop.cmp; package com.yomahub.liteflow.test.loop.cmp;
import com.yomahub.liteflow.core.NodeBreakComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import com.yomahub.liteflow.slot.DefaultContext; import com.yomahub.liteflow.slot.DefaultContext;
public class YCmp extends NodeBreakComponent { public class YCmp extends NodeBooleanComponent {
@Override @Override
public boolean processBreak() throws Exception { public boolean processBoolean() throws Exception {
DefaultContext context = this.getFirstContextBean(); DefaultContext context = this.getFirstContextBean();
int count = context.getData("test"); int count = context.getData("test");
return count > 3; return count > 3;

View File

@ -1,12 +1,12 @@
package com.yomahub.liteflow.test.loop.cmp; package com.yomahub.liteflow.test.loop.cmp;
import com.yomahub.liteflow.core.NodeWhileComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import com.yomahub.liteflow.slot.DefaultContext; import com.yomahub.liteflow.slot.DefaultContext;
public class ZCmp extends NodeWhileComponent { public class ZCmp extends NodeBooleanComponent {
@Override @Override
public boolean processWhile() throws Exception { public boolean processBoolean() throws Exception {
DefaultContext context = this.getFirstContextBean(); DefaultContext context = this.getFirstContextBean();
String key = "test"; String key = "test";
if (context.hasData(key)) { if (context.hasData(key)) {

View File

@ -1,10 +1,10 @@
package com.yomahub.liteflow.test.maxWaitMilliseconds.cmp; package com.yomahub.liteflow.test.maxWaitMilliseconds.cmp;
import com.yomahub.liteflow.core.NodeIfComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
public class FCmp extends NodeIfComponent { public class FCmp extends NodeBooleanComponent {
@Override @Override
public boolean processIf() throws Exception { public boolean processBoolean() throws Exception {
return true; return true;
} }
} }

View File

@ -1,18 +1,18 @@
package com.yomahub.liteflow.test.maxWaitMilliseconds.cmp; package com.yomahub.liteflow.test.maxWaitMilliseconds.cmp;
import com.yomahub.liteflow.core.NodeWhileComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
public class WCmp extends NodeWhileComponent { public class WCmp extends NodeBooleanComponent {
private int count = 0; private int count = 0;
// 执行过的 chain // 执行过的 chain
Set<String> executedChain = new HashSet<>(); Set<String> executedChain = new HashSet<>();
@Override @Override
public boolean processWhile() throws Exception { public boolean processBoolean() throws Exception {
// 判断是否切换了 chain // 判断是否切换了 chain
if (!executedChain.contains(this.getCurrChainId())) { if (!executedChain.contains(this.getCurrChainId())) {
count = 0; count = 0;

View File

@ -1,10 +1,10 @@
package com.yomahub.liteflow.test.maxWaitSeconds.cmp; package com.yomahub.liteflow.test.maxWaitSeconds.cmp;
import com.yomahub.liteflow.core.NodeIfComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
public class FCmp extends NodeIfComponent { public class FCmp extends NodeBooleanComponent {
@Override @Override
public boolean processIf() throws Exception { public boolean processBoolean() throws Exception {
return true; return true;
} }
} }

View File

@ -1,18 +1,18 @@
package com.yomahub.liteflow.test.maxWaitSeconds.cmp; package com.yomahub.liteflow.test.maxWaitSeconds.cmp;
import com.yomahub.liteflow.core.NodeWhileComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
public class WCmp extends NodeWhileComponent { public class WCmp extends NodeBooleanComponent {
private int count = 0; private int count = 0;
// 执行过的 chain // 执行过的 chain
Set<String> executedChain = new HashSet<>(); Set<String> executedChain = new HashSet<>();
@Override @Override
public boolean processWhile() throws Exception { public boolean processBoolean() throws Exception {
// 判断是否切换了 chain // 判断是否切换了 chain
if (!executedChain.contains(this.getCurrChainId())) { if (!executedChain.contains(this.getCurrChainId())) {
count = 0; count = 0;

View File

@ -1,12 +1,12 @@
package com.yomahub.liteflow.test.parallelLoop.cmp; package com.yomahub.liteflow.test.parallelLoop.cmp;
import com.yomahub.liteflow.core.NodeBreakComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import com.yomahub.liteflow.slot.DefaultContext; import com.yomahub.liteflow.slot.DefaultContext;
public class YCmp extends NodeBreakComponent { public class YCmp extends NodeBooleanComponent {
@Override @Override
public boolean processBreak() throws Exception { public boolean processBoolean() throws Exception {
DefaultContext context = this.getFirstContextBean(); DefaultContext context = this.getFirstContextBean();
int count = 0; int count = 0;
if(context.hasData("test")) { if(context.hasData("test")) {

View File

@ -1,12 +1,12 @@
package com.yomahub.liteflow.test.parallelLoop.cmp; package com.yomahub.liteflow.test.parallelLoop.cmp;
import com.yomahub.liteflow.core.NodeWhileComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import com.yomahub.liteflow.slot.DefaultContext; import com.yomahub.liteflow.slot.DefaultContext;
public class ZCmp extends NodeWhileComponent { public class ZCmp extends NodeBooleanComponent {
@Override @Override
public boolean processWhile() throws Exception { public boolean processBoolean() throws Exception {
DefaultContext context = this.getFirstContextBean(); DefaultContext context = this.getFirstContextBean();
String key = "test"; String key = "test";
if (context.hasData(key)) { if (context.hasData(key)) {

View File

@ -1,12 +1,12 @@
package com.yomahub.liteflow.test.retry.cmp; package com.yomahub.liteflow.test.retry.cmp;
import com.yomahub.liteflow.core.NodeIfComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
public class FCmp extends NodeIfComponent { public class FCmp extends NodeBooleanComponent {
int flag = 0; int flag = 0;
@Override @Override
public boolean processIf() throws Exception { public boolean processBoolean() throws Exception {
System.out.println("FCmp executed!"); System.out.println("FCmp executed!");
flag ++; flag ++;
if(flag < 4) throw new RuntimeException(); if(flag < 4) throw new RuntimeException();

View File

@ -1,13 +1,13 @@
package com.yomahub.liteflow.test.retry.cmp; package com.yomahub.liteflow.test.retry.cmp;
import com.yomahub.liteflow.core.NodeWhileComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
public class NCmp extends NodeWhileComponent { public class NCmp extends NodeBooleanComponent {
int flag = 0; int flag = 0;
@Override @Override
public boolean processWhile() throws Exception { public boolean processBoolean() throws Exception {
flag ++; flag ++;
System.out.println("NCmp executed!"); System.out.println("NCmp executed!");
if(flag < 4) throw new RuntimeException(); if(flag < 4) throw new RuntimeException();

View File

@ -1,11 +1,11 @@
package com.yomahub.liteflow.test.rollback.cmp; package com.yomahub.liteflow.test.rollback.cmp;
import com.yomahub.liteflow.core.NodeBreakComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
public class HCmp extends NodeBreakComponent { public class HCmp extends NodeBooleanComponent {
@Override @Override
public boolean processBreak() throws Exception { public boolean processBoolean() throws Exception {
System.out.println("HCmp executed!"); System.out.println("HCmp executed!");
throw new RuntimeException(); throw new RuntimeException();
} }

View File

@ -1,11 +1,11 @@
package com.yomahub.liteflow.test.rollback.cmp; package com.yomahub.liteflow.test.rollback.cmp;
import com.yomahub.liteflow.core.NodeWhileComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
public class WCmp extends NodeWhileComponent { public class WCmp extends NodeBooleanComponent {
@Override @Override
public boolean processWhile() throws Exception { public boolean processBoolean() throws Exception {
System.out.println("WCmp executed!"); System.out.println("WCmp executed!");
return true; return true;
} }

View File

@ -1,10 +1,10 @@
package com.yomahub.liteflow.test.rollback.cmp; package com.yomahub.liteflow.test.rollback.cmp;
import com.yomahub.liteflow.core.NodeIfComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
public class XCmp extends NodeIfComponent { public class XCmp extends NodeBooleanComponent {
@Override @Override
public boolean processIf() throws Exception { public boolean processBoolean() throws Exception {
System.out.println("XCmp executed!"); System.out.println("XCmp executed!");
return true; return true;
} }

View File

@ -1,12 +1,12 @@
package com.yomahub.liteflow.test.script.graaljs.getnodes.cmp; package com.yomahub.liteflow.test.script.graaljs.getnodes.cmp;
import com.yomahub.liteflow.core.NodeIfComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component("f") @Component("f")
public class FCmp extends NodeIfComponent { public class FCmp extends NodeBooleanComponent {
@Override @Override
public boolean processIf() throws Exception { public boolean processBoolean() throws Exception {
return true; return true;
} }
} }

View File

@ -19,13 +19,13 @@
]]> ]]>
</node> </node>
<node id="x" name="条件循环脚本" type="while_script" language="js"> <node id="x" name="条件循环脚本" type="boolean_script" language="js">
<![CDATA[ <![CDATA[
return true; return true;
]]> ]]>
</node> </node>
<node id="y" name="退出循环脚本" type="break_script" language="js"> <node id="y" name="退出循环脚本" type="boolean_script" language="js">
<![CDATA[ <![CDATA[
return true; return true;
]]> ]]>

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<flow> <flow>
<nodes> <nodes>
<node id="x0" type="if_script" language="js"> <node id="x0" type="boolean_script" language="js">
<![CDATA[ <![CDATA[
return true; return true;
]]> ]]>
</node> </node>
<node id="x1" type="if_script" language="js"> <node id="x1" type="boolean_script" language="js">
<![CDATA[ <![CDATA[
return false; return false;
]]> ]]>

View File

@ -8,14 +8,14 @@
]]> ]]>
</node> </node>
<node id="y" type="break_script" language="js"> <node id="y" type="boolean_script" language="js">
<![CDATA[ <![CDATA[
var count = defaultContext.getData("test"); var count = defaultContext.getData("test");
return count > 3; return count > 3;
]]> ]]>
</node> </node>
<node id="z" type="while_script" language="js"> <node id="z" type="boolean_script" language="js">
<![CDATA[ <![CDATA[
var key = "test"; var key = "test";
if (defaultContext.hasData(key)){ if (defaultContext.hasData(key)){

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<flow> <flow>
<nodes> <nodes>
<node id="x0" type="if_script" language="groovy"> <node id="x0" type="boolean_script" language="groovy">
<![CDATA[ <![CDATA[
return true return true
]]> ]]>
</node> </node>
<node id="x1" type="if_script" language="groovy"> <node id="x1" type="boolean_script" language="groovy">
<![CDATA[ <![CDATA[
return false return false
]]> ]]>

View File

@ -8,14 +8,14 @@
]]> ]]>
</node> </node>
<node id="y" type="break_script" language="groovy"> <node id="y" type="boolean_script" language="groovy">
<![CDATA[ <![CDATA[
def count = defaultContext.getData("test") def count = defaultContext.getData("test")
return count > 3 return count > 3
]]> ]]>
</node> </node>
<node id="z" type="while_script" language="groovy"> <node id="z" type="boolean_script" language="groovy">
<![CDATA[ <![CDATA[
def key = "test" def key = "test"
if (defaultContext.hasData(key)){ if (defaultContext.hasData(key)){

View File

@ -2,7 +2,7 @@
<!DOCTYPE flow PUBLIC "liteflow" "liteflow.dtd"> <!DOCTYPE flow PUBLIC "liteflow" "liteflow.dtd">
<flow> <flow>
<nodes> <nodes>
<node id="s1" language="groovy" type="if_script"> <node id="s1" language="groovy" type="boolean_script">
<![CDATA[ <![CDATA[
System.out.println("Groovy 脚本1 被调用。") System.out.println("Groovy 脚本1 被调用。")
return false return false

View File

@ -1,12 +1,12 @@
package com.yomahub.liteflow.test.script.javascript.getnodes.cmp; package com.yomahub.liteflow.test.script.javascript.getnodes.cmp;
import com.yomahub.liteflow.core.NodeIfComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component("f") @Component("f")
public class FCmp extends NodeIfComponent { public class FCmp extends NodeBooleanComponent {
@Override @Override
public boolean processIf() throws Exception { public boolean processBoolean() throws Exception {
return true; return true;
} }
} }

View File

@ -19,13 +19,13 @@
]]> ]]>
</node> </node>
<node id="x" name="条件循环脚本" type="while_script" language="js"> <node id="x" name="条件循环脚本" type="boolean_script" language="js">
<![CDATA[ <![CDATA[
return true; return true;
]]> ]]>
</node> </node>
<node id="y" name="退出循环脚本" type="break_script" language="js"> <node id="y" name="退出循环脚本" type="boolean_script" language="js">
<![CDATA[ <![CDATA[
return true; return true;
]]> ]]>

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<flow> <flow>
<nodes> <nodes>
<node id="x0" type="if_script" language="js"> <node id="x0" type="boolean_script" language="js">
<![CDATA[ <![CDATA[
return true; return true;
]]> ]]>
</node> </node>
<node id="x1" type="if_script" language="js"> <node id="x1" type="boolean_script" language="js">
<![CDATA[ <![CDATA[
return false; return false;
]]> ]]>

View File

@ -8,14 +8,14 @@
]]> ]]>
</node> </node>
<node id="y" type="break_script" language="js"> <node id="y" type="boolean_script" language="js">
<![CDATA[ <![CDATA[
var count = defaultContext.getData("test"); var count = defaultContext.getData("test");
return count > 3; return count > 3;
]]> ]]>
</node> </node>
<node id="z" type="while_script" language="js"> <node id="z" type="boolean_script" language="js">
<![CDATA[ <![CDATA[
var key = "test"; var key = "test";
if (defaultContext.hasData(key)){ if (defaultContext.hasData(key)){

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<flow> <flow>
<nodes> <nodes>
<node id="x0" type="if_script"> <node id="x0" type="boolean_script">
<![CDATA[ <![CDATA[
return true; return true;
]]> ]]>
</node> </node>
<node id="x1" type="if_script"> <node id="x1" type="boolean_script">
<![CDATA[ <![CDATA[
return false; return false;
]]> ]]>

View File

@ -8,14 +8,14 @@
]]> ]]>
</node> </node>
<node id="y" type="break_script"> <node id="y" type="boolean_script">
<![CDATA[ <![CDATA[
count = defaultContext.getData("test"); count = defaultContext.getData("test");
return count > 3; return count > 3;
]]> ]]>
</node> </node>
<node id="z" type="while_script"> <node id="z" type="boolean_script">
<![CDATA[ <![CDATA[
key = "test"; key = "test";
if (defaultContext.hasData(key)){ if (defaultContext.hasData(key)){

View File

@ -1,13 +1,13 @@
package com.yomahub.liteflow.test.abstractChain.cmp; package com.yomahub.liteflow.test.abstractChain.cmp;
import com.yomahub.liteflow.core.NodeIfComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import org.noear.solon.annotation.Component; import org.noear.solon.annotation.Component;
@Component("c") @Component("c")
public class CCmp extends NodeIfComponent { public class CCmp extends NodeBooleanComponent {
@Override @Override
public boolean processIf() throws Exception { public boolean processBoolean() throws Exception {
//do your biz //do your biz
return true; return true;
} }

View File

@ -2,14 +2,15 @@ package com.yomahub.liteflow.test.fallback.cmp;
import com.yomahub.liteflow.annotation.FallbackCmp; import com.yomahub.liteflow.annotation.FallbackCmp;
import com.yomahub.liteflow.annotation.LiteflowComponent; import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeBreakComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import com.yomahub.liteflow.enums.BooleanTypeEnum;
@LiteflowComponent("bn1") @LiteflowComponent("bn1")
@FallbackCmp @FallbackCmp(BooleanTypeEnum.BREAK)
public class BreakCmp extends NodeBreakComponent { public class BreakCmp extends NodeBooleanComponent {
@Override @Override
public boolean processBreak() throws Exception { public boolean processBoolean() throws Exception {
return true; return true;
} }
} }

View File

@ -1,13 +1,13 @@
package com.yomahub.liteflow.test.fallback.cmp; package com.yomahub.liteflow.test.fallback.cmp;
import com.yomahub.liteflow.annotation.LiteflowComponent; import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeIfComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
@LiteflowComponent("ifn1") @LiteflowComponent("ifn1")
public class IfCmp1 extends NodeIfComponent { public class IfCmp1 extends NodeBooleanComponent {
@Override @Override
public boolean processIf() throws Exception { public boolean processBoolean() throws Exception {
return true; return true;
} }
} }

View File

@ -2,14 +2,15 @@ package com.yomahub.liteflow.test.fallback.cmp;
import com.yomahub.liteflow.annotation.FallbackCmp; import com.yomahub.liteflow.annotation.FallbackCmp;
import com.yomahub.liteflow.annotation.LiteflowComponent; import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeIfComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import com.yomahub.liteflow.enums.BooleanTypeEnum;
@LiteflowComponent("ifn2") @LiteflowComponent("ifn2")
@FallbackCmp @FallbackCmp(BooleanTypeEnum.IF)
public class IfCmp2 extends NodeIfComponent { public class IfCmp2 extends NodeBooleanComponent {
@Override @Override
public boolean processIf() throws Exception { public boolean processBoolean() throws Exception {
return false; return false;
} }
} }

View File

@ -1,20 +1,20 @@
package com.yomahub.liteflow.test.fallback.cmp; package com.yomahub.liteflow.test.fallback.cmp;
import com.yomahub.liteflow.annotation.LiteflowComponent; import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeWhileComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
@LiteflowComponent("wn1") @LiteflowComponent("wn1")
public class WhileCmp1 extends NodeWhileComponent { public class WhileCmp1 extends NodeBooleanComponent {
private int count = 0; private int count = 0;
// 执行过的 chain // 执行过的 chain
Set<String> executedChain = new HashSet<>(); Set<String> executedChain = new HashSet<>();
@Override @Override
public boolean processWhile() throws Exception { public boolean processBoolean() throws Exception {
// 判断是否切换了 chain // 判断是否切换了 chain
if (!executedChain.contains(this.getCurrChainId())) { if (!executedChain.contains(this.getCurrChainId())) {
count = 0; count = 0;

View File

@ -2,14 +2,15 @@ package com.yomahub.liteflow.test.fallback.cmp;
import com.yomahub.liteflow.annotation.FallbackCmp; import com.yomahub.liteflow.annotation.FallbackCmp;
import com.yomahub.liteflow.annotation.LiteflowComponent; import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeWhileComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import com.yomahub.liteflow.enums.BooleanTypeEnum;
@LiteflowComponent("wn2") @LiteflowComponent("wn2")
@FallbackCmp @FallbackCmp(BooleanTypeEnum.WHILE)
public class WhileCmp2 extends NodeWhileComponent { public class WhileCmp2 extends NodeBooleanComponent {
@Override @Override
public boolean processWhile() throws Exception { public boolean processBoolean() throws Exception {
return false; return false;
} }
} }

View File

@ -7,14 +7,14 @@
*/ */
package com.yomahub.liteflow.test.ifelse.cmp; package com.yomahub.liteflow.test.ifelse.cmp;
import com.yomahub.liteflow.core.NodeIfComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import org.noear.solon.annotation.Component; import org.noear.solon.annotation.Component;
@Component("x1") @Component("x1")
public class X1Cmp extends NodeIfComponent { public class X1Cmp extends NodeBooleanComponent {
@Override @Override
public boolean processIf() throws Exception { public boolean processBoolean() throws Exception {
return Boolean.parseBoolean(this.getTag()); return Boolean.parseBoolean(this.getTag());
} }

View File

@ -1,15 +1,15 @@
package com.yomahub.liteflow.test.loop.cmp; package com.yomahub.liteflow.test.loop.cmp;
import com.yomahub.liteflow.annotation.LiteflowComponent; import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeBreakComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import com.yomahub.liteflow.core.NodeForComponent; import com.yomahub.liteflow.core.NodeForComponent;
import com.yomahub.liteflow.slot.DefaultContext; import com.yomahub.liteflow.slot.DefaultContext;
@LiteflowComponent("y") @LiteflowComponent("y")
public class YCmp extends NodeBreakComponent { public class YCmp extends NodeBooleanComponent {
@Override @Override
public boolean processBreak() throws Exception { public boolean processBoolean() throws Exception {
DefaultContext context = this.getFirstContextBean(); DefaultContext context = this.getFirstContextBean();
int count = context.getData("test"); int count = context.getData("test");
return count > 3; return count > 3;

View File

@ -1,15 +1,15 @@
package com.yomahub.liteflow.test.loop.cmp; package com.yomahub.liteflow.test.loop.cmp;
import com.yomahub.liteflow.annotation.LiteflowComponent; import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeBreakComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import com.yomahub.liteflow.core.NodeWhileComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import com.yomahub.liteflow.slot.DefaultContext; import com.yomahub.liteflow.slot.DefaultContext;
@LiteflowComponent("z") @LiteflowComponent("z")
public class ZCmp extends NodeWhileComponent { public class ZCmp extends NodeBooleanComponent {
@Override @Override
public boolean processWhile() throws Exception { public boolean processBoolean() throws Exception {
DefaultContext context = this.getFirstContextBean(); DefaultContext context = this.getFirstContextBean();
String key = "test"; String key = "test";
if (context.hasData(key)) { if (context.hasData(key)) {

View File

@ -1,12 +1,12 @@
package com.yomahub.liteflow.test.maxWaitMilliseconds.cmp; package com.yomahub.liteflow.test.maxWaitMilliseconds.cmp;
import com.yomahub.liteflow.annotation.LiteflowComponent; import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeIfComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
@LiteflowComponent("f") @LiteflowComponent("f")
public class FCmp extends NodeIfComponent { public class FCmp extends NodeBooleanComponent {
@Override @Override
public boolean processIf() throws Exception { public boolean processBoolean() throws Exception {
return true; return true;
} }
} }

View File

@ -1,20 +1,20 @@
package com.yomahub.liteflow.test.maxWaitMilliseconds.cmp; package com.yomahub.liteflow.test.maxWaitMilliseconds.cmp;
import com.yomahub.liteflow.annotation.LiteflowComponent; import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeWhileComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
@LiteflowComponent("w") @LiteflowComponent("w")
public class WCmp extends NodeWhileComponent { public class WCmp extends NodeBooleanComponent {
private int count = 0; private int count = 0;
// 执行过的 chain // 执行过的 chain
Set<String> executedChain = new HashSet<>(); Set<String> executedChain = new HashSet<>();
@Override @Override
public boolean processWhile() throws Exception { public boolean processBoolean() throws Exception {
// 判断是否切换了 chain // 判断是否切换了 chain
if (!executedChain.contains(this.getCurrChainId())) { if (!executedChain.contains(this.getCurrChainId())) {
count = 0; count = 0;

View File

@ -1,12 +1,12 @@
package com.yomahub.liteflow.test.maxWaitSeconds.cmp; package com.yomahub.liteflow.test.maxWaitSeconds.cmp;
import com.yomahub.liteflow.annotation.LiteflowComponent; import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeIfComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
@LiteflowComponent("f") @LiteflowComponent("f")
public class FCmp extends NodeIfComponent { public class FCmp extends NodeBooleanComponent {
@Override @Override
public boolean processIf() throws Exception { public boolean processBoolean() throws Exception {
return true; return true;
} }
} }

View File

@ -1,20 +1,20 @@
package com.yomahub.liteflow.test.maxWaitSeconds.cmp; package com.yomahub.liteflow.test.maxWaitSeconds.cmp;
import com.yomahub.liteflow.annotation.LiteflowComponent; import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeWhileComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
@LiteflowComponent("w") @LiteflowComponent("w")
public class WCmp extends NodeWhileComponent { public class WCmp extends NodeBooleanComponent {
private int count = 0; private int count = 0;
// 执行过的 chain // 执行过的 chain
Set<String> executedChain = new HashSet<>(); Set<String> executedChain = new HashSet<>();
@Override @Override
public boolean processWhile() throws Exception { public boolean processBoolean() throws Exception {
// 判断是否切换了 chain // 判断是否切换了 chain
if (!executedChain.contains(this.getCurrChainId())) { if (!executedChain.contains(this.getCurrChainId())) {
count = 0; count = 0;

View File

@ -1,14 +1,14 @@
package com.yomahub.liteflow.test.parallelLoop.cmp; package com.yomahub.liteflow.test.parallelLoop.cmp;
import com.yomahub.liteflow.core.NodeBreakComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import com.yomahub.liteflow.slot.DefaultContext; import com.yomahub.liteflow.slot.DefaultContext;
import org.noear.solon.annotation.Component; import org.noear.solon.annotation.Component;
@Component("y") @Component("y")
public class YCmp extends NodeBreakComponent { public class YCmp extends NodeBooleanComponent {
@Override @Override
public boolean processBreak() throws Exception { public boolean processBoolean() throws Exception {
DefaultContext context = this.getFirstContextBean(); DefaultContext context = this.getFirstContextBean();
int count = 0; int count = 0;
if(context.hasData("test")) { if(context.hasData("test")) {

View File

@ -1,14 +1,14 @@
package com.yomahub.liteflow.test.parallelLoop.cmp; package com.yomahub.liteflow.test.parallelLoop.cmp;
import com.yomahub.liteflow.core.NodeWhileComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import com.yomahub.liteflow.slot.DefaultContext; import com.yomahub.liteflow.slot.DefaultContext;
import org.noear.solon.annotation.Component; import org.noear.solon.annotation.Component;
@Component("z") @Component("z")
public class ZCmp extends NodeWhileComponent { public class ZCmp extends NodeBooleanComponent {
@Override @Override
public boolean processWhile() throws Exception { public boolean processBoolean() throws Exception {
DefaultContext context = this.getFirstContextBean(); DefaultContext context = this.getFirstContextBean();
String key = "test"; String key = "test";
if (context.hasData(key)) { if (context.hasData(key)) {

View File

@ -1,13 +1,13 @@
package com.yomahub.liteflow.test.retry.cmp; package com.yomahub.liteflow.test.retry.cmp;
import com.yomahub.liteflow.core.NodeIfComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import org.noear.solon.annotation.Component; import org.noear.solon.annotation.Component;
@Component("f") @Component("f")
public class FCmp extends NodeIfComponent { public class FCmp extends NodeBooleanComponent {
int flag = 0; int flag = 0;
@Override @Override
public boolean processIf() throws Exception { public boolean processBoolean() throws Exception {
System.out.println("FCmp executed!"); System.out.println("FCmp executed!");
flag ++; flag ++;
if(flag < 4) throw new RuntimeException(); if(flag < 4) throw new RuntimeException();

View File

@ -1,14 +1,14 @@
package com.yomahub.liteflow.test.retry.cmp; package com.yomahub.liteflow.test.retry.cmp;
import com.yomahub.liteflow.core.NodeWhileComponent; import com.yomahub.liteflow.core.NodeBooleanComponent;
import org.noear.solon.annotation.Component; import org.noear.solon.annotation.Component;
@Component("n") @Component("n")
public class NCmp extends NodeWhileComponent { public class NCmp extends NodeBooleanComponent {
int flag = 0; int flag = 0;
@Override @Override
public boolean processWhile() throws Exception { public boolean processBoolean() throws Exception {
flag ++; flag ++;
System.out.println("NCmp executed!"); System.out.println("NCmp executed!");
if(flag < 4) throw new RuntimeException(); if(flag < 4) throw new RuntimeException();

Some files were not shown because too many files have changed in this diff Show More