X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.slc.core%2Fsrc%2Forg%2Fargeo%2Fslc%2Fcore%2Fexecution%2FDefaultExecutionFlow.java;h=bebde75128243049d80a54b9d35dea87f379f555;hb=7d137263a92df9bb874f9c900524dfce640495e6;hp=535c42dad7224fdded4a561e864ec801f768d67f;hpb=0bdf6d74bb140c84fe996586df694bda616ae28b;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc.core/src/org/argeo/slc/core/execution/DefaultExecutionFlow.java b/org.argeo.slc.core/src/org/argeo/slc/core/execution/DefaultExecutionFlow.java index 535c42dad..bebde7512 100644 --- a/org.argeo.slc.core/src/org/argeo/slc/core/execution/DefaultExecutionFlow.java +++ b/org.argeo.slc.core/src/org/argeo/slc/core/execution/DefaultExecutionFlow.java @@ -24,6 +24,7 @@ import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.argeo.slc.SlcException; +import org.argeo.slc.execution.ExecutionContext; import org.argeo.slc.execution.ExecutionFlow; import org.argeo.slc.execution.ExecutionSpec; import org.argeo.slc.execution.ExecutionSpecAttribute; @@ -46,6 +47,9 @@ public class DefaultExecutionFlow implements ExecutionFlow, InitializingBean, private Boolean failOnError = true; + // Only needed if stacked execution flows are used + private ExecutionContext executionContext = null; + public DefaultExecutionFlow() { this.executionSpec = new DefaultExecutionSpec(); } @@ -154,7 +158,16 @@ public class DefaultExecutionFlow implements ExecutionFlow, InitializingBean, } public void doExecuteRunnable(Runnable runnable) { - runnable.run(); + try { + if (executionContext != null) + if (runnable instanceof ExecutionFlow) + executionContext.beforeFlow((ExecutionFlow) runnable); + runnable.run(); + } finally { + if (executionContext != null) + if (runnable instanceof ExecutionFlow) + executionContext.afterFlow((ExecutionFlow) runnable); + } } public void afterPropertiesSet() throws Exception { @@ -258,4 +271,8 @@ public class DefaultExecutionFlow implements ExecutionFlow, InitializingBean, this.failOnError = failOnError; } + public void setExecutionContext(ExecutionContext executionContext) { + this.executionContext = executionContext; + } + }