mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-24 04:18:10 +08:00
策略调用增加参数
增加策略调用的无级嵌套
This commit is contained in:
@@ -64,8 +64,8 @@ public class FlowExecutor {
|
||||
return execute(chainId, param, slotClazz,null,false);
|
||||
}
|
||||
|
||||
public <T> T invoke(String chainId,Class<? extends Slot> slotClazz,Integer slotIndex){
|
||||
return execute(chainId,null, slotClazz,slotIndex,true);
|
||||
public void invoke(String chainId,Object param,Class<? extends Slot> slotClazz,Integer slotIndex){
|
||||
execute(chainId, param, slotClazz,slotIndex,true);
|
||||
}
|
||||
|
||||
public <T> T execute(String chainId,Object param,Class<? extends Slot> slotClazz,Integer slotIndex,boolean isInnerChain){
|
||||
@@ -95,8 +95,10 @@ public class FlowExecutor {
|
||||
throw new NoAvailableSlotException("the slot is not exist");
|
||||
}
|
||||
|
||||
if(!isInnerChain && param != null) {
|
||||
if(!isInnerChain) {
|
||||
slot.setRequestData(param);
|
||||
}else {
|
||||
slot.setChainReqData(chainId, param);
|
||||
}
|
||||
|
||||
List<Condition> conditionList = chain.getConditionList();
|
||||
|
||||
@@ -34,6 +34,8 @@ public abstract class AbsSlot implements Slot{
|
||||
|
||||
private final String NODE_OUTPUT_PREFIX = "output_";
|
||||
|
||||
private final String CHAIN_REQ_PREFIX = "chain_req_";
|
||||
|
||||
private Deque<CmpStep> executeSteps = new ArrayDeque<CmpStep>();
|
||||
|
||||
protected ConcurrentHashMap<String, Object> dataMap = new ConcurrentHashMap<String, Object>();
|
||||
@@ -70,6 +72,14 @@ public abstract class AbsSlot implements Slot{
|
||||
dataMap.put(RESPONSE, t);
|
||||
}
|
||||
|
||||
public <T> T getChainReqData(String chainId) {
|
||||
return (T)dataMap.get(CHAIN_REQ_PREFIX + chainId);
|
||||
}
|
||||
|
||||
public <T> void setChainReqData(String chainId, T t) {
|
||||
dataMap.put(CHAIN_REQ_PREFIX + chainId, t);
|
||||
}
|
||||
|
||||
public <T> T getData(String key){
|
||||
return (T)dataMap.get(key);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,10 @@ public interface Slot {
|
||||
|
||||
public <T> T getResponseData();
|
||||
|
||||
public <T> void setChainReqData(String chainId, T t);
|
||||
|
||||
public <T> T getChainReqData(String chainId);
|
||||
|
||||
public <T> void setResponseData(T t);
|
||||
|
||||
public <T> T getData(String key);
|
||||
|
||||
Reference in New Issue
Block a user