Example usage for org.springframework.batch.core.job.builder FlowBuilder start

List of usage examples for org.springframework.batch.core.job.builder FlowBuilder start

Introduction

In this page you can find the example usage for org.springframework.batch.core.job.builder FlowBuilder start.

Prototype

public FlowBuilder<Q> start(Flow flow) 

Source Link

Document

If a flow should start with a subflow use this as the first state.

Usage

From source file:com.github.jrrdev.mantisbtsync.core.jobs.JobProjectsConfiguration.java

/**
 * Build the main flow to sync a project.
 *
 * @param mantisProjectExtractorStep/*ww  w .  ja  va  2s  .  c om*/
 *          Step poping the id of the project from the list stored in the execution context
 * @param projectCategoriesStep
 *          Step syncing the categories related to the project
 * @param projectCustomFieldsStep
 *          Step syncing the custom fields related to the project
 * @param mantisLoginStep
 *          Step retrieving the access_level
 * @param projectUsersStep
 *          Step syncing users related to this project
 * @param projectVersionsStep
 *          Step syncing the versions related to this project
 * @return the flow
 */
@Bean
public Flow projectInitFlow(final Step mantisProjectExtractorStep, final Step projectCategoriesStep,
        final Step projectCustomFieldsStep, final Step mantisLoginStep, final Step projectUsersStep,
        final Step projectVersionsStep) {

    final FlowBuilder<Flow> builder = new FlowBuilder<Flow>("projectInitFlow");
    builder.start(mantisProjectExtractorStep).next(projectCategoriesStep).next(projectCustomFieldsStep)
            .next(mantisLoginStep).next(projectUsersStep).next(projectVersionsStep);

    return builder.build();
}

From source file:com.github.jrrdev.mantisbtsync.core.jobs.JobProjectsConfiguration.java

/**
 * Build the syncProjectsJob job. This job will retrieve all informations
 * for the given project and its subprojects.
 *
 *
 * Parameters for this job are :/* w w w.java2s.  co m*/
 *    - mantis.username
 *       MantisBT username. If anonymous access is used, should be an empty string.
 *  - mantis.password
 *     MantisBT password. If anonymous access is used, should be an empty string.
 *  - mantis.project_id
 *     The id of the project
 *
 * @param jobs
 *          Job build factory
 * @param mantisProjectsListStep
 *          Step retrieving all subprojects
 * @param projectInitFlow
 *          Flow for project syncing
 * @param jobProjectInitFlowDecider
 *          Decider which decides if the flow must be repeated (if a subproject
 *          is still not synced)
 * @param authProjectsStep
 *          Step for portal authentication at the begining of the job
 * @param closeProjectsListener
 *          Listener for closing the portal authentication connection at the end of the job
 * @return the job
 */
@Bean
public Job syncProjectsJob(final JobBuilderFactory jobs, final Step mantisProjectsListStep,
        final Flow projectInitFlow, final JobExecutionDecider jobProjectInitFlowDecider,
        final Step authProjectsStep, final CloseAuthManagerListener closeProjectsListener) {

    final FlowBuilder<Flow> loopBuilder = new FlowBuilder<Flow>("projectInitLoop");
    final Flow loop = loopBuilder.start(projectInitFlow).next(jobProjectInitFlowDecider).on("LOOP")
            .to(projectInitFlow).from(jobProjectInitFlowDecider).on("END_LOOP").end().build();

    return jobs.get("syncProjectsJob").incrementer(new RunIdIncrementer()).listener(closeProjectsListener)
            .flow(authProjectsStep).next(mantisProjectsListStep).next(loop).end().build();
}