1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.springframework.batch.core.configuration.xml;
17
18 import org.springframework.beans.factory.support.BeanDefinitionBuilder;
19 import org.springframework.beans.factory.xml.ParserContext;
20 import org.springframework.util.StringUtils;
21 import org.w3c.dom.Element;
22
23
24
25
26
27 public class TopLevelFlowParser extends AbstractFlowParser {
28
29 private static final String ID_ATTR = "id";
30
31 private static final String ABSTRACT_ATTR = "abstract";
32
33
34
35
36
37 @Override
38 protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
39 CoreNamespaceUtils.autoregisterBeansForNamespace(parserContext, element);
40 String flowName = element.getAttribute(ID_ATTR);
41 builder.getRawBeanDefinition().setAttribute("flowName", flowName);
42 builder.addPropertyValue("name", flowName);
43 String abstractAttr = element.getAttribute(ABSTRACT_ATTR);
44 if (StringUtils.hasText(abstractAttr)) {
45 builder.setAbstract(abstractAttr.equals("true"));
46 }
47 super.doParse(element, parserContext, builder);
48 }
49
50 }