EMMA Coverage Report (generated Thu May 22 12:08:10 CDT 2014)
[all classes][org.springframework.batch.core.job.builder]

COVERAGE SUMMARY FOR SOURCE FILE [FlowJobBuilder.java]

nameclass, %method, %block, %line, %
FlowJobBuilder.java100% (1/1)80%  (4/5)74%  (35/47)80%  (12/15)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class FlowJobBuilder100% (1/1)80%  (4/5)74%  (35/47)80%  (12/15)
start (Step): JobFlowBuilder 0%   (0/1)0%   (0/6)0%   (0/1)
build (): Job 100% (1/1)77%  (20/26)78%  (7/9)
FlowJobBuilder (JobBuilderHelper): void 100% (1/1)100% (4/4)100% (2/2)
flow (Flow): FlowJobBuilder 100% (1/1)100% (5/5)100% (2/2)
start (Flow): JobFlowBuilder 100% (1/1)100% (6/6)100% (1/1)

1/*
2 * Copyright 2006-2011 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.job.builder;
17 
18import org.springframework.batch.core.Job;
19import org.springframework.batch.core.Step;
20import org.springframework.batch.core.job.flow.Flow;
21import org.springframework.batch.core.job.flow.FlowJob;
22import org.springframework.batch.core.step.builder.StepBuilderException;
23 
24/**
25 * A job builder for {@link FlowJob} instances. A flow job delegates processing to a nested flow composed of steps and
26 * conditional transitions between steps.
27 * 
28 * @author Dave Syer
29 * 
30 * @since 2.2
31 */
32public class FlowJobBuilder extends JobBuilderHelper<FlowJobBuilder> {
33 
34        private Flow flow;
35 
36        /**
37         * Create a new builder initialized with any properties in the parent. The parent is copied, so it can be re-used.
38         * 
39         * @param parent a parent helper containing common job properties
40         */
41        public FlowJobBuilder(JobBuilderHelper<?> parent) {
42                super(parent);
43        }
44 
45        /**
46         * Start a job with this flow, but expect to transition from there to other flows or steps.
47         * 
48         * @param flow the flow to start with
49         * @return a builder to enable fluent chaining
50         */
51        public JobFlowBuilder start(Flow flow) {
52                return new JobFlowBuilder(this, flow);
53        }
54 
55        /**
56         * Start a job with this step, but expect to transition from there to other flows or steps.
57         * 
58         * @param step the step to start with
59         * @return a builder to enable fluent chaining
60         */
61        public JobFlowBuilder start(Step step) {
62                return new JobFlowBuilder(this, step);
63        }
64 
65        /**
66         * Provide a single flow to execute as the job.
67         * 
68         * @param flow the flow to execute
69         * @return this for fluent chaining
70         */
71        protected FlowJobBuilder flow(Flow flow) {
72                this.flow = flow;
73                return this;
74        }
75 
76        /**
77         * Build a job that executes the flow provided, normally composed of other steps.
78         * 
79         * @return a flow job
80         */
81        public Job build() {
82                FlowJob job = new FlowJob();
83                job.setName(getName());
84                job.setFlow(flow);
85                super.enhance(job);
86                try {
87                        job.afterPropertiesSet();
88                }
89                catch (Exception e) {
90                        throw new StepBuilderException(e);
91                }
92                return job;
93        }
94 
95}

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