]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/ExecutionContext.java
Implementation of DefaultModulesManager.process
[gpl/argeo-slc.git] / runtime / org.argeo.slc.support.simple / src / main / java / org / argeo / slc / core / execution / ExecutionContext.java
index 97f7268b67cf91320158cd885902faa060f42450..d6b69af8485494dbd18cf66e693af489af1ce515 100644 (file)
@@ -30,6 +30,10 @@ public class ExecutionContext {
                        return null;
                return executionContext.get().variables;
        }
+       
+       public void addVariables(Map<? extends String, ? extends Object> 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<ExecutionFlowRuntime> stack = executionContext.get().stack;
@@ -61,8 +79,8 @@ public class ExecutionContext {
                Map<String, ExecutionSpecAttribute> specAttrs = executionFlow
                                .getExecutionSpec().getAttributes();
                for (String key : specAttrs.keySet()) {
-                       ExecutionSpecAttribute esa = specAttrs.get(key);
-                       if (esa.getIsParameter()) {
+                       //ExecutionSpecAttribute esa = specAttrs.get(key);
+                       if (executionFlow.isSetAsParameter(key)) {
                                runtime.getLocalVariables().put(key,
                                                executionFlow.getParameter(key));
                                if (log.isTraceEnabled())