]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/xml/AsFlowDecorator.java
Introduce Digest
[gpl/argeo-slc.git] / runtime / org.argeo.slc.core / src / main / java / org / argeo / slc / core / execution / xml / AsFlowDecorator.java
index 2c548857686f10946cd163fe0855b58eaa371fc5..1b38a2ebc2cda23f72cd888e02cb1d267b8ec024 100644 (file)
@@ -5,6 +5,7 @@ import org.apache.commons.logging.LogFactory;
 import org.argeo.slc.SlcException;
 import org.argeo.slc.core.execution.DefaultExecutionFlow;
 import org.springframework.beans.factory.config.BeanDefinitionHolder;
+import org.springframework.beans.factory.config.RuntimeBeanReference;
 import org.springframework.beans.factory.support.BeanDefinitionBuilder;
 import org.springframework.beans.factory.support.ManagedList;
 import org.springframework.beans.factory.xml.BeanDefinitionDecorator;
@@ -44,12 +45,20 @@ public class AsFlowDecorator implements BeanDefinitionDecorator {
                BeanDefinitionBuilder flow = BeanDefinitionBuilder
                                .rootBeanDefinition(DefaultExecutionFlow.class);
                ManagedList executables = new ManagedList(1);
-               executables.add(bean.getBeanDefinition());
+
+               String beanName = bean.getBeanName();
+               if (beanName == null)
+                       executables.add(bean.getBeanDefinition());
+               else
+                       executables.add(new RuntimeBeanReference(beanName));
+
                if (path != null)
                        flow.addPropertyValue("path", path);
                flow.addPropertyValue("executables", executables);
-               ctx.getRegistry().registerBeanDefinition(flowBeanName,
-                               flow.getBeanDefinition());
+
+               if (beanName != null)
+                       ctx.getRegistry().registerBeanDefinition(flowBeanName,
+                                       flow.getBeanDefinition());
                return bean;
        }