X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.slc.core%2Fsrc%2Forg%2Fargeo%2Fslc%2Fcore%2Fexecution%2FMapExecutionContext.java;h=324f973059fc40c150cd4f0ca5abc0935ec7109b;hb=7d137263a92df9bb874f9c900524dfce640495e6;hp=0bbc3f0df65abec30f56fc0b4984b8281bce4070;hpb=0bdf6d74bb140c84fe996586df694bda616ae28b;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc.core/src/org/argeo/slc/core/execution/MapExecutionContext.java b/org.argeo.slc.core/src/org/argeo/slc/core/execution/MapExecutionContext.java index 0bbc3f0df..324f97305 100644 --- a/org.argeo.slc.core/src/org/argeo/slc/core/execution/MapExecutionContext.java +++ b/org.argeo.slc.core/src/org/argeo/slc/core/execution/MapExecutionContext.java @@ -23,6 +23,8 @@ import java.util.UUID; import org.argeo.slc.SlcException; import org.argeo.slc.execution.ExecutionContext; +import org.argeo.slc.execution.ExecutionFlow; +import org.argeo.slc.execution.ExecutionStack; import org.springframework.beans.BeanWrapper; import org.springframework.beans.BeanWrapperImpl; import org.springframework.beans.BeansException; @@ -37,6 +39,7 @@ public class MapExecutionContext implements ExecutionContext, private final String uuid; private ApplicationContext applicationContext; + private ExecutionStack executionStack; public MapExecutionContext() { uuid = UUID.randomUUID().toString(); @@ -84,6 +87,12 @@ public class MapExecutionContext implements ExecutionContext, // try system property in last resort if (value == null) value = System.getProperty(key); + + // if the variable was not found, look in the stack starting at the + // upper flows + if (value == null) { + value = executionStack.findLocalVariable(key); + } return value; } @@ -91,6 +100,20 @@ public class MapExecutionContext implements ExecutionContext, return uuid; } + @Override + public void beforeFlow(ExecutionFlow executionFlow) { + // getUuid(); + executionStack.enterFlow(executionFlow); + setVariable(ExecutionContext.VAR_FLOW_ID, + executionStack.getCurrentStackLevelUuid()); + setVariable(ExecutionContext.VAR_FLOW_NAME, executionFlow.getName()); + } + + @Override + public void afterFlow(ExecutionFlow executionFlow) { + executionStack.leaveFlow(executionFlow); + } + @Override public boolean equals(Object obj) { if (obj instanceof ExecutionContext) @@ -108,4 +131,8 @@ public class MapExecutionContext implements ExecutionContext, this.applicationContext = applicationContext; } + public void setExecutionStack(ExecutionStack executionStack) { + this.executionStack = executionStack; + } + }