REOPENED - issue BATCH-640: FieldSetMapper.mapLine() should contain the line number

This commit is contained in:
dsyer
2008-08-06 22:36:57 +00:00
parent b690c6e92b
commit b9291aff16
27 changed files with 125 additions and 97 deletions

View File

@@ -6,7 +6,7 @@ import org.springframework.batch.sample.domain.football.Game;
public class GameFieldSetMapper implements FieldSetMapper<Game> {
public Game mapLine(FieldSet fs, int lineNum) {
public Game mapLine(FieldSet fs) {
if(fs == null){
return null;

View File

@@ -6,7 +6,7 @@ import org.springframework.batch.sample.domain.football.Player;
public class PlayerFieldSetMapper implements FieldSetMapper<Player> {
public Player mapLine(FieldSet fs, int lineNum) {
public Player mapLine(FieldSet fs) {
if(fs == null){
return null;

View File

@@ -33,7 +33,7 @@ public class AddressFieldSetMapper implements FieldSetMapper<Address> {
public static final String COUNTRY_COLUMN = "COUNTRY";
public Address mapLine(FieldSet fieldSet, int lineNum) {
public Address mapLine(FieldSet fieldSet) {
Address address = new Address();
address.setAddressee(fieldSet.readString(ADDRESSEE_COLUMN));

View File

@@ -27,7 +27,7 @@ public class BillingFieldSetMapper implements FieldSetMapper<BillingInfo> {
public static final String PAYMENT_TYPE_ID_COLUMN = "PAYMENT_TYPE_ID";
public static final String PAYMENT_DESC_COLUMN = "PAYMENT_DESC";
public BillingInfo mapLine(FieldSet fieldSet, int lineNum) {
public BillingInfo mapLine(FieldSet fieldSet) {
BillingInfo info = new BillingInfo();
info.setPaymentId(fieldSet.readString(PAYMENT_TYPE_ID_COLUMN));

View File

@@ -34,7 +34,7 @@ public class CustomerFieldSetMapper implements FieldSetMapper<Customer> {
public static final String REG_ID_COLUMN = "REG_ID";
public static final String VIP_COLUMN = "VIP";
public Customer mapLine(FieldSet fieldSet, int lineNum) {
public Customer mapLine(FieldSet fieldSet) {
Customer customer = new Customer();
if (Customer.LINE_ID_BUSINESS_CUST.equals(fieldSet.readString(LINE_ID_COLUMN))) {

View File

@@ -27,7 +27,7 @@ public class HeaderFieldSetMapper implements FieldSetMapper<Order> {
public static final String ORDER_ID_COLUMN = "ORDER_ID";
public static final String ORDER_DATE_COLUMN = "ORDER_DATE";
public Order mapLine(FieldSet fieldSet, int lineNum) {
public Order mapLine(FieldSet fieldSet) {
Order order = new Order();
order.setOrderId(fieldSet.readLong(ORDER_ID_COLUMN));
order.setOrderDate(fieldSet.readDate(ORDER_DATE_COLUMN));

View File

@@ -33,7 +33,7 @@ public class OrderItemFieldSetMapper implements FieldSetMapper<LineItem> {
public static final String ITEM_ID_COLUMN = "ITEM_ID";
public LineItem mapLine(FieldSet fieldSet, int lineNum) {
public LineItem mapLine(FieldSet fieldSet) {
LineItem item = new LineItem();
item.setItemId(fieldSet.readLong(ITEM_ID_COLUMN));

View File

@@ -90,7 +90,7 @@ public class OrderItemReader extends AbstractItemReader<Order> {
// start a new Order
if (Order.LINE_ID_HEADER.equals(lineId)) {
log.debug("STARTING NEW RECORD");
order = headerMapper.mapLine(fieldSet, -1);
order = headerMapper.mapLine(fieldSet);
return;
}
@@ -115,7 +115,7 @@ public class OrderItemReader extends AbstractItemReader<Order> {
log.debug("MAPPING CUSTOMER");
if (order.getCustomer() == null) {
order.setCustomer(customerMapper.mapLine(fieldSet, -1));
order.setCustomer(customerMapper.mapLine(fieldSet));
order.getCustomer().setBusinessCustomer(true);
}
@@ -126,7 +126,7 @@ public class OrderItemReader extends AbstractItemReader<Order> {
log.debug("MAPPING CUSTOMER");
if (order.getCustomer() == null) {
order.setCustomer(customerMapper.mapLine(fieldSet, -1));
order.setCustomer(customerMapper.mapLine(fieldSet));
order.getCustomer().setBusinessCustomer(false);
}
@@ -135,25 +135,25 @@ public class OrderItemReader extends AbstractItemReader<Order> {
if (Address.LINE_ID_BILLING_ADDR.equals(lineId)) {
log.debug("MAPPING BILLING ADDRESS");
order.setBillingAddress(addressMapper.mapLine(fieldSet, -1));
order.setBillingAddress(addressMapper.mapLine(fieldSet));
return;
}
if (Address.LINE_ID_SHIPPING_ADDR.equals(lineId)) {
log.debug("MAPPING SHIPPING ADDRESS");
order.setShippingAddress(addressMapper.mapLine(fieldSet, -1));
order.setShippingAddress(addressMapper.mapLine(fieldSet));
return;
}
if (BillingInfo.LINE_ID_BILLING_INFO.equals(lineId)) {
log.debug("MAPPING BILLING INFO");
order.setBilling(billingMapper.mapLine(fieldSet, -1));
order.setBilling(billingMapper.mapLine(fieldSet));
return;
}
if (ShippingInfo.LINE_ID_SHIPPING_INFO.equals(lineId)) {
log.debug("MAPPING SHIPPING INFO");
order.setShipping(shippingMapper.mapLine(fieldSet, -1));
order.setShipping(shippingMapper.mapLine(fieldSet));
return;
}
@@ -163,7 +163,7 @@ public class OrderItemReader extends AbstractItemReader<Order> {
if (order.getLineItems() == null) {
order.setLineItems(new ArrayList<LineItem>());
}
order.getLineItems().add(itemMapper.mapLine(fieldSet, -1));
order.getLineItems().add(itemMapper.mapLine(fieldSet));
return;
}

View File

@@ -28,7 +28,7 @@ public class ShippingFieldSetMapper implements FieldSetMapper<ShippingInfo> {
public static final String SHIPPING_TYPE_ID_COLUMN = "SHIPPING_TYPE_ID";
public static final String SHIPPER_ID_COLUMN = "SHIPPER_ID";
public ShippingInfo mapLine(FieldSet fieldSet, int lineNum) {
public ShippingInfo mapLine(FieldSet fieldSet) {
ShippingInfo info = new ShippingInfo();
info.setShipperId(fieldSet.readString(SHIPPER_ID_COLUMN));

View File

@@ -29,7 +29,7 @@ public class TradeFieldSetMapper implements FieldSetMapper<Trade> {
public static final int PRICE_COLUMN = 2;
public static final int CUSTOMER_COLUMN = 3;
public Trade mapLine(FieldSet fieldSet, int lineNum) {
public Trade mapLine(FieldSet fieldSet) {
Trade trade = new Trade();
trade.setIsin(fieldSet.readString(ISIN_COLUMN));