统一自动节点和手动节点的逻辑
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user