EMMA Coverage Report (generated Thu Jan 24 13:37:04 CST 2013)
[all classes][org.springframework.batch.core.configuration.xml]

COVERAGE SUMMARY FOR SOURCE FILE [FlowElementParser.java]

nameclass, %method, %block, %line, %
FlowElementParser.java100% (1/1)100% (2/2)100% (42/42)100% (11/11)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class FlowElementParser100% (1/1)100% (2/2)100% (42/42)100% (11/11)
FlowElementParser (): void 100% (1/1)100% (3/3)100% (1/1)
parse (Element, ParserContext): Collection 100% (1/1)100% (39/39)100% (10/10)

1/*
2 * Copyright 2006-2008 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.springframework.batch.core.configuration.xml;
17 
18import java.util.Collection;
19 
20import org.springframework.beans.MutablePropertyValues;
21import org.springframework.beans.factory.config.BeanDefinition;
22import org.springframework.beans.factory.support.AbstractBeanDefinition;
23import org.springframework.beans.factory.support.BeanDefinitionBuilder;
24import org.springframework.beans.factory.support.GenericBeanDefinition;
25import org.springframework.beans.factory.xml.ParserContext;
26import org.w3c.dom.Element;
27 
28/**
29 * Internal parser for the <flow/> elements inside a job..
30 * 
31 * @see JobParser
32 * 
33 * @author Dave Syer
34 * 
35 */
36public class FlowElementParser {
37 
38        private static final String ID_ATTR = "id";
39 
40        private static final String REF_ATTR = "parent";
41 
42        /**
43         * Parse the flow and turn it into a list of transitions.
44         * 
45         * @param element the <flow/gt; element to parse
46         * @param parserContext the parser context for the bean factory
47         * @return a collection of bean definitions for
48         * {@link org.springframework.batch.core.job.flow.support.StateTransition}
49         * instances objects
50         */
51        public Collection<BeanDefinition> parse(Element element, ParserContext parserContext) {
52 
53                String refAttribute = element.getAttribute(REF_ATTR);
54                String idAttribute = element.getAttribute(ID_ATTR);
55 
56                BeanDefinitionBuilder stateBuilder = BeanDefinitionBuilder
57                                .genericBeanDefinition("org.springframework.batch.core.job.flow.support.state.FlowState");
58 
59                AbstractBeanDefinition flowDefinition = new GenericBeanDefinition();
60                flowDefinition.setParentName(refAttribute);
61                MutablePropertyValues propertyValues = flowDefinition.getPropertyValues();
62                propertyValues.addPropertyValue("name", idAttribute);
63                stateBuilder.addConstructorArgValue(flowDefinition);
64                stateBuilder.addConstructorArgValue(idAttribute);
65                return InlineFlowParser.getNextElements(parserContext, stateBuilder.getBeanDefinition(), element);
66 
67        }
68}

[all classes][org.springframework.batch.core.configuration.xml]
EMMA 2.0.5312 (C) Vladimir Roubtsov