X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.support.simple%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fcore%2Fexecution%2FExecutionContext.java;h=d6b69af8485494dbd18cf66e693af489af1ce515;hb=2887de51b854588b4a60ab12124c179997e0a015;hp=732dd819e3d71425b1fe5c09b5417a97e9e3268a;hpb=743ecb28b3c0236bc91a5d0993f70477236d96fd;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/ExecutionContext.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/ExecutionContext.java index 732dd819e..d6b69af84 100644 --- a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/ExecutionContext.java +++ b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/ExecutionContext.java @@ -30,6 +30,10 @@ public class ExecutionContext { return null; return executionContext.get().variables; } + + public void addVariables(Map variablesToAdd) { + variables.putAll(variablesToAdd); + } public static ExecutionContext getCurrent() { return executionContext.get(); @@ -47,6 +51,20 @@ public class ExecutionContext { + " already registered."); executionContext.set(context); } + + /** + * Unregisters the ExecutionContext for the current Thread + * @throws a SlcException if no ExecutionContext was registered for the Thread + * @return the unregistered ExecutionContext + */ + public static ExecutionContext unregisterExecutionContext() { + ExecutionContext current = executionContext.get(); + if(current == null) { + throw new SlcException("No Context registered."); + } + executionContext.remove(); + return current; + } public static void enterFlow(ExecutionFlow executionFlow) { Stack stack = executionContext.get().stack;