use of cz.mzk.recordmanager.server.export.HarvestedRecordIdRowMapper in project RecordManager2 by moravianlibrary.
the class CosmotronHarvestJobConfig method upate996Reader.
@Bean(name = Constants.JOB_ID_HARVEST_COSMOTRON + ":update996reader")
@StepScope
public ItemReader<HarvestedRecordUniqueId> upate996Reader(@Value("#{jobParameters[" + Constants.JOB_PARAM_CONF_ID + "]}") Long configId, @Value("#{stepExecutionContext[" + Constants.JOB_PARAM_FROM_DATE + "] " + "?:jobParameters[ " + Constants.JOB_PARAM_FROM_DATE + "]}") Date from) throws Exception {
SqlPagingQueryProviderFactoryBean pqpf = new SqlPagingQueryProviderFactoryBean();
JdbcPagingItemReader<HarvestedRecordUniqueId> reader = new JdbcPagingItemReader<>();
Map<String, Object> parameterValues = new HashMap<>();
pqpf.setDataSource(dataSource);
pqpf.setSelectClause("SELECT harvested_record_id, import_conf_id, record_id");
pqpf.setFromClause("FROM cosmotron_periodicals_last_update");
String where = "WHERE import_conf_id = :conf_id";
parameterValues.put("conf_id", configId);
if (from != null) {
where += " AND last_update > :from";
parameterValues.put("from", from);
}
pqpf.setWhereClause(where);
pqpf.setSortKey("harvested_record_id");
reader.setParameterValues(parameterValues);
reader.setRowMapper(new HarvestedRecordIdRowMapper());
reader.setPageSize(PAGE_SIZE);
reader.setQueryProvider(pqpf.getObject());
reader.setDataSource(dataSource);
reader.setSaveState(true);
reader.afterPropertiesSet();
return reader;
}
use of cz.mzk.recordmanager.server.export.HarvestedRecordIdRowMapper in project RecordManager2 by moravianlibrary.
the class ManuscriptoriumFulltextJobConfig method manuscriptoriumFulltextReader.
@Bean(name = Constants.JOB_ID_FULLTEXT_MANUSCRIPTORIUM + ":reader")
@StepScope
public ItemReader<HarvestedRecordUniqueId> manuscriptoriumFulltextReader(@Value("#{jobParameters[" + Constants.JOB_PARAM_CONF_ID + "]}") Long configId) 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.setSortKeys(ImmutableMap.of("record_id", Order.ASCENDING));
Map<String, Object> parameterValues = new HashMap<String, Object>();
parameterValues.put("conf_id", configId);
reader.setParameterValues(parameterValues);
reader.setRowMapper(new HarvestedRecordIdRowMapper());
reader.setPageSize(1);
reader.setQueryProvider(pqpf.getObject());
reader.setDataSource(dataSource);
reader.afterPropertiesSet();
return reader;
}
use of cz.mzk.recordmanager.server.export.HarvestedRecordIdRowMapper in project RecordManager2 by moravianlibrary.
the class MiscellaneousJobsConfig method generateItemIdReader.
@Bean(name = Constants.JOB_ID_GENERATE_ITEM_ID + ":generateItemIdReader")
@StepScope
public synchronized ItemReader<HarvestedRecordUniqueId> generateItemIdReader(@Value("#{jobParameters[" + Constants.JOB_PARAM_CONF_ID + "]}") Long confId) throws Exception {
JdbcPagingItemReader<HarvestedRecordUniqueId> reader = new JdbcPagingItemReader<HarvestedRecordUniqueId>();
SqlPagingQueryProviderFactoryBean pqpf = new SqlPagingQueryProviderFactoryBean();
pqpf.setDataSource(dataSource);
pqpf.setSelectClause("SELECT id, import_conf_id, record_id");
pqpf.setFromClause("FROM harvested_record");
String where = "WHERE deleted is null";
if (confId != null) {
where += " AND import_conf_id=:conf_id";
Map<String, Object> parameterValues = new HashMap<String, Object>();
parameterValues.put("conf_id", confId);
reader.setParameterValues(parameterValues);
}
pqpf.setWhereClause(where);
pqpf.setSortKey("id");
reader.setRowMapper(new HarvestedRecordIdRowMapper());
reader.setPageSize(20);
reader.setQueryProvider(pqpf.getObject());
reader.setDataSource(dataSource);
reader.afterPropertiesSet();
return reader;
}
use of cz.mzk.recordmanager.server.export.HarvestedRecordIdRowMapper in project RecordManager2 by moravianlibrary.
the class ZakonyProLidiHarvestJobConfig method zakonyProLidiFulltextReader.
@Bean(name = Constants.JOB_ID_FULLTEXT_ZAKONYPROLIDI + ":reader")
@StepScope
public ItemReader<HarvestedRecordUniqueId> zakonyProLidiFulltextReader(@Value("#{jobParameters[" + Constants.JOB_PARAM_CONF_ID + "]}") Long configId) 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.setSortKeys(ImmutableMap.of("record_id", Order.DESCENDING));
Map<String, Object> parameterValues = new HashMap<String, Object>();
parameterValues.put("conf_id", configId);
reader.setParameterValues(parameterValues);
reader.setRowMapper(new HarvestedRecordIdRowMapper());
reader.setPageSize(1);
reader.setQueryProvider(pqpf.getObject());
reader.setDataSource(dataSource);
reader.afterPropertiesSet();
return reader;
}
use of cz.mzk.recordmanager.server.export.HarvestedRecordIdRowMapper 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;
}
Aggregations