/** * Start again from a decision that was already registered. * * @param decider the decider to start from (already registered) * @return a builder to enable chaining */ public UnterminatedFlowBuilder<Q> from(JobExecutionDecider decider) { doFrom(decider); return new UnterminatedFlowBuilder<>(this); }
/** * If a flow should start with a decision use this as the first state. * * @param decider the to start from * @return a builder to enable chaining */ public UnterminatedFlowBuilder<Q> start(JobExecutionDecider decider) { doStart(decider); return new UnterminatedFlowBuilder<>(this); }
public Job build() { if (builder != null) { return builder.end().build(); } SimpleJob job = new SimpleJob(getName()); super.enhance(job); job.setSteps(steps); try { job.afterPropertiesSet(); } catch (Exception e) { throw new JobBuilderException(e); } return job; }
/** * Creates a job builder and initializes its job repository. Note that if the builder is used to create a @Bean * definition then the name of the job and the bean name might be different. * * @param name the name of the job * @return a job builder */ public JobBuilder get(String name) { JobBuilder builder = new JobBuilder(name).repository(jobRepository); return builder; }
/** * A synonym for {@link #build()} which callers might find useful. Subclasses can override build to create an object * of the desired type (e.g. a parent builder or an actual flow). * * @return the result of the builder */ public final Q end() { return build(); }
/** * Transition to the decider on successful completion of the current step. All other outcomes are treated as * failures. * * @param decider the JobExecutionDecider to determine the next step to execute * @return this to enable chaining */ public UnterminatedFlowBuilder<Q> next(JobExecutionDecider decider) { doNext(decider); return new UnterminatedFlowBuilder<>(this); }
/** * Create a new job builder that will execute a step or sequence of steps. * * @param step a step to execute * @return a {@link SimpleJobBuilder} */ public SimpleJobBuilder start(Step step) { return new SimpleJobBuilder(this).start(step); }
/** * Create a new job builder that will execute a step or sequence of steps. * * @param step a step to execute * @return a {@link SimpleJobBuilder} */ public JobFlowBuilder flow(Step step) { return new FlowJobBuilder(this).start(step); } }
/** * Signal the successful end of the flow. * * @return a FlowBuilder */ public FlowBuilder<Q> stop() { parent.stop(pattern); return parent; }
/** * @param executor a task executor to execute the split flows * @return a builder to enable fluent chaining */ public SplitBuilder<Q> split(TaskExecutor executor) { return new SplitBuilder<>(this, executor); }
/** * Start a job with this flow, but expect to transition from there to other flows or steps. * * @param flow the flow to start with * @return a builder to enable fluent chaining */ public JobFlowBuilder start(Flow flow) { return new JobFlowBuilder(this, flow); }
/** * Register a job execution listener. * * @param listener a job execution listener * @return this to enable fluent chaining */ public B listener(JobExecutionListener listener) { properties.addJobExecutionListener(listener); @SuppressWarnings("unchecked") B result = (B) this; return result; }
/** * Start again from a subflow that was already registered. * * @param flow the flow to start from (already registered) * @return a builder to enable chaining */ public FlowBuilder<Q> from(Flow flow) { doFrom(flow); return this; }
/** * If a flow should start with a subflow use this as the first state. * * @param flow the flow to start from * @return a builder to enable chaining */ public FlowBuilder<Q> start(Flow flow) { doStart(flow); return this; }
/** * Stop the flow and provide a flow to start with if the flow is restarted. * * @param flow the flow to restart with * @return a FlowBuilder */ public FlowBuilder<Q> stopAndRestart(Flow flow) { State next = parent.createState(flow); parent.stop(pattern, next); return parent; }
/** * Start a job with this step, but expect to transition from there to other flows or steps. * * @param step the step to start with * @return a builder to enable fluent chaining */ public JobFlowBuilder start(Step step) { return new JobFlowBuilder(this, step); }
/** * Stop the flow and provide a step to start with if the flow is restarted. * * @param restart the step to restart with * @return a FlowBuilder */ public FlowBuilder<Q> stopAndRestart(Step restart) { State next = parent.createState(restart); parent.stop(pattern, next); return parent; }