use of cz.mzk.recordmanager.server.model.HarvestedRecord in project RecordManager2 by moravianlibrary.
the class HarvestedRecordLimitedRowMapper method mapRow.
@Override
public HarvestedRecord mapRow(ResultSet rs, int rowNum) throws SQLException {
HarvestedRecordUniqueId id = new HarvestedRecordUniqueId(oaiHarvestConfigurationDao.load(rs.getLong("IMPORT_CONF_ID")), rs.getString("RECORD_ID"));
HarvestedRecord harvestedRecord = new HarvestedRecord(id);
harvestedRecord.setPublicationYear(rs.getLong("PUBLICATION_YEAR"));
harvestedRecord.setFormat(rs.getString("FORMAT"));
return harvestedRecord;
}
use of cz.mzk.recordmanager.server.model.HarvestedRecord in project RecordManager2 by moravianlibrary.
the class DelegatingSolrRecordMapper method getMapper.
protected SolrRecordMapper getMapper(DedupRecord dedupRecord, List<HarvestedRecord> records) {
HarvestedRecord leadingRecord = records.get(0);
SolrRecordMapper mapper = mapperByFormat.get(leadingRecord.getFormat());
return mapper;
}
use of cz.mzk.recordmanager.server.model.HarvestedRecord in project RecordManager2 by moravianlibrary.
the class DeletedHarvestedRecordsWriter method write.
@Override
public void write(List<? extends HarvestedRecord> records) throws Exception {
List<String> ids = new ArrayList<String>(records.size());
for (HarvestedRecord record : records) {
ids.add(IndexingUtils.getSolrId(record));
}
logger.trace("About to delete: {}", ids);
server.deleteById(ids);
}
use of cz.mzk.recordmanager.server.model.HarvestedRecord in project RecordManager2 by moravianlibrary.
the class IndexIndividualHarvestedRecordsTasklet method execute.
@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
SolrServerFacade solrServer = solrServerFactory.create(solrUrl, null, LoggingSolrIndexingExceptionHandler.INSTANCE);
List<SolrInputDocument> documents = new ArrayList<SolrInputDocument>(recordIds.size());
for (String solrId : recordIds) {
HarvestedRecord rec = harvestedRecordDao.findBySolrId(solrId);
if (rec == null) {
throw new IllegalArgumentException(String.format("Harvested record %s not found", solrId));
}
SolrInputDocument document = solrInputDocumentFactory.create(rec);
documents.add(SolrUtils.removeHiddenFields(document));
}
solrServer.add(documents, commitWithinMs);
solrServer.commit();
return RepeatStatus.FINISHED;
}
use of cz.mzk.recordmanager.server.model.HarvestedRecord in project RecordManager2 by moravianlibrary.
the class IndexIndividualRecordsTasklet method execute.
@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
SolrServerFacade solrServer = solrServerFactory.create(solrUrl, null, LoggingSolrIndexingExceptionHandler.INSTANCE);
for (String solrId : recordIds) {
HarvestedRecord rec = harvestedRecordDao.findBySolrId(solrId);
if (rec == null) {
throw new IllegalArgumentException(String.format("Harvested record %s not found", solrId));
}
DedupRecord dedupRecord = rec.getDedupRecord();
if (dedupRecord == null) {
throw new IllegalArgumentException(String.format("Harvested record %s is not deduplicated, run dedup first.", solrId));
}
List<HarvestedRecord> records = harvestedRecordDao.getByDedupRecord(dedupRecord);
List<SolrInputDocument> documents = solrInputDocumentFactory.create(dedupRecord, records);
documents = SolrUtils.removeHiddenFields(documents);
solrServer.add(documents, commitWithinMs);
}
solrServer.commit();
return RepeatStatus.FINISHED;
}
Aggregations