use of cz.mzk.recordmanager.server.marc.intercepting.DefaultMarcInterceptor in project RecordManager2 by moravianlibrary.
the class GenerateItemIdWriter method write.
@Override
public void write(List<? extends HarvestedRecordUniqueId> items) throws Exception {
for (HarvestedRecordUniqueId uniqueId : items) {
try {
progress.incrementAndLogProgress();
HarvestedRecord hr = hrDao.get(uniqueId);
if (hr == null || hr.getRawRecord() == null || hr.getRawRecord().length == 0 || !hr.getFormat().equals("marc21-xml") || hr.getHarvestedFrom().getItemId() == null) {
continue;
}
Record record = marcXmlParser.parseUnderlyingRecord(new ByteArrayInputStream(hr.getRawRecord()));
hr.setRawRecord(new DefaultMarcInterceptor(record, hr.getHarvestedFrom(), uniqueId.getRecordId()).intercept());
} catch (Exception ex) {
logger.error(String.format("Exception thrown in harvested_record with id=%s", uniqueId), ex);
}
}
}
Aggregations