Example usage for org.springframework.batch.integration.chunk StepContributionSource getStepContributions

List of usage examples for org.springframework.batch.integration.chunk StepContributionSource getStepContributions

Introduction

In this page you can find the example usage for org.springframework.batch.integration.chunk StepContributionSource getStepContributions.

Prototype

Collection<StepContribution> getStepContributions();

Source Link

Document

Get the currently available contributions and drain the source.

Usage

From source file:es.fcs.batch.integration.chunk.MyRemoteChunkHandlerFactoryBean.java

/**
 * Update a StepContribution with all the data from a StepContributionSource. The filter and write conuts plus the
 * exit status will be updated to reflect the data in the source.
 * /*from w  w w. j  ava2s .  com*/
 * @param contribution the current contribution
 * @param stepContributionSource a source of StepContributions
 */
protected void updateStepContribution(StepContribution contribution,
        StepContributionSource stepContributionSource) {
    for (StepContribution result : stepContributionSource.getStepContributions()) {
        contribution.incrementFilterCount(result.getFilterCount());
        contribution.incrementWriteCount(result.getWriteCount());
        for (int i = 0; i < result.getProcessSkipCount(); i++) {
            contribution.incrementProcessSkipCount();
        }
        for (int i = 0; i < result.getWriteSkipCount(); i++) {
            contribution.incrementWriteSkipCount();
        }
        contribution.setExitStatus(contribution.getExitStatus().and(result.getExitStatus()));
    }
}