mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 12:12:08 +08:00
初步完成 liteflow-solon-plugin 适配
This commit is contained in:
@@ -2,6 +2,7 @@ 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;
|
||||
@@ -22,12 +23,12 @@ public class NodeBreakComponentOfMethod extends NodeBreakComponent {
|
||||
|
||||
if (method.getParameterCount() > 1) {
|
||||
String methodFullName = beanWrap.clz().getName() + "::" + method.getName();
|
||||
throw new RuntimeException("NodeBreakComponent method parameter cannot be more than one: " + methodFullName);
|
||||
throw new LiteFlowException("NodeBreakComponent method parameter cannot be more than one: " + methodFullName);
|
||||
}
|
||||
|
||||
if (method.getReturnType() != Boolean.class) {
|
||||
String methodFullName = beanWrap.clz().getName() + "::" + method.getName();
|
||||
throw new RuntimeException("NodeBreakComponent method returnType can only be boolean: " + methodFullName);
|
||||
throw new LiteFlowException("NodeBreakComponent method returnType can only be boolean: " + methodFullName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.yomahub.liteflow.solon;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
|
||||
import com.yomahub.liteflow.exception.LiteFlowException;
|
||||
import com.yomahub.liteflow.slot.Slot;
|
||||
import org.noear.solon.core.BeanWrap;
|
||||
|
||||
@@ -23,12 +24,12 @@ public class NodeComponentOfMethod extends NodeComponent {
|
||||
|
||||
if (method.getParameterCount() > 1) {
|
||||
String methodFullName = beanWrap.clz().getName() + "::" + method.getName();
|
||||
throw new RuntimeException("NodeComponent method parameter cannot be more than one: " + methodFullName);
|
||||
throw new LiteFlowException("NodeComponent method parameter cannot be more than one: " + methodFullName);
|
||||
}
|
||||
|
||||
if (method.getReturnType() != Void.class) {
|
||||
String methodFullName = beanWrap.clz().getName() + "::" + method.getName();
|
||||
throw new RuntimeException("NodeComponent method returnType can only be void: " + methodFullName);
|
||||
throw new LiteFlowException("NodeComponent method returnType can only be void: " + methodFullName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.yomahub.liteflow.solon;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeForComponent;
|
||||
import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
|
||||
import com.yomahub.liteflow.exception.LiteFlowException;
|
||||
import org.noear.solon.core.BeanWrap;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
@@ -22,12 +23,12 @@ public class NodeForComponentOfMethod extends NodeForComponent {
|
||||
|
||||
if (method.getParameterCount() > 1) {
|
||||
String methodFullName = beanWrap.clz().getName() + "::" + method.getName();
|
||||
throw new RuntimeException("NodeForComponent method parameter cannot be more than one: " + methodFullName);
|
||||
throw new LiteFlowException("NodeForComponent method parameter cannot be more than one: " + methodFullName);
|
||||
}
|
||||
|
||||
if (method.getReturnType() != Integer.class) {
|
||||
String methodFullName = beanWrap.clz().getName() + "::" + method.getName();
|
||||
throw new RuntimeException("NodeForComponent method returnType can only be int: " + methodFullName);
|
||||
throw new LiteFlowException("NodeForComponent method returnType can only be int: " + methodFullName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.yomahub.liteflow.solon;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeIfComponent;
|
||||
import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
|
||||
import com.yomahub.liteflow.exception.LiteFlowException;
|
||||
import org.noear.solon.core.BeanWrap;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
@@ -22,12 +23,12 @@ public class NodeIfComponentOfMethod extends NodeIfComponent {
|
||||
|
||||
if (method.getParameterCount() > 1) {
|
||||
String methodFullName = beanWrap.clz().getName() + "::" + method.getName();
|
||||
throw new RuntimeException("NodeIfComponent method parameter cannot be more than one: " + methodFullName);
|
||||
throw new LiteFlowException("NodeIfComponent method parameter cannot be more than one: " + methodFullName);
|
||||
}
|
||||
|
||||
if (method.getReturnType() != Boolean.class) {
|
||||
String methodFullName = beanWrap.clz().getName() + "::" + method.getName();
|
||||
throw new RuntimeException("NodeIfComponent method returnType can only be boolean: " + methodFullName);
|
||||
throw new LiteFlowException("NodeIfComponent method returnType can only be boolean: " + methodFullName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.yomahub.liteflow.solon;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeSwitchComponent;
|
||||
import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
|
||||
import com.yomahub.liteflow.exception.LiteFlowException;
|
||||
import org.noear.solon.core.BeanWrap;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
@@ -22,12 +23,12 @@ public class NodeSwitchComponentOfMethod extends NodeSwitchComponent {
|
||||
|
||||
if (method.getParameterCount() > 1) {
|
||||
String methodFullName = beanWrap.clz().getName() + "::" + method.getName();
|
||||
throw new RuntimeException("NodeSwitchComponent method parameter cannot be more than one: " + methodFullName);
|
||||
throw new LiteFlowException("NodeSwitchComponent method parameter cannot be more than one: " + methodFullName);
|
||||
}
|
||||
|
||||
if (method.getReturnType() != String.class) {
|
||||
String methodFullName = beanWrap.clz().getName() + "::" + method.getName();
|
||||
throw new RuntimeException("NodeSwitchComponent method returnType can only be string: " + methodFullName);
|
||||
throw new LiteFlowException("NodeSwitchComponent method returnType can only be string: " + methodFullName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ 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;
|
||||
@@ -22,12 +23,12 @@ public class NodeWhileComponentOfMethod extends NodeWhileComponent {
|
||||
|
||||
if (method.getParameterCount() > 1) {
|
||||
String methodFullName = beanWrap.clz().getName() + "::" + method.getName();
|
||||
throw new RuntimeException("NodeWhileComponent method parameter cannot be more than one: " + methodFullName);
|
||||
throw new LiteFlowException("NodeWhileComponent method parameter cannot be more than one: " + methodFullName);
|
||||
}
|
||||
|
||||
if (method.getReturnType() != Boolean.class) {
|
||||
String methodFullName = beanWrap.clz().getName() + "::" + method.getName();
|
||||
throw new RuntimeException("NodeWhileComponent method returnType can only be boolean: " + methodFullName);
|
||||
throw new LiteFlowException("NodeWhileComponent method returnType can only be boolean: " + methodFullName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,9 @@ package com.yomahub.liteflow.solon.integration;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.annotation.LiteflowMethod;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
|
||||
import com.yomahub.liteflow.flow.FlowBus;
|
||||
import com.yomahub.liteflow.solon.NodeComponentOfMethod;
|
||||
import com.yomahub.liteflow.solon.*;
|
||||
import com.yomahub.liteflow.solon.config.LiteflowAutoConfiguration;
|
||||
import com.yomahub.liteflow.solon.config.LiteflowMainAutoConfiguration;
|
||||
import com.yomahub.liteflow.solon.config.LiteflowMonitorProperty;
|
||||
@@ -51,7 +52,28 @@ public class XPluginImpl implements Plugin {
|
||||
});
|
||||
|
||||
context.beanExtractorAdd(LiteflowMethod.class, (bw, method, anno) -> {
|
||||
NodeComponent node1 = new NodeComponentOfMethod(bw, method, anno.value());
|
||||
NodeComponent node1 = null;
|
||||
switch (anno.value()) {
|
||||
case PROCESS_SWITCH:
|
||||
node1 = new NodeSwitchComponentOfMethod(bw, method, anno.value());
|
||||
break;
|
||||
case PROCESS_IF:
|
||||
node1 = new NodeIfComponentOfMethod(bw, method, anno.value());
|
||||
break;
|
||||
case PROCESS_FOR:
|
||||
node1 = new NodeForComponentOfMethod(bw, method, anno.value());
|
||||
break;
|
||||
case PROCESS_WHILE:
|
||||
node1 = new NodeWhileComponentOfMethod(bw, method, anno.value());
|
||||
break;
|
||||
case PROCESS_BREAK:
|
||||
node1 = new NodeBreakComponentOfMethod(bw, method, anno.value());
|
||||
break;
|
||||
default:
|
||||
node1 = new NodeComponentOfMethod(bw, method, anno.value());
|
||||
}
|
||||
|
||||
|
||||
String nodeId = Utils.annoAlias(anno.nodeId(), bw.name());
|
||||
node1.setNodeId(nodeId);
|
||||
node1.setType(anno.nodeType());
|
||||
|
||||
Reference in New Issue
Block a user