cond这种单词改成switch

This commit is contained in:
everywhere.z
2022-07-03 00:50:50 +08:00
parent 03ca8ceedb
commit 17ccf4791a
59 changed files with 93 additions and 74 deletions

View File

@@ -15,11 +15,11 @@ public abstract class NodeSwitchComponent extends NodeComponent {
@Override
public void process() throws Exception {
String nodeId = this.processCond();
String nodeId = this.processSwitch();
this.getSlot().setSwitchResult(this.getClass().getName(), nodeId);
}
//用以返回路由节点的beanId
public abstract String processCond() throws Exception;
public abstract String processSwitch() throws Exception;
}

View File

@@ -10,7 +10,7 @@ import com.yomahub.liteflow.script.ScriptExecutorFactory;
public class ScriptSwitchComponent extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
return (String)ScriptExecutorFactory.loadInstance().getScriptExecutor().execute(getNodeId(), getSlotIndex());
}

View File

@@ -2,7 +2,7 @@ package com.yomahub.liteflow.enums;
public enum LiteFlowMethodEnum {
PROCESS("process"),
PROCESS_COND("processCond"),
PROCESS_SWITCH("processSwitch"),
IS_ACCESS("isAccess"),
IS_END("isEnd"),

View File

@@ -11,8 +11,8 @@ import org.springframework.stereotype.Component;
@LiteflowSwitchCmpDefine
public class ECmp{
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_COND)
public String processCond(NodeComponent bindCmp) throws Exception {
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_SWITCH)
public String processSwitch(NodeComponent bindCmp) throws Exception {
System.out.println("Ecomp executed!");
return "g";
}

View File

@@ -11,8 +11,8 @@ import org.springframework.stereotype.Component;
@LiteflowSwitchCmpDefine
public class JCmp{
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_COND)
public String processCond(NodeComponent bindCmp) throws Exception {
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_SWITCH)
public String processSwitch(NodeComponent bindCmp) throws Exception {
System.out.println("Jcomp executed!");
return "chain3";
}

View File

@@ -15,8 +15,8 @@ import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
@LiteflowSwitchCmpDefine
public class ECmp{
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_COND)
public String processCond(NodeComponent bindCmp) throws Exception {
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_SWITCH)
public String processSwitch(NodeComponent bindCmp) throws Exception {
System.out.println("ECmp executed!");
return "chain2";
}

View File

@@ -12,8 +12,8 @@ import java.util.Objects;
@Component("f")
@LiteflowSwitchCmpDefine
public class FCondCmp{
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_COND)
public String processCond(NodeComponent bindCmp) {
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_SWITCH)
public String processSwitch(NodeComponent bindCmp) {
Integer requestData = bindCmp.getRequestData();
if (Objects.isNull(requestData)){
return "d";

View File

@@ -17,8 +17,8 @@ import org.springframework.stereotype.Component;
@LiteflowSwitchCmpDefine
public class ECmp{
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_COND)
public String processCond(NodeComponent bindCmp) throws Exception {
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_SWITCH)
public String processSwitch(NodeComponent bindCmp) throws Exception {
return "a";
}
}

View File

@@ -17,8 +17,8 @@ import org.springframework.stereotype.Component;
@LiteflowSwitchCmpDefine
public class ECmp{
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_COND)
public String processCond(NodeComponent bindCmp) throws Exception {
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_SWITCH)
public String processSwitch(NodeComponent bindCmp) throws Exception {
return "g";
}
}

View File

@@ -17,8 +17,8 @@ import org.springframework.stereotype.Component;
@LiteflowSwitchCmpDefine
public class ECmp{
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_COND)
public String processCond(NodeComponent bindCmp) throws Exception {
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_SWITCH)
public String processSwitch(NodeComponent bindCmp) throws Exception {
return "g";
}
}

View File

@@ -17,8 +17,8 @@ import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
@LiteflowSwitchCmpDefine
public class CCmp{
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_COND)
public String processCond(NodeComponent bindCmp) throws Exception {
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_SWITCH)
public String processSwitch(NodeComponent bindCmp) throws Exception {
if(bindCmp.getTag().equals("2")){
return "e";
}else{

View File

@@ -8,7 +8,7 @@ import org.springframework.stereotype.Component;
public class ECmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
System.out.println("Ecomp executed!");
return "g";
}

View File

@@ -8,7 +8,7 @@ import org.springframework.stereotype.Component;
public class JCmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
System.out.println("Jcomp executed!");
return "chain3";
}

View File

@@ -56,4 +56,10 @@ public class BaseELSpringbootTest extends BaseTest {
Assert.assertTrue(response.isSuccess());
}
//用变量来声明短流程
@Test
public void testBase5() throws Exception{
LiteflowResponse response = flowExecutor.execute2Resp("chain5", "arg");
Assert.assertTrue(response.isSuccess());
}
}

View File

@@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
public class ESwitchCmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
return "d";
}
}

View File

@@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
public class GSwitchCmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
return "then_1001";
}
}

View File

@@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
public class XSwitchCmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
return "w01";
}
}

View File

@@ -12,7 +12,7 @@ import com.yomahub.liteflow.core.NodeSwitchComponent;
public class ECmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
System.out.println("ECmp executed!");
return "chain2";
}

View File

@@ -9,7 +9,7 @@ import java.util.Objects;
@Component("f")
public class FSwitchCmp extends NodeSwitchComponent {
@Override
public String processCond() {
public String processSwitch() {
Integer requestData = this.getRequestData();
if (Objects.isNull(requestData)){
return "d";

View File

@@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
public class ECmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
return "a";
}
}

View File

@@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
public class ECmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
return "g";
}
}

View File

@@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
public class ECmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
return "g";
}
}

View File

@@ -14,7 +14,7 @@ import com.yomahub.liteflow.core.NodeSwitchComponent;
public class CCmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
if(this.getTag().equals("2")){
return "e";
}else{

View File

@@ -37,4 +37,17 @@
z
)
</chain>
<chain name="chain5">
t1 = THEN(c, WHEN(j,k));
w1 = WHEN(q, THEN(p, r)).id("w01");
t2 = THEN(h, i);
THEN(
a,b,
WHEN(t1, d, t2 ),
SWITCH(x).to(m, n, w1),
z
);
</chain>
</flow>

View File

@@ -11,8 +11,8 @@ import org.springframework.stereotype.Component;
@LiteflowSwitchCmpDefine
public class ECmp{
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_COND)
public String processCond(NodeComponent bindCmp) throws Exception {
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_SWITCH)
public String processSwitch(NodeComponent bindCmp) throws Exception {
System.out.println("Ecomp executed!");
return "g";
}

View File

@@ -11,8 +11,8 @@ import org.springframework.stereotype.Component;
@LiteflowSwitchCmpDefine
public class JCmp{
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_COND)
public String processCond(NodeComponent bindCmp) throws Exception {
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_SWITCH)
public String processSwitch(NodeComponent bindCmp) throws Exception {
System.out.println("Jcomp executed!");
return "chain3";
}

View File

@@ -15,8 +15,8 @@ import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
@LiteflowSwitchCmpDefine
public class ECmp{
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_COND)
public String processCond(NodeComponent bindCmp) throws Exception {
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_SWITCH)
public String processSwitch(NodeComponent bindCmp) throws Exception {
System.out.println("ECmp executed!");
return "chain2";
}

View File

@@ -12,8 +12,8 @@ import java.util.Objects;
@Component("f")
@LiteflowSwitchCmpDefine
public class FCondCmp{
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_COND)
public String processCond(NodeComponent bindCmp) {
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_SWITCH)
public String processSwitch(NodeComponent bindCmp) {
Integer requestData = bindCmp.getRequestData();
if (Objects.isNull(requestData)){
return "d";

View File

@@ -17,8 +17,8 @@ import org.springframework.stereotype.Component;
@LiteflowSwitchCmpDefine
public class ECmp{
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_COND)
public String processCond(NodeComponent bindCmp) throws Exception {
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_SWITCH)
public String processSwitch(NodeComponent bindCmp) throws Exception {
return "a";
}
}

View File

@@ -17,8 +17,8 @@ import org.springframework.stereotype.Component;
@LiteflowSwitchCmpDefine
public class ECmp{
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_COND)
public String processCond(NodeComponent bindCmp) throws Exception {
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_SWITCH)
public String processSwitch(NodeComponent bindCmp) throws Exception {
return "g";
}
}

View File

@@ -17,8 +17,8 @@ import org.springframework.stereotype.Component;
@LiteflowSwitchCmpDefine
public class ECmp{
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_COND)
public String processCond(NodeComponent bindCmp) throws Exception {
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_SWITCH)
public String processSwitch(NodeComponent bindCmp) throws Exception {
return "g";
}
}

View File

@@ -17,8 +17,8 @@ import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
@LiteflowSwitchCmpDefine
public class CCmp{
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_COND)
public String processCond(NodeComponent bindCmp) throws Exception {
@LiteflowMethod(LiteFlowMethodEnum.PROCESS_SWITCH)
public String processSwitch(NodeComponent bindCmp) throws Exception {
if(bindCmp.getTag().equals("2")){
return "e";
}else{

View File

@@ -6,7 +6,7 @@ import com.yomahub.liteflow.core.NodeSwitchComponent;
public class ECmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
System.out.println("Ecomp executed!");
return "g";
}

View File

@@ -6,7 +6,7 @@ import com.yomahub.liteflow.core.NodeSwitchComponent;
public class JCmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
System.out.println("Jcomp executed!");
return "chain3";
}

View File

@@ -12,7 +12,7 @@ import com.yomahub.liteflow.core.NodeSwitchComponent;
public class ECmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
return "g";
}
}

View File

@@ -12,7 +12,7 @@ import com.yomahub.liteflow.core.NodeSwitchComponent;
public class ECmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
System.out.println("ECmp executed!");
return "chain2";
}

View File

@@ -5,7 +5,7 @@ import java.util.Objects;
public class FSwitchCmp extends NodeSwitchComponent {
@Override
public String processCond() {
public String processSwitch() {
Integer requestData = this.getRequestData();
if (Objects.isNull(requestData)){
return "d";

View File

@@ -12,7 +12,7 @@ import com.yomahub.liteflow.core.NodeSwitchComponent;
public class ECmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
return "a";
}
}

View File

@@ -12,7 +12,7 @@ import com.yomahub.liteflow.core.NodeSwitchComponent;
public class ECmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
return "g";
}
}

View File

@@ -12,7 +12,7 @@ import com.yomahub.liteflow.core.NodeSwitchComponent;
public class ECmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
return "g";
}
}

View File

@@ -12,7 +12,7 @@ import com.yomahub.liteflow.core.NodeSwitchComponent;
public class CCmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
if(this.getTag().equals("2")){
return "e";
}else{

View File

@@ -8,7 +8,7 @@ import org.springframework.stereotype.Component;
public class ECmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
System.out.println("Ecomp executed!");
return "g";
}

View File

@@ -8,7 +8,7 @@ import org.springframework.stereotype.Component;
public class JCmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
System.out.println("Jcomp executed!");
return "chain3";
}

View File

@@ -6,7 +6,7 @@ import org.springframework.stereotype.Component;
@Component("e")
public class ECmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
return "d";
}
}

View File

@@ -12,7 +12,7 @@ import com.yomahub.liteflow.core.NodeSwitchComponent;
public class ECmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
System.out.println("ECmp executed!");
return "chain2";
}

View File

@@ -9,7 +9,7 @@ import java.util.Objects;
@Component("f")
public class FSwitchCmp extends NodeSwitchComponent {
@Override
public String processCond() {
public String processSwitch() {
Integer requestData = this.getRequestData();
if (Objects.isNull(requestData)){
return "d";

View File

@@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
public class ECmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
return "a";
}
}

View File

@@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
public class ECmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
return "g";
}
}

View File

@@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
public class ECmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
return "g";
}
}

View File

@@ -14,7 +14,7 @@ import com.yomahub.liteflow.core.NodeSwitchComponent;
public class CCmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
if(this.getTag().equals("2")){
return "e";
}else{

View File

@@ -8,7 +8,7 @@ import org.springframework.stereotype.Component;
public class ECmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
System.out.println("Ecomp executed!");
return "g";
}

View File

@@ -8,7 +8,7 @@ import org.springframework.stereotype.Component;
public class JCmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
System.out.println("Jcomp executed!");
return "chain3";
}

View File

@@ -12,7 +12,7 @@ import com.yomahub.liteflow.core.NodeSwitchComponent;
public class ECmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
System.out.println("ECmp executed!");
return "chain2";
}

View File

@@ -9,7 +9,7 @@ import java.util.Objects;
@Component("f")
public class FSwitchCmp extends NodeSwitchComponent {
@Override
public String processCond() {
public String processSwitch() {
Integer requestData = this.getRequestData();
if (Objects.isNull(requestData)){
return "d";

View File

@@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
public class ECmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
return "g";
}
}

View File

@@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
public class ECmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
return "a";
}
}

View File

@@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
public class ECmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
return "g";
}
}

View File

@@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
public class ECmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
return "g";
}
}

View File

@@ -14,7 +14,7 @@ import com.yomahub.liteflow.core.NodeSwitchComponent;
public class CCmp extends NodeSwitchComponent {
@Override
public String processCond() throws Exception {
public String processSwitch() throws Exception {
if(this.getTag().equals("2")){
return "e";
}else{