Example usage for org.springframework.batch.item WriteFailedException WriteFailedException

List of usage examples for org.springframework.batch.item WriteFailedException WriteFailedException

Introduction

In this page you can find the example usage for org.springframework.batch.item WriteFailedException WriteFailedException.

Prototype

public WriteFailedException(String message) 

Source Link

Document

Create a new WriteFailedException based on a message.

Usage

From source file:org.openmrs.module.bahmniexports.example.domain.trade.internal.TradeWriter.java

@Override
public void write(List<? extends Trade> trades) {

    for (Trade trade : trades) {

        log.debug(trade);/*from   ww  w  . j av a2 s .  c  o m*/

        dao.writeTrade(trade);

        Assert.notNull(trade.getPrice()); // There must be a price to total

        if (this.failingCustomers.contains(trade.getCustomer())) {
            throw new WriteFailedException("Something unexpected happened!");
        }
    }

}

From source file:lcn.module.batch.web.guide.service.TradeWriter.java

public void write(List<? extends Trade> trades) {

    for (Trade trade : trades) {

        log.debug(trade);//from  w  w w .  j  av  a 2  s. com

        dao.writeTrade(trade);

        Assert.notNull(trade.getPrice()); // There must be a price to total

        if (this.failingCustomers.contains(trade.getCustomer())) {
            throw new WriteFailedException("Something unexpected happened!");
        }
    }

}

From source file:org.springframework.batch.core.step.item.FaultTolerantStepFactoryBeanTests.java

/**
 * condition: skippable < fatal; exception is skippable
 *
 * expected: true//  w  ww. j  av a  2s .com
 */
@Test
public void testSkippableSubset_skippable() throws Exception {
    assertTrue(getSkippableSubsetSkipPolicy().shouldSkip(new WriteFailedException(""), 0));
}

From source file:org.springframework.batch.core.step.item.FaultTolerantStepFactoryBeanTests.java

/**
 * condition: fatal < skippable; exception is fatal
 *
 * expected: false/*ww w. ja  v  a2s  .  c  om*/
 */
@Test
public void testFatalSubsetFatal() throws Exception {
    assertFalse(getFatalSubsetSkipPolicy().shouldSkip(new WriteFailedException(""), 0));
}