当前位置: 首页>>代码示例>>Java>>正文


Java FieldSet类代码示例

本文整理汇总了Java中org.springframework.batch.item.file.transform.FieldSet的典型用法代码示例。如果您正苦于以下问题:Java FieldSet类的具体用法?Java FieldSet怎么用?Java FieldSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FieldSet类属于org.springframework.batch.item.file.transform包,在下文中一共展示了FieldSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mapFieldSet

import org.springframework.batch.item.file.transform.FieldSet; //导入依赖的package包/类
@Override
public LHHuntingClubCSVRow mapFieldSet(FieldSet fieldSet) {
    if (fieldSet.getFieldCount() <= 1) {
        LOG.debug("Ignoring invalid row: {}", formatRow(fieldSet));
        return null;
    }

    if (fieldSet.getFieldCount() != EXPECTED_FIELD_COUNT) {
        LOG.error("Invalid field set with field count {}, expexcted {}",
                fieldSet.getFieldCount(), EXPECTED_FIELD_COUNT);
        LOG.debug("Invalid row was: {}", formatRow(fieldSet));
        throw new IllegalStateException(
                MessageFormat.format("Invalid field set with field count {0}, expected {1}",
                        fieldSet.getFieldCount(), EXPECTED_FIELD_COUNT));
    }
    return csvToRow(fieldSet);
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:18,代码来源:LHHuntingClubLineFieldMapper.java

示例2: setUp

import org.springframework.batch.item.file.transform.FieldSet; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
	DelimitedLineTokenizer lineTokenizer = new DelimitedLineTokenizer();
	lineTokenizer.setDelimiter('\t');
	lineTokenizer.setNames(new String[] {"foo","bar"});
	lineTokenizer.setStrict(false);

	DefaultLineMapper<FieldSet> lineMapper = new DefaultLineMapper<FieldSet>();
	lineMapper.setLineTokenizer(lineTokenizer);
	lineMapper.setFieldSetMapper(new PassThroughFieldSetMapper());

	flatFileItemReader = new FlatFileItemReader<FieldSet>();
	flatFileItemReader.setEncoding("UTF-8");
	flatFileItemReader.setLinesToSkip(0);
	flatFileItemReader.setLineMapper(lineMapper);
	flatFileItemReader.setResource(new ClassPathResource("org/emonocot/bom.txt"));
	flatFileItemReader.setBufferedReaderFactory(new BOMIgnoringBufferedReaderFactory());

	flatFileItemReader.afterPropertiesSet();
	flatFileItemReader.open(new ExecutionContext());
}
 
开发者ID:RBGKew,项目名称:eMonocot,代码行数:22,代码来源:BOMIgnoringFlatFileItemReaderTest.java

示例3: mapFieldSet

import org.springframework.batch.item.file.transform.FieldSet; //导入依赖的package包/类
@Override
public CompetitiveIntelligenceReports mapFieldSet(final FieldSet fieldSet) throws BindException {
    final String year = fieldSet.readString(YEAR);
    if (Strings.isNotBlank(year)) {
        final String[] yearSplit = year.split(" ");
        Assertions.assertThat(yearSplit).hasSize(2);
        curYear = Integer.parseInt(yearSplit[1]);
    }
    final String title = fieldSet.readString(TITLE);
    if (Strings.isBlank(title)) {
        return INVALID_ROW;
    }
    final String categoryStr = fieldSet.readString(CATEGORY);
    if (Strings.isNotBlank(categoryStr)) {
        curCategory = CompetitiveIntelligenceReportParserCategory.valueOfTitle(categoryStr);
    }
    parseCompanyLetters(fieldSet, title);
    parseAvg(fieldSet, title);
    return reports;
}
 
开发者ID:subes,项目名称:invesdwin-nowicket,代码行数:21,代码来源:CompetitiveIntelligenceReportParserMapper.java

示例4: updateCategoryAndTitle

import org.springframework.batch.item.file.transform.FieldSet; //导入依赖的package包/类
protected void updateCategoryAndTitle(final FieldSet fieldSet) {
    final String category1 = fieldSet.readString(CompanyOperatingReportParserMapper.CATEGORY1);
    if ("N.A. Market----------------".equals(category1)) {
        curRegion = CompanyRegion.NorthAmerica;
    } else if ("E-A Market----------------".equals(category1)) {
        curRegion = CompanyRegion.EuropeAfrica;
    } else if ("A-P Market----------------".equals(category1)) {
        curRegion = CompanyRegion.AsiaPacific;
        //
    } else if ("L.A. Market----------------".equals(category1)) {
        curRegion = CompanyRegion.LatinAmerica;
    }

    final String title1 = fieldSet.readString(CompanyOperatingReportParserMapper.TITLE1);
    if (Strings.isNotBlank(title1)) {
        curTitle1 = title1;
        curTitle2 = null;
    }
    final String title2 = fieldSet.readString(CompanyOperatingReportParserMapper.TITLE2);
    if (Strings.isNotBlank(title2)) {
        curTitle2 = title2;
    }
}
 
开发者ID:subes,项目名称:invesdwin-nowicket,代码行数:24,代码来源:InternetMarketPerformanceSubReportParser.java

示例5: updateCategoryAndTitle

import org.springframework.batch.item.file.transform.FieldSet; //导入依赖的package包/类
protected void updateCategoryAndTitle(final FieldSet fieldSet) {
    final String category1 = fieldSet.readString(CompanyOperatingReportParserMapper.CATEGORY1);
    if (Strings.isNotBlank(category1)) {
        curCategory1 = category1;
        curCategory2 = null;
        curTitle1 = null;
        curTitle2 = null;
    }
    final String category2 = fieldSet.readString(CompanyOperatingReportParserMapper.CATEGORY2);
    if (Strings.isNotBlank(category2)) {
        curCategory2 = category2;
        curTitle1 = null;
        curTitle2 = null;
    }
    final String title1 = fieldSet.readString(CompanyOperatingReportParserMapper.TITLE1);
    if (Strings.isNotBlank(title1)) {
        curTitle1 = title1;
        //
        curTitle2 = null;
    }
    final String title2 = fieldSet.readString(CompanyOperatingReportParserMapper.TITLE2);
    if (Strings.isNotBlank(title2)) {
        curTitle2 = title2;
    }
}
 
开发者ID:subes,项目名称:invesdwin-nowicket,代码行数:26,代码来源:CashFlowSubReportParser.java

示例6: updateCategoryAndTitle

import org.springframework.batch.item.file.transform.FieldSet; //导入依赖的package包/类
protected void updateCategoryAndTitle(final FieldSet fieldSet) {
    final String category1 = fieldSet.readString(CompanyOperatingReportParserMapper.CATEGORY1);
    if (Strings.isNotBlank(category1)) {
        curCategory1 = category1;
        curCategory2 = null;
        curTitle1 = null;
        curTitle2 = null;
        //
    }
    final String category2 = fieldSet.readString(CompanyOperatingReportParserMapper.CATEGORY2);
    if (Strings.isNotBlank(category2)) {
        curCategory2 = category2;
        curTitle1 = null;
        curTitle2 = null;
    }
    final String title1 = fieldSet.readString(CompanyOperatingReportParserMapper.TITLE1);
    if (Strings.isNotBlank(title1)) {
        curTitle1 = title1;
        curTitle2 = null;
    }
    final String title2 = fieldSet.readString(CompanyOperatingReportParserMapper.TITLE2);
    if (Strings.isNotBlank(title2)) {
        curTitle2 = title2;
    }
}
 
开发者ID:subes,项目名称:invesdwin-nowicket,代码行数:26,代码来源:BalanceSheetSubReportParser.java

示例7: updateCategoryAndTitle

import org.springframework.batch.item.file.transform.FieldSet; //导入依赖的package包/类
protected void updateCategoryAndTitle(final FieldSet fieldSet) {
    final String category1 = fieldSet.readString(CompanyOperatingReportParserMapper.CATEGORY1);
    if (Strings.isNotBlank(category1)) {
        curCategory1 = category1;
        curCategory2 = null;
        curTitle2 = null;
    }
    final String category2 = fieldSet.readString(CompanyOperatingReportParserMapper.CATEGORY2);
    if (Strings.isNotBlank(category2)) {
        curCategory2 = category2;
        curTitle2 = null;
    }
    final String title2 = fieldSet.readString(CompanyOperatingReportParserMapper.TITLE2);
    if (Strings.isNotBlank(title2)) {
        curTitle2 = title2;
    }
}
 
开发者ID:subes,项目名称:invesdwin-nowicket,代码行数:18,代码来源:PrivateLabelBidsSubReportParser.java

示例8: mapFieldSet

import org.springframework.batch.item.file.transform.FieldSet; //导入依赖的package包/类
@Override
public CompanyOperatingReports mapFieldSet(final FieldSet fieldSet) throws BindException {
    final String subReport = fieldSet.readString(SUB_REPORT);
    if (Strings.isNotBlank(subReport)) {
        final CompanyOperatingReportParserSubReport newSubReport = CompanyOperatingReportParserSubReport
                .valueOfTitle(curSubReport, subReport);
        if (newSubReport != curSubReport) {
            curSubReport = newSubReport;
            curSubReportParser = curSubReport.newSubReportParser();
        }
    }

    if (Strings.isBlank(fieldSet.readString(SUB_REPORT)) && Strings.isBlank(fieldSet.readString(CATEGORY1))
            && Strings.isBlank(fieldSet.readString(CATEGORY2)) && Strings.isBlank(fieldSet.readString(TITLE1))
            && Strings.isBlank(fieldSet.readString(TITLE2)) || Strings.isBlank(fieldSet.readString(VALUE))) {
        return INVALID_ROW;
    }

    if (curSubReportParser != null) {
        curSubReportParser.parse(fieldSet, reports);
        return reports;
    } else {
        return INVALID_ROW;
    }
}
 
开发者ID:subes,项目名称:invesdwin-nowicket,代码行数:26,代码来源:CompanyOperatingReportParserMapper.java

示例9: updateCategoryAndTitle

import org.springframework.batch.item.file.transform.FieldSet; //导入依赖的package包/类
protected void updateCategoryAndTitle(final FieldSet fieldSet) {
    final String category1 = fieldSet.readString(CompanyOperatingReportParserMapper.CATEGORY1);
    if (Strings.isNotBlank(category1)) {
        curCategory1 = category1;
        curCategory2 = null;
        curTitle1 = null;
        curTitle2 = null;
    }
    final String category2 = fieldSet.readString(CompanyOperatingReportParserMapper.CATEGORY2);
    if (Strings.isNotBlank(category2)) {
        curCategory2 = category2;
        curTitle1 = null;
        curTitle2 = null;
    }
    final String title1 = fieldSet.readString(CompanyOperatingReportParserMapper.TITLE1);
    if (Strings.isNotBlank(title1)) {
        curTitle1 = title1;
        curTitle2 = null;
    }
    final String title2 = fieldSet.readString(CompanyOperatingReportParserMapper.TITLE2);
    if (Strings.isNotBlank(title2)) {
        curTitle2 = title2;
    }
}
 
开发者ID:subes,项目名称:invesdwin-nowicket,代码行数:25,代码来源:InternetMarketingExpensesSubReportParser.java

示例10: updateCategoryAndTitle

import org.springframework.batch.item.file.transform.FieldSet; //导入依赖的package包/类
protected void updateCategoryAndTitle(final FieldSet fieldSet) {
    final String category1 = fieldSet.readString(CompanyOperatingReportParserMapper.CATEGORY1);
    if (Strings.isNotBlank(category1)) {
        curCategory1 = category1;
        curTitle1 = null;
        curTitle2 = null;
    }
    final String title1 = fieldSet.readString(CompanyOperatingReportParserMapper.TITLE1);
    if (Strings.isNotBlank(title1)) {
        curTitle1 = title1;
        curTitle2 = null;
    }
    final String title2 = fieldSet.readString(CompanyOperatingReportParserMapper.TITLE2);
    if (Strings.isNotBlank(title2)) {
        curTitle2 = title2;
    }
}
 
开发者ID:subes,项目名称:invesdwin-nowicket,代码行数:18,代码来源:BankLoansSubReportParser.java

示例11: updateCategoryAndTitle

import org.springframework.batch.item.file.transform.FieldSet; //导入依赖的package包/类
protected void updateCategoryAndTitle(final FieldSet fieldSet) {
    final String category1 = fieldSet.readString(CompanyOperatingReportParserMapper.CATEGORY1);
    if ("N.A. Market----------------".equals(category1)) {
        curRegion = CompanyRegion.NorthAmerica;
    } else if ("E-A Market----------------".equals(category1)) {
        curRegion = CompanyRegion.EuropeAfrica;
    } else if ("A-P Market----------------".equals(category1)) {
        curRegion = CompanyRegion.AsiaPacific;
    } else if ("L.A. Market----------------".equals(category1)) {
        curRegion = CompanyRegion.LatinAmerica;
    }

    final String title1 = fieldSet.readString(CompanyOperatingReportParserMapper.TITLE1);
    if (Strings.isNotBlank(title1)) {
        curTitle1 = title1;
        curTitle2 = null;
    }
    final String title2 = fieldSet.readString(CompanyOperatingReportParserMapper.TITLE2);
    if (Strings.isNotBlank(title2)) {
        curTitle2 = title2;
    }
}
 
开发者ID:subes,项目名称:invesdwin-nowicket,代码行数:23,代码来源:WhsleMarketPerformanceSubReportParser.java

示例12: fillPreviewLines

import org.springframework.batch.item.file.transform.FieldSet; //导入依赖的package包/类
protected void fillPreviewLines(MultipartFile file) {
    try {
        Resource resource = new InputStreamResource(new ByteArrayInputStream(file.getBytes()));
        DefaultLineMapper<String[]> lineMapper = new DefaultLineMapper<>();
        lineMapper.setLineTokenizer(new DelimitedLineTokenizer());
        lineMapper.setFieldSetMapper(FieldSet::getValues);

        FlatFileItemReader<String[]> itemReader = new FlatFileItemReader<>();
        itemReader.setResource(resource);
        itemReader.setLineMapper(lineMapper);
        itemReader.open(new ExecutionContext());

        for (int i = 0; i < 10; i++) {
            String[] row = itemReader.read();
            if (row == null) {
                break;
            }

            firstRows.add(row);
            columnCount = Math.max(columnCount, row.length);
        }

    } catch (Exception e) {
        throw new IllegalStateException(e);
    }
}
 
开发者ID:imCodePartnerAB,项目名称:iVIS,代码行数:27,代码来源:FileOption.java

示例13: mapFieldSet

import org.springframework.batch.item.file.transform.FieldSet; //导入依赖的package包/类
@Override
public T mapFieldSet(FieldSet fieldSet) throws BindException {
    T entity = null;
    Integer indexColumn = fileOption.getKeyColumn();
    String indexColumnName = fieldSet.getNames()[indexColumn];
    Function<String, T> finder = getEntityFinder(indexColumnName);

    if (finder == null) {
        throw new BindException(entityType, "finder '" + indexColumnName + "' not found.");
    }

    String indexColumnValue = fieldSet.readString(indexColumn);
    entity = finder.apply(indexColumnValue);

    if (entity == null) {
        entity = newEntitySupplier.get();
    }

    bindData(entity, fieldSet.getProperties());

    return entity;
}
 
开发者ID:imCodePartnerAB,项目名称:iVIS,代码行数:23,代码来源:EntityLoader.java

示例14: setUp

import org.springframework.batch.item.file.transform.FieldSet; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
	DelimitedLineTokenizer lineTokenizer = new DelimitedLineTokenizer();
	lineTokenizer.setDelimiter(DelimitedLineTokenizer.DELIMITER_TAB);
	lineTokenizer.setNames(new String[] {"foo","bar"});
	lineTokenizer.setStrict(false);

	DefaultLineMapper<FieldSet> lineMapper = new DefaultLineMapper<FieldSet>();
	lineMapper.setLineTokenizer(lineTokenizer);
	lineMapper.setFieldSetMapper(new PassThroughFieldSetMapper());

	flatFileItemReader = new FlatFileItemReader<FieldSet>();
	flatFileItemReader.setEncoding("UTF-8");
	flatFileItemReader.setLinesToSkip(0);
	flatFileItemReader.setLineMapper(lineMapper);
	flatFileItemReader.setResource(new ClassPathResource("org/emonocot/bom.txt"));
	flatFileItemReader.setBufferedReaderFactory(new BOMIgnoringBufferedReaderFactory());

	flatFileItemReader.afterPropertiesSet();
	flatFileItemReader.open(new ExecutionContext());
}
 
开发者ID:RBGKew,项目名称:powop,代码行数:22,代码来源:BOMIgnoringFlatFileItemReaderTest.java

示例15: read

import org.springframework.batch.item.file.transform.FieldSet; //导入依赖的package包/类
@Override
public synchronized T read() {

    List<FieldSet> aTmpResult = new ArrayList<FieldSet>();
    boolean aConditionResult = false;

    FieldSet line = readNextFieldSet();
    while (!aConditionResult && (line != null)) {
        aTmpResult.add(line);
        if (nextItem != null) {
            updateContext(currentVariableName, (line.hasNames()) ? line.getProperties() : line.getValues(), getEvaluationContext());
            updateContext(nextVariableName, (nextItem.hasNames()) ? nextItem.getProperties() : nextItem.getValues(), getEvaluationContext());
            aConditionResult = getExpressionResolver().evaluate(newRecordCondition, getEvaluationContext(), Boolean.class);
        }
        if (!aConditionResult) {
            line = readNextFieldSet();
        }
    }

    return (aTmpResult.isEmpty() ? null : mapFieldSets(aTmpResult));
}
 
开发者ID:acxio,项目名称:AGIA,代码行数:22,代码来源:MultiLineItemReader.java


注:本文中的org.springframework.batch.item.file.transform.FieldSet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。