org.springframework.batch.sample.domain.trade.internal
Class TradeWriter

java.lang.Object
  extended by org.springframework.batch.item.ItemStreamSupport
      extended by org.springframework.batch.sample.domain.trade.internal.TradeWriter
All Implemented Interfaces:
ItemStream, ItemWriter<Trade>

public class TradeWriter
extends ItemStreamSupport
implements ItemWriter<Trade>

Delegates the actual writing to custom DAO delegate. Allows configurable exception raising for testing skip and restart.


Constructor Summary
TradeWriter()
           
 
Method Summary
 BigDecimal getTotalPrice()
           
 void open(ExecutionContext executionContext)
          No-op.
 void setDao(TradeDao dao)
           
 void setFailingCustomers(List<String> failingCustomers)
          Public setter for the the customers on which failure should occur.
 void update(ExecutionContext executionContext)
          Return empty ExecutionContext.
 void updateTotalPrice(List<Trade> trades)
           
 void write(List<? extends Trade> trades)
          Process the supplied data element.
 
Methods inherited from class org.springframework.batch.item.ItemStreamSupport
close
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TradeWriter

public TradeWriter()
Method Detail

write

public void write(List<? extends Trade> trades)
Description copied from interface: ItemWriter
Process the supplied data element. Will not be called with any null items in normal operation.

Specified by:
write in interface ItemWriter<Trade>

updateTotalPrice

public void updateTotalPrice(List<Trade> trades)

open

public void open(ExecutionContext executionContext)
          throws ItemStreamException
Description copied from class: ItemStreamSupport
No-op.

Specified by:
open in interface ItemStream
Overrides:
open in class ItemStreamSupport
Throws:
ItemStreamException
See Also:
ItemStream.open(ExecutionContext)

update

public void update(ExecutionContext executionContext)
Description copied from class: ItemStreamSupport
Return empty ExecutionContext.

Specified by:
update in interface ItemStream
Overrides:
update in class ItemStreamSupport
Parameters:
executionContext - to be updated
See Also:
ItemStream.update(ExecutionContext)

getTotalPrice

public BigDecimal getTotalPrice()

setDao

public void setDao(TradeDao dao)

setFailingCustomers

public void setFailingCustomers(List<String> failingCustomers)
Public setter for the the customers on which failure should occur.

Parameters:
failingCustomers - The customers to fail on


Copyright © 2009 SpringSource. All Rights Reserved.