import org.argeo.slc.execution.ExecutionContext;
import org.argeo.slc.execution.ExecutionFlow;
import org.argeo.slc.execution.ExecutionSpecAttribute;
-import org.argeo.slc.process.SlcExecution;
-import org.springframework.beans.factory.ObjectFactory;
public class MapExecutionContext implements ExecutionContext {
+
private final static Log log = LogFactory.getLog(MapExecutionContext.class);
private final Stack<ExecutionFlowRuntime> stack = new Stack<ExecutionFlowRuntime>();
// TODO: make it thread safe?
private final Map<String, Object> variables = new HashMap<String, Object>();
- private final String uuid = UUID.randomUUID().toString();
+ private final String uuid;
private final Date creationDate = new Date();
+ public MapExecutionContext() {
+ uuid = UUID.randomUUID().toString();
+ variables.put(VAR_EXECUTION_CONTEXT_ID, uuid);
+ }
+
public void addVariables(
Map<? extends String, ? extends Object> variablesToAdd) {
variables.putAll(variablesToAdd);
public void enterFlow(ExecutionFlow executionFlow) {
ExecutionFlowRuntime runtime = new ExecutionFlowRuntime(executionFlow);
stack.push(runtime);
+ variables.put(VAR_FLOW_ID, runtime.getUuid());
+ variables.put(VAR_FLOW_NAME, runtime.getExecutionFlow().getName());
if (log.isDebugEnabled())
log.debug(depthSpaces(stack.size()) + "=> " + executionFlow + " #"