Example usage for org.springframework.batch.item.file.transform FieldSet readLong

List of usage examples for org.springframework.batch.item.file.transform FieldSet readLong

Introduction

In this page you can find the example usage for org.springframework.batch.item.file.transform FieldSet readLong.

Prototype

long readLong(String name);

Source Link

Document

Read the 'long' value from column with given 'name'.

Usage

From source file:org.seedstack.spring.batch.fixtures.EmployeeMapper.java

@Override
public Employee mapFieldSet(FieldSet fieldSet) throws BindException {
    long id = fieldSet.readLong("id");
    String name = fieldSet.readString("name");
    String telephone = fieldSet.readString("telephone");
    Employee employee = new Employee();
    employee.setId(id);//from  w  w w  .j a  v  a  2s . c  o m
    employee.setName(name);
    employee.setTelephone(telephone);
    return employee;
}

From source file:org.opensourcebank.batch.transaction.mapper.IssuerResponseTransactionFieldSetMapper.java

public IssuerResponseTransaction mapFieldSet(FieldSet fieldSet) {

    IssuerResponseTransaction transaction = new IssuerResponseTransaction();

    transaction.setExternalId(fieldSet.readLong("TX_EXTERNAL_ID"));

    return transaction;
}

From source file:org.jboss.examples.spring.batch.multiline.TradeFieldSetMapper.java

@Override
public Trade mapFieldSet(FieldSet fieldSet) {

    Trade trade = new Trade();
    trade.setIsin(fieldSet.readString(ISIN_COLUMN));
    trade.setQuantity(fieldSet.readLong(QUANTITY_COLUMN));
    trade.setPrice(fieldSet.readBigDecimal(PRICE_COLUMN));
    trade.setCustomer(fieldSet.readString(CUSTOMER_COLUMN));

    return trade;
}

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

public Trade mapFieldSet(FieldSet fieldSet) {

    Trade trade = new Trade();
    trade.setIsin(fieldSet.readString(ISIN_COLUMN));
    trade.setQuantity(fieldSet.readLong(QUANTITY_COLUMN));
    trade.setPrice(fieldSet.readBigDecimal(PRICE_COLUMN));
    trade.setCustomer(fieldSet.readString(CUSTOMER_COLUMN));

    return trade;
}

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

@Override
public FieldSet tokenize(String line) {

    if (line.charAt(0) == 'F') {
        //line starts with F, so the footer tokenizer should tokenize it.
        FieldSet fs = footerTokenizer.tokenize(line);
        long customerUpdateTotal = stepExecution.getReadCount();
        long fileUpdateTotal = fs.readLong(1);
        if (customerUpdateTotal != fileUpdateTotal) {
            throw new IllegalStateException(
                    "The total number of customer updates in the file footer does not match the "
                            + "number entered  File footer total: [" + fileUpdateTotal
                            + "] Total encountered during processing: [" + customerUpdateTotal + "]");
        } else {//from  w  w  w. j a  va  2s  . c  o m
            //return null, because the footer indicates an end of processing.
            return null;
        }
    } else if (line.charAt(0) == 'A' || line.charAt(0) == 'U' || line.charAt(0) == 'D') {
        //line starts with A,U, or D, so it must be a customer operation.
        return customerTokenizer.tokenize(line);
    } else {
        //If the line doesn't start with any of the characters above, it must obviously be invalid.
        throw new IllegalArgumentException("Invalid line encountered for tokenizing: " + line);
    }
}