mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 04:02:09 +08:00
增加节点isEnd特性
This commit is contained in:
@@ -92,6 +92,10 @@ public class FlowExecutor {
|
||||
component.setSlotIndex(slotIndex);
|
||||
if(component.isAccess()){
|
||||
component.execute();
|
||||
if(component.isEnd()) {
|
||||
LOG.info("component[{}] lead the chain to end",component.getClass().getSimpleName());
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
String errorMsg = MessageFormat.format("component[{}] do not gain access", component.getClass().getSimpleName());
|
||||
throw new ComponentNotAccessException(errorMsg);
|
||||
|
||||
@@ -29,8 +29,6 @@ public abstract class NodeComponent {
|
||||
|
||||
private String nodeId;
|
||||
|
||||
private boolean continueOnError;
|
||||
|
||||
public void execute() throws Exception{
|
||||
StopWatch stopWatch = new StopWatch();
|
||||
stopWatch.start();
|
||||
@@ -69,16 +67,25 @@ public abstract class NodeComponent {
|
||||
|
||||
protected abstract void process() throws Exception;
|
||||
|
||||
/**
|
||||
* 是否进入该节点
|
||||
*/
|
||||
protected boolean isAccess(){
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isContinueOnError() {
|
||||
return continueOnError;
|
||||
/**
|
||||
* 出错是否继续执行
|
||||
*/
|
||||
protected boolean isContinueOnError() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setContinueOnError(boolean continueOnError) {
|
||||
this.continueOnError = continueOnError;
|
||||
|
||||
/**
|
||||
* 是否结束整个流程(不往下继续执行)
|
||||
*/
|
||||
protected boolean isEnd() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public NodeComponent setSlotIndex(Integer slotIndex) {
|
||||
|
||||
Reference in New Issue
Block a user