Search in sources :

Example 21 with HarvestedRecordUniqueId

use of cz.mzk.recordmanager.server.model.HarvestedRecord.HarvestedRecordUniqueId in project RecordManager2 by moravianlibrary.

the class FilterCaslinRecordsBySiglaJobConfig method caslinRecordsReader.

@Bean(name = Constants.JOB_ID_FILTER_CASLIN + ":caslinRecordsReader")
@StepScope
public synchronized ItemReader<HarvestedRecordUniqueId> caslinRecordsReader() throws Exception {
    JdbcPagingItemReader<HarvestedRecordUniqueId> reader = new JdbcPagingItemReader<HarvestedRecordUniqueId>();
    SqlPagingQueryProviderFactoryBean pqpf = new SqlPagingQueryProviderFactoryBean();
    pqpf.setDataSource(dataSource);
    pqpf.setSelectClause("SELECT import_conf_id, record_id");
    pqpf.setFromClause("FROM harvested_record");
    pqpf.setWhereClause("WHERE import_conf_id = :conf_id and deleted is null");
    pqpf.setSortKey("record_id");
    Map<String, Object> parameterValues = new HashMap<String, Object>();
    parameterValues.put("conf_id", Constants.IMPORT_CONF_ID_CASLIN);
    reader.setParameterValues(parameterValues);
    reader.setRowMapper(new HarvestedRecordIdRowMapper());
    reader.setPageSize(20);
    reader.setQueryProvider(pqpf.getObject());
    reader.setDataSource(dataSource);
    reader.afterPropertiesSet();
    return reader;
}
Also used : HarvestedRecordUniqueId(cz.mzk.recordmanager.server.model.HarvestedRecord.HarvestedRecordUniqueId) SqlPagingQueryProviderFactoryBean(org.springframework.batch.item.database.support.SqlPagingQueryProviderFactoryBean) HashMap(java.util.HashMap) HarvestedRecordIdRowMapper(cz.mzk.recordmanager.server.export.HarvestedRecordIdRowMapper) JdbcPagingItemReader(org.springframework.batch.item.database.JdbcPagingItemReader) StepScope(org.springframework.batch.core.configuration.annotation.StepScope) SqlPagingQueryProviderFactoryBean(org.springframework.batch.item.database.support.SqlPagingQueryProviderFactoryBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

HarvestedRecordUniqueId (cz.mzk.recordmanager.server.model.HarvestedRecord.HarvestedRecordUniqueId)21 HarvestedRecord (cz.mzk.recordmanager.server.model.HarvestedRecord)12 HashMap (java.util.HashMap)8 StepScope (org.springframework.batch.core.configuration.annotation.StepScope)7 JdbcPagingItemReader (org.springframework.batch.item.database.JdbcPagingItemReader)7 SqlPagingQueryProviderFactoryBean (org.springframework.batch.item.database.support.SqlPagingQueryProviderFactoryBean)7 Bean (org.springframework.context.annotation.Bean)7 Date (java.util.Date)6 HarvestedRecordIdRowMapper (cz.mzk.recordmanager.server.export.HarvestedRecordIdRowMapper)5 InputStream (java.io.InputStream)5 Record (org.marc4j.marc.Record)4 MarcRecord (cz.mzk.recordmanager.server.marc.MarcRecord)3 ByteArrayInputStream (java.io.ByteArrayInputStream)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 AbstractTest (cz.mzk.recordmanager.server.AbstractTest)2 MarcRecordImpl (cz.mzk.recordmanager.server.marc.MarcRecordImpl)2 MarcRecordInterceptor (cz.mzk.recordmanager.server.marc.intercepting.MarcRecordInterceptor)2 FulltextKramerius (cz.mzk.recordmanager.server.model.FulltextKramerius)2 ImportConfiguration (cz.mzk.recordmanager.server.model.ImportConfiguration)2 IOException (java.io.IOException)2