-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from lunasaw/2.6.0
2.6.0 流程引擎单节点扩展
- Loading branch information
Showing
9 changed files
with
120 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/main/java/com/luna/common/engine/spi/AbstractBatchNodeNodeSpi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.luna.common.engine.spi; | ||
|
||
import com.luna.common.engine.model.EngineRunData; | ||
|
||
public abstract class AbstractBatchNodeNodeSpi<T> implements BatchNodeNodeSpi<T> { | ||
|
||
@Override | ||
public boolean isAccept(EngineRunData engineRunData) { | ||
return true; | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/com/luna/common/engine/spi/BatchNodeNodeSpi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.luna.common.engine.spi; | ||
|
||
import com.luna.common.engine.model.EngineRunData; | ||
|
||
/** | ||
* 每个流程节点的扩展点 | ||
**/ | ||
public interface BatchNodeNodeSpi<T> extends NodeSpi { | ||
/** | ||
* 判断该扩展点是否需要执行 true:需要执行; false:不需要执行 | ||
* | ||
* @param spiData | ||
* @return | ||
*/ | ||
default boolean isAccept(EngineRunData spiData) { | ||
return true; | ||
} | ||
|
||
/** | ||
* 封装spi的业务逻辑方法 | ||
* | ||
*/ | ||
void invoke(EngineRunData spiData); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.luna.common.engine.spi; | ||
|
||
/** | ||
* SPI接口 | ||
*/ | ||
public interface NodeSpi { | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/com/luna/common/engine/task/AbstractEngineNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,37 @@ | ||
package com.luna.common.engine.task; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import com.luna.common.engine.model.EngineContext; | ||
import com.luna.common.engine.spi.NodeSpi; | ||
|
||
import lombok.Data; | ||
|
||
/** | ||
* @author luna | ||
*/ | ||
@Data | ||
public abstract class AbstractEngineNode<T> implements EngineNode<T> { | ||
/** | ||
* SPI列表 | ||
*/ | ||
private List<NodeSpi> batchNodeNodeList = new ArrayList<>(); | ||
|
||
@Override | ||
public boolean couldContinueExecute(EngineContext engineContext) { | ||
if (engineContext.isStop()) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
@Override | ||
public List<NodeSpi> getSpiList() { | ||
return batchNodeNodeList; | ||
} | ||
|
||
public void add(NodeSpi nodeSpi) { | ||
batchNodeNodeList.add(nodeSpi); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters