1
0

统一自动节点和手动节点的逻辑

This commit is contained in:
2025-01-03 10:34:25 +08:00
parent 07ee530b79
commit 7885f8e87a
10 changed files with 70 additions and 42 deletions

View File

@@ -3,6 +3,7 @@ package com.lanyuanxiaoyao.flowable.test;
import com.lanyuanxiaoyao.flowable.core.helper.MapHelper;
import com.lanyuanxiaoyao.flowable.core.manager.FlowableManager;
import com.lanyuanxiaoyao.flowable.core.model.FlowableAction;
import com.lanyuanxiaoyao.flowable.core.model.FlowableHandler;
import com.lanyuanxiaoyao.flowable.core.model.FlowableInstance;
import com.lanyuanxiaoyao.flowable.core.model.FlowableNode;
import java.util.Map;
@@ -34,8 +35,6 @@ public abstract class TestFlowableManager {
nodeId,
UUID.randomUUID().toString(),
UUID.randomUUID().toString(),
FlowableNode.Type.MANUAL,
null,
nextNodes
);
}
@@ -122,7 +121,7 @@ public abstract class TestFlowableManager {
Assertions.assertThrows(IllegalArgumentException.class, () -> manager.approve(instanceId));
}
protected abstract Class<?> getAutomaticNodeClass();
protected abstract Class<? extends FlowableHandler> getAutomaticNodeClass();
@Test
public void testAutomaticNode() {
@@ -131,8 +130,7 @@ public abstract class TestFlowableManager {
"2733d930-7a4b-491e-b1ca-4d5811435e9f",
"自动节点",
"自动节点",
FlowableNode.Type.AUTOMATIC,
getAutomaticNodeClass().getName(),
getAutomaticNodeClass(),
null
);
manager.create(node);

View File

@@ -1,17 +1,21 @@
package com.lanyuanxiaoyao.flowable.test;
import com.lanyuanxiaoyao.flowable.core.model.FlowableAction;
import com.lanyuanxiaoyao.flowable.core.model.FlowableHandler;
import com.lanyuanxiaoyao.flowable.core.model.FlowableInstance;
import com.lanyuanxiaoyao.flowable.core.model.FlowableNode;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
/**
* @author lanyuanxiaoyao
* @version 20250102
*/
public class SimpleAutoAction implements FlowableNode.AutoAction {
@Slf4j
public class SimpleAutoHandler implements FlowableHandler {
@Override
public FlowableAction action(FlowableInstance instance, FlowableNode node, Map<String, Object> metadata) {
public FlowableAction handle(FlowableAction action, FlowableInstance instance, FlowableNode node, Map<String, Object> metadata) {
log.info("Simple handler initial");
return FlowableAction.APPROVE;
}
}

View File

@@ -1,6 +1,7 @@
package com.lanyuanxiaoyao.flowable.test;
import com.lanyuanxiaoyao.flowable.core.manager.FlowableManager;
import com.lanyuanxiaoyao.flowable.core.model.FlowableHandler;
/**
* @author lanyuanxiaoyao
@@ -13,7 +14,7 @@ public class TestSimpleFlowableManager extends TestFlowableManager {
}
@Override
protected Class<?> getAutomaticNodeClass() {
return SimpleAutoAction.class;
protected Class<? extends FlowableHandler> getAutomaticNodeClass() {
return SimpleAutoHandler.class;
}
}